/* ============================================================
   cadernos.css — Cadernos de Questões (redesign v2 - tema claro)
   ============================================================ */

/* ── Override forçado das variáveis dark (base.css + flat.css) ── */
/* flat.css define --c-data-card:#1a1a1a e aplica com !important    */
/* Redefinimos as variáveis no escopo do módulo para neutralizá-las */

.cad-page,
.cadernos-module-root,
#cadernos-content {
    /* base.css */
    --input-bg: #ffffff;
    --input-text: #0f172a;
    --ny-bg-input: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #374151;
    --border-color: #cbd5e1;
    /* flat.css */
    --c-data-bg: #f1f5f9;
    --c-data-card: #ffffff;
    --c-data-elevated: #f8fafc;
    --c-data-border: #e2e8f0;
    --c-chrome: #f8fafc;
    --c-chrome-elevated: #ffffff;
    --c-read-bg: #f1f5f9;
    --c-read-card: #ffffff;
    --c-surface: #ffffff;
    --c-bg: #f1f5f9;
    --c-text: #0f172a;
    --c-text-2: #374151;
    --c-text-3: #64748b;
    color-scheme: light;
}

.cadernos-module-root,
#cadernos-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Layout principal ───────────────────────────────────────── */

.cad-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: #f1f5f9 !important;
    color: #0f172a;
}

.cad-topbar-global {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff !important;
    flex-shrink: 0;
}

.cad-topbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.cad-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */

.cad-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #ffffff !important;
    border-right: 1px solid #e2e8f0;
    overflow-y: auto;
    padding: 10px 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cad-sidebar-empty {
    font-size: 0.78rem;
    color: #94a3b8;
    padding: 12px 8px;
    text-align: center;
}

.cad-sidebar-item {
    padding: 10px 12px 8px;
    border-radius: 8px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.12s, border-color 0.12s;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cad-sidebar-item:hover {
    background: #f8fafc !important;
}

.cad-sidebar-item.is-active {
    background: linear-gradient(135deg, #eff6ff, #f0f9ff);
    border-left-color: #2563eb;
}

.cad-sidebar-nome {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
}

.cad-sidebar-sub {
    font-size: 0.73rem;
    color: #64748b;
    margin-top: 1px;
}

.cad-sidebar-meta {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 3px;
}

/* Mini barra de progresso na sidebar */
.cad-sidebar-prog-wrap {
    height: 3px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    margin-top: 6px;
}

.cad-sidebar-prog-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
    border-radius: 99px;
    transition: width 0.4s ease;
    min-width: 0;
}

/* ── Área principal ─────────────────────────────────────────── */

.cad-main {
    flex: 1;
    overflow-y: auto;
    background: #f1f5f9 !important;
}

.cad-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: #94a3b8;
    font-size: 0.9rem;
}

/* ── Caderno: header ─────────────────────────────────────────── */

.cad-caderno-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px 24px;
}

.cad-caderno-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: #ffffff !important;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.cad-caderno-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cad-caderno-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0f172a;
}

.cad-caderno-concurso {
    font-size: 0.78rem;
    color: #64748b;
}

.cad-caderno-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Stats cards ────────────────────────────────────────────── */

.cad-stats-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cad-stat-card {
    display: flex;
    flex-direction: column;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-left-width: 3px !important;
    border-radius: 10px !important;
    padding: 10px 12px 8px;
    min-width: 110px;
    flex: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
    gap: 1px;
}

.cad-stat-card--blue   { border-left-color: #2563eb !important; }
.cad-stat-card--purple { border-left-color: #7c3aed !important; }
.cad-stat-card--cyan   { border-left-color: #0891b2 !important; }
.cad-stat-card--green  { border-left-color: #16a34a !important; }
.cad-stat-card--amber  { border-left-color: #d97706 !important; }
.cad-stat-card--red    { border-left-color: #dc2626 !important; }

.cad-stat-icon {
    font-size: 0.95rem;
    line-height: 1;
    margin-bottom: 3px;
}

.cad-stat-label {
    font-size: 0.62rem;
    color: #64748b !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.cad-stat-val {
    font-size: 1.45rem;
    font-weight: 900;
    color: #0f172a !important;
    line-height: 1.05;
    margin-top: 2px;
}

.cad-stat-sub {
    font-size: 0.65rem;
    color: #94a3b8 !important;
    margin-top: 1px;
}

.cad-val-green { color: #16a34a !important; }
.cad-val-amber { color: #d97706 !important; }
.cad-val-red   { color: #dc2626 !important; }

/* ── Barra de progresso geral ───────────────────────────────── */

.cad-prog-geral-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cad-prog-geral-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cad-prog-geral-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cad-prog-geral-pct {
    font-size: 0.82rem;
    font-weight: 700;
    color: #3b82f6;
}

.cad-prog-geral-wrap {
    height: 10px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.cad-prog-geral-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
    border-radius: 99px;
    transition: width 0.4s ease;
    min-width: 2px;
}

/* ── Chips de disciplina ────────────────────────────────────── */

.cad-chips-wrap {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.cad-chips-wrap::-webkit-scrollbar { display: none; }

.cad-chip {
    flex-shrink: 0;
    padding: 5px 14px;
    border-radius: 99px;
    border: 1px solid #e2e8f0;
    background: #f8fafc !important;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.cad-chip:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e293b;
}

.cad-chip.is-active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}

/* ── Bloco por disciplina ───────────────────────────────────── */

.cad-disciplinas {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cad-disciplina-block {
    background: #ffffff !important;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-left: 4px solid var(--disc-color, #3b82f6);
}

.cad-disciplina-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 10px;
    background: #fafbfc !important;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    gap: 10px;
}

.cad-disciplina-header-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.cad-disciplina-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cad-disc-chevron {
    font-size: 0.72rem;
    color: #94a3b8;
    flex-shrink: 0;
}

.cad-disciplina-nome {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mini barra de progresso inline no header da disciplina */
.cad-disc-prog-mini {
    height: 4px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.cad-disc-prog-mini-fill {
    height: 100%;
    background: var(--disc-color, #3b82f6);
    border-radius: 99px;
    opacity: 0.7;
    transition: width 0.4s ease;
    min-width: 0;
}

.cad-disciplina-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.cad-disc-meta {
    font-size: 0.73rem;
    color: #64748b;
    white-space: nowrap;
}

.cad-btn-add-disc-item {
    padding: 3px 10px;
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #2563eb;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    line-height: 1.5;
    white-space: nowrap;
}

.cad-btn-add-disc-item:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.cad-btn-disc-cfg {
    padding: 3px 7px;
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #64748b;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    line-height: 1.5;
}

.cad-btn-disc-cfg:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.cad-disc-body { overflow: hidden; }
.cad-disc-body.is-hidden { display: none; }

/* ── Busca de tópico ─────────────────────────────────────────── */

.cad-search-topico-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 12px;
}
.cad-search-topico-icon { font-size: 0.9rem; color: #94a3b8; flex-shrink: 0; }
.cad-search-topico-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.875rem;
    color: #1e293b;
    background: transparent;
}
.cad-search-topico-input::placeholder { color: #cbd5e1; }
.cad-search-topico-clear {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #94a3b8;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
}
.cad-search-topico-clear:hover { color: #ef4444; }

/* ── Tabela ─────────────────────────────────────────────────── */

.cad-table-wrap { overflow-x: auto; }

.cad-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.cad-table thead th {
    background: #f8fafc !important;
    color: #475569;
    font-size: 0.67rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    padding: 5px 6px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
.cad-th-center { text-align: center !important; }

.cad-row {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}

.cad-row:last-child { border-bottom: none; }

.cad-row:hover {
    background: #f8fafc !important;
}

.cad-table td {
    padding: 5px 6px;
    vertical-align: middle;
    color: #334155;
}

.cad-cell-nome { max-width: 220px; }

.cad-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.cad-link:hover { text-decoration: underline; }

.cad-cell-num {
    text-align: center;
    white-space: nowrap;
    min-width: 36px;
}

/* Coluna Feitas (N/Total) */
.cad-cell-feitas { min-width: 52px; }

.cad-slash-total {
    color: #94a3b8;
    font-weight: 400;
    font-size: 0.73rem;
}

.cad-cell-prog { min-width: 80px; }

.cad-prog-inline {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cad-prog-wrap {
    flex: 1;
    height: 5px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.cad-prog-bar {
    height: 100%;
    background: #3b82f6;
    border-radius: 99px;
    transition: width 0.3s;
    min-width: 2px;
}

.cad-prog-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    min-width: 30px;
    text-align: right;
    flex-shrink: 0;
}

/* Acerto badge pill */
.cad-acerto-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
    letter-spacing: 0.02em;
    color-scheme: light;
}

.cad-acerto-green   { background: #dcfce7 !important; color: #15803d !important; }
.cad-acerto-amber   { background: #fef3c7 !important; color: #92400e !important; }
.cad-acerto-red     { background: #fee2e2 !important; color: #b91c1c !important; }
.cad-acerto-neutral { background: #e2e8f0 !important; color: #374151 !important; }

/* manter compatibilidade com uso legado */
.cad-acerto {
    font-weight: 700;
    font-size: 0.85rem;
}

.cad-cell-fase { white-space: nowrap; }

.cad-fase-badge {
    display: inline-block;
    font-size: 0.69rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 99px;
}

.cad-fase-1 { background: #dbeafe; color: #1d4ed8; }
.cad-fase-2 { background: #fef9c3; color: #92400e; }

.cad-cell-actions {
    display: flex;
    gap: 1px;
    align-items: center;
    white-space: nowrap;
}

/* Botões secundários — ocultos até hover na linha */
.cad-btn-secondary-action { display: none; }
.cad-row:hover .cad-btn-secondary-action { display: inline-flex; }

/* Badge de contagem de imagens no botão 🖼 */
[data-open-gallery] { position: relative; }
[data-open-gallery].cad-has-gal { color: #4338ca; }

/* Indicador de nota existente no botão 📝 */
[data-open-nota].cad-has-nota { color: #d97706; }
.cad-gal-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #4338ca;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 8px;
    padding: 1px 4px;
    line-height: 1.4;
    pointer-events: none;
    min-width: 14px;
    text-align: center;
}

/* ── Botões da tabela ───────────────────────────────────────── */

.cad-btn-reg {
    padding: 3px 9px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    line-height: 1.5;
}

.cad-btn-reg:hover { background: #1d4ed8; }

.cad-btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 4px;
    border-radius: 4px;
    color: #64748b;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.12s, color 0.12s;
    line-height: 1;
    flex-shrink: 0;
}

.cad-btn-icon:hover { opacity: 1; background: #f1f5f9 !important; }
.cad-btn-icon.cad-btn-danger:hover { color: #b91c1c; background: #fee2e2; opacity: 1; }
.cad-btn-icon.is-active { opacity: 1; color: #2563eb; }

.cad-btn-spacer { display: none; }

/* ── Logs (sub-linha) ───────────────────────────────────────── */

.cad-logs-row { background: #f8fafc !important; }
.cad-logs-row:hover { background: #f8fafc !important; } /* evita hover escuro do tema */

.cad-logs-cell { padding: 0 !important; }

.cad-logs-inner {
    padding: 12px 20px 14px 32px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    color-scheme: light;
}

.cad-logs-loading,
.cad-logs-empty {
    font-size: 0.78rem;
    color: #94a3b8;
    display: block;
    padding: 4px 0;
}

.cad-logs-table {
    width: auto;
    border-collapse: collapse;
    font-size: 0.78rem;
    color-scheme: light;
}

.cad-logs-table th {
    text-align: left;
    padding: 5px 16px 5px 0;
    color: #64748b !important;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #e2e8f0;
    background: transparent !important;
}

.cad-logs-table td {
    padding: 6px 16px 6px 0;
    color: #334155 !important;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    background: transparent !important;
}

.cad-logs-table tr { background: transparent !important; }
.cad-logs-table tr:hover { background: #f1f5f9 !important; }
.cad-logs-table tr:last-child td { border-bottom: none; }

/* ── Gráfico de evolução de acerto ──────────────────────────── */

.cad-evo-wrap {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px 6px;
    margin-bottom: 8px;
}
.cad-evo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.cad-evo-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cad-evo-trend {
    font-size: 0.75rem;
    font-weight: 700;
}
.cad-evo-canvas-wrap {
    position: relative;
    height: 120px;
}

/* ── Estados vazios ─────────────────────────────────────────── */

.cad-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 48px 20px;
    color: #94a3b8;
    font-size: 0.85rem;
    text-align: center;
}

/* ── Botões globais ─────────────────────────────────────────── */

.cad-btn-primary {
    padding: 7px 16px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.cad-btn-primary:hover {
    background: #1d4ed8;
    box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}

.cad-btn-secondary {
    padding: 6px 13px;
    background: #f1f5f9 !important;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.cad-btn-secondary:hover { background: #e2e8f0; }

.cad-btn-danger-sm {
    padding: 6px 10px;
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 7px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
}

.cad-btn-danger-sm:hover { background: #fee2e2; }

/* ── Modal ──────────────────────────────────────────────────── */

.cad-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.cad-modal-overlay.hidden { display: none; }

/* Backdrop genérico para modais do caderno */
.cad-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9300;
    padding: 16px;
}

.cad-modal-box {
    background: #ffffff;
    color: #0f172a;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cad-modal-box .cad-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.cad-modal-box .cad-modal-title {
    font-size: 0.97rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
}

.cad-modal-box .cad-modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #64748b;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1;
    transition: background 0.12s, color 0.12s;
}
.cad-modal-box .cad-modal-close:hover { background: #e2e8f0; color: #1e293b; }

.cad-modal-box .cad-modal-body {
    background: #ffffff;
    color: #374151;
}

.cad-modal-box .cad-modal-body label {
    color: #374151 !important;
}

.cad-modal-box .cad-modal-body input {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

.cad-modal-box .cad-modal-body input:focus {
    outline: none;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.cad-disc-cfg-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.cad-disc-cfg-label input {
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #0f172a;
    background: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cad-disc-cfg-label input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.cad-disc-cfg-sep {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 0;
}

/* Chips de disciplinas agrupadas */
.cad-disc-cfg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
    min-height: 0;
}

.cad-disc-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    padding: 3px 10px 3px 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.cad-disc-chip-rm {
    background: none;
    border: none;
    color: #60a5fa;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
    border-radius: 50%;
    transition: color 0.1s;
}
.cad-disc-chip-rm:hover { color: #1d4ed8; }

/* Campo de busca de disciplinas para agrupamento */
.cad-disc-cfg-search-wrap {
    position: relative;
}

.cad-disc-cfg-search-wrap input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #0f172a;
    background: #ffffff;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cad-disc-cfg-search-wrap input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.cad-disc-cfg-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
}

.cad-disc-cfg-suggestions.is-open { display: block; }

.cad-disc-cfg-sug-item {
    padding: 9px 14px;
    font-size: 0.88rem;
    color: #1e293b;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}

.cad-disc-cfg-sug-item:last-child { border-bottom: none; }
.cad-disc-cfg-sug-item:hover { background: #eff6ff; color: #1d4ed8; }

.cad-disc-cfg-opt {
    font-weight: 400;
    font-size: 0.78rem;
    color: #94a3b8;
}

.cad-disc-cfg-label input[type="text"] {
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #0f172a;
    background: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cad-disc-cfg-label input[type="text"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.cad-disc-cfg-hint {
    font-size: 0.78rem;
    color: #94a3b8;
    margin: 0;
    line-height: 1.5;
    padding-bottom: 4px;
}

.cad-modal-box .cad-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 18px 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.cad-modal {
    /* Override dark-theme CSS variables from base.css */
    --input-bg: #ffffff;
    --input-text: #0f172a;
    --input-border: #cbd5e1;
    --input-focus-border: #3b82f6;
    --input-focus-shadow: 0 0 0 3px rgba(59,130,246,0.18);
    --ny-bg-input: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #374151;
    --border-color: #cbd5e1;
    color-scheme: light;

    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-radius: 12px;
    padding: 0;
    min-width: 340px;
    max-width: 640px;
    width: 92%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    overflow: hidden;
}

.cad-modal * { box-sizing: border-box; }

.cad-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff !important;
}

.cad-modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a !important;
}

.cad-modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.12s;
}

.cad-modal-close:hover { background: #f1f5f9 !important; }

.cad-modal-subtitle {
    padding: 8px 18px 0;
    font-size: 0.82rem;
    color: #64748b;
}

.cad-form {
    padding: 14px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #ffffff !important;
}

.cad-label {
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151 !important;
    gap: 4px;
}

/* Força tema claro em todos os inputs/selects/textareas dentro do modal */
.cad-input,
.cad-select,
.cad-textarea,
#cad-modal-overlay input,
#cad-modal-overlay select,
#cad-modal-overlay textarea {
    padding: 9px 11px;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 7px;
    font-size: 0.875rem;
    color: #0f172a !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-text-fill-color: #0f172a !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    appearance: auto;
    width: 100%;
    font-family: inherit;
}

.cad-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.cad-input::placeholder,
#cad-modal-overlay input::placeholder,
#cad-modal-overlay textarea::placeholder {
    color: #94a3b8 !important;
    -webkit-text-fill-color: #94a3b8 !important;
    opacity: 1;
}

.cad-input:focus,
.cad-select:focus,
.cad-textarea:focus,
#cad-modal-overlay input:focus,
#cad-modal-overlay select:focus,
#cad-modal-overlay textarea:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.18) !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
}

.cad-select option,
#cad-modal-overlay select option {
    background: #ffffff !important;
    color: #0f172a;
}

#cad-modal-overlay input[type="date"] {
    color-scheme: light;
}

.cad-form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}

/* ── Import preview ─────────────────────────────────────────── */

.cad-import-preview {
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f7ff;
}

.cad-import-hint {
    font-size: 0.8rem;
    color: #94a3b8;
    padding: 10px 12px;
    margin: 0;
}

.cad-import-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #dbeafe;
    border-bottom: 1px solid #bfdbfe;
}

.cad-import-count {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1d4ed8;
}

.cad-import-preview-hint {
    font-size: 0.72rem;
    color: #3b82f6;
}

.cad-import-table-wrap {
    max-height: 220px;
    overflow-y: auto;
}

.cad-import-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.cad-import-table thead th {
    background: #eff6ff;
    color: #374151;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 5px 8px;
    border-bottom: 1px solid #bfdbfe;
    text-align: left;
    position: sticky;
    top: 0;
}

.cad-import-table tbody tr {
    border-bottom: 1px solid #e0eeff;
}

.cad-import-table tbody tr:last-child { border-bottom: none; }
.cad-import-table tbody tr:nth-child(even) { background: #f8fbff; }

.cad-import-table td {
    padding: 5px 8px;
    color: #1e293b;
    vertical-align: middle;
}

.cad-ipv-n {
    color: #94a3b8;
    width: 28px;
    text-align: center;
}

.cad-ipv-nome { max-width: 180px; font-weight: 500; }
.cad-ipv-link { max-width: 160px; }

.cad-import-preview-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 0.72rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cad-import-preview-link:hover { text-decoration: underline; }

.cad-import-no-link {
    color: #94a3b8;
    font-style: italic;
    font-size: 0.72rem;
}

.cad-ipv-total {
    text-align: center;
    font-weight: 600;
    color: #374151;
    width: 52px;
}

/* ── Novos elementos do header de disciplina ────────────────── */

.cad-disciplina-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cad-disc-prog-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.cad-disc-prog-bar-wrap {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    min-width: 60px;
}

.cad-disc-prog-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease;
    min-width: 0;
}

.cad-disc-prog-pct {
    font-size: 0.8rem;
    font-weight: 800;
    min-width: 36px;
    text-align: right;
    flex-shrink: 0;
}

.cad-disc-meta-inline {
    font-size: 0.7rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cad-disc-all-done {
    font-size: 0.68rem;
    font-weight: 700;
    color: #14532d;
    background: #bbf7d0;
    border-radius: 99px;
    padding: 1px 8px;
    margin-left: 4px;
    flex-shrink: 0;
}

/* ── Linha concluída ────────────────────────────────────────── */

.cad-row-done td.cad-cell-nome {
    color: #64748b;
}

.cad-esquecido-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 16px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 800;
    color: #fff;
    padding: 0 4px;
    margin-right: 4px;
    vertical-align: middle;
    cursor: default;
}

.cad-done-badge {
    display: inline-block;
    font-size: 1rem;
    line-height: 1;
    vertical-align: middle;
    margin-right: 2px;
}

.cad-prog-bar--done {
    background: #16a34a !important;
}

/* Coluna ordenável */
.cad-th-sort {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.cad-th-sort:hover { color: #2563eb; }

/* Link externo discreto ao lado do nome */
.cad-btn-aula { color: #7c3aed; text-decoration: none; }

/* ── Botão rápido avançar fase ──────────────────────────────── */

.cad-fase-advance {
    display: inline-block;
    padding: 2px 8px;
    background: #b45309;
    color: #ffffff;
    border: none;
    border-radius: 99px;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}

.cad-fase-advance:hover { opacity: 0.85; }

/* ── Seção Ranking ──────────────────────────────────────────── */

.cad-ranking-section {
    background: #ffffff !important;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Gráfico de barras horizontais de peso */
.cad-ranking-chart-center {
    padding: 20px 24px 8px;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
    margin-bottom: 0;
}

.cad-ranking-chart-center canvas {
    display: block;
    width: 100% !important;
    max-width: 100%;
}

.cad-rank-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

.cad-rank-peso {
    font-size: 0.78rem;
    min-width: 36px;
    text-align: right;
}

/* Badge de peso na disciplina */
.cad-peso-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 6px;
    padding: 1px 7px;
    margin-left: 8px;
    vertical-align: middle;
}
.cad-peso-badge--high { background: #fee2e2; color: #991b1b; }
.cad-peso-badge--mid  { background: #fef3c7; color: #92400e; }
.cad-peso-badge--low  { background: #f1f5f9; color: #475569; }

.cad-ranking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    cursor: pointer;
    user-select: none;
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0;
}

.cad-ranking-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
}

.cad-ranking-chevron {
    font-size: 0.72rem;
    color: #94a3b8;
}

.cad-ranking-body { overflow-x: auto; }
.cad-ranking-body.is-hidden { display: none; }

.cad-ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin-top: 4px;
}

.cad-ranking-table thead th {
    background: #f1f5f9 !important;
    color: #475569;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
    border-top: 2px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.cad-ranking-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}

.cad-ranking-table tbody tr:last-child { border-bottom: none; }
.cad-ranking-table tbody tr:hover { background: #f8fafc !important; }

.cad-ranking-table td {
    padding: 9px 12px;
    color: #334155;
    vertical-align: middle;
}

.cad-rank-pos {
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.75rem;
    width: 28px;
    text-align: center;
}

.cad-rank-disc { font-weight: 600; color: #0f172a; }

.cad-rank-bar { min-width: 180px; }

.cad-rank-bar-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cad-rank-bar-wrap {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.cad-rank-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.3s;
    min-width: 0;
}

.cad-rank-pct {
    font-weight: 700;
    font-size: 0.8rem;
    white-space: nowrap;
    min-width: 32px;
    text-align: right;
    flex-shrink: 0;
}

.cad-rank-acerto {
    font-weight: 700;
    font-size: 0.82rem;
    white-space: nowrap;
    text-align: center;
}

.cad-rank-ok {
    font-size: 0.78rem;
    color: #64748b;
    text-align: center;
    white-space: nowrap;
}

/* ── Chips ações (expandir/recolher todas) ──────────────────── */

.cad-chips-sep {
    flex: 1;
}

.cad-chip-action {
    padding: 4px 10px;
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 99px;
    font-size: 0.73rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    flex-shrink: 0;
}

.cad-chip-action:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

/* ── Imagens de galeria vinculadas (grid de thumbnails) ─────── */

.cad-imgs-row { background: #fafbff !important; }

.cad-imgs-inner {
    padding: 10px 16px 12px 28px;
    border-top: 1px dashed #e2e8f0;
}

.cad-imgs-empty {
    font-size: 0.78rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cad-imgs-add-btn {
    padding: 5px 14px;
    background: none;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    font-size: 0.75rem;
    color: #475569;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
    white-space: nowrap;
}

.cad-imgs-add-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
}

/* ── Cronômetro na linha do tópico ─────────────────────────── */

.cad-btn-timer {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    cursor: pointer;
    color: #64748b;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    padding: 0;
}

.cad-btn-timer:hover { background: #dcfce7; color: #15803d; border-color: #86efac; }
.cad-btn-timer.is-running { background: #fef3c7; color: #92400e; border-color: #fde68a; animation: cad-timer-pulse 1.5s ease-in-out infinite; }

@keyframes cad-timer-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(217,119,6,0.3); }
    50%       { box-shadow: 0 0 0 4px rgba(217,119,6,0); }
}

.cad-row-timer {
    font-size: 0.72rem;
    font-weight: 700;
    color: #92400e;
    font-variant-numeric: tabular-nums;
    background: #fef3c7;
    border-radius: 4px;
    padding: 1px 5px;
    white-space: nowrap;
}

.cad-row-timer.hidden { display: none; }

/* ── Barra flutuante do cronômetro ──────────────────────────── */

#cad-timer-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9500;
    display: flex;
    align-items: center;
    gap: 14px;
    background: #1e293b;
    color: #f1f5f9;
    border-radius: 16px;
    padding: 10px 14px 10px 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
    min-width: 380px;
    max-width: 600px;
    animation: cad-bar-in 0.2s cubic-bezier(0.34,1.56,0.64,1);
    color-scheme: light;
}

@keyframes cad-bar-in {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#cad-timer-bar.is-paused {
    background: #334155;
}

.cad-timer-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.cad-timer-bar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #475569;
    flex-shrink: 0;
    transition: background 0.3s;
}

#cad-timer-bar.is-running .cad-timer-bar-dot {
    background: #22c55e;
    animation: cad-dot-pulse 1.8s ease-in-out infinite;
}

@keyframes cad-dot-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
    50%       { opacity: 0.7; box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

.cad-timer-bar-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}

.cad-timer-bar-disc {
    font-size: 0.66rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cad-timer-bar-topic {
    font-size: 0.82rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.cad-timer-bar-time {
    font-size: 1.35rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    color: #94a3b8;
    flex-shrink: 0;
    transition: color 0.3s;
}

#cad-timer-bar.is-running .cad-timer-bar-time {
    color: #4ade80;
}

.cad-timer-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cad-timer-bar-toggle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #1d4ed8;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, transform 0.1s;
    flex-shrink: 0;
}
.cad-timer-bar-toggle:hover { background: #1e40af; transform: scale(1.08); }

.cad-timer-bar-reg {
    height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    border: none;
    background: #15803d;
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s;
}
.cad-timer-bar-reg:hover { background: #16a34a; }

.cad-timer-bar-close {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.08);
    color: #64748b;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
}
.cad-timer-bar-close:hover { background: #475569; color: #f1f5f9; }

/* ── Cronômetro no modal de registro ───────────────────────── */

.cad-sessao-sep {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
    margin-top: 2px;
}
.cad-sessao-sep-hint {
    font-weight: 400;
    color: #94a3b8;
}
.cad-sessao-placar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cad-timer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
}

.cad-timer-label {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 600;
    flex-shrink: 0;
}

.cad-timer-display {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    min-width: 54px;
}

.cad-tempo-manual {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.cad-tempo-h,
.cad-tempo-m {
    width: 56px !important;
    text-align: center;
    padding: 5px 6px !important;
    font-size: 0.95rem !important;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.cad-tempo-sep {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

.cad-timer-btn {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s;
}

.cad-timer-start  { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.cad-timer-pause  { background: #fef3c7; color: #78350f; border-color: #fde68a; }
.cad-timer-reset  { background: #f1f5f9; color: #475569; margin-left: auto; }
.cad-timer-reset:hover { background: #e2e8f0; }

/* ── Notas por tópico ──────────────────────────────────────── */

.cad-btn-notas-on { color: #d97706 !important; }

.cad-notas-row td { padding: 0 !important; }

.cad-notas-inner { padding: 6px 12px 10px; }

.cad-notas-textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.82rem;
    color: #0f172a;
    background: #fffbeb;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}

.cad-notas-textarea:focus { border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,0.15); }

/* ── Filtro por fase ──────────────────────────────────────── */

.cad-fase-filter-btn {
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: none;
    font-size: 0.75rem;
    color: #64748b;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    white-space: nowrap;
}

.cad-fase-filter-btn:hover { background: #f1f5f9; }

.cad-fase-filter-btn.is-active {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}

/* ── Banner de prazo do concurso ──────────────────────────── */

/* ── Countdown mecha queimando ───────────────────────────────── */

.cad-countdown {
    border-radius: 14px;
    padding: 16px 20px 14px;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cad-countdown--safe  { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.cad-countdown--warning { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.cad-countdown--danger  { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }

.cad-countdown-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.cad-countdown-left {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.cad-countdown-num {
    font-size: 2.4rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: -1px;
}

.cad-countdown-label {
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0.75;
}

.cad-countdown-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.cad-countdown-date {
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0.8;
}

.cad-prazo-proj {
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    padding: 2px 8px;
}

.cad-prazo-proj--ok   { background: #dcfce7; color: #14532d; }
.cad-prazo-proj--late { background: #fee2e2; color: #991b1b; }

/* Mecha */
.cad-countdown-rope-wrap { display: flex; flex-direction: column; gap: 4px; }

.cad-countdown-rope-bg {
    position: relative;
    height: 10px;
    background: rgba(0,0,0,0.08);
    border-radius: 99px;
    overflow: visible;
}

.cad-countdown-rope-fill {
    position: absolute;
    left: 0; top: 0;
    height: 100%;
    border-radius: 99px;
    min-width: 20px;
    transition: width 0.6s ease;
}

.cad-countdown--safe    .cad-countdown-rope-fill { background: linear-gradient(90deg, #86efac, #16a34a); }
.cad-countdown--warning .cad-countdown-rope-fill { background: linear-gradient(90deg, #fde68a, #d97706); }
.cad-countdown--danger  .cad-countdown-rope-fill { background: linear-gradient(90deg, #fca5a5, #dc2626); }

/* Chama na ponta */
.cad-countdown-flame {
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    line-height: 1;
    animation: cad-flame-flicker 0.6s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 4px rgba(251,146,60,0.8));
}

@keyframes cad-flame-flicker {
    from { transform: translateY(-50%) scale(1)   rotate(-4deg); }
    to   { transform: translateY(-55%) scale(1.15) rotate(4deg); }
}

.cad-countdown-rope-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    opacity: 0.55;
    font-weight: 500;
    padding: 0 2px;
}

/* ── Heatmap de atividade ─────────────────────────────────── */

/* ── Simulador de ritmo ──────────────────────────────────────── */

.cad-ritmo-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 18px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cad-ritmo-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.02em;
}

.cad-ritmo-body { display: flex; flex-direction: column; gap: 8px; }

.cad-ritmo-slider-wrap { display: flex; flex-direction: column; gap: 4px; }

.cad-ritmo-lbl { font-size: 0.8rem; color: #64748b; }
.cad-ritmo-lbl strong { color: #1e293b; font-size: 1rem; }

.cad-ritmo-slider {
    width: 100%;
    accent-color: #2563eb;
    cursor: pointer;
    height: 4px;
}

.cad-ritmo-resultado { display: flex; flex-direction: column; gap: 6px; }

.cad-ritmo-tag {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}
.cad-ritmo-tag--ok   { background: #dcfce7; color: #14532d; }
.cad-ritmo-tag--late { background: #fee2e2; color: #991b1b; }
.cad-ritmo-tag--info { background: #eff6ff; color: #1e40af; }

.cad-ritmo-prog-wrap {
    height: 6px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    margin-top: 2px;
}
.cad-ritmo-prog-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.2s ease, background 0.2s ease;
}
.cad-ritmo-pct {
    font-size: 0.72rem;
    color: #64748b;
}

/* ── Badge de meta diária no menu ────────────────────────────── */

.cad-meta-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #b91c1c;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    animation: cad-badge-pulse 2s ease-in-out infinite;
}

@keyframes cad-badge-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.2); }
}

.cad-heatmap-section {
    margin-bottom: 14px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.cad-heatmap-loading { font-size: 0.75rem; color: #94a3b8; }

.cad-heatmap-inner { display: flex; flex-direction: column; gap: 6px; }

.cad-hm-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.cad-hm-grid {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.cad-hm-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cad-hm-labels { margin-right: 2px; }

.cad-hm-day-label {
    width: 12px;
    height: 12px;
    font-size: 0.52rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cad-hm-cell {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    cursor: default;
}

.cad-hm-l0     { background: #e2e8f0; }
.cad-hm-l1     { background: #bbf7d0; }
.cad-hm-l2     { background: #4ade80; }
.cad-hm-l3     { background: #16a34a; }
.cad-hm-l4     { background: #14532d; }
.cad-hm-future { background: transparent; }

.cad-hm-legend {
    display: flex;
    align-items: center;
    gap: 3px;
}

.cad-hm-leg-label { font-size: 0.65rem; color: #94a3b8; }

/* ── Botão na gallery-bar (injetado por cadernos_main) ─────── */

.cad-gal-search-btn { font-size: 0.78rem; }

/* Picker de imagem: movido pra css/modules/gallery.css (.gallery-picker-*),
   compartilhado via window.gallery.openSearchPicker(). */

/* ── Lightbox de confirmação ao clicar ──────────────────────── */

.cad-gal-lb-backdrop {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9700;
    display: flex;
    flex-direction: column;
}

.cad-gal-lb-box {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.cad-gal-lb-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: #333;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cad-gal-lb-close:hover { background: #555; color: #fff; }

.cad-gal-lb-img-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 16px;
}

.cad-gal-lb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cad-gal-lb-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: #0f0f0f;
    border-top: 1px solid #1e1e1e;
    flex-shrink: 0;
}

.cad-gal-lb-cap {
    flex: 1;
    font-size: 0.82rem;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cad-gal-lb-btn {
    padding: 10px 22px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.cad-gal-lb-btn:hover { background: #1d4ed8; }

.cad-gal-lb-linked {
    font-size: 0.84rem;
    color: #4ade80;
    font-weight: 600;
}

/* ── Botão excluir disciplina ───────────────────────────────── */

.cad-btn-del-disc {
    padding: 2px 6px;
    background: none;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #dc2626;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s, background 0.15s;
    line-height: 1.4;
}

.cad-btn-del-disc:hover {
    opacity: 1;
    background: #fef2f2;
}

/* ── Responsivo mobile ──────────────────────────────────────── */

@media (max-width: 640px) {
    .cad-body { flex-direction: column; }
    .cad-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        flex-direction: row;
        overflow-x: auto;
        padding: 8px;
        gap: 6px;
    }
    .cad-sidebar-item {
        flex-shrink: 0;
        min-width: 140px;
    }
    .cad-table { font-size: 0.75rem; }
    .cad-caderno-view { padding: 12px 14px 20px; }
    .cad-caderno-header { flex-direction: column; }
    .cad-stats-row { gap: 8px; }
    .cad-stat-card { min-width: 100px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PAINEL DE ANOTAÇÕES INLINE
══════════════════════════════════════════════════════════════════════════ */

/* Painel de anotações WYSIWYG — slide-in da direita */
#cad-nota-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(500px, 100vw);
    height: 100vh;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    box-shadow: -6px 0 32px rgba(0,0,0,0.12);
    z-index: 9200;
    display: flex;
    flex-direction: column;
    animation: cad-nota-slidein 0.22s cubic-bezier(0.22,1,0.36,1);
}

@keyframes cad-nota-slidein {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* Cabeçalho escuro igual ao GPS Notebook */
.cad-nota-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    background: #1e293b;
    border-bottom: 1px solid #0f172a;
    flex-shrink: 0;
}

.cad-nota-head-icon { font-size: 1rem; flex-shrink: 0; }

.cad-nota-head-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 0.85rem;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cad-nota-save-status {
    font-size: 0.7rem;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}

.cad-nota-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 7px;
    border-radius: 5px;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
    line-height: 1;
}
.cad-nota-close-btn:hover { background: #334155; color: #f1f5f9; }

/* Toolbar: usa notas-editor-toolbar do flat.css + override de borda */
.cad-nota-toolbar-wrap {
    border-top: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
    flex-shrink: 0;
}

/* Área editável WYSIWYG */
.cad-nota-editor-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.8;
    color: #1a1a1a;
    outline: none;
    background: #fff;
    min-height: 0;
}
.cad-nota-editor-area * { font-weight: inherit; }
.cad-nota-editor-area strong, .cad-nota-editor-area b,
.cad-nota-editor-area h1, .cad-nota-editor-area h2, .cad-nota-editor-area h3 { font-weight: 700; }

/* Neutraliza "p { color: var(--c-text-on-dark) }" do flat.css (linha 456)
   e outras regras globais de cor que tornam o texto invisível no fundo branco */
.cad-nota-editor-area p,
.cad-nota-editor-area li,
.cad-nota-editor-area span:not([style*="color"]),
.cad-nota-editor-area div,
.cad-nota-editor-area td,
.cad-nota-editor-area th { color: #1a1a1a; }

.cad-nota-editor-area:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
    pointer-events: none;
    display: block;
}

/* Estilos de conteúdo no editor */
.cad-nota-editor-area h1 { font-size: 1.4rem; font-weight: 700; margin: 0.8em 0 0.3em; color: #0f172a; }
.cad-nota-editor-area h2 { font-size: 1.15rem; font-weight: 700; margin: 0.7em 0 0.3em; color: #1e293b; }
.cad-nota-editor-area h3 { font-size: 1rem; font-weight: 600; margin: 0.6em 0 0.25em; color: #334155; }
.cad-nota-editor-area p { margin: 0.35em 0; }
.cad-nota-editor-area ul { list-style-type: disc; padding-left: 1.5em; margin: 0.4em 0; }
.cad-nota-editor-area ol { list-style-type: decimal; padding-left: 1.5em; margin: 0.4em 0; }
.cad-nota-editor-area ul ul { list-style-type: circle; }
.cad-nota-editor-area ul ul ul { list-style-type: square; }
.cad-nota-editor-area li { margin: 0.2em 0; display: list-item; }
.cad-nota-editor-area blockquote {
    border-left: 3px solid #3b82f6;
    margin: 0.6em 0;
    padding: 6px 14px;
    color: #475569;
    background: #eff6ff;
    border-radius: 0 6px 6px 0;
}
.cad-nota-editor-area code {
    background: #f1f5f9;
    color: #334155;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: ui-monospace, monospace;
}
.cad-nota-editor-area a { color: #3b82f6; }

/* Barra de cor nos botões de cor */
.cad-nota-colorbar {
    width: 16px;
    height: 3px;
    border-radius: 2px;
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
}

/* Dropdown de cores */
.cad-nota-colorpicker {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: 118px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.13);
    z-index: 1;
}

.cad-nota-colorswatch {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.12);
    cursor: pointer;
    transition: transform 0.1s;
    padding: 0;
}
.cad-nota-colorswatch:hover { transform: scale(1.25); }

/* Rodapé com atalhos */
.cad-nota-footer {
    padding: 5px 16px;
    font-size: 0.67rem;
    color: #94a3b8;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.6;
}

/* ── Context menu (botão direito) ─────────────────────────────────────── */
@keyframes cadCtxIn {
    from { opacity: 0; transform: scale(0.95) translateY(-4px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.cad-ctx-menu {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 14px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.06), 0 16px 48px rgba(0,0,0,0.16);
    padding: 8px;
    min-width: 256px;
    max-height: 80vh;
    overflow-y: auto;
    animation: cadCtxIn 0.14s cubic-bezier(0.16,1,0.3,1);
    transform-origin: top left;
}

.cad-ctx-hdr {
    font-size: 0.63rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    padding: 4px 6px 6px;
}

.cad-ctx-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    margin-bottom: 2px;
}

.cad-ctx-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 4px 6px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
}
.cad-ctx-block:hover { background: #f1f5f9; }

.cad-ctx-block-ic {
    width: 38px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    line-height: 1;
}

.cad-ctx-block-lbl {
    font-size: 0.62rem;
    color: #64748b;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.cad-ctx-sep {
    height: 1px;
    background: #f1f5f9;
    margin: 6px 0;
}

.cad-ctx-fmt {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 8px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
}
.cad-ctx-fmt:hover { background: #f1f5f9; }

.cad-ctx-fmt-ic {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    flex-shrink: 0;
}

.cad-ctx-fmt-lbl {
    flex: 1;
    font-size: 0.84rem;
    color: #1e293b;
}

.cad-ctx-fmt-kbd {
    font-size: 0.68rem;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 1px 5px;
    font-family: monospace;
}

/* ── Slash menu (/  → menu de blocos tipo Notion) ─────────────────────── */
.cad-slash-menu {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.14);
    padding: 6px;
    min-width: 210px;
    max-height: 300px;
    overflow-y: auto;
}

.cad-si {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 8px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #1a1a1a;
    text-align: left;
}
.cad-si:hover, .cad-si.is-active { background: #f1f5f9; }

.cad-si-ic {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    color: #475569;
}

/* ── Task list (Lista de tarefas) ────────────────────────────────────────── */
.cad-cklist {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0.4em 0;
}

.cad-cki {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 2px 0;
    min-height: 1.6em;
    position: relative;
    padding-left: 26px;
}

.cad-cki::before {
    content: '☐';
    position: absolute;
    left: 0;
    top: 2px;
    font-size: 1rem;
    line-height: 1.5;
    cursor: pointer;
    color: #475569;
    user-select: none;
    width: 22px;
    text-align: center;
}

.cad-cki[data-checked="true"]::before {
    content: '☑';
    color: #16a34a;
}

.cad-cki[data-checked="true"] {
    color: #94a3b8;
    text-decoration: line-through;
}

/* ── Code block ────────────────────────────────────────────────────────────── */
.cad-code-blk {
    background: #1e293b;
    border-radius: 8px;
    padding: 14px 16px;
    margin: 0.6em 0;
    overflow-x: auto;
    white-space: pre;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #e2e8f0;
}

.cad-code-blk code {
    background: none !important;
    color: inherit !important;
    padding: 0 !important;
    font-size: inherit !important;
    font-family: inherit !important;
}

/* ── Callout (Destaque) ─────────────────────────────────────────────────── */
.cad-callout {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 10px 14px 10px 42px;
    margin: 0.6em 0;
    position: relative;
    color: #92400e;
    font-size: 0.9rem;
    line-height: 1.7;
}

.cad-callout::before {
    content: '💡';
    position: absolute;
    left: 12px;
    top: 10px;
    font-size: 1rem;
    line-height: 1.7;
}

.cad-callout p { color: #92400e; }

/* ── Toggle (Lista de alternantes) ─────────────────────────────────────── */
.cad-toggle {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin: 0.5em 0;
    overflow: hidden;
}

.cad-tg-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f8fafc;
    font-weight: 500;
    font-size: 0.9rem;
    color: #1a1a1a;
    min-height: 38px;
}

.cad-tg-btn {
    cursor: pointer !important;
    user-select: none;
    font-size: 0.65rem;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    flex-shrink: 0;
    transition: transform 0.18s, background 0.1s;
}
.cad-tg-btn:hover { background: #e2e8f0; }

.cad-toggle[data-open="1"] .cad-tg-btn {
    transform: rotate(90deg);
}

.cad-tg-body {
    display: none;
    padding: 10px 14px;
    border-top: 1px solid #e2e8f0;
    font-size: 0.88rem;
    color: #1a1a1a;
}

.cad-tg-body p { color: #1a1a1a; }

.cad-toggle[data-open="1"] .cad-tg-body {
    display: block;
}

/* ── Filtros rápidos de tabela ──────────────────────────────────────── */
.cad-filter-bar {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 8px 10px 0;
    flex-wrap: wrap;
}
.cad-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #f8fafc;
    font-size: 0.73rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.cad-filter-chip:hover { background: #f1f5f9; border-color: #cbd5e1; }
.cad-filter-chip.is-active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
    font-weight: 600;
}
.cad-filter-count {
    background: #e2e8f0;
    border-radius: 10px;
    padding: 0 5px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #475569;
}
.cad-filter-chip.is-active .cad-filter-count {
    background: #bfdbfe;
    color: #1d4ed8;
}

/* ── Badge prioridade (Próximo a estudar) ──────────────────────────── */


/* ── Meta diária — card ─────────────────────────────────────────────── */
.cad-meta-prog-wrap {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}
.cad-meta-prog-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s;
}
.cad-meta-edit-btn {
    display: block;
    margin-top: 8px;
    font-size: 0.68rem;
    color: #94a3b8;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.14s;
}
.cad-meta-edit-btn:hover { color: #3b82f6; }

/* ── Modal meta diária ─────────────────────────────────────────────── */
.cad-input {
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.9rem;
    color: #1e293b;
    outline: none;
    transition: border-color 0.14s;
    box-sizing: border-box;
}
.cad-input:focus { border-color: #3b82f6; }

/* ── Mini gráfico SVG por disciplina ────────────────────────────────── */
.cad-disc-mini-chart {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 12px;
    padding: 4px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.cad-disc-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    min-width: 32px;
}
.cad-disc-stat-val {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}
.cad-disc-stat-lbl {
    font-size: 0.58rem;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
}

/* ── Modal Meta Diária (redesign) ──────────────────────────────────── */
.cad-meta-modal {
    background: #fff;
    border-radius: 20px;
    padding: 32px 28px 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    text-align: center;
    animation: cadCtxIn 0.16s cubic-bezier(0.16,1,0.3,1);
}
.cad-meta-modal-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    line-height: 1;
}
.cad-meta-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 4px;
}
.cad-meta-modal-desc {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0 0 20px;
}
.cad-meta-modal-input-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
}
.cad-meta-modal-input {
    width: 110px;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: #0f172a;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 8px;
    outline: none;
    transition: border-color 0.14s;
    -moz-appearance: textfield;
}
.cad-meta-modal-input::-webkit-inner-spin-button,
.cad-meta-modal-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.cad-meta-modal-input:focus { border-color: #3b82f6; }
.cad-meta-modal-unit {
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: 500;
}
.cad-meta-modal-presets {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.cad-meta-preset {
    padding: 5px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    background: #f8fafc;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.cad-meta-preset:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}
.cad-meta-modal-actions {
    display: flex;
    gap: 8px;
}
.cad-meta-modal-cancel {
    flex: 1;
    padding: 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: background 0.12s;
}
.cad-meta-modal-cancel:hover { background: #f1f5f9; }
.cad-meta-modal-save {
    flex: 2;
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: #2563eb;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}
.cad-meta-modal-save:hover {
    background: #1d4ed8;
    box-shadow: 0 3px 12px rgba(37,99,235,0.3);
}
.cad-meta-modal-remove {
    display: block;
    margin: 12px auto 0;
    background: none;
    border: none;
    font-size: 0.72rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: color 0.14s;
}
.cad-meta-modal-remove:hover { color: #ef4444; }

/* ── Badge "Suficiente" ─────────────────────────────────────────────── */
.cad-suf-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 800;
    color: #0d9488;
    background: #ccfbf1;
    border: 1px solid #99f6e4;
    border-radius: 4px;
    padding: 0 5px;
    height: 16px;
    vertical-align: middle;
    cursor: default;
    margin-right: 3px;
    letter-spacing: 0.04em;
}
.cad-row-suf td { opacity: 0.72; }
.cad-row-suf .cad-cell-nome { opacity: 1; }



/* Chip "suficiente" no filtro */
.cad-filter-chip--suf.is-active {
    background: #f0fdfa;
    border-color: #0d9488;
    color: #0f766e;
}
.cad-filter-chip--suf.is-active .cad-filter-count {
    background: #99f6e4;
    color: #0f766e;
}

/* ── Revisao urgente (esquecimento) ─────────────────────────────────────── */
.cad-revisao-urgente {
    margin: 0 0 12px;
    border: 1.5px solid #fde68a;
    border-radius: 14px;
    overflow: hidden;
    background: #fffdf5;
}
.cad-rev-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: #fefce8;
    border-bottom: 1px solid #fde68a;
}
.cad-rev-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #1e293b;
}
.cad-rev-icon {
    font-size: 1rem;
    color: #d97706;
}
.cad-rev-hint {
    font-size: 0.7rem;
    color: #92400e;
    font-weight: 400;
}
.cad-rev-table {
    width: 100%;
    border-collapse: collapse;
}
.cad-rev-tr {
    border-bottom: 1px solid #fef9c3;
    transition: background 0.1s;
}
.cad-rev-tr:last-child { border-bottom: none; }
.cad-rev-tr:hover { background: #fefce8 !important; }
.cad-rev-td-disc {
    padding: 10px 12px 10px 18px;
    min-width: 180px;
}
.cad-rev-nome {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
    margin-bottom: 2px;
}
.cad-rev-disc {
    font-size: 0.67rem;
    color: #94a3b8;
}
.cad-rev-td-dias {
    padding: 10px 12px;
    white-space: nowrap;
}
.cad-rev-dias-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid;
    display: inline-block;
}
.cad-rev-td-ac {
    padding: 10px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #15803d;
    white-space: nowrap;
}
.cad-rev-ac-lbl {
    font-size: 0.65rem;
    font-weight: 400;
    color: #94a3b8;
    margin-left: 2px;
}
.cad-rev-td-qtd {
    padding: 10px 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #94a3b8;
    white-space: nowrap;
    width: 36px;
}
.cad-rev-td-btn {
    padding: 10px 18px 10px 8px;
    text-align: right;
    white-space: nowrap;
}
.cad-rev-btn {
    background: #fef9c3 !important;
    border-color: #fde68a !important;
    color: #92400e !important;
}
.cad-rev-btn:hover { background: #fde68a !important; }

/* ── Plano de hoje ──────────────────────────────────────────────────── */
.cad-plano-hoje {
    margin: 0 0 20px;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}
.cad-plano-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 18px;
    background: #fafafa;
    border-bottom: 1px solid #f1f5f9;
}
.cad-plano-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: #1e293b;
}
.cad-plano-total {
    font-size: 0.72rem;
    font-weight: 500;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 20px;
    padding: 2px 10px;
    white-space: nowrap;
}
.cad-plano-toggle {
    font-size: 0.76rem;
    font-weight: 600;
    color: #3b82f6;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: 8px;
    padding: 5px 16px;
    cursor: pointer;
    transition: background 0.12s;
    white-space: nowrap;
    flex-shrink: 0;
}
.cad-plano-toggle:hover { background: #dbeafe; }

/* Tabela do plano de hoje */
.cad-plano-table-wrap {
    overflow-x: auto;
}
.cad-plano-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.cad-plano-table thead th {
    padding: 8px 14px;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
    background: #fafafa;
}
.cad-plano-tr {
    border-bottom: 1px solid #f8fafc;
    transition: background 0.1s;
}
.cad-plano-tr:last-child { border-bottom: none; }
.cad-plano-tr:hover { background: #f8fafc !important; }
.cad-plano-td-num {
    padding: 10px 8px 10px 16px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #cbd5e1;
    white-space: nowrap;
    width: 28px;
}
.cad-plano-td-prio {
    padding: 10px 8px;
    white-space: nowrap;
    width: 80px;
}
.cad-plano-prio-chip {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-block;
}
.cad-plano-td-nome {
    padding: 10px 12px;
    min-width: 200px;
}
.cad-plano-nome-txt {
    font-size: 0.83rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}
.cad-plano-nome-disc {
    font-size: 0.68rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}
.cad-plano-td-prog {
    padding: 10px 12px;
    white-space: nowrap;
    width: 90px;
}
.cad-plano-prog-wrap {
    width: 56px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 3px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}
.cad-plano-prog-fill {
    height: 100%;
    border-radius: 2px;
}
.cad-plano-prog-txt {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 600;
    vertical-align: middle;
}
.cad-plano-td-ac {
    padding: 10px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    width: 60px;
}
.cad-plano-td-qtd {
    padding: 10px 12px;
    font-size: 1rem;
    font-weight: 800;
    white-space: nowrap;
    width: 52px;
}
.cad-plano-td-btn {
    padding: 10px 16px 10px 8px;
    white-space: nowrap;
    text-align: right;
    width: 120px;
}
.cad-plano-btn-ir {
    font-size: 0.72rem;
    font-weight: 600;
    color: #3b82f6;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 5px 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s;
}
.cad-plano-btn-ir:hover { background: #dbeafe; }

/* Flash ao navegar para o topico */
@keyframes cadRowFlash {
    0%   { background: #fef9c3; outline: 2px solid #ca8a04; outline-offset: -2px; }
    80%  { background: #fef9c3; outline: 2px solid #ca8a04; outline-offset: -2px; }
    100% { background: inherit; outline: none; }
}
.cad-row-flash { animation: cadRowFlash 2s ease forwards; }

