/* Sishoody — calm, discreet, mobile-first. */
:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --ink: #2a2730;
  --ink-2: #514c5a;
  --muted: #7f7986;
  --line: #e7e2da;
  --line-strong: #d6cfc4;
  --accent: #5d5480;
  --accent-hover: #4e4670;
  --accent-ink: #ffffff;
  --accent-soft: #eeebf5;
  --sage: #4f7261;
  --sage-soft: #e7efe9;
  --amber: #85621f;
  --amber-soft: #f6eedb;
  --danger: #9b3d3d;
  --danger-soft: #f7e7e4;
  --shadow: 0 1px 2px rgba(42, 39, 48, .05), 0 2px 8px rgba(42, 39, 48, .04);
  --radius: 14px;
  --radius-sm: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17161b; --surface: #1f1d24; --surface-2: #25232b; --ink: #ece9f1; --ink-2: #c6c0ce;
    --muted: #958f9d; --line: #322f39; --line-strong: #423e4a; --accent: #b0a6d6; --accent-hover: #c1b8e2;
    --accent-ink: #17161b; --accent-soft: #2b2738; --sage: #93b8a4; --sage-soft: #1d2923; --amber: #dcb874;
    --amber-soft: #2c2619; --danger: #e5a198; --danger-soft: #34201f;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans); font-size: 16px; line-height: 1.55;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; color: var(--ink); }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p + p { margin-top: 10px; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.header {
  position: fixed; inset: 0 0 auto 0; height: 60px; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 20px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.logo:hover { color: var(--ink); }
.logo svg { color: var(--accent); }
.logo-text { font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.header-right { display: flex; align-items: center; gap: 6px; }
.icon-link {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px; color: var(--ink-2); text-decoration: none;
}
.icon-link:hover { background: var(--surface-2); color: var(--ink); }
.dot-badge {
  position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border: 0; background: none; border-radius: 8px; color: var(--ink); text-decoration: none;
  font: inherit; font-size: 15px; text-align: left; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); }
.menu-panel .danger { color: var(--danger); }
.menu-panel hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu-panel form { margin: 0; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: 14px;
}
.avatar.lg { width: 44px; height: 44px; font-size: 17px; }
.avatar.anon { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line-strong); }

/* ---------- Layout ---------- */
.layout { padding-top: 60px; min-height: 100vh; }
.sidebar {
  position: fixed; top: 60px; bottom: 0; left: 0; width: 232px; padding: 18px 12px;
  border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 2px;
  border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 15px;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent); }
.nav-sep { height: 1px; background: var(--line); margin: 12px 8px; }
.content { margin-left: 232px; padding: 32px 28px 72px; }
.container { max-width: 720px; margin: 0 auto; }
.container.narrow { max-width: 460px; }
.layout-public .content { margin-left: 0; }

.mobile-nav {
  display: none; position: fixed; inset: auto 0 0 0; z-index: 50;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.mobile-nav-items { display: flex; justify-content: space-around; }
.mobile-nav-item {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600;
}
.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-item .dot-badge { top: 0; right: calc(50% - 20px); }

@media (max-width: 820px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 20px 16px calc(90px + env(safe-area-inset-bottom)); }
  .mobile-nav { display: block; }
  .header { padding: 0 12px 0 16px; }
  h1 { font-size: 24px; }
}

/* ---------- Page bits ---------- */
.page-header { margin-bottom: 20px; }
.page-header .eyebrow { margin-bottom: 4px; }
.page-header p { color: var(--ink-2); margin-top: 6px; }
.page-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); text-decoration: none; margin-bottom: 12px; }
.back-link:hover { color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.section { margin-top: 28px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-title h2 { font-size: 18px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card.flush { padding: 0; overflow: hidden; }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card + .card { margin-top: 12px; }
.card h3 + p { margin-top: 4px; }

.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--ink); font-size: 14.5px;
}
.notice svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.notice.sage { background: var(--sage-soft); } .notice.sage svg { color: var(--sage); }
.notice.amber { background: var(--amber-soft); } .notice.amber svg { color: var(--amber); }
.notice.danger { background: var(--danger-soft); } .notice.danger svg { color: var(--danger); }
.notice strong { display: block; margin-bottom: 2px; }

.messages { margin-bottom: 18px; }
.messages .notice + .notice { margin-top: 8px; }

/* ---------- Lists ---------- */
.list { list-style: none; }
.list-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line);
  color: inherit; text-decoration: none;
}
.list-item:first-child { border-top: 0; }
a.list-item:hover { background: var(--surface-2); color: inherit; }
.list-item .title { font-weight: 600; color: var(--ink); }
.list-item .sub { font-size: 14px; color: var(--muted); }
.list-item .chev { color: var(--muted); flex-shrink: 0; }
.list-item.unread .title::after {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  margin-left: 8px; vertical-align: middle;
}

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.chip.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.sage { background: var(--sage-soft); border-color: transparent; color: var(--sage); }
.chip.amber { background: var(--amber-soft); border-color: transparent; color: var(--amber); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { padding: 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.stat .num { font-family: var(--serif); font-size: 26px; font-weight: 600; line-height: 1.1; }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 2px; }

.empty { text-align: center; padding: 36px 20px; color: var(--ink-2); }
.empty svg { color: var(--muted); margin: 0 auto 10px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 15px; max-width: 380px; margin: 0 auto 16px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; font-size: 15px;
  text-decoration: none; cursor: pointer; transition: background .15s ease;
}
.btn:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
form.inline { display: inline; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field > label, .field > .label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; color: var(--ink); }
.field .help { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.field .error, .errorlist { color: var(--danger); font-size: 14px; margin-top: 6px; list-style: none; }
.optional { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url],
select, textarea {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; line-height: 1.4;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=file] { font: inherit; font-size: 14px; color: var(--ink-2); max-width: 100%; }
.code-input { font-family: ui-monospace, Menlo, monospace; font-size: 24px !important; letter-spacing: .35em; text-align: center; }

.choices { display: grid; gap: 8px; }
.choices.inline { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.choice {
  position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 15px; line-height: 1.35;
}
.choice:hover { border-color: var(--accent); }
.choice input { margin-top: 2px; accent-color: var(--accent); width: 18px; height: 18px; flex-shrink: 0; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice .choice-sub { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.fieldset { border: 0; padding: 0; margin: 0; }
.fieldset + .fieldset { margin-top: 8px; }
.form-card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.form-card-title .num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.photo-preview { margin-top: 10px; max-width: 220px; border-radius: 12px; border: 1px solid var(--line); }
.search-bar { display: flex; gap: 8px; }
.search-bar input { flex: 1; }
@media (max-width: 520px) { .search-bar { flex-direction: column; } }

/* ---------- Subject ---------- */
.subject-head { display: flex; gap: 14px; align-items: center; }
.subject-mark {
  width: 52px; height: 52px; border-radius: 16px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-family: var(--serif); font-size: 22px;
}
.subject-mark.sm { width: 40px; height: 40px; border-radius: 12px; font-size: 17px; }
.link-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.request-photo { border-radius: 12px; max-height: 360px; object-fit: contain; background: var(--surface-2); border: 1px solid var(--line); }

/* ---------- Results ---------- */
.response { padding: 18px 20px; }
.response + .response { border-top: 1px solid var(--line); }
.response-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.qa { margin-top: 10px; }
.qa dt { font-size: 13.5px; color: var(--muted); }
.qa dd { margin: 2px 0 10px; font-weight: 500; }
.quote { white-space: pre-wrap; padding: 12px 14px; border-left: 3px solid var(--line-strong); background: var(--surface-2); border-radius: 0 10px 10px 0; }
.response-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- Steps ---------- */
.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.steps span { height: 4px; flex: 1; border-radius: 4px; background: var(--line); }
.steps span.on { background: var(--accent); }
.principles { list-style: none; display: grid; gap: 14px; }
.principles li { display: flex; gap: 12px; }
.principles svg { flex-shrink: 0; color: var(--accent); margin-top: 2px; }
.principles strong { display: block; }
.principles span { color: var(--ink-2); font-size: 15px; }

/* ---------- Diagram (preview) ---------- */
.reach { display: grid; gap: 10px; }
.reach-ring {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
}
.reach-ring .ring-dot { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.reach-ring.r0 .ring-dot { background: var(--accent); color: var(--accent-ink); }
.reach-ring.r1 .ring-dot { background: var(--accent-soft); color: var(--accent); }
.reach-ring.r2 .ring-dot { background: var(--surface-2); color: var(--ink-2); border: 1px dashed var(--line-strong); }
.reach-ring.off { opacity: .55; }

/* ---------- Messages ---------- */
.thread { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.theirs { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble.mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.bubble .when { display: block; font-size: 11.5px; opacity: .7; margin-top: 4px; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.composer textarea { min-height: 44px; height: 44px; }

/* ---------- Public ---------- */
.hero { text-align: center; padding: 40px 0 24px; }
.hero h1 { font-size: 36px; max-width: 560px; margin: 0 auto; }
.hero p { color: var(--ink-2); max-width: 520px; margin: 14px auto 24px; font-size: 17px; }
.hero .btn-row { justify-content: center; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 28px; }
.feature-grid .card h3 { font-size: 16px; margin: 8px 0 4px; }
.feature-grid .card p { font-size: 14.5px; color: var(--ink-2); }
.feature-grid svg { color: var(--accent); }
.auth-card { max-width: 440px; margin: 12px auto; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .lead { color: var(--ink-2); margin-bottom: 20px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 15px; color: var(--muted); }
.footer { text-align: center; padding: 28px 16px; color: var(--muted); font-size: 13px; }
.footer a { color: var(--muted); }
@media (max-width: 520px) { .hero h1 { font-size: 28px; } .hero { padding-top: 20px; } }
.prose h2 { font-size: 19px; margin: 24px 0 8px; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 20px; }
.prose li + li { margin-top: 6px; }
