:root {
  --bg: #f5f7fb; --card: #ffffff; --ink: #0f172a; --muted: #64748b; --line: #e5e9f2;
  --brand: #2563eb; --brand-soft: #e8efff; --ok: #16a34a; --ok-soft: #e6f6ec; --warn: #d97706; --warn-soft: #fff3e0;
  --bad: #dc2626; --bad-soft: #fde8e8; --premium: #7c3aed; --premium-soft: #efe9fe; --info: #0891b2;
  --radius: 14px; --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .06);
  --tab-h: 60px; --top-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1220; --card: #111a2e; --ink: #e5ecff; --muted: #94a3b8; --line: #1f2a44; --brand-soft: #16254a; --ok-soft: #0f2a1c; --warn-soft: #30230a; --bad-soft: #3a1414; --premium-soft: #241a3f; --shadow: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, "PingFang SC", "Helvetica Neue", "Noto Sans SC", "Microsoft YaHei", Inter, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--brand); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
.right { text-align: right; } .center { text-align: center; } .row { display: flex; align-items: center; gap: 8px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--card); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.brand { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 800; }
.topsearch { flex: 1; display: flex; min-width: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.topsearch input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 10px; text-transform: uppercase; font-family: ui-monospace, Menlo, Consolas, monospace; }
.topsearch button { border: 0; background: var(--brand); color: #fff; padding: 0 12px; font-weight: 600; }
.lang { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 4px; font-weight: 600; font-size: 12px; max-width: 84px; }
.brandname { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
[dir="rtl"] .timeline { padding: 0 18px 0 0; border-left: 0; border-right: 2px solid var(--line); }
[dir="rtl"] .timeline li { padding: 0 12px 12px 0; }
[dir="rtl"] .timeline li::before { left: auto; right: -24px; }
[dir="rtl"] .status-card { border-left: 0; border-right: 4px solid var(--brand); }
[dir="rtl"] .right { text-align: left; }

.view { padding: 12px 12px calc(var(--tab-h) + 20px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; position: relative; }
.tabbar a .ic { font-size: 20px; line-height: 1; }
.tabbar a.active { color: var(--brand); font-weight: 600; }
.badge { position: absolute; top: 8px; right: 22%; min-width: 16px; height: 16px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card h2 { margin-bottom: 4px; }
.card .sub { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.stack > * + * { margin-top: 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.tile { background: var(--bg); border-radius: 10px; padding: 10px; text-align: center; }
.tile b { display: block; font-size: 20px; line-height: 1.1; }
.tile.ok b { color: var(--ok); } .tile.bad b { color: var(--bad); } .tile.warn b { color: var(--warn); } .tile.brand b { color: var(--brand); }
.tile span { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--muted); }
.chip.ok, .chip.approved, .chip.card_produced, .chip.card_delivered, .chip.oath { background: var(--ok-soft); color: var(--ok); }
.chip.processing, .chip.received, .chip.decision, .chip.document, .chip.transferred { background: var(--brand-soft); color: var(--brand); }
.chip.rfe, .chip.rfe_response, .chip.interview, .chip.biometrics { background: var(--warn-soft); color: var(--warn); }
.chip.denied, .chip.closed { background: var(--bad-soft); color: var(--bad); }
.chip.premium { background: var(--premium-soft); color: var(--premium); }
.chip.invalid, .chip.other { background: var(--bg); color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 9px 14px; font-weight: 600; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.premium { background: var(--premium); border-color: var(--premium); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.danger { color: var(--bad); }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 9px; font-weight: 600; color: var(--muted); font-size: 13.5px; }
.tabs button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pill.active { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.pill .lock { font-size: 10px; color: var(--premium); margin-left: 2px; }

.status-card { border-left: 4px solid var(--brand); }
.status-card .title { font-size: 16px; font-weight: 700; margin: 6px 0 4px; }
.status-card .text { font-size: 13.5px; color: var(--muted); }
.status-card .text.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 12px; }
.timeline li::before { content: ""; position: absolute; left: -24px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid var(--card); }
.timeline li.approved::before, .timeline li.card_produced::before, .timeline li.card_delivered::before { background: var(--ok); }
.timeline li.denied::before, .timeline li.closed::before { background: var(--bad); }
.timeline li.rfe::before, .timeline li.interview::before { background: var(--warn); }
.timeline .d { font-size: 12px; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.list li:last-child { border-bottom: 0; }
.list .l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.list .l span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list b { white-space: nowrap; }
.bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }

.lockwrap { position: relative; }
.lockwrap .blur { filter: blur(5px); pointer-events: none; user-select: none; opacity: .6; }
.lockbox { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; }
.lockbox .box, .paywall { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px; text-align: center; box-shadow: var(--shadow); max-width: 320px; margin: 0 auto; }
.paywall .lock-ic { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--premium-soft); color: var(--premium); font-size: 16px; margin-bottom: 8px; }
.paywall p { margin: 0 0 12px; font-weight: 600; }
.paywall .btn { margin-top: 2px; }

.plan { border: 2px solid var(--line); position: relative; }
.plan.popular { border-color: var(--brand); }
.plan.current { border-color: var(--ok); }
.plan .ribbon { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; letter-spacing: .04em; }
.plan .name { text-align: center; font-weight: 700; font-size: 16px; }
.plan.popular .name { color: var(--brand); } .plan.top .name { color: var(--premium); }
.plan .price { text-align: center; font-size: 30px; font-weight: 800; margin: 2px 0 0; }
.plan .price small { font-size: 13px; color: var(--muted); font-weight: 500; }
.plan .tag { text-align: center; color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.plan ul { list-style: none; margin: 0 0 12px; padding: 0; }
.plan li { display: flex; gap: 8px; padding: 5px 0; font-size: 13.5px; }
.plan li::before { content: ""; flex: 0 0 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--ok); }
.plan li.off { color: var(--muted); } .plan li.off::before { background: var(--line); }
.plan li b { color: var(--brand); }

.ticker { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.ticker > div { flex: 0 0 150px; scroll-snap-align: start; background: var(--bg); border-radius: 10px; padding: 10px; }
.ticker b { display: block; font-size: 13px; }
.ad { border: 1px dashed var(--line); border-radius: 10px; padding: 10px; text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 12px; }

.range { width: 100%; }
.caselist { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.caselist li { padding: 7px 10px; }
.caselist li.me { background: var(--brand-soft); position: sticky; top: 0; bottom: 0; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 16px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13.5px; z-index: 50; max-width: 90vw; }
.empty { text-align: center; padding: 28px 10px; color: var(--muted); }
.empty .big { font-size: 34px; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; margin-bottom: 12px; }
.notice.info { background: var(--brand-soft); color: var(--brand); }
.svgchart { width: 100%; height: auto; display: block; }
.ai { background: linear-gradient(135deg, var(--premium-soft), transparent); border-radius: 10px; padding: 10px; font-size: 13.5px; }
.ai .tag { font-size: 10.5px; color: var(--premium); font-weight: 700; letter-spacing: .05em; }
details summary { cursor: pointer; font-weight: 600; }
.journey { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 6px 0; }
.journey .step { flex: 0 0 92px; text-align: center; font-size: 11px; color: var(--muted); position: relative; }
.journey .step::before { content: ""; position: absolute; top: 9px; left: 0; right: 0; height: 2px; background: var(--line); }
.journey .step i { position: relative; display: inline-block; width: 18px; height: 18px; border-radius: 50%; background: var(--card); border: 2px solid var(--line); }
.journey .step.done i { background: var(--ok); border-color: var(--ok); }
.journey .step.now i { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.journey .step.done::before { background: var(--ok); }
.journey .step b { display: block; color: var(--ink); margin-top: 4px; }
@media print { .topbar, .tabbar, .toast, .card:not(:first-of-type) { display: none !important; } .view { padding: 0; } }
a.tile:hover { background: var(--brand-soft); }
details > summary { list-style: none; } details > summary::-webkit-details-marker { display: none; }
@media (min-width: 720px) { .view { padding-top: 20px; } .tiles { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); } }
