/* ==========================================================================
   Study Hub — uses the tokens from styles.css
   ========================================================================== */
#hub-backdrop {
    position: fixed; inset: 0; z-index: 45;
    background: rgba(50, 36, 24, 0.22);
    backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
body.hub-open #hub-backdrop { opacity: 1; pointer-events: auto; }
body.hub-open #hub-tab { opacity: 0; pointer-events: none; }

#hub {
    position: fixed; top: 0; right: 0; z-index: 50;
    height: 100vh; height: 100dvh;
    width: min(440px, 100vw);
    display: flex; flex-direction: column;
    background: var(--bg);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    color: var(--text);
    text-align: left;
    font-size: 14px;
    transform: translateX(105%);
    transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
body.hub-open #hub { transform: translateX(0); }

#hub h2, #hub h3, #hub h4 { margin: 0; letter-spacing: -0.01em; }
#hub p { margin: 4px 0; }
#hub ul { list-style: none; margin: 0; padding: 0; }
#hub button { font-family: var(--font); }
#hub input[type="text"], #hub input[type="number"], #hub input[type="date"], #hub select, #hub textarea {
    font: inherit; font-size: 14px; color: var(--text);
    background: #fff; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); padding: 9px 12px;
    outline: none; min-width: 0;
    transition: border-color .15s ease, box-shadow .15s ease;
}
#hub input:focus, #hub select:focus, #hub textarea:focus { border-color: var(--primary-strong); box-shadow: 0 0 0 3px var(--primary-soft); }
#hub textarea { width: 100%; resize: vertical; margin: 10px 0 8px; }

.hub-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 8px 22px; }
.hub-brand { display: flex; align-items: center; gap: 10px; color: var(--primary-ink); }
.hub-brand h2 { font-size: 21px; font-weight: 800; color: var(--text); }
.hub-account { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 22px 12px; font-size: 12.5px; }
.hub-tabs { display: flex; margin: 0 22px 12px; }
.hub-tabs button { flex: 1; justify-content: center; }
.hub-body { flex: 1; overflow-y: auto; padding: 4px 22px 28px; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ---------- primitives ---------- */
#hub .card { display: block; width: 100%; padding: 16px 18px; margin: 0 0 12px; text-align: left; color: var(--text); font-size: 14px; }
#hub button.card { cursor: pointer; transition: border-color .15s ease, transform .1s ease, box-shadow .15s ease; }
#hub button.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
#hub .card.hero { background: linear-gradient(160deg, #fff 0%, var(--surface) 60%, var(--primary-soft) 160%); border-color: var(--border-strong); }
.card-title { display: flex; align-items: center; gap: 8px; color: var(--primary-ink); margin-bottom: 10px; }
.card-title h3 { font-size: 18px; font-weight: 800; color: var(--text); }
.card-title h4 { font-size: 15px; font-weight: 700; color: var(--text); }
.card-title .small { margin-left: 2px; }
.row-between .card-title { margin-bottom: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#hub .card > .row-between:first-child { margin-bottom: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.small-text { font-size: 13px; }
#hub .ok { color: var(--ok); }
#hub .warn { color: var(--warn); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; flex-shrink: 0; vertical-align: 1px; }
.sep { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--muted); margin: 0 8px; vertical-align: middle; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px; padding: 0;
    border: none; border-radius: 10px;
    background: var(--surface-2); color: var(--text-2);
    font-size: 18px; font-weight: 600;
}
.icon-btn:hover { background: var(--track); color: var(--text); }
.icon-btn.ghost { background: none; width: 28px; height: 28px; color: var(--muted); }
.icon-btn.ghost:hover { background: var(--warn-soft); color: var(--warn); }
#hub .del { opacity: 0; transition: opacity .15s ease; }
#hub li:hover .del, #hub .del:focus-visible { opacity: 1; }
@media (hover: none) { #hub .del { opacity: 1; } }

#hub .btn-primary, #hub .btn-soft {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: none; border-radius: var(--radius-sm);
    padding: 10px 16px; font-size: 14px; font-weight: 700;
    text-decoration: none;
    transition: background-color .15s ease, transform .1s ease;
}
#hub .btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 4px 14px color-mix(in srgb, var(--primary-strong) 30%, transparent); }
#hub .btn-primary:hover { background: var(--primary-hover); }
#hub .btn-soft { background: var(--primary-soft); color: var(--primary-ink); }
#hub .btn-soft:hover { background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 12%); }
#hub .btn-soft.icon-only { padding: 0; width: 40px; height: 40px; flex-shrink: 0; }
#hub .block { display: flex; width: 100%; margin: 6px 0; }
#hub .lg { padding: 14px 18px; font-size: 15.5px; border-radius: 14px; margin: 12px 0 8px; }
#hub .link {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: none; padding: 2px 0;
    color: var(--primary-ink); font-size: 13px; font-weight: 600; cursor: pointer;
}
#hub .link { white-space: nowrap; }
#hub .link:hover { text-decoration: underline; text-underline-offset: 3px; }
#hub .link.danger { color: var(--warn); }
#hub .link.center { display: flex; margin: 6px auto 0; }
#hub .back { margin: 0 0 10px; }

.pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: 999px;
    background: var(--surface-2); color: var(--text-2);
    font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
#hub .pill.ok { background: var(--ok-soft); color: var(--ok); }
#hub .pill.warn { background: var(--warn-soft); color: var(--warn); }

.hbar { height: 7px; background: var(--track); border-radius: 99px; overflow: hidden; margin: 7px 0; }
.hbar > div { height: 100%; border-radius: 99px; min-width: 0; transition: width .35s ease; }

.ring text { font: 700 13px var(--font); fill: var(--text); }

.eyebrow { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary-ink); }
.hero-title { font-size: 22px; font-weight: 800; margin: 6px 0 4px !important; overflow-wrap: anywhere; }
.hero-meta { display: flex; align-items: center; flex-wrap: wrap; color: var(--text-2); font-size: 13.5px; }
.big-num { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* fields */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.field.row { flex-direction: row; align-items: center; justify-content: space-between; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
#hub .stepper input { width: 72px; text-align: center; font-weight: 700; font-size: 16px; }
.inline-add { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
#hub .inline-add input { flex: 1; }
#hub .inline-add select { max-width: 42%; }
.inline-add.with-icon { position: relative; }
.inline-add.with-icon .field-icon { position: absolute; left: 11px; color: var(--muted); display: inline-flex; }
#hub .inline-add.with-icon input { padding-left: 32px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
#hub .chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 11px; border-radius: 999px;
    background: #fff; color: var(--text-2);
    border: 1px solid var(--border-strong);
    font-size: 12.5px; font-weight: 600; cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
#hub .chip:hover { border-color: var(--primary-strong); color: var(--primary-ink); }
#hub .chip.on { background: var(--primary-soft); border-color: transparent; color: var(--primary-ink); }
#hub .chip.add { background: var(--primary); color: var(--on-primary); border-color: transparent; margin-left: auto; }
#hub .chip.static { cursor: default; background: var(--surface-2); border-color: transparent; color: var(--text); }
#hub .chip input[type="date"] { border: none; padding: 0; background: transparent; font-size: 12.5px; width: 112px; box-shadow: none; }
#hub .chip-x { display: inline-grid; place-items: center; border: none; background: none; color: var(--muted); padding: 0; margin-left: 2px; cursor: pointer; }
#hub .chip-x:hover { color: var(--warn); }

/* check lists (tasks + unit items) */
.check-list li { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-radius: 10px; }
.check-list li:hover { background: var(--surface-2); }
.check-list li.done .cl-text { text-decoration: line-through; color: var(--muted); }
.cl-text { flex: 1; min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; }
#hub .cbox {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 20px; height: 20px; padding: 0;
    border: 2px solid var(--border-strong); border-radius: 7px;
    background: #fff; color: var(--on-primary); cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}
#hub .cbox:hover { border-color: var(--primary-strong); }
#hub .cbox.on { background: var(--primary); border-color: var(--primary-strong); }
.due { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
#hub .due.soon { color: #A35A00; }
#hub .due.late { color: var(--warn); }

/* list rows (courses on Today) */
#hub .list-row {
    display: flex; align-items: center; gap: 14px; width: 100%;
    background: none; border: none; border-radius: 12px;
    padding: 8px 8px; margin: 0 -8px; width: calc(100% + 16px);
    color: var(--text); text-align: left; cursor: pointer;
}
#hub .list-row:hover { background: var(--surface-2); }
.lr-main { flex: 1; min-width: 0; }
.lr-name { display: flex; align-items: center; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-side { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* course cards */
#hub .course-card { display: flex; align-items: center; gap: 14px; }
.cc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.cc-name { font-size: 15.5px; font-weight: 700; overflow-wrap: anywhere; }

/* course detail */
.course-head { display: flex; align-items: center; gap: 16px; }
.ch-main { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.ch-main h3 { font-size: 20px; font-weight: 800; overflow-wrap: anywhere; }
.exam-box {
    display: flex; align-items: center; gap: 12px;
    margin-top: 14px; padding: 12px 14px;
    background: var(--surface-2); border-radius: 14px;
}
.exam-box.unlocked { background: var(--ok-soft); }
.exam-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #fff; color: var(--muted); flex-shrink: 0; }
.exam-box.unlocked .exam-icon { color: var(--ok); }
.exam-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.exam-date { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
#hub .exam-date input { padding: 6px 8px; font-size: 12.5px; width: 128px; }
.advice { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text-2); margin-top: 12px !important; }
.advice .ic { margin-top: 1px; color: var(--primary-ink); }
#hub .advice.warn, #hub .advice.warn .ic { color: var(--warn); }

/* units accordion */
.units { display: flex; flex-direction: column; gap: 6px; }
.unit { border: 1px solid var(--border); border-radius: 14px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
.unit.next { border-color: color-mix(in srgb, var(--primary-strong) 60%, transparent); box-shadow: 0 0 0 3px var(--primary-soft); }
.unit.complete { background: var(--surface); }
.unit-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; }
#hub .unit-check {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 26px; height: 26px; padding: 0; border-radius: 50%;
    border: 2px solid var(--border-strong); background: #fff;
    color: var(--primary-ink); font-size: 11px; font-weight: 800; cursor: pointer;
}
#hub .unit-check:hover { border-color: var(--primary-strong); }
.unit.complete .unit-check { background: var(--ok); border-color: var(--ok); color: #fff !important; }
#hub .unit-head {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
    background: none; border: none; padding: 2px 0; text-align: left; cursor: pointer; color: var(--text);
}
.unit-title { flex: 1; min-width: 0; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.unit.complete .unit-title { color: var(--muted); }
.unit-sub { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.has-link { display: inline-flex; color: var(--primary-ink); }
.tag { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--primary-ink); background: var(--primary-soft); padding: 2px 7px; border-radius: 6px; }
.chev { color: var(--muted); transition: transform .2s ease; }
.unit.open .chev { transform: rotate(180deg); }
.unit-body { padding: 0 12px 12px 12px; border-top: 1px dashed var(--border); }
.unit-body .check-list { margin-top: 8px !important; }
.unit-actions { margin-top: 10px; }
.units-foot { margin-top: 12px; }
.links-box { margin-top: 6px; }

/* files */
.drop {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 18px 12px; border: 1.5px dashed var(--border-strong); border-radius: 14px;
    background: #fff; color: var(--primary-ink); cursor: pointer; text-align: center;
    transition: background-color .15s ease, border-color .15s ease;
}
.drop b { color: var(--text); font-size: 13.5px; }
.drop:hover, .drop.over { background: var(--primary-soft); border-color: var(--primary-strong); }
.file-list { margin-top: 8px !important; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-radius: 10px; }
.file-list li:hover { background: var(--surface-2); }
.f-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-ink); flex-shrink: 0; }
#hub .f-name { flex: 1; min-width: 0; text-align: left; background: none; border: none; padding: 0; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
#hub .f-name:hover { color: var(--primary-ink); text-decoration: underline; }

/* insights */
#hub .summary p { font-size: 15px; line-height: 1.5; margin-top: 8px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px; box-shadow: var(--shadow); }
.t-label { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.t-value { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.t-value small { font-size: 12px; font-weight: 600; color: var(--muted); }
.t-sub { display: flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.prog-row { padding: 8px 0; }
.prog-row + .prog-row { border-top: 1px solid var(--border); }
.prog-row .row-between.muted span:first-child { min-width: 0; }

.sbars { display: flex; flex-direction: column; gap: 12px; }
.sbar-track { position: relative; height: 10px; background: var(--track); border-radius: 99px; margin-top: 6px; }
.sbar-fill { height: 100%; border-radius: 99px; min-width: 3px; }
.sbar-goal { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); border-radius: 1px; transform: translateX(-1px); }

.heatmap-wrap { display: flex; gap: 6px; }
.hm-days { display: grid; grid-template-rows: repeat(7, 1fr); font-size: 9.5px; color: var(--muted); gap: 3px; }
.heatmap { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; flex: 1; }
.hm-cell { display: block; aspect-ratio: 1; border-radius: 4px; background: #ECE3D2; }
.hm-cell.l1 { background: #E3ECC0; }
.hm-cell.l2 { background: #C3D67E; }
.hm-cell.l3 { background: #8FAA3B; }
.hm-cell.l4 { background: #4F6A17; }
.hm-cell.future { background: transparent; }
.hm-legend { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin-top: 10px; }
.hm-legend .hm-cell { width: 11px; }
.hm-legend .small:first-child { margin-right: 4px; }
.hm-legend .small:last-child { margin-left: 4px; }

.hours { display: flex; align-items: flex-end; gap: 2px; height: 72px; margin-top: 10px; }
.hours i { flex: 1; background: #DCE7B4; border-radius: 3px 3px 0 0; min-height: 2px; }
.hours i.best { background: #7E9A2F; }
.hours-axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 4px; }

#hub-tip {
    position: fixed; z-index: 80; display: none; pointer-events: none;
    background: var(--text); color: #fff; font: 600 12px var(--font);
    padding: 5px 9px; border-radius: 8px; white-space: nowrap; box-shadow: var(--shadow);
}

/* ---------- course chip on the timer card ---------- */
#subject-chip {
    position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
    display: inline-flex; align-items: center; gap: 6px;
    max-width: 300px; padding: 6px 12px;
    background: var(--surface); color: var(--text-2);
    border: 1px solid var(--border-strong); border-radius: 999px;
    box-shadow: var(--shadow);
    font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
#subject-chip span { overflow: hidden; text-overflow: ellipsis; }
#subject-chip:hover { color: var(--primary-ink); border-color: var(--primary-strong); }
#subject-chip .dot { margin-right: 0; }

#subject-menu {
    position: fixed; z-index: 70; width: 240px; max-height: 50vh; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    padding: 6px; box-shadow: var(--shadow-lg); text-align: left;
}
#subject-menu button {
    display: flex; align-items: center; gap: 8px; width: 100%;
    background: none; border: none; color: var(--text);
    font-size: 14px; font-weight: 500; padding: 9px 10px; border-radius: 9px; text-align: left; cursor: pointer;
}
#subject-menu button .dot { margin-right: 0; }
#subject-menu button:hover { background: var(--surface-2); }
#subject-menu .menu-add { color: var(--primary-ink); font-weight: 700; }

/* ---------- toasts ---------- */
#pomo-toasts {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
    z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center;
    width: max-content; max-width: calc(100vw - 32px);
}
.pomo-toast {
    background: var(--text); color: #fff; border-radius: 14px; padding: 11px 16px;
    font: 500 14px var(--font); box-shadow: var(--shadow-lg); text-align: left;
    animation: pomo-in .22s cubic-bezier(.2, .8, .2, 1);
}
.pomo-toast-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.pomo-toast-actions button { border: none; font: 700 13px var(--font); padding: 7px 14px; border-radius: 10px; background: var(--primary); color: var(--on-primary); cursor: pointer; }
.pomo-toast-actions button.secondary { background: rgba(255, 255, 255, .12); color: #fff; }
@keyframes pomo-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
    #hub { border-left: none; }
    .hub-body { padding: 4px 16px 28px; }
    .hub-tabs { margin: 0 16px 12px; }
    .hub-head { padding: 16px 14px 8px 16px; }
    .hub-account { padding: 0 16px 12px; }
    .exam-box { flex-wrap: wrap; }
    .exam-text { flex: 1 1 calc(100% - 60px); }
    .exam-date { flex: 1 1 100%; }
    #hub .exam-date input { flex: 1; width: auto; }
}

/* course color picker */
.swatch-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.field > span small { font-weight: 500; }
.sw-custom { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text-2); cursor: pointer; background: #fff; }
#hub .sw-custom input[type="color"] { width: 26px; height: 22px; padding: 0; border: none; background: none; box-shadow: none; cursor: pointer; }

/* ==========================================================================
   Course folders
   ========================================================================== */
.folders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; padding: 4px 2px 8px; }
#hub .folder {
    position: relative; display: block; width: 100%; aspect-ratio: 666 / 523;
    padding: 0; border: none; background: none; cursor: pointer; text-align: left;
    color: var(--ink, #3E2727);
    filter: drop-shadow(0 6px 10px rgba(62, 39, 39, .12));
    transition: transform .18s cubic-bezier(.2, .8, .2, 1), filter .18s ease;
}
#hub .folder:hover { transform: translateY(-3px) rotate(-.6deg); filter: drop-shadow(0 12px 18px rgba(62, 39, 39, .18)); }
#hub .folder:active { transform: translateY(0) scale(.98); }
#hub .folder:focus-visible { outline: 3px solid var(--primary-strong); outline-offset: 4px; border-radius: 14px; }
.folder-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.folder-label {
    position: absolute; left: 9%; right: 8%; bottom: 11%;
    display: flex; flex-direction: column; gap: 3px;
}
.folder-name {
    font-size: 15px; font-weight: 800; line-height: 1.15; letter-spacing: -0.01em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.folder-meta { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-bar { display: block; height: 5px; margin-top: 3px; border-radius: 99px; background: rgba(255, 255, 255, .55); overflow: hidden; }
.folder-bar i { display: block; height: 100%; border-radius: 99px; background: var(--bar); }
.folder-peek {
    position: absolute; top: 22%; right: 9%;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 10.5px; font-weight: 700; color: #6A5352;
}
.folder-peek .ic { margin-right: -3px; }
.folder-flag {
    position: absolute; top: 2%; right: 4%;
    display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
    background: var(--warn-soft); color: var(--warn); box-shadow: 0 0 0 2px #fff;
}
#hub .folder.new { color: var(--border-strong); filter: none; }
#hub .folder.new:hover { color: var(--primary-strong); transform: translateY(-2px); }
.folder-new-label {
    position: absolute; inset: 22% 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    font-size: 13px; font-weight: 700; color: var(--text-2);
}

/* folder header inside a course */
.folder-head { position: relative; margin: 2px 0 12px; padding-top: 14px; color: var(--ink); }
.fh-tab { position: absolute; top: 0; left: 0; width: 38%; height: 30px; background: var(--fb); border-radius: 18px 0 0 0; }
.fh-tab::after { content: ""; position: absolute; left: 100%; bottom: 0; width: 30px; height: 100%; background: var(--fb); border-radius: 0 12px 0 0; transform: skewX(32deg); transform-origin: bottom left; }
.fh-body {
    position: relative; display: flex; align-items: center; gap: 14px;
    padding: 16px 16px 16px 16px; border-radius: 22px;
    background: linear-gradient(180deg, var(--f1), var(--f2));
    box-shadow: 0 8px 20px rgba(62, 39, 39, .1);
}
.fh-icon { position: relative; width: 52px; aspect-ratio: 666 / 523; flex-shrink: 0; filter: drop-shadow(0 2px 3px rgba(62, 39, 39, .15)); }
.fh-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fh-kicker { font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.fh-text h3 { font-size: 21px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; color: inherit; }
.fh-sub { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; opacity: .9; }
.fh-ring { flex-shrink: 0; background: rgba(255, 255, 255, .6); border-radius: 50%; padding: 3px; }
.fh-ring .ring text { fill: #3E2727; }

.course-tabs { display: flex; margin-bottom: 12px; }
.course-tabs button { flex: 1; justify-content: center; }
.course-tabs button[data-ctab="settings"] { flex: 0 0 auto; padding: 8px 12px; }
.course-tabs .count { min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-ink); font-size: 11px; line-height: 18px; text-align: center; }
.exam-box.first { margin-top: 0; }

.notes-card textarea { min-height: 280px; line-height: 1.55; font-size: 14.5px !important; }

/* ==========================================================================
   "Review later" marks
   ========================================================================== */
:root { --review: #C26A1B; --review-soft: #FDF0DF; }
.tag.review { display: inline-flex; align-items: center; gap: 3px; color: var(--review); background: var(--review-soft); }
#hub .flag-btn {
    display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; padding: 0;
    border: none; border-radius: 9px; background: none; color: #C9BBAA; cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}
#hub .flag-btn:hover { color: var(--review); background: var(--review-soft); }
#hub .flag-btn.on { color: var(--review); }
#hub .flag-btn.on svg { fill: #F5C58E; }
.unit.flagged { border-color: #F1C9A0; }
.unit.flagged.next { box-shadow: 0 0 0 3px var(--review-soft); }
#hub .review-ask {
    display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 10px; padding: 8px 10px;
    border: 1px dashed #E8C9A8; border-radius: 10px; background: #FFFAF3;
    color: var(--text-2); font: 600 12.5px var(--font); text-align: left; cursor: pointer;
}
#hub .review-ask:hover { border-color: var(--review); color: var(--review); background: var(--review-soft); }
.review-box { margin-top: 10px; padding: 10px; border-radius: 12px; background: var(--review-soft); }
.rb-head { display: flex; align-items: center; gap: 6px; color: var(--review); font-size: 13px; margin-bottom: 8px; }
.rb-head b { flex: 1; }
#hub .rb-head .link { color: var(--ok); }
#hub .review-box input { width: 100%; background: #fff; }
#hub .review-card { border-color: #F1C9A0; background: linear-gradient(180deg, #FFFCF6, var(--surface)); }
#hub .review-card .card-title { color: var(--review); }
.review-list li { display: flex; align-items: center; gap: 8px; padding: 8px 2px; border-bottom: 1px dashed #EEDCC6; }
.review-list li:last-child { border-bottom: none; }
.rv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rv-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px; font-weight: 700; }
.rv-title small { font-weight: 500; color: var(--muted); font-size: 12px; }
.rv-note { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); }
#hub .btn-soft.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 9px; }
#hub .ok-btn:hover { background: var(--ok-soft); color: var(--ok); }
.pk-review { display: inline-flex; align-items: center; gap: 2px; color: var(--review); font-weight: 800; }

/* toast buttons keep the matcha look in every mode (dark toast background) */
.pomo-toast-actions button:not(.secondary) { background: #BDD373; color: #3E2727; }

/* ==========================================================================
   Units: one tick + note
   ========================================================================== */
.units-hint { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: -4px 0 10px !important; }
#hub .unit-check { width: 28px; height: 28px; }
#hub .unit-check:hover { background: var(--primary-soft); }
.unit-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.unit-main .unit-title { flex: none; }
.unit-note-preview {
    display: flex; align-items: center; gap: 4px; min-width: 0;
    font-size: 12px; font-weight: 500; color: var(--text-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.unit-note-preview .ic { flex-shrink: 0; color: var(--muted); }
.unit-note { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.unit-note > span { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--text-2); }
#hub .unit-note textarea { margin: 0; min-height: 76px; line-height: 1.5; }
.unit.complete .unit-note-preview { opacity: .8; }
#hub .unit.complete .unit-check { background: var(--ok); border-color: var(--ok); color: #fff; }
#hub .unit.complete .unit-check:hover { background: #3f6418; }
