:root {
  --milk: #F5F0E8;        /* page */
  --foam: #FFFCF8;        /* raised surfaces */
  --latte: #E4DBCF;       /* sidebar */
  --latte-deep: #D6C9B9;
  --roast: #241A15;       /* ink */
  --roast-soft: #6B5E55;  /* secondary ink */
  --cherry: #D9502F;      /* primary accent: persimmon */
  --cherry-tint: #F8DFD6;
  --crema: #C8902E;       /* warmth / hot */
  --crema-tint: #F3E5C8;
  --cardamom: #2E5B4E;    /* success */
  --cardamom-tint: #DCE8E2;
  --iced: #6F8A9C;        /* going cold */
  --iced-tint: #DDE6EC;
  --line: #E4DBCF;

  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--roast);
  background: var(--milk);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cherry); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cherry); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; letter-spacing: -0.005em; }
h1 { font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 21px; line-height: 1.25; }
h3 { font-size: 17px; }
p { margin: 0; }
.muted { color: var(--roast-soft); }
.small { font-size: 13px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--foam);
  cursor: pointer; text-decoration: none; color: var(--roast);
  font-weight: 500; font-size: 14px; white-space: nowrap;
}
.btn:hover { border-color: var(--roast-soft); }
.btn-primary { background: var(--cherry); border-color: var(--cherry); color: #FFF; font-weight: 600; }
.btn-primary:hover { background: #B8411F; border-color: #B8411F; }
.btn-ghost { background: transparent; border-color: transparent; padding: 6px 10px; }
.btn-ghost:hover { background: var(--latte); border-color: transparent; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-danger { color: #8E2A2A; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- sign-in ---------- */
.signin {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.signin-art {
  background: var(--roast); color: var(--milk);
  padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.signin-art .brand { color: var(--milk); }
.signin-art h1 { font-size: clamp(38px, 5vw, 60px); max-width: 11ch; color: var(--milk); }
.signin-art p { max-width: 38ch; color: #C9BBAE; font-size: 17px; margin-top: 18px; }
.ring { position: absolute; border-radius: 50%; border: 14px solid rgba(217, 80, 47, .22); }
.signin-form { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.signin-card { width: 100%; max-width: 360px; display: grid; gap: 14px; }
.signin-card h2 { margin-bottom: 4px; }
.provider-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--foam); font-weight: 500; cursor: pointer; text-decoration: none; color: var(--roast);
}
.provider-btn:hover { border-color: var(--roast-soft); }
.provider-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--roast-soft); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.notice { background: var(--crema-tint); border-radius: var(--r-md); padding: 10px 14px; font-size: 13px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--latte); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; text-decoration: none; color: var(--roast); }
.brand img { width: 34px; height: 34px; }
.brand span { font-family: var(--display); font-weight: 800; font-size: 18px; line-height: 1.05; letter-spacing: -0.01em; }
.nav-group { display: grid; gap: 2px; }
.nav-label { font-size: 12px; color: var(--roast-soft); padding: 14px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-md);
  color: var(--roast); text-decoration: none; font-weight: 500; font-size: 14.5px;
}
.nav-link:hover { background: var(--latte-deep); }
.nav-link[aria-current="page"] { background: var(--roast); color: var(--milk); }
.nav-link .count { margin-left: auto; font-size: 12px; color: var(--roast-soft); font-weight: 500; }
.nav-link[aria-current="page"] .count { color: var(--latte-deep); }
.nav-link .badge { margin-left: auto; background: var(--cherry); color: #FFF; border-radius: 999px; font-size: 11px; padding: 1px 7px; }
.nav-link .ext { margin-left: auto; width: 14px; height: 14px; opacity: .6; }
.sidebar-foot { margin-top: auto; padding-top: 16px; display: grid; gap: 6px; }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-md); text-decoration: none; color: var(--roast); }
.me-chip:hover { background: var(--latte-deep); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 12px; font-weight: 600; color: #FFF7F0; background: var(--cherry); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.main { min-width: 0; }
.topbar {
  display: flex; gap: 12px; align-items: center; padding: 16px 36px;
  border-bottom: 1px solid var(--line); background: var(--milk); position: sticky; top: 0; z-index: 5;
}
.search { flex: 1; max-width: 420px; position: relative; }
.search input {
  width: 100%; padding: 9px 14px 9px 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--foam);
}
.search .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--roast-soft); }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; }
.menu-btn { display: none; }
.page { padding: 32px 36px 64px; max-width: 1180px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head p { margin-top: 6px; }

/* ---------- panels ---------- */
.panel { background: var(--foam); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 10px; gap: 12px; }
.panel-body { padding: 4px 22px 18px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--cherry); cursor: pointer; font-weight: 500; font-size: 14px; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }

/* ---------- home ---------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; }
.stack { display: grid; gap: 22px; align-content: start; }
.home-grid > *, .stack > *, .cal-grid > * { min-width: 0; }
.tally { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 26px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tally a { flex: 1 1 140px; padding: 16px 20px 16px 0; text-decoration: none; color: var(--roast); }
.tally a + a { padding-left: 20px; border-left: 1px solid var(--line); }
.tally b { font-family: var(--display); font-weight: 800; font-size: 30px; display: block; line-height: 1.1; }
.tally span { font-size: 13px; color: var(--roast-soft); }

/* the warmth shelf: the signature element */
.shelf { padding: 8px 22px 22px; }
.mugs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 18px 10px; }
.mug { display: grid; justify-items: center; gap: 6px; text-align: center; text-decoration: none; color: var(--roast); padding: 6px 4px; border-radius: var(--r-md); }
.mug:hover { background: var(--milk); }
.mug svg { width: 64px; height: 64px; overflow: visible; }
.mug .who { font-size: 13px; font-weight: 500; line-height: 1.2; }
.mug .when { font-size: 12px; color: var(--roast-soft); }
.shelf-board { height: 10px; border-radius: 0 0 6px 6px; background: var(--latte); margin: 4px -6px 0; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--roast-soft); margin-top: 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
@media (prefers-reduced-motion: no-preference) {
  .steam path { animation: rise 2.8s ease-in-out infinite; }
  .steam path:nth-child(2) { animation-delay: .9s; }
  @keyframes rise { 0% { opacity: 0; transform: translateY(4px); } 40% { opacity: .9; } 100% { opacity: 0; transform: translateY(-6px); } }
}

.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 500; }
.row .sub { font-size: 13px; color: var(--roast-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 10px; border-radius: 999px; background: var(--latte); color: var(--roast); white-space: nowrap; }
.pill.overdue { background: var(--cherry-tint); color: var(--cherry); }
.pill.today { background: var(--crema-tint); color: #7A5512; }
.pill.done { background: var(--cardamom-tint); color: var(--cardamom); }
.pill.cold { background: var(--iced-tint); color: #3F5868; }
.empty { padding: 22px 0; color: var(--roast-soft); }
.empty .btn { margin-top: 12px; }

.pipeline { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--latte); margin: 6px 0 12px; }
.pipeline span { display: block; }
.goal-cup { display: flex; align-items: center; gap: 16px; }
.goal-cup svg { width: 54px; height: 54px; flex: none; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; font-size: 13px; color: var(--roast-soft); padding: 12px 14px; border-bottom: 1px solid var(--line); }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--milk); }
.who-cell { display: flex; align-items: center; gap: 10px; }
.clamp { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.temp-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar select, .toolbar input { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--foam); }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--latte); border-radius: var(--r-lg); padding: 12px; min-height: 220px; }
.col h3 { font-family: var(--body); font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; padding: 2px 4px 10px; }
.card { background: var(--foam); border-radius: var(--r-md); padding: 12px; margin-bottom: 10px; border: 1px solid var(--line); cursor: pointer; text-align: left; width: 100%; }
.card:hover { border-color: var(--roast-soft); }
.card .title { font-weight: 600; }
.card .sub { font-size: 13px; color: var(--roast-soft); }

/* ---------- calendar ---------- */
.cal-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.day-head { font-family: var(--display); font-size: 16px; padding-top: 14px; }
.cal-embed { width: 100%; height: 560px; border: 0; border-radius: var(--r-lg); background: var(--foam); }

/* ---------- forms / modal ---------- */
.form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
label.field input, label.field select, label.field textarea {
  padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: #FFF; font-weight: 400; font-size: 15px;
}
label.field textarea { min-height: 90px; resize: vertical; }
.field-error { color: #8E2A2A; font-size: 12.5px; font-weight: 400; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(43, 27, 21, .45); display: grid; place-items: center; padding: 20px; z-index: 50;
}
.modal { background: var(--foam); border-radius: var(--r-lg); width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto; padding: 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }
.modal-foot .right { display: flex; gap: 10px; margin-left: auto; }
@media (prefers-reduced-motion: no-preference) {
  .modal { animation: pour .18s ease-out; }
  @keyframes pour { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
}

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--roast); color: var(--milk);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60;
}
#toast.show { opacity: 1; }

.profile-head { display: flex; align-items: center; gap: 18px; }
.profile-head .avatar { width: 72px; height: 72px; font-size: 24px; }
.settings-list { display: grid; gap: 22px; }
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ext-card { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; color: var(--roast); background: var(--foam); }
.ext-card:hover { border-color: var(--roast-soft); }
.ext-card .sub { font-size: 13px; color: var(--roast-soft); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .home-grid, .cal-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .signin { grid-template-columns: 1fr; }
  .signin-art { padding: 36px 28px; min-height: 300px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(43, 27, 21, .35); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .topbar .actions .btn-label { display: none; }
  .page { padding: 24px 16px 56px; }
  h1 { font-size: 28px; }
  .form-row { grid-template-columns: 1fr; }
  .tally a { flex-basis: 45%; }
  .tally a + a { border-left: 0; padding-left: 0; }
}

.tones { display: flex; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--foam); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 13px; font-weight: 500; }
.chip[aria-checked="true"] { background: var(--roast); color: var(--milk); border-color: var(--roast); }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 22px; align-items: start; }
.editor-grid > * { min-width: 0; }
.ai-panel { position: sticky; top: 92px; }
.ai-panel h2 { display: flex; align-items: center; gap: 8px; }
.feedback { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.feedback li { font-size: 14px; line-height: 1.45; }
.feedback .pill { margin-right: 4px; }
.suggestion { margin-top: 16px; padding: 14px; border-radius: var(--r-md); background: var(--milk); border: 1px solid var(--line); }
.suggestion pre { white-space: pre-wrap; font-family: var(--body); font-size: 14px; line-height: 1.55; margin: 0; }
button:disabled { opacity: .55; cursor: progress; }
@media (max-width: 1180px) { .editor-grid { grid-template-columns: 1fr; } .ai-panel { position: static; } }

.notepad { width: 100%; min-height: 440px; padding: 16px 18px; border-radius: var(--r-md); border: 1px solid var(--line); background: #fff; font-size: 15.5px; line-height: 1.7; resize: vertical; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.checklist input { margin-top: 3px; accent-color: var(--cardamom); }
.checklist input:checked + span { color: var(--roast-soft); text-decoration: line-through; }
