:root { color-scheme: light; } /* D-31: the whole app stays light whatever the phone setting */
:root {
  /* PROMED brand (assets/ProMed_Web_Logos): sky #00A6FB, navy #073B4C. */
  --brand-sky: #00a6fb; --brand-navy: #073b4c; --logo: var(--brand-navy);
  --bg: #f5f9ff; --surface: #fff; --surface-2: #f8f9fb; --text: #1a1d24; --muted: #697083; --line: #e3e6ec;
  --accent: #0a6fe0; --accent-ink: #fff; --accent-soft: #e8f2ff;
  --ok: #1f8f5a; --ok-soft: #e1f5ea; --warn: #b86a00; --warn-soft: #fff1d6; --bad: #cf3434; --bad-soft: #fde6e6;
  --radius: 12px; --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 1px 1px rgba(20, 24, 40, .04);
  color-scheme: light;
}
@media not all /* D-31: always light — was (prefers-color-scheme: dark) */ {
  :root {
    --logo: #fff;
    --bg: #111319; --surface: #1a1d26; --surface-2: #20242f; --text: #e7e9ef; --muted: #9aa1b2; --line: #2c313d;
    --accent: #4c9dff; --accent-ink: #071425; --accent-soft: #14243d;
    --ok: #4cc38a; --ok-soft: #16301f; --warn: #f0b04a; --warn-soft: #362a12; --bad: #f27474; --bad-soft: #3b1b1b;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 14px; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.neg { color: var(--bad); font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.ic { width: 18px; height: 18px; flex: none; }

/* Shell: floating rounded sidebar with the logo on top; round tool buttons at the top right */
.app { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
.side { grid-column: 1; grid-row: 1 / -1; position: sticky; top: 16px; align-self: start; width: 248px; height: calc(100vh - 32px); margin: 16px 0 16px 16px; padding: 26px 14px 14px;
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 6px 24px rgba(7, 59, 76, .07); transition: width .2s ease; z-index: 6; }
.side-logo { display: flex; align-items: center; padding: 0 10px 22px; }
.side-mark { display: none; width: 44px; height: 44px; border-radius: 13px; place-items: center; background: var(--brand-sky); color: #fff; }
.side-mark .pm-mark { width: 26px; }
.side-toggle { position: absolute; top: 34px; right: -12px; width: 24px; height: 24px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 8px rgba(0, 90, 140, .3); }
.side-toggle .ic { width: 14px; height: 14px; stroke-width: 2.4; transition: transform .2s; }
.side-nav { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.side-nav a, .side-out { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--text); font: inherit; font-weight: 500; }
.side-nav a .ic, .side-out .ic { color: var(--muted); }
.side-nav a:hover, .side-out:hover { background: var(--surface-2); text-decoration: none; }
.side-nav a.on { color: var(--accent); font-weight: 700; background: none; }
.side-nav a.on .ic { color: var(--accent); }
.side-nav a.on::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--accent); }
.side-out { width: 100%; margin-top: 10px; border: 0; background: none; cursor: pointer; text-align: left; }
.side .navsec { padding: 18px 10px 6px; text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 500; }
/* Bottom of the sidebar: environment switch (clients in both environments) and the signed-in user */
.side-foot { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.env-sw { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.env-sw button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.env-sw button:hover { color: var(--text); }
.env-sw button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(7, 59, 76, .12); }
.env-sw .ic { width: 16px; height: 16px; }
.env-sw button.on.off .ic { color: var(--ok); }
.env-sw button.on.on .ic { color: var(--accent); }
.side-me { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 4px; }
.side-me-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.side-me-t b, .side-me-t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ava { position: relative; flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; }
.ava-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); }
.ava-dot.off { background: var(--ok); }
.ava-dot.on { background: var(--accent); }
.round .ava-dot { right: 0; bottom: 0; }
.me-pop .env-sw { margin: 10px 0 2px; }
.side-mini .side { width: 76px; }
.side-mini .side-logo .pm-word, .side-mini .side-nav span, .side-mini .side-out span, .side-mini .side .navsec, .side-mini .side-me-t, .side-mini .env-sw span { display: none; }
.side-mini .side-logo { padding: 0 0 22px; justify-content: center; }
.side-mini .side-mark { display: grid; }
.side-mini .side-me { justify-content: center; padding: 0; }
.side-mini .env-sw { flex-direction: column; }
.side-mini .env-sw button { padding: 8px 0; }
.side-mini .side-nav a, .side-mini .side-out { justify-content: center; }
.side-mini .side .navsec + a { margin-top: 12px; }
.side-mini .side-toggle .ic { transform: rotate(180deg); }
.top { grid-column: 2; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 18px 28px 0; }
.top-logo { display: none; margin-right: auto; }
.top-tools { gap: 10px; }
.round { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; padding: 0; }
.round .ic { width: 20px; height: 20px; }
.round:hover { border-color: var(--accent); text-decoration: none; }
.round.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.round .count { position: absolute; top: -3px; right: -3px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 9px; padding: 0 5px; line-height: 16px; }
.me-wrap { position: relative; }
.me-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 12; min-width: 220px; display: flex; flex-direction: column; gap: 2px; padding: 14px 12px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 32px rgba(7, 59, 76, .14); }
.me-pop b, .me-pop > span { padding: 0 6px; }
.me-pop .side-out { margin-top: 8px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; padding-top: 12px; }
.me-pop .side-out + .side-out { margin-top: 0; border-top: 0; border-radius: 8px; padding-top: 9px; }
/* Profile and settings (src/components/profile.js) */
.side-me { color: var(--text); border-radius: 12px; padding: 6px 4px; }
.side-me:hover, .side-me.on { background: var(--accent-soft); text-decoration: none; }
.lang-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.lang-opt { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.lang-opt b { font-size: 16px; }
.lang-opt:hover { border-color: var(--accent); }
.lang-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.main { grid-column: 2; padding: 20px 28px 48px; min-width: 0; max-width: 1280px; }
.page-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-h p { margin: 4px 0 0; }
.sec { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }

/* Cards and stats */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats.tight { gap: 8px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.card .stat { background: var(--surface-2); box-shadow: none; }
.stat-l { color: var(--muted); font-size: 12.5px; }
.stat-v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-v .sv-sm { font-size: 15px; }
.stat-s { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stat.bad .stat-v { color: var(--bad); }
.stat.warn .stat-v { color: var(--warn); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.ok i { background: var(--ok); } .bar.bad i { background: var(--bad); }
.prow { padding: 8px 0; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.prow-h { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.empty { color: var(--muted); padding: 18px; text-align: center; background: var(--surface-2); border-radius: 10px; }
.alert { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.alert.bad { background: var(--bad-soft); color: var(--text); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* Badges, buttons, forms */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.muted { color: var(--muted); }
.btn { font: inherit; font-weight: 600; font-size: 14px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: 7px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; display: inline-block; }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { font-size: 13px; padding: 4px 10px; }
.btn.danger { color: var(--bad); }
.linkbtn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=search] { min-width: 240px; }
textarea { width: 100%; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; flex: 1; min-width: 160px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.field.inline input { width: 90px; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.perms { display: flex; flex-direction: column; gap: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { font: inherit; font-size: 13px; font-weight: 600; background: none; border: 0; padding: 5px 12px; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.seg button.on.ok { background: var(--ok-soft); color: var(--ok); }
.seg button.on.warn { background: var(--warn-soft); color: var(--warn); }
.seg button.on.bad { background: var(--bad-soft); color: var(--bad); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.main > .row { margin-bottom: 14px; }

/* Tables */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td .bar { max-width: 140px; }

/* Lessons, feeds, recordings */
.lessons { display: flex; flex-direction: column; }
.day-h { font-weight: 700; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.day-h:first-child { margin-top: 0; }
.lesson, .rec { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin-bottom: 6px; border-left: 4px solid var(--c, var(--accent)); }
.lesson-t { font-weight: 700; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; font-size: 14px; min-width: 46px; }
.lesson-t span { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.lesson-b { flex: 1; min-width: 0; }
.rec { border-left: 0; }
.play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; flex: none; font-size: 13px; }
.file { font-size: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; margin-top: 4px; }
.file::before { content: "📄 "; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed li.read { opacity: .7; }
.pin { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: none; }
.pin.warn { background: var(--warn); } .pin.bad { background: var(--bad); }
.datebox { width: 46px; flex: none; text-align: center; background: var(--accent-soft); color: var(--accent); border-radius: 9px; padding: 4px 0; font-size: 12px; line-height: 1.1; }
.datebox b { display: block; font-size: 18px; }
.weeknav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.player { aspect-ratio: 16 / 9; background: #11131a; color: #cfd4e0; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-size: 34px; }
.player span { font-size: 13px; }

/* Chart */
.chart { width: 100%; height: auto; margin: 4px 0 8px; }
.chart .gl { stroke: var(--line); }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .base { stroke: var(--muted); stroke-dasharray: 4 4; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.500; }
.chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .dot.pointA, .chart .dot.pointB { fill: var(--accent); }

/* Schedule builder */
.sgrid { table-layout: fixed; min-width: 980px; }
.sgrid th:first-child { width: 150px; }
.sgrid th.today { color: var(--accent); }
.sgrid td { vertical-align: top; border-left: 1px solid var(--line); padding: 6px; height: 64px; }
.sgrid tbody th { color: var(--text); font-size: 13px; white-space: normal; border-bottom: 1px solid var(--line); }
.chip { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; font: inherit; font-size: 12px; line-height: 1.3; background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 8px; padding: 4px 6px; margin-bottom: 4px; cursor: pointer; color: var(--text); }
.chip small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.chip.conflict { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.add { width: 100%; border: 1px dashed var(--line); background: none; color: var(--muted); border-radius: 8px; cursor: pointer; opacity: 0; font-size: 14px; }
.sgrid td:hover .add, .add:focus { opacity: 1; }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.kcol-h { font-weight: 700; font-size: 13px; margin-bottom: 8px; display: flex; justify-content: space-between; }
.lead { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }

/* Student card */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; }

/* Modal and toast */
.overlay { position: fixed; inset: 0; background: rgba(10, 12, 20, .45); display: flex; align-items: flex-start; justify-content: center; padding: max(6vh, calc(16px + env(safe-area-inset-top))) 16px calc(16px + env(safe-area-inset-bottom)); z-index: 20; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 480px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 680px; }
.modal header, .modal footer { display: flex; align-items: center; gap: 8px; padding: 14px 18px; }
.modal header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal footer { border-top: 1px solid var(--line); }
.modal-b { padding: 16px 18px 4px; }
.modal-b p { margin: 0 0 12px; }
.x { background: none; border: 0; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 600; z-index: 30; max-width: calc(100% - 32px); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: max(24px, calc(16px + env(safe-area-inset-top))) 16px max(24px, calc(16px + env(safe-area-inset-bottom))); }
.login-box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: 100%; max-width: 620px; box-shadow: var(--shadow); }
.login-box h1 { margin: 22px 0 6px; }
.user { font: inherit; text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; color: var(--text); font-weight: 600; }
.users { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.user { display: flex; flex-direction: column; gap: 2px; }
.user:hover { border-color: var(--accent); }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .top { grid-column: 1; grid-row: 1; padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); background: var(--surface); border-bottom: 1px solid var(--line); }
  .top-logo { display: inline-flex; }
  .round { width: 38px; height: 38px; }
  .side, .side-mini .side { grid-column: 1; grid-row: 2; width: auto; height: auto; margin: 0; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; top: 0; align-self: stretch; }
  .side-logo, .side-toggle, .side > .side-out, .side .navsec, .side-foot { display: none; }
  .side-nav, .side-mini .side-nav { flex-direction: row; overflow-x: auto; margin: 0; padding: 0; }
  .side-nav a { white-space: nowrap; flex: none; }
  .side-mini .side-nav span { display: inline; }
  .side-nav a.on { background: var(--accent-soft); }
  .side-nav a.on::before { display: none; }
  .main { grid-column: 1; grid-row: 3; padding: 18px 16px 40px; }
  .grid2 { grid-template-columns: 1fr; }
  input[type=search] { min-width: 0; width: 100%; }
  .users { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 21px; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-v { font-size: 19px; }
  .users { grid-template-columns: 1fr; }
  .lesson { flex-wrap: wrap; }
}

/* ---- Online school, environments, finance (added with the shared core + online school) */
.navsec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 14px 10px 4px; }
.rolegroup { margin: 16px 0 8px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.chain { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.elcard { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.elcard.done { border-color: var(--ok); }
.elcard.locked { opacity: .65; }
.elcard p { margin: 6px 0; }
.elicon { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.elcard.done .elicon { background: var(--ok-soft); color: var(--ok); }
.player.sm { aspect-ratio: auto; height: 120px; font-size: 24px; margin: 8px 0; }
.qlist { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.qcard.ok { border-left: 4px solid var(--ok); }
.qcard.bad { border-left: 4px solid var(--bad); }
.qcard p { margin: 4px 0; }
.qopt { display: flex; gap: 8px; align-items: center; padding: 6px 4px; cursor: pointer; }
.thread { border-bottom: 1px solid var(--line); padding: 8px 0; }
.thread p { margin: 4px 0; }
.reply { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.ask, .hw { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.ask input[name=text] { flex: 1; min-width: 200px; }
.hw textarea { flex-basis: 100%; }
.st { display: inline-block; width: 18px; text-align: center; color: var(--muted); }
.st.completed { color: var(--ok); }
.qpick { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }

/* ---- Phone tab bar: iOS-style "liquid glass" floating over the page (shell() in src/core/app.js)
   .pm-workspace is always light (styles/promed-workspace.css), so it keeps the light glass in dark mode too. */
:root, .pm-workspace {
  --glass: linear-gradient(135deg, rgba(128, 210, 253, .34) 0%, rgba(0, 166, 251, .16) 50%, rgba(102, 200, 253, .32) 100%);
  --glass-sheet: linear-gradient(160deg, rgba(224, 244, 255, .62) 0%, rgba(150, 216, 253, .5) 100%); --glass-on: rgba(255, 255, 255, .45);
  --glass-edge: rgba(255, 255, 255, .6); --glass-ink: #073b4c; --glass-tint: #0077b6;
  --glass-shadow: 0 10px 30px rgba(0, 90, 140, .22), 0 1px 3px rgba(7, 59, 76, .08), inset 0 1px 1px rgba(255, 255, 255, .75), inset 0 -1px 1px rgba(255, 255, 255, .25);
  --glass-blur: blur(14px) saturate(190%) brightness(1.06);
}
@media not all /* D-31: always light — was (prefers-color-scheme: dark) */ {
  :root {
    --glass: linear-gradient(135deg, rgba(10, 90, 120, .34) 0%, rgba(5, 35, 46, .3) 50%, rgba(0, 110, 170, .34) 100%);
    --glass-sheet: linear-gradient(160deg, rgba(10, 60, 78, .6) 0%, rgba(4, 26, 34, .62) 100%); --glass-on: rgba(255, 255, 255, .14);
    --glass-edge: rgba(150, 220, 255, .22); --glass-ink: #e4f0f5; --glass-tint: #4cc3ff;
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, .4), inset 0 1px 1px rgba(255, 255, 255, .18), inset 0 -1px 1px rgba(255, 255, 255, .05);
    --glass-blur: blur(14px) saturate(170%) brightness(.92);
  }
}
.tabbar, .more-shade { display: none; }
/* Phones and tablets (up to 900px): the tab bar and the "More" sheet replace the side menu */
@media (max-width: 900px) {
  .side { display: none; }
  /* The header stays under the phone's own top bar (notch, Dynamic Island, punch-hole): padded by the safe-area inset */
  .top { position: sticky; top: 0; z-index: 12; }
  .main { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(100px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; z-index: 15; left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom)); padding: 4px; gap: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    background: var(--glass); border: .5px solid var(--glass-edge); border-radius: 999px; box-shadow: var(--glass-shadow);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
  .tabbar a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 6px; border-radius: 999px;
    color: var(--glass-ink); font-size: clamp(9px, 2.7vw, 10px); font-weight: 500; letter-spacing: .01em; line-height: 1.15; -webkit-tap-highlight-color: transparent;
    transition: background .25s ease, color .25s ease, transform .15s ease; }
  .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar a .ic { width: 24px; height: 24px; stroke-width: 1.7; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a:active { transform: scale(.94); }
  .tabbar a.on { background: var(--glass-on); color: var(--glass-tint); font-weight: 600; }
  .tabbar a.on .ic { stroke-width: 2.1; }
  /* "More": the full menu as a glass sheet above the bar */
  .more-open .more-shade { display: block; position: fixed; inset: 0; z-index: 14; background: rgba(0, 0, 0, .18); }
  .more-open .side { display: flex; flex-direction: column; position: fixed; z-index: 15; top: auto; left: 14px; right: 14px; bottom: calc(86px + env(safe-area-inset-bottom)); height: auto; max-height: calc(100vh - 150px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; padding: 8px;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    background: var(--glass-sheet); border: .5px solid var(--glass-edge); border-radius: 28px; box-shadow: var(--glass-shadow);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
  .more-open .side-nav { flex: none; flex-direction: column; overflow: visible; }
  .more-open .side-nav a.in-tabs { display: none; }
  .more-open .side > .side-out, .more-open .side .navsec { display: flex; }
  .more-open .side-nav span { display: inline; }
  .more-open .side-nav a, .more-open .side-out { color: var(--glass-ink); border-radius: 14px; padding: 10px 12px; justify-content: flex-start; }
  .more-open .side-nav a.on::before { display: none; }
  .more-open .side-nav a.on { background: var(--glass-on); color: var(--glass-tint); }
  .more-open .side .navsec { color: var(--glass-ink); opacity: .55; }
}
/* Tablets: the bar and the sheet keep a phone-like width, centred */
@media (min-width: 601px) and (max-width: 900px) {
  .tabbar, .more-open .side { left: 50%; right: auto; width: min(520px, calc(100% - 28px)); transform: translateX(-50%); }
}

/* ---- Desktop / phone preview switch (src/core/device.js) */
.devbar { position: fixed; right: 16px; bottom: 16px; z-index: 40; display: flex; gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 4px 16px rgba(7, 59, 76, .14); }
.devbar button { font: inherit; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.devbar button:hover { color: var(--text); }
.devbar button.on { background: var(--accent); color: var(--accent-ink); }
.dev-stage { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px 80px; background: var(--bg); }
.dev-phone { width: calc(var(--pw) + 24px); height: min(calc(var(--ph) + 24px), calc(100vh - 104px)); padding: 12px; border-radius: 48px; background: var(--brand-navy); box-shadow: 0 20px 60px rgba(7, 59, 76, .25); }
.dev-screen { display: flex; flex-direction: column; height: 100%; overflow: hidden; border-radius: 36px; background: #fff; }
.dev-frame { display: block; flex: 1; min-height: 0; width: 100%; border: 0; background: var(--surface); }
/* The phone's own status bar (devStatus() in src/core/device.js), painted like the app's top by paintDevStatus() */
.dev-status { flex: none; position: relative; transition: background .2s, color .2s; display: flex; align-items: center; justify-content: space-between; height: 50px; padding: 4px 26px 0 38px; color: #0c1a20;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; font-size: 16px; font-weight: 600; letter-spacing: -.01em; user-select: none; }
.dev-time { font-variant-numeric: tabular-nums; }
.dev-island { position: absolute; left: 50%; top: 11px; width: 118px; height: 34px; margin-left: -59px; border-radius: 20px; background: #000; }
.dev-icons { display: flex; align-items: center; gap: 6px; }
.dev-icons svg { width: auto; height: 12px; }
@media (max-width: 600px) { .devbar { display: none; } }
/* Mobile pages and nested lists keep scrolling without desktop-style tracks. */
@media(max-width:900px){html,body,body *{scrollbar-width:none}html::-webkit-scrollbar,body::-webkit-scrollbar,body *::-webkit-scrollbar{display:none}}
