/* LifeNotes web · base: tokens, shell, sidebar (kept), topbar, auth, modal, toast.
   Tokens mirror the app's Aurora Borealis defaults (default ThemeMode.DARK, verified
   against ui/theme/Color.kt + Theme.kt): bg/toolbar #1A1B26 (one shared color, not two),
   card level 1 (surface) #21222D is a 3% lighten of it, card level 2 (surface-2) #282933
   is a 6% lighten, accent #BB9AF7. theme.js overrides the first five variables per
   Aurora theme; everything else derives from them. */

:root {
  --accent: #BB9AF7;
  --bg: #1A1B26;
  --sidebar-bg: #1A1B26;
  --surface: #21222D;
  --surface-2: #282933;
  --surface-3: color-mix(in srgb, var(--surface-2), #ffffff 8%);
  --card: color-mix(in srgb, var(--bg), #ffffff 5%);
  --border: rgba(255, 255, 255, 0.075);
  --border-2: rgba(255, 255, 255, 0.16);
  --text: #e0e0e0;
  --text-dim: #9e9ea8;
  --text-faint: #6b7194;
  --accent-hi: color-mix(in srgb, var(--accent), #ffffff 24%);
  --accent-soft: color-mix(in srgb, var(--accent) 15%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 40%, transparent);
  --on-accent: #14121c;
  --success: #4caf50;
  --success-soft: color-mix(in srgb, #4caf50 18%, transparent);
  --info: #7dcfff;
  --warn: #ff9e64;
  --amber: #e8923c;
  --danger: #e53935;
  --gold: #ffd700;
  --r-lg: 18px;
  --r-card: 14px;
  --r-md: 12px;
  --r-sm: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

/* ── Scrollbars: thin, theme-matched (default OS bars read as bright
   against the dark surfaces, so every scroll container gets this instead) */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--border-2); }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1 { font-size: 24px; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.4px; color: var(--text); }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 10px; color: var(--text); }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 6px; color: var(--text); }
a { color: var(--accent-hi); }

/* ── Buttons & inputs ─────────────────────────────────── */
.btn {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 999px;
  padding: 9px 18px; cursor: pointer; font: inherit; font-weight: 500;
  transition: background .12s, border-color .12s, transform .04s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-accent:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-wide { width: 100%; margin-top: 8px; padding: 12px; }
.btn-sm { padding: 5px 13px; font-size: 12.5px; }
.btn-link { background: none; border: 0; color: var(--accent-hi); cursor: pointer; font: inherit; padding: 0; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn i { margin-right: 7px; }
.btn-sm i { margin-right: 5px; }

input, textarea, select {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--r-md);
  padding: 11px 14px; font: inherit; width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 96px; }
label { display: block; color: var(--text-dim); font-size: 12.5px; margin: 0 0 5px; }
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.check-label { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 13.5px; cursor: pointer; margin-bottom: 8px; }

/* ── App shell ────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; }

/* Sidebar: kept exactly as before — icon + label rows, dividers, collapsible to icons */
.sidebar {
  width: 236px; flex: 0 0 236px; background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: width .16s ease;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px; }
.sidebar-brand { color: var(--accent); font-size: 20px; font-weight: 700; letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; }
.sidebar-brand span { color: var(--text) }
.nav-collapse-btn { background: none; border: 0; color: var(--text-faint); cursor: pointer; font-size: 15px; padding: 7px; border-radius: 9px; flex: 0 0 auto; }
.nav-collapse-btn:hover { color: var(--text); background: var(--surface); }
.nav-collapse-btn i { transition: transform .15s; }
.side-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 6px 12px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 11px 14px; font-size: 14px; font-weight: 500; color: var(--text-dim);
  background: none; border: 0; text-align: left; cursor: pointer; font-family: inherit;
  border-radius: var(--r-md); white-space: nowrap; overflow: hidden;
  text-decoration: none; transition: background .12s, color .12s;
}
.nav-item i { width: 20px; text-align: center; font-size: 16px; flex: 0 0 auto; }
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.active { color: var(--text); background: var(--accent-soft); font-weight: 600; }
.nav-divider { height: 1px; background: var(--border); margin: 9px 14px; border: 0; }
.sidebar-foot { padding: 10px 12px; }
.sync-indicator {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 10px 14px; background: var(--surface); border: 0; border-radius: var(--r-md);
  color: var(--text-dim); cursor: pointer; font: inherit; font-size: 13px; text-align: left;
}
.sync-indicator:hover { color: var(--text); }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); flex: 0 0 9px; }
.sync-dot.ok { background: #6cc98f; }
.sync-dot.busy { background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

body.nav-collapsed .sidebar { width: 66px; flex-basis: 66px; }
body.nav-collapsed .sidebar-brand { display: none; }
body.nav-collapsed .nav-collapse-btn i { transform: rotate(180deg); }
body.nav-collapsed .nav-label { display: none; }
body.nav-collapsed .nav-item { justify-content: center; padding: 12px 0; gap: 0; }
body.nav-collapsed .nav-item i { width: auto; }
body.nav-collapsed .nav-divider { margin: 9px 12px; }
body.nav-collapsed .sidebar-foot { padding: 10px; }
body.nav-collapsed .sync-indicator { justify-content: center; padding: 11px 0; gap: 0; }

/* Main column */
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 32px; border-bottom: 1px solid var(--border);
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.account-name { color: var(--text-dim); font-size: 13px; margin-right: 4px; }
.view { flex: 1; overflow-y: auto; padding: 24px 32px 96px; position: relative; }
.page-inner { max-width: 1200px; }

/* ── Modal & toast ────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.64);
  display: flex; align-items: flex-start; justify-content: center; z-index: 40;
  padding: 8vh 18px 18px; overflow-y: auto;
}
.modal { background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-lg); padding: 26px; width: 100%; max-width: 540px; }
.modal h2 { color: var(--text); font-size: 19px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--border-2); color: var(--text);
  padding: 12px 20px; border-radius: var(--r-md); z-index: 60; font-size: 13.5px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
}

/* ── Auth screen ──────────────────────────────────────── */
.auth-screen { min-height: 100vh; display: flex; flex-direction: column; }
.auth-topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 28px; border-bottom: 1px solid var(--border); }
.brand { color: var(--accent); font-size: 21px; font-weight: 800; letter-spacing: -0.3px; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 32px 28px; width: 100%; max-width: 400px; }
.auth-sub { color: var(--text-dim); font-size: 13px; margin: 4px 0 22px; line-height: 1.55; }
.auth-error { background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--r-md); color: var(--text); padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.auth-or { text-align: center; color: var(--text-faint); font-size: 12px; margin: 18px 0; position: relative; }
.auth-or::before, .auth-or::after { content: ""; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--border); }
.auth-or::before { left: 0; } .auth-or::after { right: 0; }
.google-btn { display: flex; justify-content: center; min-height: 40px; }
.auth-switch { margin-top: 20px; color: var(--text-dim); font-size: 13px; display: flex; gap: 6px; justify-content: center; }

/* ── Narrow screens ───────────────────────────────────── */
@media (max-width: 760px) {
  .sidebar { width: 66px; flex-basis: 66px; }
  .sidebar-brand, .nav-collapse-btn, .nav-label { display: none; }
  .nav-item { justify-content: center; padding: 12px 0; gap: 0; }
  .nav-item i { width: auto; }
  .sync-indicator { justify-content: center; padding: 11px 0; gap: 0; }
  .topbar, .view { padding-left: 16px; padding-right: 16px; }
  .account-name { display: none; }
}
