:root {
  --paper: #f5efe3;
  --paper-2: #efe6d4;
  --card: #fffdf8;
  --ink: #1c2638;
  --ink-2: #4b556b;
  --ink-3: #8a90a0;
  --line: #d9cfbc;
  --stamp: #b2382b;
  --stamp-2: #e7cfc9;
  --ok: #2b7a6c;
  --ok-2: #d6e9e3;
  --warn: #b7791f;
  --warn-2: #f3e4c4;
  --over: #b2382b;
  --sky: #2e5c8a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28,38,56,.06), 0 8px 24px rgba(28,38,56,.06);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--paper);
  background-image: radial-gradient(ellipse at 20% 0%, #fff8ea 0, transparent 50%), radial-gradient(ellipse at 100% 100%, #ead9bf 0, transparent 45%);
  min-height: 100vh; line-height: 1.45;
}
a { color: var(--sky); }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 34px; } h2 { font-size: 22px; } h3 { font-size: 17px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* header */
.top { display: flex; align-items: center; gap: 28px; padding: 18px 32px; border-bottom: 1px dashed var(--line); background: rgba(245,239,227,.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; border: 2px solid var(--stamp); color: var(--stamp); border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 20px; transform: rotate(-8deg); }
.brand-name { font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1; }
.brand-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tabs button { background: transparent; border: 0; padding: 8px 14px; border-radius: 999px; color: var(--ink-2); font-weight: 500; }
.tabs button.active { background: var(--ink); color: var(--paper); }
.top-right { font-size: 12px; color: var(--ok); background: var(--ok-2); padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
@media (max-width: 860px) { .top { flex-wrap: wrap; gap: 12px; padding: 14px 16px; } .tabs { margin-left: 0; order: 3; width: 100%; overflow-x: auto; } .top-right { margin-left: auto; } }

main { max-width: 1180px; margin: 0 auto; padding: 28px 32px 60px; }
@media (max-width: 860px) { main { padding: 18px 14px 50px; } }
.tab { display: none; } .tab.active { display: block; }
.foot { max-width: 1180px; margin: 0 auto; padding: 20px 32px 40px; font-size: 12px; color: var(--ink-3); border-top: 1px dashed var(--line); }

/* layout */
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.section { margin-top: 34px; }
.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 14px; }
.section-head .muted { font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); position: relative; }
.card.tear { background-image: linear-gradient(var(--card), var(--card)); }
.card.tear::before { content: ''; position: absolute; left: 20px; right: 20px; top: 62px; border-top: 1px dashed var(--line); }

/* hero / now */
.now { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
@media (max-width: 860px) { .now { grid-template-columns: 1fr; } }
.now-card { background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 24px 26px; display: flex; gap: 20px; align-items: center; overflow: hidden; position: relative; }
.now-card .flag { font-size: 54px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.now-card .label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; opacity: .65; }
.now-card .big { font-family: var(--serif); font-size: 30px; margin: 2px 0; }
.now-card .since { opacity: .8; font-size: 14px; }
.now-card button { margin-left: auto; background: transparent; color: var(--paper); border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 8px 14px; font-size: 13px; }
.now-card button:hover { background: rgba(255,255,255,.1); }
.now-card .stripe { position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border: 2px dashed rgba(255,255,255,.12); border-radius: 50%; }

.stat-card { padding: 18px 20px; }
.stat-card .k { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.stat-card .v { font-family: var(--serif); font-size: 30px; margin-top: 2px; }
.stat-card .d { font-size: 13px; color: var(--ink-2); }

/* rule cards */
.rule { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; }
.rule .ring { width: 96px; height: 96px; position: relative; }
.rule .ring svg { width: 96px; height: 96px; transform: rotate(-90deg); }
.rule .ring .num { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-family: var(--serif); line-height: 1; }
.rule .ring .num b { font-size: 26px; font-weight: 500; }
.rule .ring .num span { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; margin-top: 3px; }
.rule .title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule .title h3 { font-size: 18px; }
.rule .meta { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.rule .main { margin-top: 8px; font-size: 15px; }
.rule .main b { font-weight: 600; }
.rule .foot { margin-top: 6px; font-size: 12.5px; color: var(--ink-3); }
.rule.over .main b, .rule.over .ring b { color: var(--over); }
.rule.warn .main b, .rule.warn .ring b { color: var(--warn); }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); background: var(--paper); white-space: nowrap; }
.badge.free { color: var(--ok); border-color: var(--ok-2); background: var(--ok-2); }
.badge.visa { color: var(--stamp); border-color: var(--stamp-2); background: var(--stamp-2); }
.badge.here { color: #fff; background: var(--sky); border-color: var(--sky); }
.badge.verify { border-style: dashed; }

/* attention */
.attn { border-left: 4px solid var(--warn); }
.attn.red { border-left-color: var(--stamp); }
.attn ul { margin: 8px 0 0; padding-left: 18px; }
.attn li { margin: 4px 0; }
.linkbtn { background: none; border: 0; color: var(--sky); padding: 0; text-decoration: underline dotted; }

/* map */
.map-wrap { position: relative; }
canvas#map { width: 100%; aspect-ratio: 2 / 1; display: block; border-radius: 10px; background: #eaf1f4; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.map-legend span i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* bars */
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 170px 1fr 70px; gap: 10px; align-items: center; font-size: 14px; }
.bar .track { height: 10px; background: var(--paper-2); border-radius: 999px; overflow: hidden; position: relative; }
.bar .fill { height: 100%; border-radius: 999px; }
.bar .fill.possible { position: absolute; top: 0; opacity: .35; }
.bar .n { text-align: right; }
@media (max-width: 600px) { .bar { grid-template-columns: 120px 1fr 60px; } }

/* calendar */
.cal-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.cal-controls select, .cal-controls button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 10px; }
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.month { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.month h4 { margin: 0 0 8px; font-family: var(--serif); font-weight: 500; font-size: 15px; }
.month .wd { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 10px; color: var(--ink-3); text-align: center; margin-bottom: 4px; }
.month .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.day { aspect-ratio: 1; border-radius: 5px; font-size: 10px; display: grid; place-items: center; background: var(--paper-2); color: var(--ink-3); cursor: pointer; border: 1px solid transparent; }
.day.has { color: #fff; font-weight: 500; }
.day.uncertain { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.35) 0 3px, transparent 3px 6px); }
.day.assumed { opacity: .7; }
.day.today { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.day.future { background: transparent; border: 1px dashed var(--line); }
.day.empty { visibility: hidden; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-top: 14px; }
.legend span i, .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.trip-list { display: grid; gap: 6px; }
.trip { display: grid; grid-template-columns: 36px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.trip .flag { font-size: 22px; }
.trip .dates { color: var(--ink-2); font-size: 13px; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
tr:hover td { background: #fbf7ee; }

/* forms */
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
input[type=date] { font-family: var(--mono); font-size: 13px; }
label.f { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); }
.btn { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); border-radius: 999px; padding: 9px 16px; font-weight: 500; }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.danger { background: transparent; color: var(--stamp); border-color: var(--stamp-2); }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 6px 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* import */
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--ink-2); background: rgba(255,255,255,.4); transition: .15s; }
.drop.over { border-color: var(--sky); background: #eef4fa; }
.drop input { display: none; }
.steps { counter-reset: s; display: grid; gap: 10px; margin: 10px 0 0; padding: 0; list-style: none; }
.steps li { position: relative; padding-left: 34px; font-size: 14px; }
.steps li::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--stamp); color: var(--stamp); font-size: 12px; display: grid; place-items: center; font-family: var(--serif); }
.log { font-family: var(--mono); font-size: 12px; color: var(--ink-2); max-height: 200px; overflow: auto; background: var(--paper-2); border-radius: 8px; padding: 10px; }
.progress { height: 6px; background: var(--paper-2); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: var(--sky); width: 0; transition: width .2s; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(28,38,56,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal.hidden, .hidden { display: none; }
.modal-card { background: var(--card); border-radius: 16px; padding: 24px; width: min(520px, 100%); box-shadow: 0 30px 60px rgba(0,0,0,.25); }
.modal-card h3 { margin-bottom: 12px; }
.modal-card .row { margin-top: 14px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); }

/* onboarding */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center; padding: 36px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; padding: 22px; } }
.hero h1 { font-size: 40px; line-height: 1.1; }
.hero p { font-size: 16px; color: var(--ink-2); }
.hero .stamp-art { font-family: var(--serif); border: 2px solid var(--stamp); color: var(--stamp); border-radius: 50%; width: 180px; height: 180px; display: grid; place-items: center; text-align: center; transform: rotate(-12deg); margin: 0 auto; font-size: 14px; letter-spacing: .1em; text-transform: uppercase; line-height: 1.3; opacity: .85; }
.hero .stamp-art b { display: block; font-size: 34px; letter-spacing: 0; text-transform: none; font-weight: 500; }
details summary { cursor: pointer; color: var(--ink-2); font-size: 14px; }
.kbd { font-family: var(--mono); font-size: 12px; background: var(--paper-2); padding: 2px 6px; border-radius: 5px; }
