/* =========================================================================
   Grifter's Portal — theme system + layout
   Every colour is a CSS variable, so switching [data-theme] on <html>
   repaints the whole app with no reload.
   ========================================================================= */

/* ---------- Theme: Dark Slate (default) ---------- */
:root,
[data-theme="slate"] {
  --bg:            #0b0f14;
  --bg-elev:       #111722;
  --bg-elev-2:     #161e2b;
  --bg-inset:      #0a0e13;
  --line:          #222d3d;
  --line-soft:     #1a2331;

  --text:          #e6edf6;
  --text-dim:      #93a3b8;
  --text-faint:    #5b6b80;

  --accent:        #4f9cf9;
  --accent-soft:   rgba(79, 156, 249, 0.14);
  --accent-text:   #0b0f14;

  --ok:            #35d07f;
  --ok-soft:       rgba(53, 208, 127, 0.13);
  --warn:          #f5b73d;
  --warn-soft:     rgba(245, 183, 61, 0.13);
  --danger:        #ff5f6d;
  --danger-soft:   rgba(255, 95, 109, 0.13);

  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 8px 28px rgba(0, 0, 0, 0.45);
  --glow:          none;
  --font:          ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:     ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --heading-font:  var(--font);
  --heading-spacing: -0.01em;
  --heading-transform: none;
}

/* ---------- Theme: Cyberpunk Neon ---------- */
[data-theme="neon"] {
  --bg:            #05060a;
  --bg-elev:       #0b0e17;
  --bg-elev-2:     #121729;
  --bg-inset:      #030409;
  --line:          #1e2a4a;
  --line-soft:     #141c33;

  --text:          #e9f4ff;
  --text-dim:      #8ba3c7;
  --text-faint:    #566a8f;

  --accent:        #00e5ff;
  --accent-soft:   rgba(0, 229, 255, 0.14);
  --accent-text:   #04121a;

  --ok:            #2bff88;
  --ok-soft:       rgba(43, 255, 136, 0.12);
  --warn:          #ffcf3d;
  --warn-soft:     rgba(255, 207, 61, 0.12);
  --danger:        #ff2e88;
  --danger-soft:   rgba(255, 46, 136, 0.14);

  --radius:        6px;
  --radius-sm:     4px;
  --shadow:        0 0 0 1px rgba(0, 229, 255, 0.08), 0 10px 34px rgba(0, 0, 0, 0.7);
  --glow:          0 0 14px rgba(0, 229, 255, 0.35);
  --heading-font:  var(--font-mono);
  --heading-spacing: 0.06em;
  --heading-transform: uppercase;
}

/* ---------- Theme: Vault Noir ---------- */
[data-theme="vault"] {
  --bg:            #0d0b08;
  --bg-elev:       #17130d;
  --bg-elev-2:     #1f1912;
  --bg-inset:      #0a0806;
  --line:          #35291a;
  --line-soft:     #261e13;

  --text:          #f2e9d8;
  --text-dim:      #b09a78;
  --text-faint:    #7a6849;

  --accent:        #e0a940;
  --accent-soft:   rgba(224, 169, 64, 0.14);
  --accent-text:   #17130d;

  --ok:            #86b04a;
  --ok-soft:       rgba(134, 176, 74, 0.13);
  --warn:          #e08b2f;
  --warn-soft:     rgba(224, 139, 47, 0.13);
  --danger:        #d1483f;
  --danger-soft:   rgba(209, 72, 63, 0.14);

  --radius:        4px;
  --radius-sm:     3px;
  --shadow:        0 10px 30px rgba(0, 0, 0, 0.6);
  --glow:          none;
  --heading-spacing: 0.04em;
  --heading-transform: uppercase;
}

/* ---------- Theme: Deep Forest ---------- */
[data-theme="forest"] {
  --bg:            #0a1210;
  --bg-elev:       #101c19;
  --bg-elev-2:     #16261f;
  --bg-inset:      #071009;
  --line:          #1f342c;
  --line-soft:     #17271f;

  --text:          #e4f0e9;
  --text-dim:      #93b3a4;
  --text-faint:    #5f7d6e;

  --accent:        #4fd1a5;
  --accent-soft:   rgba(79, 209, 165, 0.13);
  --accent-text:   #06120e;

  --ok:            #6ee7a8;
  --ok-soft:       rgba(110, 231, 168, 0.12);
  --warn:          #e8c46a;
  --warn-soft:     rgba(232, 196, 106, 0.12);
  --danger:        #f0716a;
  --danger-soft:   rgba(240, 113, 106, 0.13);

  --radius:        14px;
  --radius-sm:     9px;
  --shadow:        0 8px 26px rgba(0, 0, 0, 0.45);
  --glow:          none;
}

/* ---------- Theme: Carbon Mono ---------- */
[data-theme="mono"] {
  --bg:            #0c0c0c;
  --bg-elev:       #141414;
  --bg-elev-2:     #1c1c1c;
  --bg-inset:      #080808;
  --line:          #2b2b2b;
  --line-soft:     #202020;

  --text:          #ededed;
  --text-dim:      #9a9a9a;
  --text-faint:    #6a6a6a;

  --accent:        #f0f0f0;
  --accent-soft:   rgba(255, 255, 255, 0.09);
  --accent-text:   #0c0c0c;

  --ok:            #8fd18f;
  --ok-soft:       rgba(143, 209, 143, 0.11);
  --warn:          #d6bb72;
  --warn-soft:     rgba(214, 187, 114, 0.11);
  --danger:        #e08585;
  --danger-soft:   rgba(224, 133, 133, 0.12);

  --radius:        2px;
  --radius-sm:     2px;
  --shadow:        none;
  --glow:          none;
  --font:          var(--font-mono);
  --heading-spacing: 0.03em;
}

/* =========================================================================
   Base
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--heading-font, var(--font));
  letter-spacing: var(--heading-spacing, normal);
  margin: 0;
  font-weight: 650;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--font-mono); }

::selection { background: var(--accent-soft); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-inset); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* =========================================================================
   Login screen
   ========================================================================= */
.auth-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
}

.auth-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 500px at 15% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(700px 420px at 95% 110%, var(--accent-soft), transparent 55%);
  opacity: 0.85;
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: min(400px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 30px 30px;
}

.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand h1 { font-size: 22px; text-transform: var(--heading-transform, none); }
.auth-sub { color: var(--text-faint); font-size: 13px; margin: 4px 0 0; }

.brand-mark {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  color: var(--accent);
  filter: drop-shadow(var(--glow));
}
.brand-mark svg { width: 100%; height: 100%; }
.brand-mark.small { width: 30px; height: 30px; margin: 0; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-hint { font-size: 13px; color: var(--text-dim); margin: 0; text-align: center; }

.code-input {
  font-family: var(--font-mono);
  font-size: 24px !important;
  letter-spacing: 0.32em;
  text-align: center;
}

/* =========================================================================
   Form controls
   ========================================================================= */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="url"], input[type="search"],
select, textarea {
  width: 100%;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { resize: vertical; min-height: 76px; }
select { cursor: pointer; }

label.check {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; cursor: pointer; color: var(--text-dim);
}
label.check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.form-error {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
}

.form-note {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 13px;
  color: var(--text-dim);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, transform 0.06s;
  white-space: nowrap;
}
.btn:hover { background: var(--line-soft); border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--glow);
}
.btn-primary:hover { filter: brightness(1.1); background: var(--accent); border-color: var(--accent); }

.btn-danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--bg); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--bg-elev-2); color: var(--text); border-color: transparent; }

.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
}
.icon-btn:hover { background: var(--bg-elev-2); color: var(--text); }

/* =========================================================================
   App shell
   ========================================================================= */
.shell { display: flex; height: 100vh; height: 100dvh; }

.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong {
  font-size: 15px;
  letter-spacing: var(--heading-spacing, normal);
  text-transform: var(--heading-transform, none);
}
.brand-text span { font-size: 11px; color: var(--text-faint); letter-spacing: 0.14em; text-transform: uppercase; }

.nav { flex: 1; padding: 12px 10px; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 520;
  margin-bottom: 2px;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background 0.13s, color 0.13s;
}
.nav-item:hover { background: var(--bg-elev-2); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-left-color: var(--accent);
}
.nav-ico { width: 18px; height: 18px; flex: 0 0 18px; display: inline-block; }
.nav-ico svg { width: 100%; height: 100%; display: block; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  min-width: 19px;
  height: 19px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  padding: 0 6px;
}

.nav-sep { height: 1px; background: var(--line-soft); margin: 10px 12px; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--line-soft); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  flex: 0 0 34px;
  border: 1px solid var(--accent);
}
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.user-meta strong { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.07em; }

/* ---------- Main column ---------- */
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 58px;
  flex: 0 0 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.topbar h2 {
  font-size: 17px;
  text-transform: var(--heading-transform, none);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.clock { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-faint); }
.theme-select { width: auto; padding: 6px 10px; font-size: 13px; }
.menu-btn { display: none; }

.content { flex: 1; overflow-y: auto; padding: 22px; }
.content:focus { outline: none; }

/* =========================================================================
   Cards, layout primitives
   ========================================================================= */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card + .card { margin-top: 16px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.card-head h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
}
.card-head .spacer { margin-left: auto; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { margin-left: auto; }

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head .lead { color: var(--text-dim); font-size: 13.5px; }

/* ---------- Stat tiles ---------- */
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  font-weight: 650;
}
.stat-value {
  font-size: 27px;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-top: 5px;
  line-height: 1.1;
}
.stat-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.stat.ok .stat-value { color: var(--ok); }
.stat.warn .stat-value { color: var(--warn); }
.stat.danger .stat-value { color: var(--danger); }
.stat.accent .stat-value { color: var(--accent); }

/* ---------- Badges / pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}
.badge.ok      { background: var(--ok-soft);     color: var(--ok);     border-color: var(--ok); }
.badge.warn    { background: var(--warn-soft);   color: var(--warn);   border-color: var(--warn); }
.badge.danger  { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.badge.accent  { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.badge.muted   { background: var(--bg-elev-2);   color: var(--text-faint); border-color: var(--line); }

.tag {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  cursor: pointer;
}
.tag:hover, .tag.active { border-color: var(--accent); color: var(--accent); }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line-soft);
}
.list-row:last-child { border-bottom: none; }
.list-row .title { font-weight: 560; font-size: 14px; }
.list-row .meta { font-size: 12px; color: var(--text-faint); }

.empty {
  text-align: center;
  padding: 34px 18px;
  color: var(--text-faint);
  font-size: 13.5px;
}
.empty strong { display: block; color: var(--text-dim); margin-bottom: 5px; font-size: 15px; }

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  font-weight: 650;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td {
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--bg-elev-2); }
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }

/* =========================================================================
   Bills
   ========================================================================= */
.bill-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.bill-card.overdue  { border-left-color: var(--danger); }
.bill-card.due-soon { border-left-color: var(--warn); }
.bill-card.paid     { border-left-color: var(--ok); opacity: 0.72; }
.bill-card.upcoming { border-left-color: var(--accent); }

.bill-top { display: flex; align-items: flex-start; gap: 10px; }
.bill-name { font-weight: 620; font-size: 15px; }
.bill-amount { font-family: var(--font-mono); font-size: 16px; font-weight: 650; margin-left: auto; }
.bill-meta { font-size: 12px; color: var(--text-faint); display: flex; gap: 12px; flex-wrap: wrap; }
.bill-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.cat-group { margin-bottom: 24px; }
.cat-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

/* ---------- Quick links ---------- */
.link-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  text-decoration: none;
  transition: border-color 0.13s, background 0.13s;
}
.link-tile:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}
.link-tile .nav-ico { color: var(--accent); }

/* =========================================================================
   Calendar
   ========================================================================= */
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-month { font-size: 17px; font-weight: 650; min-width: 190px; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-dow {
  background: var(--bg-elev-2);
  padding: 8px 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  font-weight: 700;
  text-align: center;
}
.cal-day {
  background: var(--bg-elev);
  min-height: 108px;
  padding: 6px 7px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  transition: background 0.12s;
}
.cal-day:hover { background: var(--bg-elev-2); }
.cal-day.other { background: var(--bg-inset); }
.cal-day.other .cal-daynum { color: var(--text-faint); opacity: 0.5; }
.cal-day.today .cal-daynum {
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 50%;
  width: 22px; height: 22px;
  display: grid; place-items: center;
}
.cal-daynum { font-size: 12px; font-weight: 650; color: var(--text-dim); font-family: var(--font-mono); }

.cal-event {
  font-size: 11.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  border-left: 2px solid var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.cal-event.allday { background: var(--ok-soft); color: var(--ok); border-left-color: var(--ok); }
.cal-more { font-size: 10.5px; color: var(--text-faint); padding-left: 4px; }

.agenda-day { margin-bottom: 18px; }
.agenda-date {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  font-weight: 700;
  margin-bottom: 8px;
}
.agenda-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
}
.agenda-item:hover { border-color: var(--accent); }
.agenda-time { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); min-width: 88px; }

/* =========================================================================
   Documents
   ========================================================================= */
.doc-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.doc-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  font-size: 10px;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
  flex: 0 0 38px;
}
.doc-title { font-weight: 600; font-size: 14px; word-break: break-word; }

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--text-faint);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* =========================================================================
   Reminders
   ========================================================================= */
.rem-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.rem-row.high    { border-left-color: var(--danger); }
.rem-row.normal  { border-left-color: var(--accent); }
.rem-row.low     { border-left-color: var(--text-faint); }
.rem-row.done    { opacity: 0.5; }
.rem-row.done .rem-title { text-decoration: line-through; }
.rem-row.overdue { background: var(--danger-soft); }

.rem-check {
  width: 20px; height: 20px;
  flex: 0 0 20px;
  border: 2px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  margin-top: 2px;
  display: grid; place-items: center;
  background: transparent;
  padding: 0;
  color: var(--ok);
}
.rem-check:hover { border-color: var(--ok); }
.rem-check.done { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.rem-title { font-weight: 550; font-size: 14px; }

/* =========================================================================
   Modals
   ========================================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 22px;
  z-index: 100;
  overflow-y: auto;
}
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(560px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  margin: auto;
}
.modal.wide { width: min(820px, 100%); }
.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

/* =========================================================================
   Toasts
   ========================================================================= */
.toast-root {
  position: fixed;
  bottom: 20px; right: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  max-width: 340px;
  animation: toast-in 0.18s ease-out;
}
.toast.ok    { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Recovery codes ---------- */
.codes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 12px 0;
}
.codes-grid span { letter-spacing: 0.06em; }

.qr-box {
  background: #fff;
  padding: 12px;
  border-radius: var(--radius-sm);
  display: inline-block;
  line-height: 0;
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading { display: grid; place-items: center; padding: 60px; }

/* =========================================================================
   Responsive
   ========================================================================= */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 35;
  display: none;
}
.scrim.show { display: block; }

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-grid; }
  .content { padding: 16px; }
  .topbar { padding: 0 14px; }
  .clock { display: none; }
  .cal-day { min-height: 68px; }
  .cal-event { font-size: 10px; }
}

@media (max-width: 520px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .codes-grid { grid-template-columns: 1fr; }
  .agenda-time { min-width: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .sidebar, .topbar, .toast-root { display: none !important; }
  body { overflow: visible; background: #fff; color: #000; }
}
