/* All Day (Timber & Salt) — theme system.
   Five switchable themes via CSS variables on [data-theme].
   Default: "pastel" — soft aurora gradient + frosted glass panels,
   modeled on the mail-app style Will picked (Nov 3, 2026).
   Typography is deliberately bold and large — no thin fonts. */

:root {
  --radius: 16px;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Theme 1: Pastel (default) ---------- */
[data-theme="pastel"] {
  --bg: linear-gradient(165deg, #aecdf2 0%, #c3c8f2 22%, #d9c2ee 42%, #efc3d8 62%, #f7d3bd 82%, #fbe7c6 100%);
  --bg-solid: #dfe4f5;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(255, 255, 255, 0.85);
  --glass: blur(18px) saturate(1.5);
  --ink: #1f2a44;
  --ink-soft: #46536e;
  --accent: #5b3ed6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(91, 62, 214, 0.12);
  --good: #1e7d4f;
  --warn: #b25b09;
  --bad: #b3263c;
  --shadow: 0 10px 30px rgba(63, 52, 120, 0.16);
  --input-bg: rgba(255, 255, 255, 0.9);
}

/* ---------- Theme 2: Forest (deep green + ivory) ---------- */
[data-theme="forest"] {
  --bg: linear-gradient(160deg, #0d2b1d 0%, #123524 55%, #1a4630 100%);
  --bg-solid: #123524;
  --panel: #f5f1e4;
  --panel-strong: #fbf8ef;
  --panel-border: #d9d2ba;
  --glass: none;
  --ink: #20302a;
  --ink-soft: #55604f;
  --accent: #1d5c3a;
  --accent-ink: #ffffff;
  --accent-soft: rgba(29, 92, 58, 0.12);
  --good: #1e7d4f;
  --warn: #a85d08;
  --bad: #b3263c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --input-bg: #fffdf6;
}

/* ---------- Theme 3: Harbor (navy + slate) ---------- */
[data-theme="harbor"] {
  --bg: linear-gradient(160deg, #0a1c33 0%, #10294a 60%, #173a63 100%);
  --bg-solid: #10294a;
  --panel: #eef2f8;
  --panel-strong: #ffffff;
  --panel-border: #c3cede;
  --glass: none;
  --ink: #16283f;
  --ink-soft: #4d6076;
  --accent: #1450a0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(20, 80, 160, 0.12);
  --good: #177245;
  --warn: #a85d08;
  --bad: #b3263c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --input-bg: #ffffff;
}

/* ---------- Theme 4: Bordeaux (burgundy + gold) ---------- */
[data-theme="bordeaux"] {
  --bg: linear-gradient(160deg, #380d18 0%, #571f2b 55%, #713040 100%);
  --bg-solid: #571f2b;
  --panel: #faf1de;
  --panel-strong: #fffaf0;
  --panel-border: #e3d3ae;
  --glass: none;
  --ink: #3a1e1c;
  --ink-soft: #6e554b;
  --accent: #7c2233;
  --accent-ink: #ffffff;
  --accent-soft: rgba(124, 34, 51, 0.1);
  --good: #1e7d4f;
  --warn: #9c6206;
  --bad: #a31230;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --input-bg: #fffdf8;
}

/* ---------- Theme 5: Graphite (charcoal + mint, dark) ---------- */
[data-theme="graphite"] {
  --bg: linear-gradient(160deg, #14171b 0%, #1d2126 60%, #262c33 100%);
  --bg-solid: #1d2126;
  --panel: #262c33;
  --panel-strong: #2e353e;
  --panel-border: #414b55;
  --glass: none;
  --ink: #edf3ee;
  --ink-soft: #a9b8ad;
  --accent: #2fae74;
  --accent-ink: #0d1512;
  --accent-soft: rgba(87, 217, 163, 0.14);
  --good: #57d9a3;
  --warn: #e8b34b;
  --bad: #ff7a70;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --input-bg: #1a1f24;
}

/* ---------- Base layout ---------- */
/* The hidden attribute must always win — .login-wrap sets display:flex,
   which used to override it and left the login form on screen after
   sign-in. This rule is the fix for that bug. */
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
  background-color: var(--bg-solid);
  background-attachment: fixed;
  min-height: 100vh;
}
h1, h2, h3 { font-weight: 800; letter-spacing: -0.01em; margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; font-weight: 500; color: var(--ink); }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

header.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}
.brand { font-size: 21px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.brand .mark {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
}
nav.tabs { display: flex; gap: 6px; margin-left: 8px; }
nav.tabs button {
  border: none; background: transparent; color: var(--ink-soft);
  font-size: 16px; font-weight: 700; padding: 9px 14px; border-radius: 999px;
}
nav.tabs button.active { background: var(--accent); color: var(--accent-ink); }
.topbar .spacer { flex: 1; }
.whoami { display: flex; align-items: center; gap: 9px; font-weight: 700; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 14px;
}
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }

main { max-width: 1060px; margin: 0 auto; padding: 22px 16px 60px; }
.view { display: none; }
.view.active { display: block; }

/* ---------- Buttons, forms ---------- */
.btn {
  border: none; border-radius: 12px; padding: 11px 18px;
  font-size: 16px; font-weight: 700;
  background: var(--accent); color: var(--accent-ink);
}
.btn.ghost { background: var(--accent-soft); color: var(--ink); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 9px; }
.btn:disabled { opacity: 0.55; cursor: default; }

.field { margin-bottom: 13px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 5px; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border-radius: 11px;
  border: 1.5px solid var(--panel-border); background: var(--input-bg);
}
.field textarea { min-height: 84px; resize: vertical; }
.error { color: var(--bad); font-weight: 700; min-height: 22px; }
.hint { color: var(--ink-soft); font-size: 14px; }

/* ---------- Board ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar select {
  padding: 10px 12px; border-radius: 11px; font-weight: 700;
  border: 1.5px solid var(--panel-border); background: var(--input-bg);
}
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { padding: 16px; display: flex; flex-direction: column; gap: 9px; }
.card h3 { font-size: 18px; line-height: 1.25; }
.card .details { color: var(--ink-soft); font-size: 15px; white-space: pre-wrap; }
.card .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.card .foot { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.badge { padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; color: #fff; }
.badge.Idea { background: #6d4bd8; }
.badge.Request { background: #1c63c7; }
.badge.Issue { background: #c62f45; }
.badge.Report { background: #178a5b; }
.status { padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; background: var(--accent-soft); color: var(--ink); }
.status.Done { background: var(--good); color: #fff; }
.status.Parked { opacity: 0.75; }
.due { font-weight: 800; }
.due.overdue { color: var(--bad); }
select.status-select {
  padding: 7px 9px; border-radius: 9px; font-weight: 700; font-size: 14px;
  border: 1.5px solid var(--panel-border); background: var(--input-bg);
}

/* ---------- Feed / to-do / tables ---------- */
.feed-item { padding: 14px 16px; margin-bottom: 11px; display: flex; gap: 12px; }
.feed-item .body { flex: 1; }
.feed-item .when { color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.feed-item .text { white-space: pre-wrap; margin-top: 3px; }
.feed-item .on { font-weight: 800; color: var(--accent); }
table.users { width: 100%; border-collapse: collapse; }
table.users th, table.users td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--panel-border); font-size: 15px; }
table.users th { font-weight: 800; color: var(--ink-soft); font-size: 13.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.todo-row { display: flex; gap: 12px; align-items: center; padding: 13px 16px; margin-bottom: 10px; }
.todo-row .grow { flex: 1; }
.empty { padding: 26px; text-align: center; color: var(--ink-soft); font-weight: 700; }

/* ---------- Login, modal, settings ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; padding: 30px 28px; }
.login-card h1 { font-size: 26px; margin-bottom: 4px; }
.modal-back {
  position: fixed; inset: 0; z-index: 50; display: none;
  background: rgba(20, 22, 40, 0.45); align-items: flex-start; justify-content: center;
  padding: 28px 14px; overflow-y: auto;
}
.modal-back.open { display: flex; }
.modal { width: 100%; max-width: 560px; padding: 22px; background: var(--panel-strong); }
.modal h2 { font-size: 21px; margin-bottom: 12px; }
.theme-row { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-chip {
  border: 2.5px solid var(--panel-border); border-radius: 13px; padding: 7px;
  background: var(--panel-strong); display: flex; flex-direction: column; gap: 6px;
  font-weight: 800; font-size: 13.5px; color: var(--ink); align-items: center;
}
.theme-chip.active { border-color: var(--accent); }
.theme-chip .swatch { width: 74px; height: 44px; border-radius: 9px; border: 1px solid rgba(0,0,0,0.14); }
.swatch.pastel { background: linear-gradient(150deg, #aecdf2, #d9c2ee 45%, #f7d3bd); }
.swatch.forest { background: linear-gradient(150deg, #123524 55%, #f5f1e4 55%); }
.swatch.harbor { background: linear-gradient(150deg, #10294a 55%, #eef2f8 55%); }
.swatch.bordeaux { background: linear-gradient(150deg, #571f2b 55%, #c9a227 55%, #faf1de); }
.swatch.graphite { background: linear-gradient(150deg, #1d2126 55%, #57d9a3 55%); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Meeting Room ---------- */
.room-head { margin-bottom: 12px; }
.room-head h2 { font-size: 24px; margin-bottom: 2px; }
.messages { display: flex; flex-direction: column; gap: 2px; padding-bottom: 14px; }
.msg { display: flex; gap: 11px; padding: 10px 12px; border-radius: 13px; }
.msg:hover { background: var(--accent-soft); }
.msg .mbody { flex: 1; min-width: 0; }
.msg .mhead { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.msg .mhead strong { font-size: 15.5px; }
.msg .when { color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.msg .text { white-space: pre-wrap; margin-top: 2px; line-height: 1.45; overflow-wrap: anywhere; }
.msg.assistant { background: var(--accent-soft); }
.avatar.assistant {
  background: var(--accent) !important;
  box-shadow: 0 0 0 2.5px var(--panel-strong), 0 0 0 5px var(--accent);
}
.badge-assistant {
  padding: 2.5px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 800;
  background: var(--accent); color: var(--accent-ink);
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.composer {
  position: sticky; bottom: 14px; z-index: 5;
  display: flex; gap: 10px; padding: 12px; align-items: flex-end;
}
.composer textarea {
  flex: 1; padding: 11px 12px; border-radius: 11px; resize: vertical;
  border: 1.5px solid var(--panel-border); background: var(--input-bg);
  min-height: 48px; max-height: 170px;
}

/* ---------- Settings ---------- */
.settings-modal { max-width: 680px; }
.settings-head { display: flex; align-items: center; justify-content: space-between; }
.settings-h { margin: 24px 0 8px; font-size: 17px; }
.panel-inset {
  border: 1.5px solid var(--panel-border); border-radius: 13px;
  padding: 14px; margin: 12px 0; background: var(--panel);
}

@media (max-width: 640px) {
  nav.tabs button { padding: 8px 10px; font-size: 15px; }
  .brand { font-size: 18px; }
  .composer { bottom: 8px; }
}
