:root {
  --paper: #fff8f6;
  --paper-2: #ffffff;
  --side: #fff1eb;
  --soft: #f6e5de;
  --ink: #221a16;
  --muted: #574239;
  --line: #dec0b4;
  --primary: #9c3f00;
  --primary-2: #c05410;
  --green: #366644;
  --green-soft: #e7f6ea;
  --warn: #8a5011;
  --warn-soft: #ffdcc0;
  --shadow: 0 4px 24px -4px rgba(180, 140, 110, 0.12);
  --display: "Manrope", "PingFang SC", "Microsoft YaHei", sans-serif;
  --body: "Plus Jakarta Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  font-size: 20px;
  line-height: 1;
  user-select: none;
}

a { color: inherit; }

.shell { min-height: 100vh; }

.side {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  width: 176px;
  height: 100vh;
  padding: 16px 8px 12px;
  background: var(--side);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: width 0.3s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 4px 12px;
  border-bottom: 1px solid rgba(246, 229, 222, 0.9);
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  object-position: center 28%;
  flex: 0 0 auto;
  background: var(--paper);
}

.brand-text { min-width: 0; display: flex; flex-direction: column; }
.mark {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
}
.side-note { margin-top: 2px; }

.side-head {
  display: flex;
  align-items: center;
  gap: 4px;
}

.side-toggle {
  width: 28px;
  height: 28px;
  margin-left: auto;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.side-toggle:hover { background: var(--soft); color: var(--primary); }
.side-toggle svg { width: 16px; height: 16px; }

.side-note, .db-label, .meta, .who {
  color: var(--muted);
  font-size: 13px;
}

.side nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  overflow: auto;
  flex: 1;
}

.side nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.side nav a:hover { background: var(--soft); color: var(--ink); }
.side nav a.is-on {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.side-foot { display: flex; flex-direction: column; gap: 8px; padding: 8px 4px 0; }
.db-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  background: var(--paper-2);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}
.db-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--green);
  flex: 0 0 auto;
}
.db-label {
  margin: 0;
  word-break: break-all;
  font-size: 11px;
  line-height: 1.3;
}

.logout { margin: 0; }
.logout button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logout button:hover { background: var(--soft); color: var(--ink); }

.shell.is-collapsed .side { width: 72px; }
.shell.is-collapsed .brand-text,
.shell.is-collapsed .nav-label,
.shell.is-collapsed .logout-label,
.shell.is-collapsed .db-label { display: none; }
.shell.is-collapsed .side-toggle svg { transform: scaleX(-1); }
.shell.is-collapsed .main { margin-left: 72px; }

button, .stack-form input, .stack-form textarea, .inline-form input, .login-card input {
  font: inherit;
}

button {
  border: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
button:hover { background: var(--primary-2); }

.stack-form, .inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack-form { flex-direction: column; align-items: stretch; margin-top: 12px; }
.stack-form label, .login-card label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.stack-form input, .stack-form textarea, .inline-form input, .login-card input {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
}
.check { flex-direction: row !important; align-items: center; color: var(--ink) !important; }
.reminder { border-top: 1px solid var(--line); padding-top: 12px; }
.form-actions { display: flex; gap: 8px; }
.account-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.result { white-space: pre-wrap; background: var(--paper); border-radius: 8px; padding: 12px; overflow: auto; }

.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  width: min(420px, calc(100% - 32px));
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 { font-family: var(--display); font-weight: 600; margin: 0 0 8px; }

.main {
  min-width: 0;
  margin-left: 176px;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 40px;
  background: rgba(255, 248, 246, 0.85);
  backdrop-filter: blur(16px);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.search {
  flex: 1;
  max-width: 32rem;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-2);
  border-radius: 999px;
  padding: 8px 16px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}
.search .material-symbols-outlined { color: var(--line); }

.search input,
.user-switch select {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 2px 0;
  font: inherit;
}
.search input:focus { outline: none; }

.top-actions { display: flex; align-items: center; gap: 12px; }
.btn-new {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
}
a.btn-new:hover, button.btn-new:hover { background: var(--primary-2); color: #fff; }
.btn-account {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--paper-2);
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
}
a.btn-account:hover { background: var(--soft); color: var(--ink); }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: #ffdbcb;
  color: var(--primary);
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
}

.user-switch label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.user-switch select {
  width: auto;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 8px;
  padding: 8px 10px;
}

main { padding: 24px 40px 48px; }

.hero h1,
.page-head h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 32px;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: 0 0 8px;
}

.eyebrow {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  margin: 22px 0 8px;
  list-style: none;
}

.stats li,
.panel,
.card-link,
.card-block,
.timeline a {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.stats li { padding: 14px 16px; }
.stats strong { display: block; font-size: 22px; }
.stats span { color: var(--muted); font-size: 13px; }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.panel { padding: 16px 18px 8px; }
.panel h2,
.card-top h2 {
  font-size: 16px;
  margin: 0;
}

.page-head { margin: 18px 0; }
.page-head p { margin: 0; color: var(--muted); }

.cards, .rows, .timeline, .week {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.card-link, .card-block { display: block; padding: 16px; text-decoration: none; }
.card-link p, .card-block p { margin: 8px 0 0; }
.card-top, .rows li, .sheet li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.rows li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.rows li span, .timeline p {
  color: var(--muted);
  min-width: 0;
}

.timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline a { display: block; padding: 14px 16px; text-decoration: none; }
.timeline time { display: block; font-variant-numeric: tabular-nums; }
.timeline p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 6px 0 0;
}

.sheet li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.sheet { border-top: 1px solid var(--line); }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--soft);
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.pill.is-good { background: var(--green-soft); color: var(--green); }
.pill.is-warn { background: var(--warn-soft); color: var(--warn); }

.bar, .meter {
  height: 6px;
  background: var(--soft);
  border-radius: 99px;
  margin-top: 8px;
  overflow: hidden;
}

.bar span, .meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #fdb16a, var(--primary-2), var(--primary));
  border-radius: 99px;
}
.meter.lg { height: 8px; max-width: 280px; }

.week { display: flex; gap: 6px; margin-top: 12px; }
.week li {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  display: grid;
  place-items: center;
}
.week li.is-done { background: var(--green); color: white; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
}
.filters button.is-on { background: var(--primary); color: #fff; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}
.facts div {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 2px 0 0; }

.prose, .lead { white-space: pre-wrap; }
.log-body {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  font-size: 17px;
}

.empty { color: var(--muted); }
.warn { color: var(--warn); }
.back a { color: var(--muted); }

details summary { cursor: pointer; color: var(--green); margin-top: 8px; }

.table-wrap { overflow-x: auto; border: 0; border-radius: 16px; background: var(--paper-2); box-shadow: var(--shadow); }
.table-wrap:has(.project-table) { overflow: visible; }
.list { width: 100%; border-collapse: collapse; min-width: 640px; }
.list th, .list td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--soft); vertical-align: top; }
.list th { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; background: #fff1eb; }
.list tr:last-child td { border-bottom: 0; }
.list a { text-decoration: none; }
.list a:hover { text-decoration: underline; }
.actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.actions form, .inline-form { margin: 0; }
a.ghost, button.ghost, button.danger {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
button.ghost:hover, a.ghost:hover { background: var(--soft); color: var(--ink); }
button.danger { color: var(--warn); }
button.danger:hover { background: var(--warn-soft); color: var(--warn); }
.editor { margin: 0 0 16px; }
.editor > summary { color: var(--ink); font-weight: 600; }
.editor-form, .inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}
.editor-form {
  margin-top: 12px;
  padding: 14px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.editor-form label, .stack-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  min-width: 140px;
  flex: 1;
}
.editor-form label.wide, .editor-form .wide { flex-basis: 100%; }
.editor-form input, .editor-form textarea, .editor-form select,
.inline-form input, .inline-form select, .list select {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  font: inherit;
}
.editor-form textarea { min-height: 72px; width: 100%; }
.subhead { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 22px 0 8px; }
.subhead h2 { margin: 0; font-size: 16px; }

.page-head.split {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

button.name-link {
  background: none;
  color: var(--ink);
  border: 0;
  border-radius: 0;
  padding: 0;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
  word-break: break-word;
}

button.name-link:hover { color: var(--primary); }

.page-head h1 button.name-link {
  font-size: inherit;
  line-height: inherit;
  font-family: inherit;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}

.tag-chip-form,
.tag-add { margin: 0; }

.tag-chip-form {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--soft);
  border-radius: 999px;
  padding: 1px 2px 1px 10px;
  font-size: 13px;
}

.tag-chip-form button,
.tag-box .tag-chip button,
button.icon-close {
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0 6px;
}

button.icon-close {
  border: 0;
  font-size: 22px;
  line-height: 1;
  padding: 0 4px;
}

.tag-add input {
  width: 8.5em;
  border: 1px dashed var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--ink);
  font: inherit;
}

.tag-box {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 6px;
}

.tag-box .tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--soft);
  color: var(--ink);
  border-radius: 999px;
  padding: 2px 4px 2px 10px;
  font-size: 13px;
}

.editor-form .tag-entry {
  border: 0;
  background: transparent;
  padding: 4px 6px;
  min-width: 9em;
  flex: 1;
  outline: none;
}

dialog.modal {
  width: min(680px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(29, 26, 22, 0.18);
}

dialog.modal::backdrop { background: rgba(29, 26, 22, 0.38); }

dialog.modal .editor-form {
  margin: 0;
  border: 0;
  padding: 18px 20px 20px;
  background: transparent;
  border-radius: 0;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.modal-head h2 {
  margin: 0;
  font-size: 22px;
  font-family: var(--display);
  font-weight: 600;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--paper-2);
  box-shadow: var(--shadow);
}

.task-item { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.task-item:last-child { border-bottom: 0; }

.task-row,
.record-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.task-row .name-link { font-weight: 600; }
.task-row .actions { margin-left: auto; }
.task-meta { color: var(--muted); font-size: 13px; }

.record-list {
  list-style: none;
  margin: 8px 0 0 10px;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--line);
}

.record-row { padding: 6px 0; }
.record-row .name-link { flex: 1 1 160px; }
.record-row form { margin: 0 0 0 auto; }
.record-list .empty { margin: 2px 0 4px; font-size: 13px; }

.desk {
  max-width: 1560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.banner, .focus-card, .board, .aside-card, .motto {
  background: var(--paper-2);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.banner {
  position: relative;
  overflow: hidden;
  padding: 24px;
}
.banner::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 280px;
  height: 280px;
  border-radius: 99px;
  background: radial-gradient(circle, rgba(255, 182, 147, 0.35), transparent 70%);
  pointer-events: none;
}
.banner-row, .focus-head, .board-head, .aside-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}
.banner-copy { position: relative; z-index: 1; min-width: 0; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.kicker i {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--green);
  display: inline-block;
}
.banner h1 {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 8px 0;
}
.summary { margin: 0; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.summary strong { color: var(--primary); font-weight: 600; }
.summary .plain { color: var(--ink); }
.summary .ok { color: var(--green); display: inline-flex; align-items: center; gap: 4px; }
.dot-sep { color: var(--line); }

.gauge-box {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--side);
  border-radius: 12px;
  padding: 16px 20px;
  flex: 0 0 auto;
}
.gauge { position: relative; width: 56px; height: 56px; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 600;
  line-height: 1;
}
.gauge-label small { font-size: 9px; color: var(--line); font-weight: 600; }
.gauge-copy { display: flex; flex-direction: column; }
.gauge-copy strong { font-size: 14px; }
.gauge-copy span { color: var(--primary); font-size: 12px; font-weight: 600; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
}
.stack { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.focus-card { padding: 24px; position: relative; overflow: hidden; }
.focus-card h2 { margin: 4px 0; font-family: var(--display); font-size: 22px; }
.focus-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--soft);
  color: var(--primary);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}
.focus-kicker i { width: 6px; height: 6px; border-radius: 99px; background: var(--primary); }
.readout { font-family: var(--display); font-size: 40px; font-weight: 600; color: var(--primary); letter-spacing: -0.02em; }
.readout span { color: var(--line); font-size: 14px; font-weight: 600; margin-left: 8px; }
.focus-link { color: inherit; text-decoration: none; }
.focus-link:hover { color: var(--primary); }

.board, .aside-card { padding: 20px 22px; }
.board h2, .aside-card h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
}
.count-pill {
  background: var(--soft);
  color: var(--muted);
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}
.plan { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.plan li, .habit-row, .bill-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: #fff1eb;
  border-radius: 12px;
  padding: 12px 14px;
}
.plan a { color: inherit; text-decoration: none; font-weight: 600; }
.plan a:hover { color: var(--primary); }
.plan .meta, .habit-row .meta, .bill-row .meta { margin: 2px 0 0; }
.plan-main, .habit-main { min-width: 0; }

.shortcuts { display: flex; flex-wrap: wrap; gap: 8px; }
.shortcuts a {
  text-decoration: none;
  background: var(--side);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}
.shortcuts a:hover { background: var(--soft); }

.memo { margin: 12px 0 0; white-space: pre-wrap; }
.spend-total {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 600;
  margin: 8px 0 0;
}
.spend-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 88px;
  margin-top: 16px;
}
.spend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.spend-col b {
  display: block;
  width: 100%;
  border-radius: 8px 8px 4px 4px;
  background: #ffdcc0;
  min-height: 4px;
}
.spend-col.is-today b { background: var(--primary); }
.spend-col span { font-size: 11px; color: var(--muted); font-weight: 600; }
.bill-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bill-row { background: var(--paper); }

.flow { list-style: none; margin: 16px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--soft); display: flex; flex-direction: column; gap: 14px; }
.flow li { position: relative; }
.flow li::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--line);
}
.flow time { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.flow strong { display: block; }
.flow .is-now::before { background: var(--primary); }

.motto {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
}
.motto img { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; object-position: center 28%; }
.motto p { margin: 0; }
.motto .quote { font-family: var(--display); font-size: 16px; margin-top: 4px; }

.page-card {
  background: var(--paper-2);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 8px 8px 16px;
}

.stat-row { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  background: var(--paper-2);
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
  color: var(--muted);
  font-weight: 600;
}
.stat-chip strong { color: var(--ink); font-family: var(--display); }
.stat-chip.is-on { background: var(--primary); color: #fff; }
.stat-chip.is-on strong { color: #fff; }

.project-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: var(--paper-2);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.project-toolbar label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.project-toolbar .toolbar-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.project-toolbar select, .toolbar-search {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
}
.project-toolbar select,
.project-toolbar .toolbar-search,
.project-toolbar .toolbar-action {
  height: 40px;
  box-sizing: border-box;
}
.project-toolbar select { padding: 0 10px; min-width: 8.5em; }
.toolbar-search { display: flex; flex-direction: row; align-items: center; gap: 6px; padding: 0 12px; min-width: min(280px, 100%); }
.project-toolbar .toolbar-search { padding: 0 4px 0 12px; flex: 1 1 240px; max-width: 360px; }
.toolbar-search input { border: 0; background: transparent; padding: 8px 0; width: 100%; font: inherit; color: var(--ink); }
.toolbar-search input:focus { outline: none; }
.project-toolbar .search-go {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.project-toolbar .search-go .material-symbols-outlined { font-size: 18px; color: #fff; }
.toolbar-count { margin: 0; flex: 1; white-space: nowrap; }
.project-toolbar .ghost, .project-toolbar button { display: inline-flex; align-items: center; gap: 4px; }
.project-toolbar .toolbar-action {
  padding: 0 14px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
}
.project-title { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.project-copy { min-width: 0; max-width: 100%; }
.project-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
button.project-name.name-link { word-break: normal; }
.project-goal {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.avatar.sm { width: 36px; height: 36px; flex: 0 0 auto; }
.project-table { table-layout: fixed; width: 100%; }
.project-table .col-name { width: 29%; }
.project-table .col-tags { width: 15%; }
.project-table .col-status { width: 9%; }
.project-table .col-progress { width: 18%; }
.project-table .col-date { width: 12%; }
.project-table .col-actions { width: 17%; }
.project-table th,
.project-table td { white-space: nowrap; vertical-align: middle; padding: 12px 14px; }
.project-table td:first-child { white-space: normal; }
.project-table .tag-row { margin-top: 0; flex-wrap: nowrap; }
.project-table td.actions {
  display: table-cell;
  text-align: right;
  vertical-align: middle;
}
.project-table td.actions > * {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 6px;
}
.project-table td.actions > :first-child { margin-left: 0; }
.progress-cell { display: flex; align-items: center; gap: 8px; }
.progress-cell .meter { width: 72px; margin: 0; flex: 0 0 auto; }
.progress-cell .meta { white-space: nowrap; }
.row-menu { position: relative; }
.row-menu > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: transparent;
}
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 6;
  min-width: 196px;
  background: var(--paper-2);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(34, 26, 22, 0.12);
  padding: 6px;
}
.row-menu-panel form { margin: 0; }
.row-menu-panel button, .row-menu-panel a {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  text-decoration: none;
  font-size: 13px;
}
.row-menu-panel button:hover, .row-menu-panel a:hover { background: var(--soft); color: var(--ink); }
.pager { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.pager p { margin: 0; }
.pager-links { display: flex; gap: 6px; flex-wrap: wrap; }
.pager-links a { text-decoration: none; min-width: 32px; text-align: center; padding: 6px 8px; border-radius: 8px; background: var(--paper-2); }
.pager-links a.is-on { background: var(--primary); color: #fff; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .banner-row, .gauge-box { flex-wrap: wrap; }
}

.habit-head {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.habit-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.habit-title h1 { margin: 0; }
.count-badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #baefc4;
  color: #205030;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}
.live-pill i {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--green);
}
.habit-tools { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; margin-left: auto; }
.habit-tools .toolbar-search {
  flex: 0 1 260px;
  width: 260px;
  min-width: 180px;
  background: var(--paper-2);
  box-shadow: var(--shadow);
  border-color: transparent;
}
.habit-tools .btn-new { flex: 0 0 auto; white-space: nowrap; }

.line-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: nowrap; }
.line-actions form, .line-actions .inline-form { margin: 0; }
.brief { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 36rem; }
.clip-date, .clip-title { white-space: nowrap; }
.fold-cell { padding: 0 !important; }
.fold-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.fold-summary::-webkit-details-marker { display: none; }
.fold-summary::marker { content: ""; }
.fold-summary strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fold-body { padding: 0 16px 14px; }
.fold-body .prose { margin: 0 0 8px; }
.rich-editor { display: flex; flex-direction: column; gap: 8px; }
.rich-bar { display: flex; gap: 6px; }
.rich-bar button {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
}
.rich-bar button:hover { background: var(--soft); color: var(--ink); }
.rich-body {
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--paper);
  outline: none;
}
.rich-body:focus { border-color: var(--primary); }
.rich-body img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 8px 0; }
.req { color: #ba1a1a; }

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.metric-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--paper-2);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.metric-kicker {
  margin: 0;
  color: #8b7267;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.metric-value {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}
.metric-value span { color: var(--muted); font-size: 14px; font-weight: 500; }
.metric-value.is-primary { color: var(--primary); }
.metric-note { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.metric-note.is-good { color: var(--green); font-weight: 600; }
.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--side);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.metric-icon .material-symbols-outlined { font-size: 26px; }
.metric-icon.is-warm { color: var(--warn); }
.metric-icon.is-green { background: #baefc4; color: #205030; }
.material-symbols-outlined.filled { font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }

.habit-board {
  background: var(--paper-2);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.habit-board-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 241, 235, 0.65);
}
.habit-board-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.habit-board-title h2 { margin: 0; font-size: 18px; font-family: var(--display); font-weight: 600; }
.habit-legend { display: flex; flex-wrap: wrap; gap: 14px; color: #8b7267; font-size: 12px; font-weight: 600; }
.habit-legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 4px; background: var(--soft); display: inline-block; }
.swatch.is-done { background: var(--green); }
.swatch.is-today { background: rgba(156, 63, 0, 0.16); box-shadow: inset 0 0 0 1px var(--primary); }
.habit-board .table-wrap { box-shadow: none; border-radius: 0; background: transparent; }
.habit-board .empty { margin: 0; padding: 28px 18px; }
.habit-table th.center, .habit-table td.center { text-align: center; }
.habit-table .actions { justify-content: flex-end; }
.streak-num { color: var(--primary); font-weight: 600; white-space: nowrap; }
.week.matrix { margin: 0; justify-content: center; gap: 6px; }
.week.matrix li {
  width: 32px;
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
}
.week.matrix li .material-symbols-outlined { font-size: 12px; }
.week.matrix li.is-today {
  background: rgba(156, 63, 0, 0.14);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}
button.checkin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}
button.checkin:hover { background: var(--primary-2); color: #fff; }
button.checkin .material-symbols-outlined { font-size: 16px; }
.checked-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(54, 102, 68, 0.14);
  color: var(--green);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.checked-badge .material-symbols-outlined { font-size: 16px; }

dialog.modal.habit-modal { width: min(960px, calc(100vw - 32px)); }
.modal-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.modal-title h2 { margin: 0; }
.modal-title p { margin: 2px 0 0; }
.accent-bar { width: 4px; height: 24px; border-radius: 99px; background: var(--primary); flex: 0 0 auto; }
dialog.modal.habit-modal .habit-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 18px;
  align-items: start;
}
dialog.modal.habit-modal .habit-form > label,
dialog.modal.habit-modal .habit-form > .span-2,
dialog.modal.habit-modal .habit-form > .span-3,
dialog.modal.habit-modal .habit-form > .habit-actions {
  min-width: 0;
  flex: none;
}
dialog.modal.habit-modal .habit-form .span-2 { grid-column: span 2; }
dialog.modal.habit-modal .habit-form .span-3 { grid-column: 1 / -1; }
.habit-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--soft);
  padding-top: 12px;
  margin-top: 4px;
}

@media (max-width: 860px) {
  .side {
    position: static;
    width: auto;
    height: auto;
  }
  .shell.is-collapsed .side { width: auto; }
  .main, .shell.is-collapsed .main { margin-left: 0; }
  .shell.is-collapsed .brand-text,
  .shell.is-collapsed .nav-label,
  .shell.is-collapsed .logout-label,
  .shell.is-collapsed .db-label { display: initial; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .top { height: auto; flex-direction: column; align-items: stretch; padding: 12px 16px; }
  main, .top { padding-left: 16px; padding-right: 16px; }
  .hero h1, .page-head h1, .banner h1 { font-size: 26px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .metric-row, dialog.modal.habit-modal .habit-form { grid-template-columns: 1fr; }
  dialog.modal.habit-modal .habit-form .span-2,
  dialog.modal.habit-modal .habit-form .span-3 { grid-column: auto; }
}
