:root {
  --cream: #fbf7f2; --plum: #2b1b3d; --peri: #8c9eff; --peri-deep: #5b6cf0; --peri-soft: #e9ecff;
  --mint: #9ee6c4; --mint-soft: #e3f7ee; --butter: #ffd98a; --butter-soft: #fff3d6; --blush: #f6b8c4; --blush-soft: #fdebef;
  --surface: #fff; --muted: #6e6378; --line: #ece5dc; --shadow: 0 20px 40px -28px rgba(43, 27, 61, 0.35);
  --display: 'Bricolage Grotesque', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); color: var(--plum); font-family: var(--body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .num { font-family: var(--display); letter-spacing: -0.02em; margin: 0; line-height: 1.1; }
h1 { font-size: 30px; font-weight: 700; } h2 { font-size: 21px; font-weight: 650; } h3 { font-size: 17px; font-weight: 650; }
p { margin: 0; } a { color: var(--peri-deep); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; font-weight: 700; }
.muted { color: var(--muted); } .small { font-size: 13.5px; } .tiny { font-size: 12px; }
.row { display: flex; align-items: center; gap: 12px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.stack { display: grid; gap: 14px; } .grow { flex: 1; min-width: 0; }

/* Shell: rail, page, Guardian */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr) 400px; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--line); }
.brand { font-family: var(--display); font-weight: 750; font-size: 21px; padding: 4px 12px 18px; letter-spacing: -0.03em; }
.brand span { color: var(--peri-deep); }
.nav { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px; text-decoration: none; color: var(--plum); font-weight: 550; border: 0; background: none; width: 100%; text-align: left; }
.nav svg { width: 21px; height: 21px; flex: none; }
.nav:hover { background: #f3ece3; } .nav.on { background: var(--plum); color: var(--cream); }
.rail .who { margin-top: auto; padding: 12px; border-radius: 16px; background: #f3ece3; }
.page { padding: 30px 36px 80px; max-width: 980px; width: 100%; margin: 0 auto; }
.chat { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); }
.fab, .tabs, .chat-close { display: none; }

/* Cards */
.card { background: var(--surface); border-radius: 24px; padding: 22px; box-shadow: var(--shadow); border: 1px solid #f3ece3; }
.card.flat { box-shadow: none; }
.card.peri { background: var(--peri); border-color: transparent; }
.card.plum { background: var(--plum); color: var(--cream); border-color: transparent; } .card.plum .muted { color: #c9bfd6; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.section { margin-top: 30px; } .section > h2 { margin-bottom: 14px; }
.eyebrow { font-size: 12.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.big { font-size: 46px; } .mid { font-size: 30px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: #f3ece3; white-space: nowrap; }
.chip.mint { background: var(--mint-soft); color: #14613f; } .chip.butter { background: var(--butter-soft); color: #7a5300; } .chip.blush { background: var(--blush-soft); color: #9a2c44; } .chip.peri { background: var(--peri-soft); color: #2f3aa8; }
.btn { border: 0; border-radius: 99px; padding: 12px 20px; font-weight: 650; background: var(--plum); color: var(--cream); transition: transform 0.12s; }
.btn:hover { transform: translateY(-1px); } .btn:disabled { opacity: 0.5; transform: none; cursor: default; }
.btn.soft { background: #f3ece3; color: var(--plum); } .btn.light { background: #fff; color: var(--plum); } .btn.sm { padding: 8px 14px; font-size: 14px; }
.link { border: 0; background: none; padding: 0; color: var(--peri-deep); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.art { width: 104px; height: 104px; object-fit: contain; flex: none; mix-blend-mode: multiply; }
.source { font-size: 12px; color: var(--muted); margin-top: 10px; display: flex; gap: 6px; align-items: baseline; }
.source::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--peri); flex: none; transform: translateY(-1px); }

/* Home */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 28px; }
.hero h1 { font-size: 34px; }
.askbox { display: flex; gap: 8px; background: #fff; border-radius: 99px; padding: 7px 7px 7px 20px; margin-top: 18px; box-shadow: 0 10px 30px -18px rgba(43, 27, 61, 0.6); }
.askbox input { border: 0; outline: 0; flex: 1; min-width: 0; background: none; font-size: 16px; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.suggest button { border: 0; background: rgba(255, 255, 255, 0.55); border-radius: 99px; padding: 7px 13px; font-size: 13.5px; font-weight: 550; }
.suggest button:hover { background: #fff; }
.notice { display: grid; gap: 8px; align-content: start; border-left: 6px solid var(--peri); }
.notice.gain { border-color: var(--mint); } .notice.attention { border-color: var(--blush); } .notice.note { border-color: var(--butter); }
.notice h3 { font-size: 18px; line-height: 1.25; }
.tile { display: grid; grid-template-columns: 1fr auto; gap: 10px; text-decoration: none; color: inherit; align-items: center; transition: transform 0.15s; }
.tile:hover { transform: translateY(-2px); }

/* Lists and meters */
.list { display: grid; } .item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); } .item:first-child { border-top: 0; }
.dot { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; background: var(--peri-soft); color: #2f3aa8; }
.meter { height: 9px; border-radius: 9px; background: #f0e9df; overflow: hidden; } .meter > i { display: block; height: 100%; border-radius: 9px; background: var(--peri-deep); }
.meter.mint > i { background: #3fbf8a; } .meter.blush > i { background: #e88aa0; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; } .kv b { font-family: var(--display); font-variant-numeric: tabular-nums; }
input[type='range'] { width: 100%; accent-color: var(--peri-deep); height: 28px; }
.field { border: 1.5px solid var(--line); border-radius: 14px; padding: 11px 14px; background: #fff; width: 100%; outline: 0; } .field:focus { border-color: var(--peri); }
table { border-collapse: collapse; width: 100%; font-size: 14px; } th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 6px 8px 6px 0; }
td { padding: 8px 8px 8px 0; border-top: 1px solid var(--line); vertical-align: top; } td:first-child { color: var(--muted); } td:last-child, th:last-child { padding-right: 0; }
.standards { position: relative; height: 54px; margin-top: 6px; }
.standards .bar { position: absolute; left: 0; top: 18px; height: 14px; border-radius: 14px; background: linear-gradient(90deg, var(--peri), var(--peri-deep)); transition: width 0.25s; }
.standards .track { position: absolute; left: 0; right: 0; top: 18px; height: 14px; border-radius: 14px; background: #f0e9df; }
.standards .mark { position: absolute; top: 8px; width: 2px; height: 34px; background: var(--plum); opacity: 0.55; }
.standards .mark span { position: absolute; top: 36px; transform: translateX(-50%); font-size: 11.5px; white-space: nowrap; color: var(--muted); }

/* Guardian panel */
.chat-head { padding: 18px 20px 12px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.chat-head img { width: 44px; height: 44px; mix-blend-mode: multiply; }
.chat-body { flex: 1; overflow-y: auto; padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; padding: 11px 15px; border-radius: 20px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--plum); color: var(--cream); border-bottom-right-radius: 6px; }
.msg.guardian { align-self: flex-start; background: #f6f1ea; border-bottom-left-radius: 6px; white-space: normal; }
.msg.guardian p + p, .msg.guardian ul + p, .msg.guardian p + ul { margin-top: 9px; } .msg.guardian ul { margin: 0; padding-left: 19px; }
.working { align-self: flex-start; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.working i { width: 8px; height: 8px; border-radius: 50%; background: var(--peri-deep); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.7); } }
.bubble-card { align-self: stretch; border: 1.5px solid var(--line); border-radius: 20px; padding: 14px 16px; background: #fff; font-size: 14px; }
.bubble-card h4 { margin: 0 0 8px; font-family: var(--display); font-size: 16px; }
.bubble-card.confirm { border-color: var(--peri); background: var(--peri-soft); } .bubble-card.done { border-color: var(--mint); background: var(--mint-soft); font-weight: 550; }
.bubble-card ul { margin: 0 0 12px; padding-left: 18px; } .bubble-card pre { white-space: pre-wrap; font: inherit; background: #f6f1ea; border-radius: 12px; padding: 12px; margin: 8px 0; max-height: 260px; overflow: auto; }
.chat-foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.chat-foot .askbox { margin: 0; box-shadow: none; border: 1.5px solid var(--line); }
.chat-empty { margin: auto 0; display: grid; gap: 10px; justify-items: start; }
.chat-empty button { border: 1.5px solid var(--line); background: #fff; border-radius: 16px; padding: 10px 14px; text-align: left; font-size: 14.5px; }
.chat-empty button:hover { border-color: var(--peri); }

/* Modal */
.veil { position: fixed; inset: 0; background: rgba(43, 27, 61, 0.45); display: grid; place-items: center; padding: 18px; z-index: 50; }
.modal { background: var(--cream); border-radius: 28px; padding: 26px; width: min(480px, 100%); max-height: 90vh; overflow: auto; display: grid; gap: 14px; }
.banks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; } .banks button { border: 1.5px solid var(--line); background: #fff; border-radius: 16px; padding: 12px; display: flex; align-items: center; gap: 10px; font-weight: 600; text-align: left; }
.banks button:hover { border-color: var(--peri); }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--plum); color: var(--cream); padding: 12px 20px; border-radius: 99px; z-index: 60; font-weight: 550; box-shadow: var(--shadow); }

@media (max-width: 1180px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr) 360px; }
  .rail { padding: 22px 10px; } .rail .label, .rail .who, .brand em { display: none; } .nav { justify-content: center; padding: 12px; } .brand { padding: 4px 0 18px; text-align: center; }
}
@media (max-width: 900px) {
  .shell { display: block; } .rail { display: none; }
  .page { padding: 18px 16px 110px; }
  h1 { font-size: 26px; } .hero { grid-template-columns: 1fr; padding: 22px; } .hero h1 { font-size: 27px; } .hero .art { display: none; }
  .grid2, .grid3 { grid-template-columns: 1fr; } .big { font-size: 38px; }
  .tabs { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
  .tabs a { display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 6px 0; border-radius: 12px; }
  .tabs a svg { width: 22px; height: 22px; } .tabs a.on { color: var(--plum); background: var(--peri-soft); }
  .fab { display: flex; position: fixed; right: 16px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 25; align-items: center; gap: 8px; border: 0; border-radius: 99px; background: var(--plum); color: var(--cream); padding: 9px 18px 9px 9px; font-weight: 650; box-shadow: 0 14px 30px -10px rgba(43, 27, 61, 0.7); }
  .fab img { width: 34px; height: 34px; border-radius: 50%; background: var(--cream); }
  .chat { display: none; position: fixed; inset: 0; height: 100dvh; z-index: 40; border: 0; } .chat.open { display: flex; }
  .chat-close { display: block; margin-left: auto; border: 0; background: #f3ece3; border-radius: 99px; width: 36px; height: 36px; font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.askbox svg { width: 20px; height: 20px; display: block; }
.hero .art { background: var(--cream); border-radius: 36px; padding: 10px; mix-blend-mode: normal; }
.chat-head img { border-radius: 14px; }
.askbox .btn { flex: none; display: grid; place-items: center; }
@media (max-width: 900px) { .page > .row > .art { display: none; } }
