/* ── Unit Assessment Tracker ── */
.ua-container { font-family: 'Inter', sans-serif; color: #1e293b; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; background: #fff; }

/* Header */
.ua-header { background: linear-gradient(135deg, #0c4a6e, #0284c7); color: #fff; padding: 1.25rem 1.5rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ua-header h2 { margin: 0 0 .2rem; font-size: 1.2rem; font-weight: 700; }
.ua-header-sub { font-size: .82rem; opacity: .8; }
.ua-tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.ua-tab { font-family: 'JetBrains Mono', monospace; font-size: .7rem; font-weight: 600; letter-spacing: .04em; padding: .35rem .7rem; border-radius: 50px; border: 1px solid rgba(255,255,255,.35); color: #fff; background: rgba(255,255,255,.08); cursor: pointer; transition: background .15s; }
.ua-tab:hover { background: rgba(255,255,255,.18); }
.ua-tab.ua-tab-active { background: #fff; color: #0c4a6e; border-color: #fff; }

/* Question paper (opened from the header tab) */
.ua-tab svg { width: 12px; height: 12px; vertical-align: -2px; margin-right: .35rem; }
.ua-paper { display: none; border-bottom: 1px solid #e2e8f0; background: #f0f9ff; }
.ua-paper.ua-paper-open { display: block; }
.ua-paper-head { display: flex; align-items: center; justify-content: space-between; padding: .7rem 1.5rem; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #0c4a6e; }
.ua-paper-head svg { width: 15px; height: 15px; color: #0284c7; vertical-align: -3px; margin-right: .4rem; }
.ua-paper-close { background: none; border: none; cursor: pointer; color: #64748b; font-size: .9rem; padding: .2rem .5rem; border-radius: 6px; }
.ua-paper-close:hover { background: #e0f2fe; color: #0c4a6e; }
.ua-paper-slot.sc-visible { max-height: none; margin: 0 1.5rem 1.25rem; }

/* Empty states */
.ua-empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .4rem; padding: 2rem 1rem; border: 1px dashed #cbd5e1; border-radius: 12px; background: #f8fafc; color: #64748b; font-size: .82rem; line-height: 1.6; }
.ua-empty-state svg { width: 28px; height: 28px; color: #94a3b8; margin-bottom: .2rem; }
.ua-empty-state b { color: #1e293b; font-size: .95rem; }
.ua-empty-state span { max-width: 520px; }

/* Hero stats */
.ua-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.ua-stat { background: #f8fafc; padding: 1rem 1.25rem; }
.ua-stat-label { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #64748b; }
.ua-stat-value { font-size: 1.7rem; font-weight: 800; color: #0f172a; line-height: 1.15; margin-top: .2rem; }
.ua-stat-value small { font-size: .95rem; font-weight: 600; color: #64748b; }
.ua-stat-sub { font-size: .74rem; color: #64748b; margin-top: .15rem; }
.ua-grade { display: inline-block; min-width: 2.4rem; text-align: center; border-radius: 8px; padding: .05rem .5rem; }
.ua-grade-A { background: #d1fae5; color: #065f46; }
.ua-grade-B { background: #dbeafe; color: #1e40af; }
.ua-grade-C { background: #e0f2fe; color: #075985; }
.ua-grade-D { background: #fef3c7; color: #92400e; }
.ua-grade-E { background: #ffedd5; color: #9a3412; }
.ua-grade-u { background: #fee2e2; color: #991b1b; }

/* Sections */
.ua-section { padding: 1.25rem 1.5rem; border-bottom: 1px solid #f1f5f9; }
.ua-section:last-child { border-bottom: none; }
.ua-section-title { display: flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #0c4a6e; margin: 0 0 .9rem; }
.ua-section-title svg { width: 16px; height: 16px; color: #0284c7; }
.ua-section-note { font-size: .78rem; color: #64748b; margin: -.5rem 0 .9rem; line-height: 1.5; }

/* Question bars (single series — score as a share of the marks available) */
.ua-qbars { display: flex; flex-direction: column; gap: .6rem; }
.ua-qrow { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) 4.2rem; align-items: center; gap: .75rem; }
.ua-qrow-q { font-family: 'JetBrains Mono', monospace; font-size: .75rem; font-weight: 700; color: #0c4a6e; }
.ua-qrow-title { font-size: .72rem; color: #64748b; margin-bottom: .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ua-qbar { position: relative; height: 12px; background: #e0f2fe; border-radius: 4px; overflow: visible; }
.ua-qbar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #0284c7; border-radius: 4px; transition: width .6s ease; }
.ua-qbar-fill.ua-fill-zero { width: 3px !important; background: #dc2626; }
.ua-qbar-mean { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #0f172a; opacity: .55; border-radius: 1px; }
.ua-qrow-score { font-family: 'JetBrains Mono', monospace; font-size: .78rem; font-weight: 700; color: #0f172a; text-align: right; white-space: nowrap; }
.ua-qrow-score small { font-weight: 500; color: #94a3b8; }
.ua-legend { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: .72rem; color: #64748b; margin-top: .9rem; }
.ua-legend-item { display: inline-flex; align-items: center; gap: .4rem; }
.ua-legend-swatch { width: 14px; height: 8px; border-radius: 3px; background: #0284c7; }
.ua-legend-mean { width: 2px; height: 12px; background: #0f172a; opacity: .55; }

/* Part cells */
.ua-parts { display: flex; flex-wrap: wrap; gap: .5rem; }
.ua-part { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 58px; padding: .45rem .5rem .4rem; border-radius: 8px; border: 1px solid transparent; cursor: default; }
.ua-part-label { font-family: 'JetBrains Mono', monospace; font-size: .66rem; font-weight: 700; letter-spacing: .02em; }
.ua-part-score { font-size: .9rem; font-weight: 800; line-height: 1.1; margin-top: .15rem; }
.ua-part-score small { font-size: .65rem; font-weight: 600; opacity: .75; }
.ua-part-full { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.ua-part-partial { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.ua-part-zero { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.ua-part[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); background: #0f172a; color: #fff; font-size: .7rem; font-weight: 500; padding: .35rem .55rem; border-radius: 6px; white-space: nowrap; z-index: 5; pointer-events: none; }
.ua-part-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .9rem; font-size: .72rem; color: #64748b; }
.ua-part-legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.ua-part-legend .ua-lg-full::before { background: #10b981; }
.ua-part-legend .ua-lg-partial::before { background: #f59e0b; }
.ua-part-legend .ua-lg-zero::before { background: #ef4444; }

/* Topic table */
.ua-topics { width: 100%; border-collapse: collapse; font-size: .8rem; }
.ua-topics th { text-align: left; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #64748b; padding: .35rem .5rem; border-bottom: 1px solid #e2e8f0; }
.ua-topics td { padding: .45rem .5rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.ua-topics tr:last-child td { border-bottom: none; }
.ua-topics .ua-topic-name { font-weight: 600; color: #1e293b; }
.ua-topics .ua-topic-parts { font-family: 'JetBrains Mono', monospace; font-size: .68rem; color: #94a3b8; }
.ua-topic-bar { height: 8px; background: #e0f2fe; border-radius: 4px; min-width: 120px; overflow: hidden; }
.ua-topic-fill { height: 100%; background: #0284c7; border-radius: 4px; }
.ua-topics .ua-topic-score { font-family: 'JetBrains Mono', monospace; font-size: .76rem; font-weight: 700; text-align: right; white-space: nowrap; }

/* Two-column strengths / lost marks */
.ua-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }
.ua-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.ua-list li { border-radius: 10px; padding: .7rem .85rem; font-size: .8rem; line-height: 1.55; color: #334155; }
.ua-list-strength li { background: #f0fdf4; border: 1px solid #bbf7d0; }
.ua-list-lost li { background: #fff7ed; border: 1px solid #fed7aa; }
.ua-list-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-weight: 700; color: #0f172a; margin-bottom: .2rem; }
.ua-list-head .ua-chip { font-family: 'JetBrains Mono', monospace; font-size: .68rem; font-weight: 700; padding: .12rem .45rem; border-radius: 50px; background: #fff; border: 1px solid #e2e8f0; color: #475569; white-space: nowrap; }
.ua-empty { font-size: .8rem; color: #94a3b8; font-style: italic; }

/* Action items */
.ua-actions { display: flex; flex-direction: column; gap: .55rem; }
.ua-action { display: grid; grid-template-columns: 4.2rem 1fr; gap: .75rem; align-items: start; font-size: .8rem; line-height: 1.6; color: #334155; padding: .6rem .8rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; }
.ua-action-part { font-family: 'JetBrains Mono', monospace; font-size: .7rem; font-weight: 700; color: #0284c7; background: #e0f2fe; border-radius: 6px; padding: .2rem .4rem; text-align: center; margin-top: .15rem; }

/* Study plan */
.ua-plan { width: 100%; border-collapse: collapse; font-size: .78rem; }
.ua-plan th { text-align: left; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #64748b; padding: .4rem .6rem; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.ua-plan td { padding: .55rem .6rem; border-bottom: 1px solid #f1f5f9; vertical-align: top; line-height: 1.5; color: #334155; }
.ua-plan tr:last-child td { border-bottom: none; }
.ua-plan .ua-plan-part { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: #0c4a6e; white-space: nowrap; }
.ua-plan .ua-plan-lost { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: #dc2626; white-space: nowrap; }
.ua-plan .ua-plan-title { font-weight: 600; color: #0f172a; display: block; margin-bottom: .15rem; }

/* Marking accordion */
.ua-acc { border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: .6rem; overflow: hidden; }
.ua-acc-head { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; background: #f8fafc; cursor: pointer; user-select: none; }
.ua-acc-head:hover { background: #f1f5f9; }
.ua-acc-q { font-family: 'JetBrains Mono', monospace; font-size: .74rem; font-weight: 700; color: #0c4a6e; }
.ua-acc-title { flex: 1; font-size: .82rem; font-weight: 600; color: #1e293b; }
.ua-acc-score { font-family: 'JetBrains Mono', monospace; font-size: .76rem; font-weight: 700; padding: .15rem .5rem; border-radius: 50px; }
.ua-acc-chev { width: 16px; height: 16px; color: #94a3b8; transition: transform .2s; }
.ua-acc.ua-open .ua-acc-chev { transform: rotate(180deg); }
.ua-acc-body { display: none; padding: .6rem .9rem .9rem; }
.ua-acc.ua-open .ua-acc-body { display: block; }
.ua-mark { display: grid; grid-template-columns: 1.1rem 3.6rem 3rem 1fr; gap: .5rem; align-items: start; padding: .4rem 0; border-bottom: 1px dashed #f1f5f9; font-size: .78rem; line-height: 1.5; }
.ua-mark:last-of-type { border-bottom: none; }
.ua-mark-ok { color: #059669; font-weight: 800; }
.ua-mark-no { color: #dc2626; font-weight: 800; }
.ua-mark-code { font-family: 'JetBrains Mono', monospace; font-size: .7rem; font-weight: 700; color: #475569; }
.ua-mark-part { font-family: 'JetBrains Mono', monospace; font-size: .7rem; color: #94a3b8; }
.ua-mark-text { color: #334155; }
.ua-mark-note { display: block; margin-top: .2rem; color: #b91c1c; font-size: .75rem; }
.ua-summary { margin-top: .7rem; padding: .55rem .75rem; border-radius: 8px; background: #fffbeb; border: 1px solid #fde68a; font-size: .76rem; color: #78350f; line-height: 1.5; }
.ua-summary.ua-summary-full { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.ua-revision { margin-top: .6rem; padding: .6rem .75rem; border-left: 3px solid #0284c7; background: #f0f9ff; border-radius: 0 8px 8px 0; font-size: .77rem; line-height: 1.55; color: #334155; }
.ua-revision b { color: #0c4a6e; }
.ua-revision .ua-tb { margin-top: .35rem; color: #475569; font-size: .74rem; }

/* PDF button + notebook */
.ua-toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.ua-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .9rem; border-radius: 8px; border: 1px solid #0284c7; background: #0284c7; color: #fff; font-family: 'Inter', sans-serif; font-size: .78rem; font-weight: 600; cursor: pointer; transition: background .15s; }
.ua-btn:hover { background: #0369a1; }
.ua-btn.ua-btn-ghost { background: #fff; color: #0369a1; }
.ua-btn.ua-btn-ghost:hover { background: #f0f9ff; }
.ua-btn svg { width: 15px; height: 15px; }
.ua-notebook-slot { margin-top: 1rem; }
.ua-notebook-slot.sc-visible { max-height: none; margin: 1rem 0 0; }

/* Class report */
.ua-rank { width: 100%; border-collapse: collapse; font-size: .8rem; }
.ua-rank th { text-align: left; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #64748b; padding: .4rem .6rem; border-bottom: 1px solid #e2e8f0; }
.ua-rank td { padding: .5rem .6rem; border-bottom: 1px solid #f1f5f9; }
.ua-rank tr:last-child td { border-bottom: none; }
.ua-rank .ua-rank-n { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: #b45309; }
.ua-rank .ua-rank-name { font-weight: 600; }
.ua-rank .ua-rank-score { font-family: 'JetBrains Mono', monospace; font-weight: 700; text-align: right; }
.ua-fac { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: .4rem; }
.ua-fac-cell { border-radius: 8px; padding: .45rem .3rem; text-align: center; border: 1px solid transparent; }
.ua-fac-label { font-family: 'JetBrains Mono', monospace; font-size: .64rem; font-weight: 700; }
.ua-fac-val { font-size: .95rem; font-weight: 800; line-height: 1.1; margin-top: .1rem; }
.ua-fac-hi { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.ua-fac-mid { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.ua-fac-lo { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.ua-prose { font-size: .8rem; line-height: 1.65; color: #334155; }
.ua-prose p { margin: 0 0 .7rem; }
.ua-prose p:last-child { margin-bottom: 0; }
.ua-theme { padding: .7rem .85rem; border-radius: 10px; background: #f8fafc; border: 1px solid #e2e8f0; margin-bottom: .55rem; font-size: .79rem; line-height: 1.6; color: #334155; }
.ua-theme b { display: block; color: #0f172a; margin-bottom: .15rem; }
.ua-theme.ua-theme-rec { background: #f0f9ff; border-color: #bae6fd; }

.ua-loading { text-align: center; padding: 3rem; color: #64748b; font-family: 'Inter', sans-serif; font-size: .85rem; }
.ua-error { text-align: center; padding: 2rem; color: #dc2626; background: #fef2f2; border-radius: 8px; margin: 1rem; font-family: 'Inter', sans-serif; font-size: .85rem; }

@media (max-width: 640px) {
    .ua-qrow { grid-template-columns: 2.2rem minmax(0, 1fr) 3.6rem; gap: .5rem; }
    .ua-mark { grid-template-columns: 1rem 3.2rem 1fr; }
    .ua-mark-part { display: none; }
    .ua-action { grid-template-columns: 1fr; }
    .ua-action-part { justify-self: start; }
}
