/* =====================================================================
   Jonas Academy — design system
   Tokens are RGB triplets so Tailwind can apply opacity (bg-brand/10).
   Component classes are prefixed with `html` so they win over the
   Tailwind CDN preflight/forms styles, which are injected after this file.
   ===================================================================== */

:root {
    --brand: 79 70 229;          /* indigo 600 */
    --brand-strong: 67 56 202;   /* indigo 700 */
    --brand-soft: 238 240 255;   /* tinted fill */
    --canvas: 248 247 244;       /* warm paper */
    --surface: 255 255 255;
    --surface-2: 243 242 238;
    --surface-3: 234 232 227;
    --line: 231 229 223;
    --line-strong: 214 211 204;
    --ink: 24 23 21;
    --ink-2: 87 83 78;
    --ink-3: 112 108 101;

    --success: 4 120 87;
    --warning: 180 83 9;
    --danger: 225 29 72;

    --shadow-card: 0 1px 2px rgb(28 25 23 / 0.04), 0 1px 3px rgb(28 25 23 / 0.04);
    --shadow-lift: 0 1px 2px rgb(28 25 23 / 0.04), 0 12px 32px -12px rgb(28 25 23 / 0.16);
    --shadow-pop: 0 2px 6px rgb(28 25 23 / 0.06), 0 28px 64px -20px rgb(28 25 23 / 0.28);
    --shadow-glow: 0 1px 2px rgb(67 56 202 / 0.25), 0 8px 24px -8px rgb(79 70 229 / 0.45);

    --sidebar-w: 256px;
    --topbar-h: 60px;
    --radius-card: 18px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

html.dark {
    --brand: 124 120 255;
    --brand-strong: 99 102 241;
    --brand-soft: 33 31 66;
    --canvas: 11 11 13;
    --surface: 20 20 23;
    --surface-2: 27 27 31;
    --surface-3: 36 36 41;
    --line: 39 39 44;
    --line-strong: 56 56 63;
    --ink: 237 237 240;
    --ink-2: 166 166 175;
    --ink-3: 135 135 144;

    --success: 52 211 153;
    --warning: 251 191 36;
    --danger: 251 113 133;

    --shadow-card: 0 0 0 1px rgb(255 255 255 / 0.02), 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-lift: 0 0 0 1px rgb(255 255 255 / 0.04), 0 16px 40px -12px rgb(0 0 0 / 0.7);
    --shadow-pop: 0 0 0 1px rgb(255 255 255 / 0.05), 0 28px 64px -16px rgb(0 0 0 / 0.8);
    --shadow-glow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 28px -8px rgb(99 102 241 / 0.55);
}

/* ---------- Base ---------- */
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "ss01", "cv11";
}
html body {
    background-color: rgb(var(--canvas));
    color: rgb(var(--ink));
    font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.006em;
}
html ::selection { background: rgb(var(--brand) / 0.18); }
html :focus-visible { outline: 2px solid rgb(var(--brand) / 0.55); outline-offset: 2px; border-radius: 6px; }

/* Soft ambient glow behind app pages */
html body.ja-app::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(900px 480px at 85% -10%, rgb(var(--brand) / 0.07), transparent 70%),
        radial-gradient(700px 420px at 10% -20%, rgb(236 72 153 / 0.035), transparent 70%);
}

/* Icons: Material Symbols Rounded, refined weight. Pages may keep the
   legacy `material-symbols-outlined` class — it is remapped here. */
html .material-symbols-outlined,
html .material-symbols-rounded,
html .icon {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    user-select: none;
}
html .icon-fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24 !important; }

/* Scrollbars */
html .ja-scroll { scrollbar-width: thin; scrollbar-color: rgb(var(--line-strong)) transparent; }
html .ja-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
html .ja-scroll::-webkit-scrollbar-track { background: transparent; }
html .ja-scroll::-webkit-scrollbar-thumb { background: rgb(var(--line-strong)); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
html .ja-scroll::-webkit-scrollbar-thumb:hover { background-color: rgb(var(--ink-3)); }

/* ---------- Typography ---------- */
html .ja-eyebrow {
    font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
    color: rgb(var(--ink-3));
}
html .ja-title {
    font-family: 'Instrument Serif', ui-serif, Georgia, serif;
    font-weight: 400;
    font-size: clamp(2.15rem, 1.6rem + 2vw, 3.1rem);
    line-height: 1.04;
    letter-spacing: -0.015em;
    color: rgb(var(--ink));
}
html .ja-title em, html .ja-serif-italic { font-style: italic; color: rgb(var(--brand)); }
html .ja-subtitle { font-size: 15px; line-height: 1.6; color: rgb(var(--ink-2)); max-width: 62ch; }
html .ja-section-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: rgb(var(--ink)); }
html .ja-serif { font-family: 'Instrument Serif', ui-serif, Georgia, serif; font-weight: 400; letter-spacing: -0.01em; }
html .ja-muted { color: rgb(var(--ink-3)); }
html .ja-mono { font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- Surfaces ---------- */
html .card {
    background: rgb(var(--surface));
    border: 1px solid rgb(var(--line));
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}
html .card-hover { transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out), border-color .2s ease; }
html .card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: rgb(var(--line-strong)); }
html .panel { background: rgb(var(--surface-2)); border: 1px solid rgb(var(--line)); border-radius: 14px; }
html .divider { height: 1px; background: rgb(var(--line)); border: 0; }

/* ---------- Buttons ---------- */
html .btn {
    align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 16px; border-radius: 11px;
    font-size: 14px; font-weight: 500; letter-spacing: -0.005em; line-height: 1;
    white-space: nowrap; cursor: pointer; user-select: none;
    border: 1px solid transparent;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .2s ease, transform .1s ease;
    -webkit-tap-highlight-color: transparent;
}
html .btn:active:not(:disabled) { transform: translateY(0.5px) scale(0.99); }
html .btn:disabled, html .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
html .btn .material-symbols-outlined, html .btn .icon { font-size: 18px; }
html .btn-sm { height: 32px; padding: 0 12px; border-radius: 9px; font-size: 13px; gap: 6px; }
html .btn-sm .material-symbols-outlined, html .btn-sm .icon { font-size: 16px; }
html .btn-lg { height: 48px; padding: 0 22px; border-radius: 13px; font-size: 15px; }
html .btn-block { width: 100%; }
html .btn-icon { width: 40px; padding: 0; }
html .btn-icon.btn-sm { width: 32px; }

html .btn-primary {
    color: #fff;
    background: linear-gradient(180deg, rgb(var(--brand)) 0%, rgb(var(--brand-strong)) 100%);
    border-color: rgb(var(--brand-strong));
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 1px 2px rgb(var(--brand-strong) / 0.3), 0 4px 12px -4px rgb(var(--brand) / 0.5);
}
html .btn-primary:hover:not(:disabled) { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 1px 2px rgb(var(--brand-strong) / 0.3), 0 8px 20px -6px rgb(var(--brand) / 0.6); filter: brightness(1.05); }
html.dark .btn-primary { background: linear-gradient(180deg, rgb(99 92 240) 0%, rgb(79 70 229) 100%); border-color: rgb(110 108 250 / 0.55); }

html .btn-secondary {
    color: rgb(var(--ink));
    background: rgb(var(--surface));
    border-color: rgb(var(--line-strong));
    box-shadow: 0 1px 2px rgb(28 25 23 / 0.05);
}
html .btn-secondary:hover:not(:disabled) { background: rgb(var(--surface-2)); }
html.dark .btn-secondary { background: rgb(var(--surface-2)); border-color: rgb(var(--line-strong)); }
html.dark .btn-secondary:hover:not(:disabled) { background: rgb(var(--surface-3)); }

html .btn-ghost { color: rgb(var(--ink-2)); background: transparent; }
html .btn-ghost:hover:not(:disabled) { color: rgb(var(--ink)); background: rgb(var(--ink) / 0.05); }
html.dark .btn-ghost:hover:not(:disabled) { background: rgb(255 255 255 / 0.06); }

html .btn-soft { color: rgb(var(--brand)); background: rgb(var(--brand) / 0.09); }
html .btn-soft:hover:not(:disabled) { background: rgb(var(--brand) / 0.14); }

html .btn-danger { color: #fff; background: rgb(var(--danger)); border-color: rgb(var(--danger)); }
html .btn-danger:hover:not(:disabled) { filter: brightness(1.06); }
html.dark .btn-danger { background: rgb(190 18 60); border-color: rgb(190 18 60); }
html .btn-danger-ghost { color: rgb(var(--danger)); background: transparent; }
html .btn-danger-ghost:hover:not(:disabled) { background: rgb(var(--danger) / 0.08); }

/* ---------- Form controls ---------- */
html .label { font-size: 13px; font-weight: 500; color: rgb(var(--ink)); margin-bottom: 6px; }
html .hint { font-size: 12.5px; color: rgb(var(--ink-3)); margin-top: 6px; }

html .input, html .select, html .textarea {
    width: 100%;
    font-size: 14px; line-height: 1.4; color: rgb(var(--ink));
    background-color: rgb(var(--surface));
    border: 1px solid rgb(var(--line-strong));
    border-radius: 11px;
    padding: 0 14px; height: 42px;
    box-shadow: 0 1px 2px rgb(28 25 23 / 0.04);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
    outline: none;
}
html .textarea { height: auto; padding: 11px 14px; resize: vertical; min-height: 96px; }
html .input::placeholder, html .textarea::placeholder { color: rgb(var(--ink-3)); opacity: 1; }
html .input:hover, html .select:hover, html .textarea:hover { border-color: rgb(var(--ink-3) / 0.6); }
html .input:focus, html .select:focus, html .textarea:focus {
    border-color: rgb(var(--brand));
    box-shadow: 0 0 0 4px rgb(var(--brand) / 0.12);
    outline: none;
}
html.dark .input, html.dark .select, html.dark .textarea { background-color: rgb(var(--surface-2)); }
html .input[readonly] { background-color: rgb(var(--surface-2)); color: rgb(var(--ink-2)); }
html .input-lg { height: 48px; font-size: 15px; border-radius: 13px; }
html .input-with-icon { position: relative; }
html .input-with-icon > .material-symbols-outlined, html .input-with-icon > .icon {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 19px; color: rgb(var(--ink-3)); pointer-events: none;
}
html .input-with-icon > .input { padding-left: 40px; }

html .select {
    appearance: none; -webkit-appearance: none;
    padding-right: 36px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23878279' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
html .checkbox {
    width: 16px; height: 16px; border-radius: 5px; border: 1px solid rgb(var(--line-strong));
    color: rgb(var(--brand)); background-color: rgb(var(--surface)); cursor: pointer;
}
html .checkbox:focus { box-shadow: 0 0 0 3px rgb(var(--brand) / 0.15); border-color: rgb(var(--brand)); }

/* ---------- Chips / segmented ---------- */
html .chip {
    align-items: center; gap: 6px;
    height: 32px; padding: 0 12px; border-radius: 999px;
    font-size: 13px; font-weight: 500; color: rgb(var(--ink-2));
    background: rgb(var(--surface)); border: 1px solid rgb(var(--line));
    cursor: pointer; white-space: nowrap;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
html .chip:hover { color: rgb(var(--ink)); border-color: rgb(var(--line-strong)); }
html .chip[aria-pressed="true"], html .chip.is-active {
    color: rgb(var(--brand-strong)); background: rgb(var(--brand) / 0.09); border-color: rgb(var(--brand) / 0.35);
}
html.dark .chip[aria-pressed="true"], html.dark .chip.is-active {
    color: rgb(var(--brand)); background: rgb(var(--brand) / 0.14); border-color: rgb(var(--brand) / 0.4);
}
html .chip .count { font-size: 11.5px; color: rgb(var(--ink-3)); font-variant-numeric: tabular-nums; }
html .chip[aria-pressed="true"] .count, html .chip.is-active .count { color: inherit; opacity: .75; }

html .segmented { padding: 3px; gap: 2px; border-radius: 12px; background: rgb(var(--surface-2)); border: 1px solid rgb(var(--line)); }
html .segmented > button, html .segmented > a {
    height: 30px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 500; color: rgb(var(--ink-2));
    align-items: center; gap: 6px; transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
html .segmented > button:hover, html .segmented > a:hover { color: rgb(var(--ink)); }
html .segmented > [aria-pressed="true"], html .segmented > [aria-selected="true"], html .segmented > .is-active {
    background: rgb(var(--surface)); color: rgb(var(--ink)); box-shadow: 0 1px 2px rgb(28 25 23 / 0.08), 0 0 0 1px rgb(var(--line));
}
html.dark .segmented > [aria-pressed="true"], html.dark .segmented > [aria-selected="true"], html.dark .segmented > .is-active { background: rgb(var(--surface-3)); }

/* ---------- Badges ---------- */
html .badge {
    align-items: center; gap: 4px;
    height: 22px; padding: 0 8px; border-radius: 999px;
    font-size: 11.5px; font-weight: 500; letter-spacing: 0.005em; white-space: nowrap;
    color: rgb(var(--ink-2)); background: rgb(var(--surface-2)); border: 1px solid rgb(var(--line));
}
html .badge .material-symbols-outlined, html .badge .icon { font-size: 14px; }
html .badge-brand { color: rgb(var(--brand)); background: rgb(var(--brand) / 0.08); border-color: rgb(var(--brand) / 0.18); }
html .badge-success { color: rgb(var(--success)); background: rgb(var(--success) / 0.08); border-color: rgb(var(--success) / 0.2); }
html .badge-warning { color: rgb(var(--warning)); background: rgb(var(--warning) / 0.09); border-color: rgb(var(--warning) / 0.22); }
html .badge-danger { color: rgb(var(--danger)); background: rgb(var(--danger) / 0.08); border-color: rgb(var(--danger) / 0.2); }
html .badge-new { color: #fff; background: rgb(var(--brand)); border-color: transparent; }

html .kbd {
    align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
    font: 500 11px/1 'Geist Mono', ui-monospace, monospace; color: rgb(var(--ink-2));
    background: rgb(var(--surface)); border: 1px solid rgb(var(--line-strong)); border-bottom-width: 2px; border-radius: 6px;
}

/* ---------- Callouts (inline, non-blocking notes — replaces popups) ---------- */
html .callout {
    gap: 10px; align-items: flex-start;
    padding: 11px 14px; border-radius: 12px;
    font-size: 13px; line-height: 1.55; color: rgb(var(--ink-2));
    background: rgb(var(--surface-2)); border: 1px solid rgb(var(--line));
}
html .callout > .material-symbols-outlined, html .callout > .icon { font-size: 18px; margin-top: 1px; color: rgb(var(--ink-3)); flex-shrink: 0; }
html .callout strong { color: rgb(var(--ink)); font-weight: 600; }
html .callout a { color: rgb(var(--brand)); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgb(var(--brand) / 0.35); }
html .callout-info > .material-symbols-outlined, html .callout-info > .icon { color: rgb(var(--brand)); }
html .callout-info { background: rgb(var(--brand) / 0.05); border-color: rgb(var(--brand) / 0.14); }
html .callout-warn > .material-symbols-outlined, html .callout-warn > .icon { color: rgb(var(--warning)); }
html .callout-warn { background: rgb(var(--warning) / 0.06); border-color: rgb(var(--warning) / 0.18); }
html .callout-danger > .material-symbols-outlined, html .callout-danger > .icon { color: rgb(var(--danger)); }
html .callout-danger { background: rgb(var(--danger) / 0.05); border-color: rgb(var(--danger) / 0.16); }
html .callout-success > .material-symbols-outlined, html .callout-success > .icon { color: rgb(var(--success)); }
html .callout-success { background: rgb(var(--success) / 0.06); border-color: rgb(var(--success) / 0.18); }

/* ---------- Stats ---------- */
html .stat { padding: 18px 18px 16px; }
html .stat-label { font-size: 12.5px; font-weight: 500; color: rgb(var(--ink-3)); display: flex; align-items: center; gap: 6px; }
html .stat-label .material-symbols-outlined, html .stat-label .icon { font-size: 16px; }
html .stat-value { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; color: rgb(var(--ink)); font-variant-numeric: tabular-nums; margin-top: 10px; line-height: 1; }

/* ---------- Icon tile ---------- */
html .icon-tile {
    width: 36px; height: 36px; border-radius: 10px; align-items: center; justify-content: center; flex-shrink: 0;
    background: rgb(var(--surface-2)); border: 1px solid rgb(var(--line)); color: rgb(var(--ink-2));
}
html .icon-tile .material-symbols-outlined, html .icon-tile .icon { font-size: 19px; }
html .icon-tile-brand { background: rgb(var(--brand) / 0.08); border-color: rgb(var(--brand) / 0.16); color: rgb(var(--brand)); }

/* ---------- Skeleton ---------- */
html .skeleton {
    background: linear-gradient(90deg, rgb(var(--surface-2)) 25%, rgb(var(--surface-3)) 37%, rgb(var(--surface-2)) 63%);
    background-size: 400% 100%;
    animation: ja-shimmer 1.4s ease infinite;
    border-radius: 8px;
}
@keyframes ja-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Empty state ---------- */
html .empty-state { text-align: center; padding: 56px 24px; }
html .empty-state .icon-tile { width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 16px; }
html .empty-state .icon-tile .material-symbols-outlined, html .empty-state .icon-tile .icon { font-size: 24px; }
html .empty-state h3 { font-size: 16px; font-weight: 600; color: rgb(var(--ink)); }
html .empty-state p { font-size: 14px; color: rgb(var(--ink-3)); margin-top: 4px; }

/* ---------- Dialog (user-initiated only) ---------- */
html .dialog-backdrop {
    position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px;
    background: rgb(12 10 9 / 0.38); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    animation: ja-fade .18s ease both;
}
html .dialog-backdrop.hidden { display: none; }
html .dialog {
    width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow: auto;
    background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: 20px; box-shadow: var(--shadow-pop);
    animation: ja-pop .22s var(--ease-out) both;
}
@keyframes ja-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ja-pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---------- What's new (one-time announcement of new notes; scripts/whats-new.js) ---------- */
html .wn-backdrop {
    position: fixed; inset: 0; z-index: 85; display: flex; align-items: center; justify-content: center; padding: 16px;
    background: rgb(12 10 9 / 0.32); backdrop-filter: blur(6px) saturate(1.1); -webkit-backdrop-filter: blur(6px) saturate(1.1);
    animation: ja-fade .28s ease both;
}
html.dark .wn-backdrop { background: rgb(0 0 0 / 0.55); }
html .wn-dialog {
    position: relative; width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow: auto;
    background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: 24px;
    box-shadow: var(--shadow-pop), 0 0 0 1px rgb(255 255 255 / 0.04) inset;
    animation: wn-rise .45s var(--ease-out) .04s both;
}
html .wn-dialog:focus { outline: none; }
html .wn-hero { position: relative; padding: 8px 8px 0; }
html .wn-cover { height: 148px; border-radius: 17px; }
html .wn-cover .ja-cover-icon { font-size: 128px !important; right: 18px; bottom: -14px; }
html .wn-cover .ja-cover-code { left: 14px; top: 14px; }
html .wn-close {
    position: absolute; top: 18px; right: 18px; width: 32px; height: 32px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center; color: #fff; cursor: pointer;
    background: rgb(255 255 255 / 0.16); border: 1px solid rgb(255 255 255 / 0.24);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    transition: background-color .15s ease;
}
html .wn-close:hover { background: rgb(255 255 255 / 0.28); }
html .wn-close .material-symbols-outlined { font-size: 18px; }
html .wn-body { padding: 18px 24px 22px; }
html .wn-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
html .wn-meta-text { font-size: 12.5px; color: rgb(var(--ink-3)); }
html .wn-title {
    margin-top: 12px;
    font-family: 'Instrument Serif', ui-serif, Georgia, serif; font-weight: 400;
    font-size: 30px; line-height: 1.08; letter-spacing: -0.015em; color: rgb(var(--ink));
}
html .wn-title em { font-style: italic; color: rgb(var(--brand)); }
html .wn-desc { margin-top: 10px; font-size: 14.5px; line-height: 1.6; color: rgb(var(--ink-2)); }
html .wn-points {
    margin-top: 16px; padding: 4px 14px; list-style: none;
    background: rgb(var(--surface-2)); border: 1px solid rgb(var(--line)); border-radius: 14px;
}
html .wn-points li { display: flex; align-items: flex-start; gap: 11px; padding: 10px 0; font-size: 13.5px; line-height: 1.45; color: rgb(var(--ink-2)); }
html .wn-points li + li { border-top: 1px solid rgb(var(--line)); }
html .wn-point-icon {
    width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    color: rgb(var(--brand)); background: rgb(var(--brand) / 0.09); margin-top: -2px;
}
html .wn-point-icon .material-symbols-outlined { font-size: 16px; }
html .wn-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 20px; }
html .wn-backdrop.is-leaving { animation: ja-fade .2s ease reverse both; }
html .wn-backdrop.is-leaving .wn-dialog { animation: wn-fall .2s ease both; }
@keyframes wn-rise { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes wn-fall { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(8px) scale(.98); } }

/* Phones: a bottom sheet that rises from the edge, with full-width buttons */
@media (max-width: 519.98px) {
    html .wn-backdrop { align-items: flex-end; padding: 0; }
    html .wn-dialog {
        max-width: none; max-height: calc(100dvh - 24px); border-radius: 24px 24px 0 0; border-bottom: 0;
        padding-bottom: env(safe-area-inset-bottom);
        animation-name: wn-sheet-up;
    }
    html .wn-backdrop.is-leaving .wn-dialog { animation: wn-sheet-down .22s ease both; }
    html .wn-cover { height: 128px; }
    html .wn-cover .ja-cover-icon { font-size: 108px !important; }
    html .wn-body { padding: 16px 20px 20px; }
    html .wn-title { font-size: 28px; }
    html .wn-actions { flex-direction: column-reverse; align-items: stretch; }
    html .wn-actions .btn { width: 100%; height: 46px; }
}
@keyframes wn-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes wn-sheet-down { from { transform: none; } to { transform: translateY(100%); } }

/* ---------- Toasts (non-blocking feedback; replaces alert()) ---------- */
html #ja-toasts {
    position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
    z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px);
}
html .toast {
    pointer-events: auto; display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 500;
    color: rgb(var(--surface)); background: rgb(var(--ink)); box-shadow: var(--shadow-pop);
    animation: ja-pop .22s var(--ease-out) both;
}
html.dark .toast { color: rgb(var(--ink)); background: rgb(var(--surface-3)); border: 1px solid rgb(var(--line-strong)); }
html .toast .material-symbols-outlined, html .toast .icon { font-size: 18px; }
html .toast-success .material-symbols-outlined, html .toast-success .icon { color: rgb(52 211 153); }
html .toast-error .material-symbols-outlined, html .toast-error .icon { color: rgb(251 113 133); }
html .toast.is-leaving { animation: ja-fade .18s ease reverse both; }

/* ---------- Module cover art ---------- */
html .ja-cover {
    position: relative; overflow: hidden; isolation: isolate;
    background:
        radial-gradient(110% 130% at 0% 0%, color-mix(in srgb, var(--c1) 85%, transparent) 0%, transparent 52%),
        radial-gradient(120% 120% at 100% 100%, var(--c3) 0%, transparent 60%),
        linear-gradient(135deg, var(--c2), var(--c3));
    color: #fff;
}
html .ja-cover::before {
    content: ""; position: absolute; inset: 0; z-index: -1; opacity: .22;
    background-image:
        linear-gradient(rgb(255 255 255 / 0.5) 1px, transparent 1px),
        linear-gradient(90deg, rgb(255 255 255 / 0.5) 1px, transparent 1px);
    background-size: 22px 22px;
    mask-image: radial-gradient(120% 90% at 100% 100%, #000 10%, transparent 75%);
    -webkit-mask-image: radial-gradient(120% 90% at 100% 100%, #000 10%, transparent 75%);
}
html .ja-cover::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(180deg, rgb(255 255 255 / 0.10), transparent 40%);
}
html .ja-cover-icon {
    position: absolute; right: 10px; bottom: -6px; font-size: 92px !important; line-height: 1;
    color: rgb(255 255 255 / 0.9); opacity: .85;
    font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 48 !important;
    text-shadow: 0 8px 30px rgb(0 0 0 / 0.15);
}
html .ja-cover-code {
    position: absolute; left: 14px; top: 14px;
    font: 500 11px/1 'Geist Mono', ui-monospace, monospace; letter-spacing: 0.06em;
    padding: 6px 8px; border-radius: 7px; color: #fff;
    background: rgb(255 255 255 / 0.16); border: 1px solid rgb(255 255 255 / 0.22);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
html .ja-cover-sm .ja-cover-icon { font-size: 44px !important; right: -4px; bottom: -8px; }
html .ja-cover-sm .ja-cover-code { display: none; }


/* ---------- Display (low specificity so Tailwind's hidden / sm:flex etc. win) ---------- */
:where(html) .material-symbols-outlined, :where(html) .material-symbols-rounded, :where(html) .icon { display: inline-block; }
:where(html) .btn { display: inline-flex; }
:where(html) .chip { display: inline-flex; }
:where(html) .segmented { display: inline-flex; }
:where(html) .badge { display: inline-flex; }
:where(html) .kbd { display: inline-flex; }
:where(html) .callout { display: flex; }
:where(html) .icon-tile { display: inline-flex; }
:where(html) .label { display: block; }
:where(html) .segmented > button, :where(html) .segmented > a { display: inline-flex; }

/* Touch-friendly targets */
@media (pointer: coarse), (max-width: 767.98px) {
    html .chip { height: 40px; padding: 0 14px; }
    html .segmented > button, html .segmented > a { height: 36px; }
    html .btn-sm { height: 36px; }
    html .btn-icon.btn-sm { width: 36px; }
}

/* Search inputs: hide the native (bright blue) clear button; pages provide their own */
html input[type="search"]::-webkit-search-cancel-button,
html input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

/* Horizontally scrollable rows without a visible scrollbar */
html .no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
html .no-scrollbar::-webkit-scrollbar { display: none; }
html [hidden] { display: none !important; }

/* =====================================================================
   App shell — sidebar (desktop ≥1024px) + top bar & drawer (mobile)
   ===================================================================== */
html .ja-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
    display: none; flex-direction: column;
    padding: 18px 14px 14px;
    background: rgb(var(--canvas) / 0.85);
    border-right: 1px solid rgb(var(--line));
    backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
@media (min-width: 1024px) {
    html .ja-sidebar { display: flex; }
    html .ja-main { padding-left: var(--sidebar-w); }
    html .ja-topbar { display: none !important; }
}
/* The shell wrapper must not box its children, or the sticky mobile top bar has no room to stick. */
html #ja-shell { display: contents; }
html .ja-main { position: relative; z-index: 1; min-height: 100dvh; }
html .ja-main-fill { height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
@media (max-width: 1023.98px) {
    html .ja-main-fill { height: calc(100dvh - var(--topbar-h)); }
}
html .ja-container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 20px 64px; }
@media (min-width: 768px) { html .ja-container { padding: 44px 40px 80px; } }

html .ja-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 6px; border-radius: 12px; color: rgb(var(--ink)); text-decoration: none; }
html .ja-brand-mark { width: 32px; height: 32px; flex-shrink: 0; filter: drop-shadow(0 2px 6px rgb(var(--brand) / 0.35)); }
html .ja-brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
html .ja-brand-sub { font-size: 11.5px; color: rgb(var(--ink-3)); margin-top: 2px; }

html .ja-nav { display: flex; flex-direction: column; gap: 2px; }
html .ja-nav-label { padding: 18px 10px 6px; font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(var(--ink-3)); }
html .ja-nav-item {
    display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: 10px;
    font-size: 14px; font-weight: 500; color: rgb(var(--ink-2)); text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}
html .ja-nav-item .material-symbols-outlined, html .ja-nav-item .icon { font-size: 20px; color: rgb(var(--ink-3)); transition: color .15s ease; }
html .ja-nav-item:hover { color: rgb(var(--ink)); background: rgb(var(--ink) / 0.045); }
html .ja-nav-item:hover .material-symbols-outlined, html .ja-nav-item:hover .icon { color: rgb(var(--ink-2)); }
html.dark .ja-nav-item:hover { background: rgb(255 255 255 / 0.05); }
html .ja-nav-item[aria-current="page"] {
    color: rgb(var(--ink)); background: rgb(var(--surface));
    box-shadow: 0 1px 2px rgb(28 25 23 / 0.06), 0 0 0 1px rgb(var(--line));
}
html.dark .ja-nav-item[aria-current="page"] { background: rgb(var(--surface-2)); }
html .ja-nav-item[aria-current="page"] .material-symbols-outlined, html .ja-nav-item[aria-current="page"] .icon {
    color: rgb(var(--brand)); font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
html .ja-nav-item .ja-nav-badge { margin-left: auto; }

html .ja-user {
    margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px;
    background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); box-shadow: var(--shadow-card);
}
html.dark .ja-user { background: rgb(var(--surface)); }
html .ja-avatar {
    width: 34px; height: 34px; border-radius: 999px; flex-shrink: 0; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; color: #fff; letter-spacing: 0.01em;
    background: linear-gradient(135deg, #818cf8, #6d28d9);
}
html .ja-avatar img { width: 100%; height: 100%; object-fit: cover; }
html .ja-user-name { font-size: 13.5px; font-weight: 600; color: rgb(var(--ink)); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html .ja-icon-btn {
    width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    color: rgb(var(--ink-3)); transition: background-color .15s ease, color .15s ease;
}
html .ja-icon-btn:hover { color: rgb(var(--ink)); background: rgb(var(--ink) / 0.06); }
html.dark .ja-icon-btn:hover { background: rgb(255 255 255 / 0.07); }
html .ja-icon-btn .material-symbols-outlined, html .ja-icon-btn .icon { font-size: 19px; }

/* Mobile top bar */
html .ja-topbar {
    position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
    display: flex; align-items: center; gap: 8px; padding: 0 10px 0 14px;
    background: rgb(var(--canvas) / 0.82);
    border-bottom: 1px solid rgb(var(--line));
    backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
html .ja-topbar .ja-brand-mark { width: 28px; height: 28px; }
html .ja-topbar-title { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; color: rgb(var(--ink)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mobile drawer (opened by the user) */
html .ja-drawer { position: fixed; inset: 0; z-index: 70; visibility: hidden; }
html .ja-drawer.is-open { visibility: visible; }
html .ja-drawer-backdrop { position: absolute; inset: 0; background: rgb(12 10 9 / 0.35); opacity: 0; transition: opacity .25s ease; }
html .ja-drawer.is-open .ja-drawer-backdrop { opacity: 1; }
html .ja-drawer-panel {
    position: absolute; inset: 0 auto 0 0; width: min(300px, 86vw);
    display: flex; flex-direction: column; padding: 16px 14px calc(14px + env(safe-area-inset-bottom));
    background: rgb(var(--canvas)); border-right: 1px solid rgb(var(--line)); box-shadow: var(--shadow-pop);
    transform: translateX(-102%); transition: transform .32s var(--ease-out);
    overflow-y: auto;
}
html .ja-drawer.is-open .ja-drawer-panel { transform: none; }

/* Page entrance */
html .ja-enter { animation: ja-enter .5s var(--ease-out) both; }
html .ja-enter-2 { animation: ja-enter .5s var(--ease-out) .06s both; }
html .ja-enter-3 { animation: ja-enter .5s var(--ease-out) .12s both; }
@keyframes ja-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    html *, html *::before, html *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
}

/* Touch targets for shell controls (after the base .ja-icon-btn rule so it wins) */
@media (pointer: coarse), (max-width: 767.98px) {
    html .ja-icon-btn { width: 40px; height: 40px; }
}
html .ja-topbar > a:first-child { padding: 6px; margin-left: -6px; border-radius: 10px; }

/* iOS zooms the page when focusing inputs under 16px; keep them at 16px there. */
@supports (-webkit-touch-callout: none) {
    html .input, html .select, html .textarea { font-size: 16px; }
}

/* Sidebar user card: compact controls so typical names aren't truncated */
html .ja-sidebar .ja-user { gap: 8px; padding: 10px 8px 10px 10px; }
html .ja-sidebar .ja-user .ja-icon-btn { width: 30px; height: 30px; }

/* Keep toasts clear of the drawer's user card (sign-out button) while the menu is open */
html.ja-drawer-open #ja-toasts { bottom: calc(110px + env(safe-area-inset-bottom)); }
html.dark .badge-new { background: rgb(79 70 229); }

/* Semantic accent for streak/flame icons (readable in both themes) */
html .text-streak { color: rgb(var(--warning)); }
