/* Driftboard — warm cream aesthetic from the design package */

:root {
  --bg: #E7E3D9;
  --panel: #F4F2EC;
  --card: #FFFFFF;
  --ink: #21201C;
  --muted: #6F6A60;
  --faint: #8C867A;
  --hairline: #EBE7DE;
  --line: #DAD5C9;
  --line-strong: #C7BFB0;
  --accent: #D9803E;
  --serif: 'Newsreader', Georgia, serif;
  --sans: 'Hanken Grotesk', -apple-system, sans-serif;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(33,32,28,.05), 0 8px 24px rgba(33,32,28,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.45; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea { font: inherit; color: var(--ink); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; }
[hidden] { display: none !important; }

::selection { background: #21201C; color: #F4F2EC; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

/* ---------- layout ---------- */

#app { min-height: 100vh; }

.shell { display: flex; min-height: 100vh; max-width: 1240px; margin: 0 auto; }

.sidebar {
  width: 264px; flex-shrink: 0; padding: 28px 20px;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { font-family: var(--serif); font-size: 26px; margin: 4px 8px 18px; }
.side-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border-radius: 12px; text-align: left;
  color: var(--muted); font-weight: 500;
}
.side-btn:hover { background: rgba(33,32,28,.05); color: var(--ink); }
.side-btn.active { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hairline); }
.side-btn .count { margin-left: auto; color: var(--faint); font-size: 13px; }
.side-label { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 18px 12px 6px; font-weight: 600; }
.side-cta {
  margin: 6px 0 2px; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: #F4F2EC; border-radius: 14px; padding: 11px; font-weight: 600;
}
.side-cta:hover { background: #3a382f; }
.side-spacer { flex: 1; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

.main { flex: 1; min-width: 0; padding: 32px clamp(18px, 4vw, 48px) 110px; }

.page-head { margin-bottom: 6px; }
.page-eyebrow { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.page-title { font-size: clamp(28px, 4vw, 38px); margin: 2px 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 18px; }

/* ---------- chips / filters ---------- */

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 999px; padding: 6px 13px; font-size: 13.5px; font-weight: 500; color: var(--muted);
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.on { background: var(--ink); color: #F4F2EC; border-color: var(--ink); }
.chip .count { opacity: .55; font-size: 12px; }

.searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--hairline); border-radius: 14px;
  padding: 10px 14px; margin: 4px 0 6px; box-shadow: var(--shadow);
}
.searchbar input { flex: 1; border: 0; outline: 0; background: none; font-size: 15px; }
.searchbar svg { color: var(--faint); flex-shrink: 0; }

/* ---------- idea cards ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }

.card {
  background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 16px 16px 15px; text-align: left; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px; transition: transform .12s ease, border-color .12s;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.card-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.card-meta .dot { width: 8px; height: 8px; }
.card-meta .energy { margin-left: auto; }
.card-title { font-family: var(--serif); font-size: 19px; line-height: 1.25; }
.card-note { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.empty {
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 40px 20px;
  text-align: center; color: var(--faint);
}
.empty b { display: block; font-family: var(--serif); font-weight: 500; font-size: 19px; color: var(--muted); margin-bottom: 4px; }

/* ---------- project list ---------- */

.proj-row {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--card); border: 1px solid var(--hairline); border-radius: 16px;
  padding: 15px 17px; box-shadow: var(--shadow);
}
.proj-row:hover { border-color: var(--line-strong); }
.proj-row .name { font-family: var(--serif); font-size: 18px; }
.proj-row .meta { color: var(--muted); font-size: 13px; }
.proj-row .arrow { margin-left: auto; color: var(--faint); }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- modal / sheet ---------- */

.scrim {
  position: fixed; inset: 0; background: rgba(33,32,28,.4); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .16s ease;
}
@media (min-width: 640px) { .scrim { align-items: center; padding: 24px; } }
.sheet {
  background: var(--panel); width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  border-radius: 24px 24px 0 0; padding: 22px 22px 28px;
  animation: sheetUp .22s cubic-bezier(.32,.72,.33,1);
}
@media (min-width: 640px) { .sheet { border-radius: 24px; animation: pop .18s ease; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-title { font-size: 22px; }
.x { color: var(--faint); font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.x:hover { background: rgba(33,32,28,.06); color: var(--ink); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: .02em; }
.field input[type=text], .field input[type=email], .field input[type=password], .field textarea {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 11px 13px; outline: 0;
}
.field input:focus, .field textarea:focus { border-color: var(--ink); }
.field textarea { resize: vertical; min-height: 74px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: #F4F2EC; border-radius: 14px; padding: 12px 20px;
  font-weight: 600; width: 100%;
}
.btn:hover { background: #3a382f; }
.btn.ghost { background: none; color: var(--muted); border: 1px solid var(--line); }
.btn.ghost:hover { color: var(--ink); border-color: var(--line-strong); }
.btn.danger { background: none; border: 1px solid #d9b3a0; color: #A54B24; }
.btn.danger:hover { background: #f6e8e0; }
.btn-row { display: flex; gap: 10px; margin-top: 8px; }
.btn-row .btn { flex: 1; }

.detail-title { font-size: 28px; margin: 6px 0 8px; }
.detail-note { color: var(--muted); white-space: pre-wrap; margin: 0 0 18px; }
.promo {
  background: var(--card); border: 1px solid var(--hairline); border-radius: 16px;
  padding: 15px 16px; margin-top: 14px;
}
.promo h3 { font-size: 18px; margin-bottom: 4px; }
.promo p { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }

.err { color: #A54B24; font-size: 13.5px; margin: 8px 0 0; min-height: 18px; }

/* ---------- settings ---------- */

.set-row {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--card); border: 1px solid var(--hairline); border-radius: 14px; padding: 13px 15px;
}
.set-row .meta { color: var(--faint); font-size: 13px; margin-left: auto; }
.set-row input[type=color] { width: 26px; height: 26px; border: 0; padding: 0; background: none; cursor: pointer; }
.mini { font-size: 13px; color: var(--muted); padding: 5px 9px; border: 1px solid var(--line); border-radius: 9px; }
.mini:hover { color: var(--ink); border-color: var(--line-strong); }
.add-row { color: var(--muted); border: 1.5px dashed var(--line); border-radius: 14px; padding: 12px; width: 100%; font-weight: 500; }
.add-row:hover { color: var(--ink); border-color: var(--line-strong); }
.hint { color: var(--faint); font-size: 13px; margin: 2px 0 12px; }

/* ---------- auth ---------- */

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--hairline);
  border-radius: 28px; padding: 34px 30px; box-shadow: var(--shadow); animation: pop .2s ease;
}
.auth-brand { text-align: center; font-size: 34px; margin-bottom: 2px; }
.auth-tag { text-align: center; color: var(--muted); margin: 0 0 24px; }
.auth-alt { text-align: center; color: var(--muted); font-size: 14px; margin-top: 16px; }
.auth-alt button { color: var(--ink); font-weight: 600; text-decoration: underline; }
.demo-hint { text-align: center; color: var(--faint); font-size: 12.5px; margin-top: 14px; }

.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 20px 0 8px; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.pin-dot.full { background: var(--ink); border-color: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.key {
  background: var(--card); border: 1px solid var(--hairline); border-radius: 16px;
  padding: 15px 0; font-size: 20px; font-family: var(--serif);
}
.key:hover { border-color: var(--line-strong); }
.key.blank { visibility: hidden; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; background: var(--ink); color: #F4F2EC;
  display: flex; align-items: center; justify-content: center; font-family: var(--serif);
  font-size: 22px; margin: 0 auto 12px;
}

/* ---------- spark ---------- */

.spark-eyebrow { display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; font-size: 13px; }
.spark-card { background: var(--card); border: 1px solid var(--hairline); border-radius: 18px; padding: 18px; margin: 14px 0 16px; box-shadow: var(--shadow); }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  background: var(--ink); color: #F4F2EC; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 500; z-index: 60; animation: pop .18s ease;
  box-shadow: 0 8px 24px rgba(33,32,28,.25); max-width: 88vw;
}

/* ---------- mobile ---------- */

.bottombar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(244,242,236,.94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  justify-content: space-around;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--faint); font-size: 11.5px; font-weight: 600; padding: 4px 14px; border-radius: 12px; }
.tab.active { color: var(--ink); }
.fab {
  position: fixed; right: 18px; bottom: 76px; z-index: 31; width: 56px; height: 56px;
  border-radius: 50%; background: var(--ink); color: #F4F2EC; font-size: 26px;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(33,32,28,.3);
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { padding: 24px 18px 130px; }
  .bottombar { display: flex; }
  .fab { display: flex; }
}

@keyframes sheetUp { from { transform: translateY(102%); } to { transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
