:root {
  --ground: #F3F2EC; --page: #E9EBE1; --card: #FFFFFF; --soft: #E4E8D8;
  --ink: #2B3120; --ink2: #4B5238; --muted: #5C6448;
  --olive: #5F6B3A; --olive-dark: #4A542C; --deep: #2F3A24;
  --teal: #2F6F6B; --teal-mid: #3E8A86; --teal-soft: #A9CCC8;
  --pink: #B9665A; --pink-ink: #7A3A30; --pink-soft: #F6E3DE;
  --gold: #C9A24B; --gold-ink: #8A6A1F; --gold-deep: #3A3418;
  --radius: 20px;
}
* { box-sizing: border-box; }
html { background: var(--ground); }
body { margin: 0; min-height: 100vh; background: var(--ground); color: var(--ink);
  font-family: Nunito, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.5;
  -webkit-text-size-adjust: 100%; }
#app { max-width: 480px; margin: 0 auto; padding: 0 0 calc(96px + env(safe-area-inset-bottom)); }
h1, h2, p { margin: 0; }
button, input { font: inherit; color: inherit; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid var(--teal-mid); outline-offset: 2px; }

.head { padding: 26px 22px 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.head .when { font-size: 14px; font-weight: 600; color: var(--muted); }
.head h1 { font-size: 30px; font-weight: 800; line-height: 1.15; margin-top: 4px; }
.iconbtn { width: 44px; height: 44px; border-radius: 22px; border: none; background: var(--soft); color: var(--ink);
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }

.stack { display: flex; flex-direction: column; gap: 14px; padding: 0 16px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.label { font-size: 13px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; display: flex; gap: 8px; align-items: center; }
.small { font-size: 14px; color: var(--ink2); line-height: 1.45; }
.tiny { font-size: 13px; color: var(--muted); }
.big { font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.big .u { font-size: 16px; font-weight: 700; }

.banner { border-radius: 16px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.45; }
.banner.pink { background: var(--pink-soft); color: var(--pink-ink); }
.banner.gold { background: #F4ECD6; color: #5A4512; }
.banner svg { flex: none; margin-top: 2px; }

.shield { background: var(--soft); border-radius: 24px; padding: 20px 18px; display: flex; gap: 18px; align-items: center; }
.shield .pct { font-size: 46px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.shield .pct span { font-size: 22px; }
.shield .status { font-size: 15px; font-weight: 700; }
.status.good { color: var(--olive-dark); } .status.warn { color: var(--pink-ink); } .status.calm { color: var(--teal); }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row { background: var(--card); border-radius: var(--radius); padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row .k { font-size: 15px; font-weight: 700; } .row .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.row.quiet .k, .row.quiet .v { color: var(--ink2); font-weight: 600; } .row.quiet .v { font-size: 18px; }

.ticker { background: var(--deep); color: var(--ground); border-radius: 24px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.ticker .label { color: #D9C48A; }
.ticker .amount { font-size: 46px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.ticker .split { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: #DCDFD0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 5px; margin-right: 6px; vertical-align: 0; }

.suggest { background: var(--pink-soft); }
.suggest .label { color: #8E4639; } .suggest p { color: #3E2420; font-size: 16px; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.bar .n { width: 18px; font-weight: 700; } .bar .val { width: 60px; text-align: right; font-variant-numeric: tabular-nums; }
.bar .track { flex: 1; height: 10px; border-radius: 5px; background: var(--page); overflow: hidden; }
.bar .fill { height: 10px; border-radius: 5px; background: #7FA6A2; }
.bar .fill.hot { background: var(--pink); }

.days { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; align-items: end; height: 110px; }
.days .col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.days .b { width: 100%; border-radius: 4px 4px 2px 2px; background: #9DB08A; min-height: 2px; }
.days .b.today { background: var(--olive); } .days .b.gap { background: repeating-linear-gradient(45deg, #E4E8D8 0 4px, #F3F2EC 4px 8px); }
.days .d { font-size: 11px; color: var(--muted); }

.goldhero { background: var(--gold-deep); color: #F7F0DC; border-radius: 24px; padding: 24px 20px; display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; }
.goldhero .tag { font-size: 13px; font-weight: 800; letter-spacing: .08em; color: #E2C77E; }
.goldhero .line { font-size: 22px; font-weight: 800; line-height: 1.3; }
.goldhero .mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; }
.goldhero .mini div { padding: 12px; border-radius: 16px; background: #4A4322; }
.goldhero .mini b { display: block; font-size: 26px; } .goldhero .mini span { font-size: 13px; color: #E8DFC2; }
.goldhero p { font-size: 15px; color: #F1E8CC; }
.goldweek { background: var(--deep); color: var(--ground); border-radius: 24px; padding: 20px 18px; display: flex; flex-direction: column; gap: 10px; }
.goldweek .label { color: #D9C48A; } .goldweek .n { font-size: 44px; font-weight: 800; line-height: 1; }
.goldweek p { color: #DCDFD0; font-size: 15px; } .goldweek b { color: var(--ground); }

.timeline { display: flex; height: 26px; border-radius: 13px; overflow: hidden; background: var(--page); }
.timeline div { height: 100%; }
.t-gold { background: var(--gold); } .t-cut { background: var(--pink); } .t-zesa { background: var(--teal-soft); } .t-none { background: repeating-linear-gradient(45deg, #E4E8D8 0 4px, #F3F2EC 4px 8px); }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink2); }

.nav { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(243, 242, 236, .96); backdrop-filter: blur(6px);
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid #E1E3D6; }
.nav div { max-width: 448px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.nav a { min-height: 48px; border-radius: 16px; background: var(--soft); color: var(--ink); font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; text-decoration: none; }
.nav a[aria-current="page"] { background: var(--olive); color: #fff; }

.chat { display: flex; flex-direction: column; gap: 12px; padding: 4px 16px 8px; }
.msg { max-width: 85%; padding: 12px 15px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--olive); color: #fff; border-radius: 18px 18px 4px 18px; }
.msg.ai { align-self: flex-start; background: var(--card); border-radius: 18px 18px 18px 4px; }
.msg.wait { color: var(--muted); font-style: italic; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 16px 8px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1.5px solid #A9B58C; background: var(--card); font-weight: 600; font-size: 14px; cursor: pointer; }
.askbar { display: flex; gap: 8px; padding: 6px 16px; }
.askbar input { flex: 1; min-width: 0; min-height: 48px; padding: 0 16px; border-radius: 24px; border: 1.5px solid #A9B58C; background: var(--card); font-size: 16px; }
.send { width: 48px; height: 48px; border-radius: 24px; border: none; background: var(--olive); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.send:disabled { opacity: .5; }
.meter { margin: 6px 16px 0; padding: 12px 14px; border-radius: 16px; background: var(--card); display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink2); }
.meter .track { height: 8px; border-radius: 4px; background: var(--page); overflow: hidden; display: flex; }
.meter .free { background: var(--olive); } .meter .extra { background: var(--pink); }

.login { max-width: 420px; margin: 0 auto; padding: 48px 22px; display: flex; flex-direction: column; gap: 18px; }
.login .brand { display: flex; align-items: center; gap: 12px; font-size: 26px; font-weight: 800; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
.field input { min-height: 50px; padding: 0 16px; border-radius: 14px; border: 1.5px solid #A9B58C; background: var(--card); font-size: 16px; font-weight: 400; }
.btn { min-height: 50px; border-radius: 16px; border: none; background: var(--olive); color: #fff; font-weight: 800; font-size: 16px; cursor: pointer; padding: 0 18px; }
.btn.alt { background: var(--soft); color: var(--ink); }
.btn:disabled { opacity: .6; }
.linkbtn { background: none; border: none; color: var(--teal); font-weight: 700; font-size: 15px; cursor: pointer; padding: 8px 0; text-align: left; min-height: 44px; }
.err { color: var(--pink-ink); font-weight: 600; font-size: 14px; min-height: 20px; }
.ok { color: var(--olive-dark); font-weight: 600; font-size: 14px; }
.owner { background: #EEF3F2; border: 1.5px dashed var(--teal-soft); }
.owner .label { color: var(--teal); }
.owner dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.owner dt { color: var(--muted); } .owner dd { margin: 0; font-weight: 600; }
.empty { padding: 40px 22px; text-align: center; color: var(--ink2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes zap { 0%, 100% { opacity: 1; transform: translateY(0); } 50% { opacity: .55; transform: translateY(-2px); } }
@keyframes glow { 0%, 100% { opacity: .45; } 50% { opacity: .95; } }
.zap { animation: zap var(--zap, 2.4s) ease-in-out infinite; }
.glow { animation: glow 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .zap, .glow { animation: none; } }
