/* ── Checklist Container ── */
.cl-container { max-width: 100%; margin: 0 auto; padding: 0 0 2rem; }
.cl-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; background: linear-gradient(135deg, #1e3a5f, #2c5282); border-radius: 12px 12px 0 0; color: #fff; flex-wrap: wrap; gap: .5rem; }
.cl-header h2 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.cl-toolbar { display: flex; gap: .5rem; flex-wrap: wrap; }
.cl-btn { padding: .4rem .9rem; border: none; border-radius: 6px; cursor: pointer; font-size: .8rem; font-weight: 600; transition: all .2s; }
.cl-btn-export { background: rgba(255,255,255,.2); color: #fff; }
.cl-btn-export:hover { background: rgba(255,255,255,.35); }
.cl-btn-import { background: rgba(255,255,255,.15); color: #fff; }
.cl-btn-import:hover { background: rgba(255,255,255,.3); }
.cl-btn-close { background: #e53e3e; color: #fff; }
.cl-btn-close:hover { background: #c53030; }
.cl-saved { font-size: .75rem; opacity: .8; transition: opacity .3s; }

/* ── Table Wrapper ── */
.cl-table-wrap { overflow: auto; max-height: 80vh; border: 1px solid #e2e8f0; border-top: none; border-radius: 0 0 12px 12px; background: #fff; }
.cl-table { width: 100%; border-collapse: collapse; font-size: .82rem; min-width: 1100px; }

/* ── Column Header ── */
.cl-table thead th { position: sticky; top: 0; z-index: 10; background: #f7fafc; padding: .6rem .4rem; border-bottom: 2px solid #cbd5e0; text-align: center; font-size: .72rem; font-weight: 700; color: #4a5568; white-space: nowrap; }

/* ── Custom Tooltip for Column Headers ── */
.cl-table thead th[data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 6px; padding: .5rem .8rem; background: #1e293b; color: #fff; font-size: 1.1rem; font-weight: 600; border-radius: 6px; white-space: nowrap; z-index: 100; pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,.15); letter-spacing: .02em; }
.cl-table thead th[data-tooltip]:hover::before { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: -2px; border: 6px solid transparent; border-bottom-color: #1e293b; z-index: 100; pointer-events: none; }
.cl-table thead th:nth-child(1) { text-align: left; min-width: 42px; }
.cl-table thead th:nth-child(2) { text-align: left; min-width: 200px; }
.cl-table thead th:nth-child(3) { text-align: center; min-width: 40px; }

/* ── Chapter Row ── */
.cl-ch-row { cursor: pointer; user-select: none; }
.cl-ch-row td { background: #edf2f7; padding: .6rem .8rem; font-weight: 700; font-size: .88rem; color: #2d3748; border-bottom: 1px solid #cbd5e0; }
.cl-ch-row:hover td { background: #e2e8f0; }
.cl-ch-arrow { display: inline-block; transition: transform .2s; margin-right: .4rem; font-size: .7rem; }
.cl-ch-row.collapsed .cl-ch-arrow { transform: rotate(-90deg); }

/* Chapter color bars */
.cl-ch-row[data-ch="0"] td { border-left: 4px solid #3b82f6; }
.cl-ch-row[data-ch="1"] td { border-left: 4px solid #10b981; }
.cl-ch-row[data-ch="2"] td { border-left: 4px solid #f59e0b; }
.cl-ch-row[data-ch="3"] td { border-left: 4px solid #ef4444; }
.cl-ch-row[data-ch="4"] td { border-left: 4px solid #8b5cf6; }
.cl-ch-row[data-ch="5"] td { border-left: 4px solid #ec4899; }
.cl-ch-row[data-ch="6"] td { border-left: 4px solid #14b8a6; }
.cl-ch-row[data-ch="7"] td { border-left: 4px solid #f97316; }
.cl-ch-row[data-ch="8"] td { border-left: 4px solid #6366f1; }
.cl-ch-row[data-ch="9"] td { border-left: 4px solid #e11d48; }
.cl-ch-row[data-ch="10"] td { border-left: 4px solid #0ea5e9; }

/* ── Topic Rows ── */
.cl-topic-row td { padding: .45rem .4rem; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.cl-topic-row:hover td { background: #f7fafc; }
.cl-topic-row[data-ch="0"] td:first-child { border-left: 4px solid #3b82f6; }
.cl-topic-row[data-ch="1"] td:first-child { border-left: 4px solid #10b981; }
.cl-topic-row[data-ch="2"] td:first-child { border-left: 4px solid #f59e0b; }
.cl-topic-row[data-ch="3"] td:first-child { border-left: 4px solid #ef4444; }
.cl-topic-row[data-ch="4"] td:first-child { border-left: 4px solid #8b5cf6; }
.cl-topic-row[data-ch="5"] td:first-child { border-left: 4px solid #ec4899; }
.cl-topic-row[data-ch="6"] td:first-child { border-left: 4px solid #14b8a6; }
.cl-topic-row[data-ch="7"] td:first-child { border-left: 4px solid #f97316; }
.cl-topic-row[data-ch="8"] td:first-child { border-left: 4px solid #6366f1; }
.cl-topic-row[data-ch="9"] td:first-child { border-left: 4px solid #e11d48; }
.cl-topic-row[data-ch="10"] td:first-child { border-left: 4px solid #0ea5e9; }

.cl-section { font-weight: 600; color: #4a5568; white-space: nowrap; }
.cl-desc { color: #2d3748; line-height: 1.35; }
.cl-page { color: #718096; text-align: center; font-size: .78rem; }

/* ── Input Controls ── */
.cl-table td { text-align: center; vertical-align: middle; }
.cl-topic-row td { height: 36px; }

/* Checkbox */
.cl-check { width: 18px; height: 18px; cursor: pointer; accent-color: #38a169; vertical-align: middle; margin: 0; }

/* Dropdown */
.cl-select { width: 48px; height: 28px; padding: 0 .2rem; border: 1px solid #d1d5db; border-radius: 4px; text-align: center; font-size: .8rem; background: #fff; cursor: pointer; appearance: none; -webkit-appearance: none; vertical-align: middle; line-height: 28px; box-sizing: border-box; }
.cl-select:focus { outline: 2px solid #3b82f6; border-color: #3b82f6; }

/* Confidence colors */
.cl-conf-1 { background: #fee2e2 !important; color: #991b1b; }
.cl-conf-2 { background: #ffedd5 !important; color: #9a3412; }
.cl-conf-3 { background: #fef9c3 !important; color: #854d0e; }
.cl-conf-4 { background: #d1fae5 !important; color: #065f46; }
.cl-conf-5 { background: #bbf7d0 !important; color: #14532d; }

/* Toggle (✓/✗) */
.cl-toggle { width: 36px; height: 28px; border: 1px solid #d1d5db; border-radius: 4px; cursor: pointer; font-size: .9rem; font-weight: 700; background: #fff; transition: all .15s; line-height: 26px; vertical-align: middle; padding: 0; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; }
.cl-toggle:hover { border-color: #9ca3af; }
.cl-toggle-empty { color: #cbd5e0; }
.cl-toggle-yes { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.cl-toggle-no { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

/* Date */
.cl-date { width: 110px; height: 28px; padding: 0 .3rem; border: 1px solid #d1d5db; border-radius: 4px; font-size: .78rem; vertical-align: middle; box-sizing: border-box; }
.cl-date:focus { outline: 2px solid #3b82f6; }

/* Text */
.cl-text { width: 100%; min-width: 120px; height: 28px; padding: .2rem .4rem; border: 1px solid #d1d5db; border-radius: 4px; font-size: .78rem; resize: none; vertical-align: middle; box-sizing: border-box; }
.cl-text:focus { outline: 2px solid #3b82f6; }

/* ── Summary Section ── */
.cl-summary { margin-top: 1.5rem; padding: 1.25rem; background: #f7fafc; border: 1px solid #e2e8f0; border-radius: 12px; }
.cl-summary h3 { margin: 0 0 1rem; font-size: 1rem; color: #2d3748; }
.cl-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; margin-bottom: 1.5rem; }
.cl-stat-card { background: #fff; padding: .75rem 1rem; border-radius: 8px; border: 1px solid #e2e8f0; }
.cl-stat-label { font-size: .72rem; color: #718096; text-transform: uppercase; letter-spacing: .5px; }
.cl-stat-value { font-size: 1.4rem; font-weight: 700; color: #2d3748; margin-top: .2rem; }

/* Progress by Chapter */
.cl-progress h3 { margin: 0 0 .75rem; font-size: 1rem; color: #2d3748; }
.cl-progress-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.cl-progress-table th { background: #edf2f7; padding: .5rem; text-align: center; font-weight: 600; color: #4a5568; border-bottom: 2px solid #cbd5e0; }
.cl-progress-table th:first-child { text-align: left; }
.cl-progress-table td { padding: .5rem; text-align: center; border-bottom: 1px solid #f0f0f0; }
.cl-progress-table td:first-child { text-align: left; font-weight: 600; }

/* ── Hidden rows (collapsed chapter) ── */
.cl-topic-hidden { display: none; }

/* ── Auto-save indicator ── */
.cl-autosave { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; color: rgba(255,255,255,.7); }
.cl-autosave-dot { width: 6px; height: 6px; border-radius: 50%; background: #48bb78; }
.cl-autosave.saving .cl-autosave-dot { background: #fbbf24; animation: cl-pulse .6s infinite; }
@keyframes cl-pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ── Sync indicator ── */
.cl-sync-status { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; color: rgba(255,255,255,.7); margin-right: .5rem; }
.cl-sync-dot { width: 6px; height: 6px; border-radius: 50%; background: #38bdf8; }
.cl-sync-status.syncing .cl-sync-dot { background: #fbbf24; animation: cl-pulse .6s infinite; }
.cl-sync-status.sync-error .cl-sync-dot { background: #ef4444; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .cl-header { padding: .75rem; }
  .cl-header h2 { font-size: 1rem; }
  .cl-table { font-size: .75rem; }
  .cl-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
