:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --text: #16181d;
  --muted: #667085;
  --border: #e2e5ea;
  --accent: #3b5bdb;
  --accent-soft: #e7ecfd;
  --danger: #c1341c;
  --danger-soft: #fdecea;
  --warn: #a35c00;
  --warn-soft: #fdf1dd;
  --ok: #1a7f4b;
  --ok-soft: #e3f5eb;
  --testing: #6b3fa0;
  --testing-soft: #f0eaf8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1c1f25;
    --surface-2: #22262d;
    --text: #e8eaed;
    --muted: #98a2b3;
    --border: #2c313a;
    --accent: #7d97f4;
    --accent-soft: #23293c;
    --danger: #f08b78;
    --danger-soft: #35211d;
    --warn: #e0b169;
    --warn-soft: #332a1a;
    --ok: #6ac48f;
    --ok-soft: #1b2c22;
    --testing: #c4a3ef;
    --testing-soft: #2c2438;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .2rem; letter-spacing: -0.01em; }
h2 { font-size: .95rem; margin: 0 0 .75rem; letter-spacing: .01em; }
p { margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.struck { text-decoration: line-through; opacity: .65; }
.hidden { display: none; }
mark { background: var(--warn-soft); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ------------------------------------------------------------------ topbar */

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border);
}
.nav { display: flex; gap: .25rem; flex: 1; }
.nav a {
  padding: .35rem .65rem;
  border-radius: 7px;
  color: var(--muted);
  font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  margin-left: .35rem;
  padding: 0 .3rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}
.search input { width: min(38vw, 320px); }
.topbar-end { display: flex; align-items: center; gap: .75rem; }
.icon-link { color: var(--muted); font-size: .88rem; }

/* -------------------------------------------------------------------- page */

.page { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1.25rem 4rem; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.detail-head { border-left: 3px solid var(--chip, var(--border)); padding-left: .85rem; }
.crumb { font-size: .82rem; color: var(--muted); margin-bottom: .15rem; }
.contacts a { color: var(--muted); text-decoration: underline; }

.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.inbox-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(16rem, .9fr); gap: 1rem; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
@media (max-width: 860px) {
  .grid.two, .inbox-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.stack .panel { margin-bottom: 0; }
.panel h2 { color: var(--muted); text-transform: uppercase; font-size: .72rem; font-weight: 700; }
.panel-alert { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.panel-danger { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.panel-foot { margin: .6rem 0 0; font-size: .85rem; }
.count {
  display: inline-block;
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 20px;
  padding: 0 .45rem;
  font-size: .7rem;
  margin-left: .2rem;
}
.summary { color: var(--text); }
.summary p { margin: 0 0 .5rem; }
.summary p:last-child { margin-bottom: 0; }
.empty { color: var(--muted); font-size: .9rem; margin: .25rem 0; }

.banner {
  padding: .6rem .85rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
  border: 1px solid transparent;
}
.banner-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.banner-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

/* ------------------------------------------------------------------- forms */

input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=search], input[type=email], input[type=password],
input[type=date], input[type=datetime-local], input[type=number], input:not([type]), select, textarea {
  width: 100%;
  padding: .42rem .6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 2.6rem; }
label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .6rem; }
label input, label select, label textarea { margin-top: .2rem; color: var(--text); }
input[type=color] { padding: 2px; height: 2.2rem; }
input[type=file] { font-size: .85rem; }
.narrow { max-width: 6rem; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 .75rem; }

.btn {
  display: inline-block;
  padding: .42rem .8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: .88rem;
  font-weight: 550;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.linkish {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: .82rem;
  text-decoration: underline;
}
.linkish:hover { color: var(--text); }
.linkish.danger:hover { color: var(--danger); }

.row-form, .filters {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
}
.row-form input[name=title] { flex: 3 1 220px; }
.row-form select, .filters select { flex: 0 1 auto; width: auto; min-width: 8rem; }
.row-form input[type=date], .row-form input[type=datetime-local] { flex: 0 1 auto; width: auto; }
.filters input[type=search] { flex: 2 1 200px; }
.quick-add { background: var(--surface); }

.new-form summary { list-style: none; cursor: pointer; }
.new-form summary::-webkit-details-marker { display: none; }
.new-form[open] summary { margin-bottom: .85rem; }
details.inline-edit { margin-top: .6rem; }
details.inline-edit > summary { cursor: pointer; color: var(--muted); font-size: .82rem; }
details.panel > summary { cursor: pointer; list-style: none; }
details.panel > summary h2 { display: inline; }
details.panel > summary::after { content: " ▾"; color: var(--muted); }
details.panel[open] > summary::after { content: " ▴"; }

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .74rem;
  padding: .1rem .45rem;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid transparent;
  white-space: nowrap;
}
a.chip:hover { text-decoration: none; border-color: currentColor; }
.chip-client { background: color-mix(in srgb, var(--chip) 15%, transparent); color: var(--chip); font-weight: 600; }
.chip-overdue { background: var(--danger-soft); color: var(--danger); }
.chip-today { background: var(--warn-soft); color: var(--warn); }
.chip-due { background: var(--surface-2); color: var(--muted); }
.chip.prio-3 { background: var(--warn-soft); color: var(--warn); }
.chip.prio-4 { background: var(--danger-soft); color: var(--danger); font-weight: 650; }

.pill {
  display: inline-block;
  font-size: .72rem;
  padding: .1rem .45rem;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
}
.pill-doing { background: var(--accent-soft); color: var(--accent); }
.pill-testing { background: var(--testing-soft); color: var(--testing); }
.pill-hold { background: var(--warn-soft); color: var(--warn); }
.pill-blocked { background: var(--danger-soft); color: var(--danger); }
.pill-done, .pill-held { background: var(--ok-soft); color: var(--ok); }
.pill-cancelled, .pill-archived { background: var(--surface-2); color: var(--muted); }
.pill-prospect { background: var(--warn-soft); color: var(--warn); }
.pill-urgent { background: var(--danger-soft); color: var(--danger); }
.pill-important { background: var(--warn-soft); color: var(--warn); }
.pill-info, .pill-unread { background: var(--accent-soft); color: var(--accent); }
.pill-read { background: var(--surface-2); color: var(--muted); }
.pill-gmail { background: #fdecea; color: #c1341c; }
.pill-linkedin { background: #e4eef8; color: #0a66c2; }
.pill-website { background: var(--testing-soft); color: var(--testing); }
.pill-calendar { background: var(--ok-soft); color: var(--ok); }
.pill-github { background: var(--surface-2); color: var(--text); }
.pill-slack { background: #f5e8f3; color: #611f69; }
.pill-call { background: var(--ok-soft); color: var(--ok); }
.pill-put { background: var(--danger-soft); color: var(--danger); }
.pill-high { background: var(--danger-soft); color: var(--danger); }
.pill-medium { background: var(--warn-soft); color: var(--warn); }
.pill-low { background: var(--surface-2); color: var(--muted); }
.pill-new { background: var(--accent-soft); color: var(--accent); }
.pill-watching { background: var(--testing-soft); color: var(--testing); }
.pill-taken { background: var(--ok-soft); color: var(--ok); }
.pill-passed, .pill-expired { background: var(--surface-2); color: var(--muted); }

@media (prefers-color-scheme: dark) {
  .pill-gmail { background: #35211d; color: #f08b78; }
  .pill-linkedin { background: #1b2838; color: #7db3e8; }
  .pill-slack { background: #2d2030; color: #d2a8d6; }
}

/* ------------------------------------------------------------------- inbox */

.alerts { list-style: none; margin: 0; padding: 0; }
.alert {
  display: flex;
  gap: .75rem;
  padding: .75rem 0;
  border-top: 1px solid var(--border);
}
.alert:first-child { border-top: none; }
.alert-main { min-width: 0; flex: 1; }
.alert-meta { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin: 0 0 .2rem; }
.alert-title { color: var(--text); font-weight: 550; display: block; word-break: break-word; }
.alert-title:hover { color: var(--accent); }
.alert.is-unread .alert-title { font-weight: 650; }
.alert.is-unread { border-left: 3px solid var(--accent); padding-left: .7rem; margin-left: -.7rem; }
.alert.severity-urgent.is-unread { border-left-color: var(--danger); }
.alert.severity-important.is-unread { border-left-color: var(--warn); }
.alert-body {
  color: var(--muted);
  font-size: .88rem;
  margin: .2rem 0 0;
  word-break: break-word;
}
.alert-actions { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .45rem; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.panel-head h2 { margin-bottom: .75rem; }

.option-idea {
  display: flex;
  gap: .75rem;
  padding: .75rem 0;
  border-top: 1px solid var(--border);
}
.option-idea:first-child { border-top: none; }
.option-main { min-width: 0; flex: 1; }
.option-symbol {
  font-weight: 700;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}
.option-idea.is-new { border-left: 3px solid var(--accent); padding-left: .7rem; margin-left: -.7rem; }
.option-idea.conviction-high.is-new { border-left-color: var(--danger); }

/* ------------------------------------------------------------------- tasks */

.tasks, .meetings, .notes, .files, .results, .client-grid, .stat-list { list-style: none; margin: 0; padding: 0; }

.task {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  padding: .45rem 0;
  border-top: 1px solid var(--border);
}
.task:first-child { border-top: none; }
.task-toggle { display: flex; }
.checkbox {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: .18rem;
  border: 1.5px solid var(--muted);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.checkbox:hover { border-color: var(--accent); }
.checkbox.checked { background: var(--ok); border-color: var(--ok); position: relative; }
.checkbox.checked::after {
  content: "";
  position: absolute;
  left: .3rem;
  top: .08rem;
  width: .25rem;
  height: .55rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.task-main { min-width: 0; flex: 1; }
.task-title { color: var(--text); font-weight: 500; display: block; word-break: break-word; }
.task-title:hover { color: var(--accent); }
.is-done .task-title { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.task-meta { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; margin-top: .15rem; }

/* ---------------------------------------------------------------- meetings */

.meeting {
  display: flex;
  gap: .85rem;
  padding: .5rem 0;
  border-top: 1px solid var(--border);
  align-items: baseline;
}
.meeting:first-child { border-top: none; }
.meeting-when { min-width: 11rem; display: flex; flex-direction: column; }
.meeting-date { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.meeting-main { min-width: 0; flex: 1; }
.meeting-title { color: var(--text); font-weight: 500; }
.meeting-title:hover { color: var(--accent); }
@media (max-width: 620px) {
  .meeting { flex-direction: column; gap: .1rem; }
  .meeting-when { min-width: 0; flex-direction: row; gap: .4rem; }
}

/* ------------------------------------------------------------------- notes */

.note-form textarea { margin-bottom: .5rem; }
.note { padding: .6rem 0; border-top: 1px solid var(--border); }
.note-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.note-actions { display: flex; gap: .6rem; align-items: center; }
.note-actions form { display: inline; }
.note-body { margin-top: .2rem; word-break: break-word; }
.note-body p { margin: 0 0 .4rem; }
.note-edit { margin-top: .5rem; }
.note-edit textarea { margin-bottom: .4rem; }

/* ------------------------------------------------------------------- files */

.upload-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.upload-form input[type=file] { flex: 1 1 200px; }
.file {
  display: flex;
  gap: .6rem;
  align-items: baseline;
  padding: .4rem 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.file-name { flex: 1 1 auto; word-break: break-all; }
.file form { display: inline; }

/* ----------------------------------------------------------------- clients */

.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; }
.client-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--chip, var(--border));
  border-radius: var(--radius);
  padding: .75rem .85rem;
  box-shadow: var(--shadow);
}
.client-name { font-weight: 600; color: var(--text); }
.client-name:hover { color: var(--accent); }
.client-card .task-meta { margin-top: .4rem; }

.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs a {
  padding: .4rem .7rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: .9rem;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ------------------------------------------------------------------- stats */

.stat-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 4.5rem;
  padding: .4rem .7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
a.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .72rem; color: var(--muted); }
.stat-list li { display: flex; justify-content: space-between; padding: .3rem 0; border-top: 1px solid var(--border); font-size: .88rem; }
.stat-list li:first-child { border-top: none; }
.stat-list span { color: var(--muted); }

/* ------------------------------------------------------------------ search */

.result { padding: .5rem 0; border-top: 1px solid var(--border); }
.result:first-child { border-top: none; }
.result-title { font-weight: 550; color: var(--text); margin-right: .4rem; }
.result-title:hover { color: var(--accent); }
.result-snippet { font-size: .85rem; color: var(--muted); margin: .15rem 0 0; word-break: break-word; }

/* ------------------------------------------------------------------- login */

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  background: #1a120c;
}
.ferment-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.ferment-still {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  animation: cellar-drift 28s ease-in-out infinite alternate;
  filter: saturate(1.05) contrast(1.05);
}
.ferment-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% 20%, transparent 20%, rgba(18, 10, 6, .55) 70%, rgba(12, 7, 4, .82)),
    linear-gradient(180deg, rgba(20, 12, 8, .15), rgba(20, 12, 8, .45));
}
.bubbles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bubble {
  position: absolute;
  bottom: -8%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 244, 214, .95), rgba(232, 184, 109, .15) 55%, transparent 70%);
  box-shadow: 0 0 8px rgba(255, 214, 140, .25);
  animation: rise linear infinite;
  opacity: 0;
}
.b1 { left: 8%; width: 10px; height: 10px; animation-duration: 11s; animation-delay: 0s; }
.b2 { left: 16%; width: 6px; height: 6px; animation-duration: 14s; animation-delay: 1.4s; }
.b3 { left: 24%; width: 14px; height: 14px; animation-duration: 9s; animation-delay: 2.1s; }
.b4 { left: 33%; width: 7px; height: 7px; animation-duration: 13s; animation-delay: .6s; }
.b5 { left: 41%; width: 11px; height: 11px; animation-duration: 10s; animation-delay: 3.2s; }
.b6 { left: 49%; width: 5px; height: 5px; animation-duration: 16s; animation-delay: 4s; }
.b7 { left: 57%; width: 13px; height: 13px; animation-duration: 8.5s; animation-delay: 1s; }
.b8 { left: 66%; width: 8px; height: 8px; animation-duration: 12s; animation-delay: 2.8s; }
.b9 { left: 74%; width: 16px; height: 16px; animation-duration: 15s; animation-delay: .3s; }
.b10 { left: 82%; width: 6px; height: 6px; animation-duration: 11.5s; animation-delay: 5s; }
.b11 { left: 90%; width: 9px; height: 9px; animation-duration: 13.5s; animation-delay: 1.8s; }
.b12 { left: 12%; width: 4px; height: 4px; animation-duration: 18s; animation-delay: 6s; }
.b13 { left: 38%; width: 12px; height: 12px; animation-duration: 9.5s; animation-delay: 4.4s; }
.b14 { left: 53%; width: 7px; height: 7px; animation-duration: 12.5s; animation-delay: 7s; }
.b15 { left: 61%; width: 5px; height: 5px; animation-duration: 17s; animation-delay: 2.5s; }
.b16 { left: 78%; width: 10px; height: 10px; animation-duration: 10.5s; animation-delay: 3.6s; }
.b17 { left: 28%; width: 8px; height: 8px; animation-duration: 14.5s; animation-delay: 5.5s; }
.b18 { left: 85%; width: 15px; height: 15px; animation-duration: 8s; animation-delay: 6.8s; }

@keyframes cellar-drift {
  from { transform: scale(1.06) translate3d(0, 0, 0); }
  to { transform: scale(1.16) translate3d(-2%, -1.5%, 0); }
}
@keyframes rise {
  0% { transform: translate3d(0, 0, 0) scale(.6); opacity: 0; }
  12% { opacity: .85; }
  70% { opacity: .7; }
  100% { transform: translate3d(18px, -110vh, 0) scale(1.15); opacity: 0; }
}
@keyframes mascot-idle {
  0%, 100% { transform: translateY(0) rotate(-.4deg); }
  50% { transform: translateY(-6px) rotate(.6deg); }
}
@keyframes foam {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 184, 109, .0); }
  50% { box-shadow: 0 0 28px 2px rgba(232, 184, 109, .28); }
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  padding: 1.5rem 1.45rem 1.35rem;
  background: color-mix(in srgb, #2a1c12 78%, transparent);
  border: 1px solid rgba(232, 184, 109, .28);
  border-radius: 18px;
  backdrop-filter: blur(14px);
  color: #f6ead7;
  text-align: center;
  animation: foam 5s ease-in-out infinite;
}
.login-card h1 {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  letter-spacing: .01em;
  color: #f3ddb0;
}
.login-card .muted { color: #d9c4a4; }
.login-card label { text-align: left; color: #ead7b8; }
.login-card input {
  background: rgba(18, 11, 7, .55);
  border-color: rgba(232, 184, 109, .28);
  color: #f6ead7;
}
.login-card .btn.primary {
  background: #c47a22;
  border-color: #c47a22;
  width: 100%;
}
.login-card .btn.primary:hover { filter: brightness(1.08); }
.login-mascot {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto .35rem;
  display: block;
  box-shadow: 0 0 0 3px rgba(232, 184, 109, .35), 0 10px 24px rgba(0, 0, 0, .35);
  animation: mascot-idle 4.6s ease-in-out infinite;
}
.login-tag { margin: 0 auto .85rem; max-width: 28ch; }

@media (prefers-reduced-motion: reduce) {
  .ferment-still, .bubble, .login-mascot, .login-card { animation: none; }
}

.login-card h1 { margin-bottom: .1rem; }
.login-card .muted { margin-bottom: 1.1rem; font-size: .88rem; }
.login-card .btn { width: 100%; margin-top: .4rem; }

.check-label {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--text);
  font-size: .88rem;
  margin: .4rem 0 .75rem;
}
.check-label input { width: auto; }

/* ------------------------------------------------------------------- board */

body.is-board {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.is-board .page-board {
  flex: 1;
  min-height: 0;
  max-width: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: .85rem 1rem .75rem;
}
body.is-board .banner { flex: 0 0 auto; }

.board-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
  flex: 0 0 auto;
}
.board-head h1 { margin-bottom: .15rem; }
.board-actions { display: flex; gap: .45rem; flex-wrap: wrap; }

.composer-panel { margin-bottom: .75rem; flex: 0 0 auto; }
.board-filters { margin-bottom: .55rem; flex: 0 0 auto; }
.board-count { margin-left: .25rem; }

.client-filters {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
  flex: 0 0 auto;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: .15rem .6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
}
.filter-chip:hover { text-decoration: none; color: var(--text); border-color: var(--muted); }
.filter-chip.active {
  background: color-mix(in srgb, var(--chip, var(--accent)) 16%, var(--surface));
  color: var(--chip, var(--accent));
  border-color: color-mix(in srgb, var(--chip, var(--accent)) 40%, var(--border));
}

.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(200px, 1fr));
  gap: .7rem;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: .25rem;
}
.board-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 200px;
  transition: border-color .15s ease, background .15s ease;
}
.board-col.is-drop {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface-2));
}
.board-col-head {
  padding: .7rem .75rem .35rem;
  flex: 0 0 auto;
}
.board-col-head h2 {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
}
.board-cards {
  flex: 1;
  min-height: 4rem;
  overflow-y: auto;
  padding: .35rem .55rem .7rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.col-empty { margin: .4rem .15rem; pointer-events: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--chip, var(--border));
  border-radius: 10px;
  padding: .6rem .65rem .55rem;
  box-shadow: var(--shadow);
  cursor: grab;
  touch-action: manipulation;
  user-select: none;
}
.card:hover { border-color: color-mix(in srgb, var(--chip, var(--border)) 50%, var(--border)); }
.card.is-dragging { opacity: .45; cursor: grabbing; }
.board.is-sorting { scroll-snap-type: none; }
.card.is-done { opacity: .72; }
.card.is-overdue { box-shadow: 0 0 0 1px color-mix(in srgb, var(--danger) 35%, transparent); }
.card-title {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-size: .92rem;
  line-height: 1.35;
  word-break: break-word;
}
.card-title:hover { color: var(--accent); text-decoration: none; }
.card.is-done .card-title { font-weight: 500; color: var(--muted); text-decoration: line-through; }
.card .card-meta { margin-top: .4rem; }
.card-move {
  display: flex;
  gap: .35rem;
  margin-top: .5rem;
}
.card-move select { width: auto; flex: 1; }
.js .card-move { display: none; }
.chip-hermes { background: var(--accent-soft); color: var(--accent); font-weight: 650; }

@media (max-width: 1280px) {
  .board {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }
  .board-col { flex: 0 0 min(86vw, 340px); scroll-snap-align: start; max-height: 100%; }
}

/* ------------------------------------------------------------------ drawer */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.36);
  z-index: 40;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 50;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 32px rgba(16, 24, 40, 0.12);
}
.drawer[hidden], .drawer-backdrop[hidden], .hermes[hidden] { display: none; }
.drawer-head, .hermes-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.drawer-head h2, .hermes-head h2 { margin: 0; text-transform: none; font-size: 1.05rem; color: var(--text); letter-spacing: -0.01em; }
.drawer-body { flex: 1; overflow: auto; padding: 1rem 1.1rem 1.25rem; }
.drawer-section { margin-bottom: 1rem; }
.drawer-section h3 {
  margin: 0 0 .45rem;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.comment {
  padding: .55rem 0;
  border-top: 1px solid var(--border);
}
.comment-head { display: flex; justify-content: space-between; gap: .5rem; font-size: .78rem; color: var(--muted); }
.comment-body { margin-top: .2rem; word-break: break-word; }
.comment-form textarea { margin: .35rem 0 .45rem; }
.drawer-error { color: var(--danger); font-size: .85rem; }

/* ------------------------------------------------------------------ hermes */

.hermes {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 55;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 32px rgba(16, 24, 40, 0.12);
}
.hermes-head-actions { display: flex; align-items: center; gap: .65rem; }
.hermes-log {
  flex: 1;
  overflow: auto;
  padding: .85rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .7rem;
}
.hermes-bubble {
  max-width: 92%;
  padding: .55rem .7rem;
  border-radius: 10px;
  font-size: .9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.hermes-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}
.hermes-bubble.assistant {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.hermes-bubble.error { background: var(--danger-soft); color: var(--danger); border: 1px solid transparent; }
.hermes-actions { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.hermes-form {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .85rem 1.1rem 1.1rem;
  border-top: 1px solid var(--border);
}
.hermes-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.suggest {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .2rem .55rem;
  font-size: .78rem;
  color: var(--muted);
  cursor: pointer;
}
.suggest:hover { color: var(--text); border-color: var(--muted); }
.hermes-pending { color: var(--muted); font-size: .85rem; font-style: italic; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .5rem;
  padding: .55rem 0;
  border-top: 1px solid var(--border);
  font-size: .88rem;
}
.activity-item:first-child { border-top: none; }
.token-value {
  font-family: var(--mono);
  font-size: .82rem;
  margin: .4rem 0;
}
.token-list li { align-items: center; gap: .75rem; }
.token-list form { margin: 0; }
pre.code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem .85rem;
  overflow: auto;
  font-family: var(--mono);
  font-size: .8rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
