/* ============================================================
   DS Hercules — Stylesheet
   "Maroon and gold" — DS company branding (logo maroon #911132,
   logo gold #ffb000, deep wine structure), light + dark themes.
   ============================================================ */

/* DS brand palette — maroon #911132 + gold #ffb000 from the company
   logo (canonical across Hercules/Xenia/Olympus). Light + dark themes
   via [data-theme] on <html>; every component reads tokens only. */
:root {
  --primary:        #911132;   /* DS maroon — from the company logo */
  --primary-deep:   #240a13;   /* deep wine — structure/sidebar */
  --primary-soft:   #f7e3e9;
  --accent:         #ffb000;   /* DS gold — from the company logo */
  --accent-soft:    #fff3d6;
  --success:        #059669;
  --danger:         #dc2626;
  --warn:           #f59e0b;
  --info:           #0284c7;
  --info-soft:      #e0f2fe;
  --bg:             #f4f6f9;
  --surface:        #ffffff;
  --text:           #1e293b;
  --text-2:         #64748b;
  --line:           #e2e8f0;
  --sidebar-ink:    #d8b3c0;            /* muted text on the navy sidebar */
  --toast-bg:       #240a13;
  --toast-text:     #f1f5f9;
  --flash-done:     #d6f5e8;
  --radius:         14px;
  --shadow:         0 2px 12px rgba(15, 23, 42, .07);
  --shadow-lg:      0 8px 32px rgba(15, 23, 42, .16);
  --grad:           linear-gradient(120deg, #2a0b15, #911132 55%, #c01a45);
  --grad-warm:      linear-gradient(120deg, #e09a00, #ffb000);
  --nav-h:          62px;
}

[data-theme="dark"] {
  --primary:        #d94f74;   /* rose — maroon needs lifting on dark */
  --primary-deep:   #190509;
  --primary-soft:   #3d1422;
  --accent:         #ffbe33;
  --accent-soft:    #3a2d10;
  --success:        #10b981;
  --danger:         #f05252;
  --warn:           #fbbf24;
  --info:           #38bdf8;
  --info-soft:      #0c2a3d;
  --bg:             #120810;
  --surface:        #221220;
  --text:           #e2e8f0;
  --text-2:         #bf9fae;
  --line:           #41263a;
  --sidebar-ink:    #bf95a4;
  --toast-bg:       #e2e8f0;
  --toast-text:     #0f172a;
  --flash-done:     #0c3b2b;
  --shadow:         0 2px 12px rgba(0, 0, 0, .45);
  --shadow-lg:      0 10px 36px rgba(0, 0, 0, .6);
  --grad:           linear-gradient(120deg, #1c0710, #911132 60%, #c01a45);
}
html { background: var(--bg); color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

/* Slate scrollbars — same treatment as DS Rheia */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-2); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.45;
  overscroll-behavior-y: none;
}
.hidden { display: none !important; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 9px 12px; width: 100%;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
label { font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; display: block; margin: 12px 0 5px; }

.grad-text { background: linear-gradient(120deg, var(--primary), #c01a45 70%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Display face — Manrope gives headings the DS-family engineering feel */
h1, h2, h3, .topbar-title, .brand-name, .login-card h1, .modal-head,
.stat .num, .day-head h2, .quad h3 {
  font-family: 'Manrope', 'Segoe UI', Roboto, sans-serif;
  letter-spacing: -0.01em;
}

/* Smooth theme transitions (colors only, never layout) */
body, .card, .topbar, .sidebar, .task-card, .modal, .wk-col, .mn-cell,
.quad, .stat, .timegrid, input, select, textarea {
  transition: background-color .25s ease, border-color .25s ease, color .15s ease;
}

/* ── Login ─────────────────────────────────────────────────── */
.login-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--grad); z-index: 100;
}
.login-card {
  background: var(--surface); border-radius: 22px; padding: 44px 40px; text-align: center;
  box-shadow: var(--shadow-lg); max-width: 360px; width: calc(100% - 40px);
  animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
.login-logo { font-size: 52px; margin-bottom: 8px; }
.login-card h1 { font-size: 26px; letter-spacing: .04em; }
.login-tag { color: var(--text-2); margin: 6px 0 26px; font-style: italic; }
.btn-ms {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: #240a13; color: #fff; border: none; border-radius: 10px;
  padding: 13px; font-size: 14px; font-weight: 600; transition: transform .12s, opacity .15s;
}
.btn-ms:hover { opacity: .92; transform: translateY(-1px); }
.login-note { font-size: 12px; color: var(--text-2); margin-top: 16px; }

/* ── Layout ────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: var(--primary-deep); color: #fff;
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 30;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px 18px; font-size: 16px; letter-spacing: .03em; }
.brand-icon { font-size: 24px; }
.brand-name b { color: var(--accent); }
.sidebar-nav { flex: 1; padding: 8px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; color: var(--sidebar-ink); padding: 11px 13px;
  border-radius: 10px; margin-bottom: 3px; font-weight: 500; transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(145,17,50,.4); }
.nav-ico { font-size: 16px; }
.sidebar-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); }
.side-user { font-size: 12.5px; color: var(--sidebar-ink); margin-bottom: 8px; }

.main { flex: 1; min-width: 0; margin-left: 230px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  /* viewport-fit=cover draws under the phone status bar — keep buttons below it */
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
}
.topbar-title { font-size: 19px; font-weight: 800; }
.topbar-actions { display: flex; align-items: center; gap: 12px; position: relative; }
.icon-btn { background: none; border: none; font-size: 19px; position: relative; padding: 4px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; cursor: pointer;
}
.badge {
  position: absolute; top: -4px; right: -6px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 9px; padding: 1px 5px; min-width: 16px; text-align: center;
}
.sidebar .badge { position: static; margin-left: auto; }
.dot { position: absolute; top: 6px; right: 18px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; }
.offline-pill { background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }

.view { flex: 1; padding: 22px 26px 90px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ── Bottom nav + FAB (mobile) ─────────────────────────────── */
.bottomnav { display: none; }
.fab {
  position: fixed; right: 24px; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--grad); color: #fff; border: none; font-size: 26px; line-height: 1;
  box-shadow: 0 6px 20px rgba(145,17,50,.5); z-index: 40; transition: transform .15s;
}
.fab:hover { transform: scale(1.07) rotate(90deg); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  border: none; border-radius: 10px; padding: 10px 18px; font-weight: 700; font-size: 13.5px;
  transition: transform .12s, opacity .15s, box-shadow .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 3px 12px rgba(145,17,50,.35); }
.btn-primary:hover { box-shadow: 0 5px 18px rgba(145,17,50,.5); }
.btn-accent { background: var(--grad-warm); color: #fff; }
.btn-danger-soft { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-ghost { background: none; border: 1.5px solid rgba(255,255,255,.25); color: var(--sidebar-ink); border-radius: 8px; padding: 7px 12px; font-size: 12px; }
.btn-ghost.dark { border-color: var(--line); color: var(--text-2); }
.btn.small, .btn-ghost.small { padding: 6px 12px; font-size: 12px; }

/* ── Cards / stats ─────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
  border-left: 4px solid var(--primary); cursor: pointer; transition: transform .15s;
}
.stat:hover { transform: translateY(-2px); }
.stat .num { font-size: 24px; font-weight: 800; }
.stat .lbl { font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.stat.red { border-color: var(--danger); }    .stat.red .num { color: var(--danger); }
.stat.gold { border-color: var(--accent); }   .stat.gold .num { color: var(--warn); }
.stat.green { border-color: var(--success); } .stat.green .num { color: var(--success); }

/* ── Section headers / filter chips ────────────────────────── */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 20px 0 10px; flex-wrap: wrap; }
.section-head h2 { font-size: 15px; font-weight: 800; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  background: var(--surface); border: 1.5px solid var(--line); color: var(--text-2);
  border-radius: 20px; padding: 6px 14px; font-size: 12.5px; font-weight: 600; transition: all .15s;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

/* ── Task cards ────────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: 9px; }
.task-card {
  display: flex; align-items: flex-start; gap: 12px; background: var(--surface);
  border-radius: var(--radius); padding: 13px 16px; box-shadow: var(--shadow);
  cursor: pointer; transition: transform .13s, box-shadow .15s; position: relative; overflow: hidden;
}
.task-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.task-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--pcol, var(--primary)); }
.task-card.p-urgent { --pcol: var(--danger); }
.task-card.p-high   { --pcol: var(--warn); }
.task-card.p-normal { --pcol: var(--primary); }
.task-card.p-low    { --pcol: #94a3b8; }
.task-card.done-anim { animation: doneFlash .6s; }
@keyframes doneFlash { 0% { background: var(--flash-done); } 100% { background: var(--surface); } }

.tick {
  width: 22px; height: 22px; min-width: 22px; border-radius: 50%; border: 2px solid var(--line);
  background: none; margin-top: 2px; font-size: 13px; line-height: 1; color: transparent; transition: all .15s;
}
.tick:hover { border-color: var(--success); color: var(--success); }
.tick.done { background: var(--success); border-color: var(--success); color: #fff; }

.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 14px; }
.tid { color: var(--text-2); font-weight: 700; font-size: .85em; }
.task-card.is-done .task-title { text-decoration: line-through; color: var(--text-2); }
.task-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-2); margin-top: 4px; align-items: center; }
.task-meta .overdue { color: var(--danger); font-weight: 700; }
.pill { padding: 2px 9px; border-radius: 10px; font-size: 10.5px; font-weight: 700; }
.pill.src { background: var(--accent-soft); color: #b45309; }
.pill.status-in_progress { background: var(--primary-soft); color: var(--primary); }
.pill.status-waiting { background: var(--accent-soft); color: var(--warn); }
.pill.lbl { background: var(--info-soft); color: var(--info); }

/* ── Day planner ───────────────────────────────────────────── */
.planner-wrap { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.day-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.day-head h2 { font-size: 17px; font-weight: 800; }
.day-nav { display: flex; gap: 6px; align-items: center; }
.day-nav button { background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 11px; font-weight: 700; }

.timegrid { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; position: relative; }
.time-row { display: flex; border-top: 1px solid var(--line); min-height: 52px; position: relative; }
.time-row:first-child { border-top: none; }
.time-label { width: 56px; min-width: 56px; font-size: 11px; color: var(--text-2); padding: 6px 8px; text-align: right; border-right: 1px solid var(--line); }
.time-slot { flex: 1; position: relative; transition: background .15s; }
.time-slot:hover { background: var(--primary-soft); cursor: pointer; }
.time-slot.dragover { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -2px; }
.time-now { position: absolute; left: 56px; right: 0; height: 2px; background: var(--danger); z-index: 5; }
.time-now::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

.block {
  position: absolute; left: 62px; right: 8px; background: var(--grad); color: #fff;
  border-radius: 9px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; z-index: 4;
  box-shadow: 0 3px 10px rgba(145,17,50,.35); cursor: pointer; overflow: hidden;
  display: flex; justify-content: space-between; gap: 8px; align-items: flex-start;
}
.block.is-done { background: var(--flash-done); color: var(--success); box-shadow: none; }
.block .block-time { font-size: 10.5px; opacity: .85; font-weight: 500; }
.block .unsched { background: rgba(255,255,255,.2); border: none; color: inherit; border-radius: 6px; font-size: 11px; padding: 1px 7px; }

/* min-width:0 — nowrap task titles must not widen the grid column past the phone screen */
.side-panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.side-panel .card { min-width: 0; }
.side-panel .card h3 { font-size: 13px; font-weight: 800; margin-bottom: 9px; display: flex; align-items: center; gap: 7px; }
.mini-task { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-top: 1px solid var(--line); font-size: 13px; }
.mini-task:first-of-type { border-top: none; }
.mini-task .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.mini-task .plan-btn { background: var(--primary-soft); color: var(--primary); border: none; border-radius: 7px; font-size: 11px; font-weight: 700; padding: 4px 9px; }
.mini-task[draggable="true"] { cursor: grab; }

.empty {
  text-align: center; color: var(--text-2); padding: 34px 16px; font-size: 13.5px;
}
.empty .big { font-size: 40px; display: block; margin-bottom: 8px; }

/* ── Planner: week / workweek grid ─────────────────────────── */
.week-grid { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 10px; }
.wk-col {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px; min-height: 140px; min-width: 0;
}
.wk-col.is-today { outline: 2px solid var(--primary); }
.wk-head {
  text-align: center; font-size: 11.5px; font-weight: 700; color: var(--text-2);
  padding: 4px 0 8px; cursor: pointer; border-bottom: 1px solid var(--line); margin-bottom: 7px;
}
.wk-head:hover { color: var(--primary); }
.wk-head b { font-size: 14px; color: var(--text); margin-left: 3px; }
.wk-col.is-today .wk-head b { color: var(--primary); }
.wk-chip {
  font-size: 11.5px; line-height: 1.3; padding: 5px 7px; border-radius: 7px;
  background: var(--bg); border-left: 3px solid var(--primary); margin-bottom: 5px;
  cursor: pointer; overflow: hidden; transition: transform .12s;
}
.wk-chip:hover { transform: translateX(2px); }
.wk-chip.p-urgent { border-left-color: var(--danger); }
.wk-chip.p-high   { border-left-color: var(--warn); }
.wk-chip.p-low    { border-left-color: #94a3b8; }
.wk-chip.is-done  { opacity: .5; text-decoration: line-through; }
.wk-chip .wk-due  { color: var(--text-2); font-size: 10px; }
.wk-empty { text-align: center; color: var(--line); font-size: 12px; padding: 14px 0; }
.wk-chip.is-proj {
  opacity: .75; background: transparent; border: 1.5px dashed var(--line);
  border-left: 3px dashed var(--primary); color: var(--text-2);
}
.wk-chip.is-proj.p-urgent { border-left-color: var(--danger); }
.wk-chip.is-proj.p-high   { border-left-color: var(--warn); }
.mini-task.is-proj { cursor: help; }

/* ── Planner: month grid ───────────────────────────────────── */
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.month-dow { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; padding: 2px 0; }
.mn-cell {
  background: var(--surface); border-radius: 10px; box-shadow: var(--shadow);
  min-height: 92px; padding: 5px 6px; cursor: pointer; overflow: hidden; min-width: 0;
  transition: transform .12s;
}
.mn-cell:hover { transform: translateY(-1px); }
.mn-cell.dim { opacity: .45; }
.mn-num { font-size: 11px; font-weight: 700; color: var(--text-2); margin-bottom: 3px; }
.mn-cell.is-today .mn-num span {
  background: var(--primary); color: #fff; border-radius: 50%;
  display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center;
}
.mn-cell .wk-chip { font-size: 10px; padding: 2px 5px; margin-bottom: 3px; white-space: nowrap; text-overflow: ellipsis; }
.mn-more { font-size: 9.5px; color: var(--text-2); font-weight: 700; }

/* ── Planner: Eisenhower matrix ────────────────────────────── */
.matrix-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.quad {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; min-height: 170px; border-top: 4px solid var(--line);
  transition: background .15s;
}
.quad.dragover { outline: 2px dashed var(--accent); background: var(--accent-soft); }
.quad h3 { font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.quad-count { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--text-2); background: var(--bg); border-radius: 10px; padding: 1px 8px; }
.quad-sub { font-size: 11px; color: var(--text-2); margin: 2px 0 10px; }
.quad-q1 { border-top-color: var(--danger); }
.quad-q2 { border-top-color: var(--primary); }
.quad-q3 { border-top-color: var(--warn); }
.quad-q4 { border-top-color: #94a3b8; }
.quad .wk-chip { cursor: grab; }
.quad .wk-chip:active { cursor: grabbing; }

/* ── Modals ────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(26, 23, 51, .45); z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px calc(18px + env(safe-area-inset-bottom, 0px));
  animation: fadeIn .15s;
}
.modal {
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; overflow-y: auto;
  max-height: calc(100vh - 60px);
  max-height: calc(100dvh - 60px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  animation: pop .22s cubic-bezier(.2, 1.3, .4, 1);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 0; font-size: 16px; font-weight: 800;
}
.modal-close { background: var(--bg); border: none; border-radius: 8px; width: 30px; height: 30px; font-size: 15px; }
.modal-body { padding: 10px 22px 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 22px 20px; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.frow3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.seg { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: none; background: none; border-radius: 8px; padding: 7px 4px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.seg button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

.weekday-picker { display: flex; gap: 5px; }
.weekday-picker button {
  flex: 1; border: 1.5px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 7px 0; font-size: 12px; font-weight: 700; color: var(--text-2);
}
.weekday-picker button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.checklist-item { display: flex; align-items: center; gap: 9px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.checklist-item input[type="checkbox"] { width: auto; }
.checklist-item .x { margin-left: auto; background: none; border: none; color: var(--text-2); font-size: 14px; }
.journey { margin: 4px 0 6px 5px; }
.j-row { border-left: 2px solid var(--line); padding: 5px 0 7px 14px; position: relative; font-size: 13px; }
.j-row::before {
  content: ''; position: absolute; left: -5px; top: 11px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--primary);
}
.j-row:last-child::before { background: var(--accent); }
.j-held { color: var(--text-2); font-size: 11px; margin-left: 6px; font-weight: 600; }
.j-reason { font-size: 12px; color: var(--text-2); font-style: italic; margin-top: 2px; }
.j-when { font-size: 10.5px; color: var(--text-2); margin-top: 2px; }

.comment { padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.comment .who { font-weight: 700; font-size: 12px; }
.comment .when { color: var(--text-2); font-size: 11px; margin-left: 6px; }

/* ── Suggestions ───────────────────────────────────────────── */
.sug-card { border-left: 4px solid var(--accent); }
.sug-from { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.sug-title { font-weight: 700; font-size: 14.5px; }
.sug-desc { font-size: 13px; color: var(--text-2); margin: 6px 0 10px; }
.conf-bar { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; margin: 8px 0 12px; }
.conf-bar > div { height: 100%; background: var(--grad-warm); }
.sug-actions { display: flex; gap: 8px; }

/* ── Notification panel ────────────────────────────────────── */
.notif-panel {
  position: absolute; top: 46px; right: 0; width: 330px; max-height: 420px; overflow-y: auto;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 50; padding: 8px;
}
.notif-item { padding: 11px 12px; border-radius: 10px; cursor: pointer; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-soft); }
.notif-item .nt { font-size: 13px; font-weight: 600; }
.notif-item .nb { font-size: 12px; color: var(--text-2); }
.notif-item .nw { font-size: 10.5px; color: var(--text-2); margin-top: 3px; }

/* ── Settings ──────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .tl { font-size: 13.5px; font-weight: 600; }
.toggle-row .td { font-size: 11.5px; color: var(--text-2); }
.switch { position: relative; width: 42px; height: 24px; min-width: 42px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; background: var(--line); border-radius: 24px; transition: .2s; cursor: pointer;
}
.switch span::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::before { transform: translateX(18px); }

table.dtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.dtable th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--text-2); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.dtable td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.keybox { background: var(--primary-deep); color: var(--accent); font-family: monospace; padding: 12px 14px; border-radius: 10px; font-size: 12.5px; word-break: break-all; margin: 10px 0; }

/* ── Toasts ────────────────────────────────────────────────── */
#toast-root { position: fixed; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--toast-bg); color: var(--toast-text); padding: 11px 20px; border-radius: 12px; font-size: 13px;
  font-weight: 600; box-shadow: var(--shadow-lg); animation: toastIn .25s cubic-bezier(.2, 1.3, .4, 1);
  max-width: 90vw;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { transform: translateY(16px); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }

/* ── Loading ───────────────────────────────────────────────── */
.loading { display: flex; justify-content: center; padding: 50px; }
.loading::after {
  content: ''; width: 34px; height: 34px; border: 4px solid var(--primary-soft);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .view { padding: 16px 14px calc(var(--nav-h) + 84px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }

  /* 16px minimum stops iOS zooming in when an input is focused */
  input, select, textarea { font-size: 16px; }

  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0;
    /* home-indicator inset extends the bar; items keep their full --nav-h */
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--line); z-index: 40;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; font-size: 10.5px; font-weight: 700; color: var(--text-2); position: relative;
  }
  .bottomnav a span:first-child { font-size: 19px; }
  .bottomnav a.active { color: var(--primary); }
  .fab { bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom, 0px)); right: 16px; }

  .planner-wrap { grid-template-columns: 1fr; }
  .week-grid { display: flex; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
  .week-grid .wk-col { min-width: 150px; flex: 1 0 150px; }
  .matrix-grid { grid-template-columns: 1fr; }
  .mn-cell { min-height: 64px; padding: 3px 4px; }
  .mn-cell .wk-chip { font-size: 8.5px; padding: 1px 3px; }
  .frow, .frow3 { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .notif-panel { position: fixed; top: calc(58px + env(safe-area-inset-top, 0px)); left: 10px; right: 10px; width: auto; }
}
