:root {
  --ink: #211c18;
  --muted: #716860;
  --paper: #f7f2e8;
  --card: rgba(255, 255, 255, 0.82);
  --line: rgba(58, 43, 31, 0.13);
  --china: #c72b28;
  --china-dark: #8f1717;
  --gold: #f2b544;
  --france: #245aa8;
  --france-dark: #153b76;
  --blue-soft: #e9f0fb;
  --red-soft: #fae9e5;
  --green: #247254;
  --shadow: 0 18px 55px rgba(74, 48, 24, 0.11);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(199, 43, 40, 0.045) 0 49.8%, rgba(36, 90, 168, 0.045) 50.2% 100%),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.is-hidden { display: none !important; }
.page-glow { position: fixed; width: 420px; height: 420px; border-radius: 50%; filter: blur(100px); opacity: .16; pointer-events: none; z-index: -1; }
.china-glow { background: var(--china); left: -190px; top: 20%; }
.france-glow { background: var(--france); right: -190px; top: 40%; }
.app-shell { min-height: 100vh; padding-bottom: 100px; }
.topbar {
  height: 76px; padding: 0 max(20px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
  background: rgba(247, 242, 232, .86); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand-lockup, .profile-pill, .brand-mark { display: flex; align-items: center; }
.brand-lockup { gap: 12px; }
.brand-lockup p { margin: 0; font-family: Georgia, serif; font-size: 21px; font-weight: 700; }
.brand-lockup small { color: var(--muted); }
.brand-mark { width: 58px; height: 38px; overflow: hidden; border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.1); }
.brand-mark span { width: 50%; height: 100%; display: grid; place-items: center; color: white; font-size: 12px; font-weight: 800; }
.brand-mark span:first-child { background: var(--china); color: #ffdc67; }
.brand-mark span:last-child { background: var(--france); }
.brand-mark i { width: 2px; height: 100%; background: white; }
.profile-pill { border: 1px solid var(--line); background: rgba(255,255,255,.7); padding: 7px 9px 7px 8px; border-radius: 999px; gap: 9px; color: var(--ink); }
.profile-pill strong { font-size: 13px; }
.profile-pill small { color: var(--muted); display: block; text-align: left; }
.mini-seal { width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; color: white; font-size: 11px; font-weight: 800; }
.mini-seal.china { background: var(--china); color: #ffe27c; }
.mini-seal.france { background: var(--france); }
.live-strip { min-height: 38px; display: flex; justify-content: center; align-items: center; padding: 6px 16px; background: #211c18; color: white; font-size: 13px; font-weight: 700; letter-spacing: .01em; }
.live-strip.is-quiet { color: #d8d1c7; font-weight: 500; }
.live-pulse { width: 8px; height: 8px; background: #ff5c57; border-radius: 50%; margin-right: 9px; box-shadow: 0 0 0 0 rgba(255,92,87,.6); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(255,92,87,0); } 100% { box-shadow: 0 0 0 0 rgba(255,92,87,0); } }
main { width: min(1160px, calc(100% - 36px)); margin: 0 auto; padding: 42px 0; }
.view { display: none; animation: rise .25s ease; }
.view.is-active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
h1, h2, p { margin-top: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 6vw, 66px); line-height: .98; letter-spacing: -.035em; margin-bottom: 12px; }
h2 { font-family: Georgia, serif; font-size: 24px; margin: 2px 0 0; letter-spacing: -.02em; }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .18em; margin-bottom: 8px; }
.subcopy, .section-heading > p:last-child { color: var(--muted); max-width: 650px; line-height: 1.65; }
.welcome-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.streak-badge { flex: 0 0 auto; border: 1px solid rgba(242,181,68,.42); background: #fff7dc; padding: 12px 15px; border-radius: 18px; text-align: center; }
.streak-badge strong { display: block; font-family: Georgia, serif; font-size: 28px; }
.streak-badge small { color: #7c6424; }
.panel { background: var(--card); border: 1px solid rgba(255,255,255,.9); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(13px); }
.today-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-bottom: 18px; }
.today-card { padding: 24px; overflow: hidden; position: relative; min-height: 188px; }
.today-card::after { content: attr(data-symbol); position: absolute; right: -8px; bottom: -38px; font-family: Georgia, serif; font-size: 140px; opacity: .06; }
.today-card.china-card { border-top: 4px solid var(--china); }
.today-card.france-card { border-top: 4px solid var(--france); }
.card-topline { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.status-chip { border-radius: 999px; padding: 7px 10px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-chip.done { background: #e4f4ea; color: var(--green); }
.status-chip.pending { background: #f4ead9; color: #8d5e12; }
.status-chip.live { background: #fbe1df; color: var(--china-dark); }
.today-card strong.big-number { display: block; margin: 25px 0 8px; font-family: Georgia, serif; font-size: 36px; }
.today-card p { color: var(--muted); margin: 0; }
.progress-track { height: 7px; background: rgba(0,0,0,.07); border-radius: 99px; margin-top: 17px; overflow: hidden; }
.progress-track span { display: block; height: 100%; border-radius: inherit; transition: width .4s ease; }
.china-card .progress-track span { background: var(--china); }
.france-card .progress-track span { background: var(--france); }
.quick-button { margin-top: 17px; border: 0; border-radius: 12px; padding: 10px 13px; color: white; font-weight: 800; font-size: 13px; position: relative; z-index: 2; }
.china-card .quick-button { background: var(--china); }
.france-card .quick-button { background: var(--france); }
.chart-panel, .consistency-panel, .activity-panel, .ledger-panel, .request-panel { padding: 24px; }
.panel-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 22px; }
.chart-legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.chart-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.china-dot::before { background: var(--china); }
.france-dot::before { background: var(--france); }
.minute-chart { height: 230px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; padding-top: 20px; border-bottom: 1px solid var(--line); }
.chart-day { height: 100%; display: grid; grid-template-rows: 1fr auto; gap: 9px; min-width: 0; }
.bar-pair { height: 100%; display: flex; gap: 4px; align-items: end; justify-content: center; }
.bar { width: min(22px, 38%); min-height: 3px; border-radius: 7px 7px 2px 2px; position: relative; transition: height .4s ease; }
.bar.china { background: linear-gradient(var(--gold), var(--china)); }
.bar.france { background: linear-gradient(#91b7ef, var(--france)); }
.bar em { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 9px; color: var(--muted); font-style: normal; }
.chart-day label { text-align: center; color: var(--muted); font-size: 10px; }
.dashboard-lower { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; margin-top: 18px; }
.consistency-person { display: grid; grid-template-columns: 85px 1fr; gap: 12px; align-items: center; margin: 15px 0; }
.consistency-person strong { font-size: 13px; }
.heat-row { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; }
.heat-cell { aspect-ratio: 1; min-height: 14px; border-radius: 5px; background: #e5dfd5; }
.heat-cell.half { background: #efc977; }
.heat-cell.full.china { background: var(--china); }
.heat-cell.full.france { background: var(--france); }
.activity-feed { display: grid; gap: 13px; max-height: 230px; overflow: auto; }
.activity-item { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; }
.activity-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: #eee8dd; font-size: 13px; }
.activity-item p { margin: 0; line-height: 1.35; font-size: 13px; }
.activity-item time { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.empty-state { color: var(--muted); border: 1px dashed var(--line); padding: 18px; border-radius: 16px; text-align: center; }
.section-heading { margin-bottom: 28px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; align-items: start; }
.form-card { padding: 25px; display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.form-icon { width: 46px; height: 46px; display: grid; place-items: center; color: white; border-radius: 15px; font-family: Georgia, serif; font-weight: 800; }
.china-bg { background: var(--china); color: #ffe27c; }
.france-bg { background: var(--france); font-size: 11px; }
.neutral-bg { background: var(--ink); }
.wide, .timer-box, .form-note { grid-column: 1 / -1; }
.form-note { color: var(--muted); margin: -6px 0 1px; font-size: 13px; }
label, fieldset { display: grid; gap: 7px; color: #50483f; font-size: 12px; font-weight: 800; }
fieldset { border: 0; padding: 0; margin: 0; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 12px 13px; background: rgba(255,255,255,.72); color: var(--ink); outline: none; }
input:focus, textarea:focus, select:focus { border-color: #907d6b; box-shadow: 0 0 0 3px rgba(144,125,107,.12); }
textarea { resize: vertical; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: #ece6dc; padding: 4px; border-radius: 13px; }
.segmented label { display: block; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 9px; border-radius: 10px; }
.segmented input:checked + span { background: white; box-shadow: 0 2px 8px rgba(0,0,0,.08); color: var(--ink); }
.primary-button { border: 0; border-radius: 14px; padding: 13px 17px; color: white; font-weight: 800; box-shadow: 0 9px 20px rgba(0,0,0,.1); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.china-button { background: linear-gradient(135deg, var(--china), var(--china-dark)); }
.france-button { background: linear-gradient(135deg, var(--france), var(--france-dark)); }
.neutral-button { background: var(--ink); }
.rest-message { background: #e7f3ed; color: var(--green); padding: 13px; border-radius: 13px; font-size: 13px; }
.timer-box { border: 1px dashed rgba(199,43,40,.35); border-radius: 16px; background: var(--red-soft); padding: 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.timer-box strong { font-family: ui-monospace, monospace; font-size: 20px; }
.timer-box button { border: 0; background: var(--china); color: white; padding: 9px 12px; border-radius: 10px; font-weight: 800; }
.pot-layout { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; margin-bottom: 20px; }
.pot-stage { min-height: 430px; display: grid; place-items: center; position: relative; overflow: hidden; padding: 30px; }
.jar { width: 270px; height: 300px; border: 6px solid rgba(71,55,40,.58); border-top: 0; border-radius: 20px 20px 72px 72px; position: relative; overflow: hidden; background: rgba(255,255,255,.28); box-shadow: inset 15px 0 25px rgba(255,255,255,.55), inset -12px 0 24px rgba(82,53,22,.08); }
.jar-rim { position: absolute; z-index: 4; left: -17px; right: -17px; top: 0; height: 26px; border: 6px solid rgba(71,55,40,.66); border-radius: 11px; background: rgba(255,255,255,.55); }
.jar-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0%; background: linear-gradient(180deg, rgba(242,181,68,.68), rgba(199,43,40,.62)); transition: height .65s cubic-bezier(.2,.8,.2,1); }
.jar-fill::before { content: ""; position: absolute; top: -9px; left: 0; right: 0; height: 18px; background: #f2bd51; border-radius: 50%; opacity: .85; }
.jar-label { position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; text-align: center; }
.jar-label small { font-size: 10px; letter-spacing: .17em; font-weight: 900; }
.jar-label strong { font-family: Georgia, serif; font-size: 35px; margin: 5px 0; }
.jar-label span { color: #594a39; font-size: 12px; }
.pot-caption { position: absolute; bottom: 14px; color: var(--muted); font-size: 12px; }
.coin-cloud { position: absolute; inset: 0; pointer-events: none; }
.coin { position: absolute; width: 33px; height: 33px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe89c, var(--gold) 60%, #be7e16); border: 2px solid #b97810; display: grid; place-items: center; color: #74490b; font-size: 9px; font-weight: 900; box-shadow: 0 5px 11px rgba(100,65,11,.2); }
.balance-stack { display: grid; gap: 18px; }
.balance-card { padding: 24px; position: relative; overflow: hidden; }
.balance-card::before { content: ""; position: absolute; width: 90px; height: 90px; right: -30px; top: -30px; border-radius: 50%; opacity: .14; background: currentColor; }
.balance-card.red { color: #a71e1b; background: rgba(255,239,236,.86); }
.balance-card.black { color: #171717; background: rgba(255,255,255,.86); }
.balance-card.even { color: var(--green); }
.balance-card h3 { margin: 0; color: inherit; font-family: Georgia, serif; font-size: 24px; }
.balance-value { display: block; font-family: Georgia, serif; font-size: 42px; margin: 16px 0 5px; color: inherit; }
.balance-card p { color: var(--muted); font-size: 13px; }
.settle-button { border: 0; background: var(--ink); color: white; border-radius: 12px; padding: 10px 12px; font-weight: 800; width: 100%; }
.ledger { display: grid; gap: 9px; }
.ledger-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); }
.ledger-row:first-child { border-top: 0; }
.ledger-row strong { display: block; font-size: 13px; }
.ledger-row small { color: var(--muted); }
.ledger-amount { font-weight: 900; }
.ledger-status { border-radius: 999px; padding: 5px 8px; font-size: 10px; font-weight: 900; background: #f5e4df; color: var(--china-dark); }
.ledger-status.paid { background: #e5f1ea; color: var(--green); }
.exemption-grid { grid-template-columns: .85fr 1.15fr; }
.request-list { display: grid; gap: 13px; }
.request-card { border: 1px solid var(--line); border-radius: 17px; padding: 16px; }
.request-card header { display: flex; justify-content: space-between; gap: 12px; }
.request-card p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.request-card small { color: var(--muted); }
.request-actions { display: flex; gap: 8px; margin-top: 13px; }
.request-actions button { flex: 1; border-radius: 10px; padding: 9px; font-weight: 800; }
.approve { border: 0; background: var(--green); color: white; }
.reject { border: 1px solid var(--line); background: white; color: var(--ink); }
.decision-chip { padding: 5px 8px; border-radius: 99px; font-size: 9px; text-transform: uppercase; font-weight: 900; }
.decision-chip.pending { background: #fff0cd; color: #76520c; }
.decision-chip.approved { background: #e4f2e9; color: var(--green); }
.decision-chip.rejected { background: #f5e3e0; color: var(--china-dark); }
.bottom-nav { position: fixed; z-index: 30; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 6px; background: rgba(32,28,24,.94); backdrop-filter: blur(18px); border-radius: 22px; box-shadow: 0 18px 50px rgba(0,0,0,.25); }
.nav-button { width: 82px; border: 0; background: transparent; color: #b9b1a8; padding: 9px 8px; border-radius: 16px; font-size: 11px; font-weight: 700; }
.nav-button span { display: block; color: inherit; font-size: 18px; margin-bottom: 2px; }
.nav-button.is-active { color: white; background: rgba(255,255,255,.13); }
.profile-gate { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: linear-gradient(115deg, rgba(130,20,20,.93) 0 49.7%, rgba(25,64,125,.93) 50.3% 100%); backdrop-filter: blur(15px); }
.gate-card { width: min(560px, 100%); padding: 35px; background: #fbf7ef; border-radius: 30px; box-shadow: 0 30px 90px rgba(0,0,0,.3); text-align: center; }
.gate-card h1 { font-size: 44px; }
.gate-card > p:not(.eyebrow) { color: var(--muted); }
.gate-flags { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; }
.gate-flags span { width: 49px; height: 49px; display: grid; place-items: center; border-radius: 16px; background: var(--china); color: #ffdc67; font-weight: 900; }
.gate-flags span:last-child { background: var(--france); color: white; }
.gate-flags i { font-family: Georgia, serif; font-size: 24px; }
.profile-options { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 25px; }
.profile-choice { border: 1px solid var(--line); border-radius: 19px; padding: 17px; background: white; display: flex; align-items: center; gap: 12px; text-align: left; color: var(--ink); transition: transform .15s ease, box-shadow .15s ease; }
.profile-choice:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,0,0,.1); }
.profile-choice strong, .profile-choice small { display: block; }
.profile-choice small { color: var(--muted); margin-top: 3px; }
.profile-seal { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: white; flex: 0 0 auto; font-weight: 900; }
.china-choice .profile-seal { background: var(--china); color: #ffe27c; }
.france-choice .profile-seal { background: var(--france); }
.toast { position: fixed; z-index: 150; left: 50%; bottom: 105px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #211c18; color: white; padding: 12px 17px; border-radius: 13px; box-shadow: 0 15px 40px rgba(0,0,0,.25); transition: .22s ease; font-size: 13px; font-weight: 700; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #981d1b; }

@media (max-width: 760px) {
  .topbar { height: 67px; }
  .brand-lockup small { display: none; }
  main { width: min(100% - 24px, 620px); padding: 28px 0; }
  h1 { font-size: 42px; }
  .welcome-row { align-items: start; }
  .today-grid, .dashboard-lower, .form-grid, .pot-layout, .exemption-grid { grid-template-columns: 1fr; }
  .today-card { min-height: 170px; }
  .chart-panel, .consistency-panel, .activity-panel, .ledger-panel, .request-panel, .form-card { padding: 19px; }
  .minute-chart { height: 190px; gap: 5px; }
  .chart-legend { gap: 8px; font-size: 10px; }
  .bar em { display: none; }
  .pot-stage { min-height: 390px; }
  .jar { width: 230px; height: 270px; }
  .bottom-nav { width: calc(100% - 24px); bottom: max(8px, env(safe-area-inset-bottom)); justify-content: space-between; }
  .nav-button { width: 24%; }
  .profile-options { grid-template-columns: 1fr; }
  .gate-card { padding: 27px 20px; }
  .gate-card h1 { font-size: 38px; }
}

@media (max-width: 430px) {
  .profile-pill small { display: none; }
  .form-card { grid-template-columns: 1fr; }
  .form-card .wide, .timer-box, .form-note { grid-column: 1; }
  .welcome-row { display: block; }
  .streak-badge { display: inline-block; margin-top: 8px; }
  .panel-heading { align-items: start; }
  .chart-panel .panel-heading { display: block; }
  .chart-legend { margin-top: 12px; }
  .consistency-person { grid-template-columns: 68px 1fr; }
  .heat-row { gap: 3px; }
  .ledger-row { grid-template-columns: 1fr auto; }
  .ledger-status { display: none; }
}

