:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #12233f;
  --muted: #5b6b82;
  --line: #d8e0ec;
  --navy: #0b2447;
  --gold: #c9a227;
  --orange: #f47b20;
  --green: #2f9e44;
  --red: #c92a2a;
  --shadow: 0 8px 24px rgba(11, 36, 71, 0.08);
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.hint { font-size: 0.8rem; margin-top: 12px; }
code { background: #eef2f8; padding: 1px 6px; border-radius: 6px; }
.msg { min-height: 1.2em; color: var(--red); margin-top: 8px; }
.msg.ok { color: var(--green); }

.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, #0b2447, #1f3a5f 55%, #2a4a73); }
.login-card { width: min(420px, 100%); background: #fff; border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.brand h1 { margin: 0; font-size: 1.5rem; color: var(--navy); }
.brand p { margin: 2px 0 0; }
.logo { width: 48px; height: 48px; border-radius: 12px; background: var(--navy); color: var(--gold); display: grid; place-items: center; font-weight: 800; }
.pill { display: inline-block; background: #fff7e6; color: #8a6d1d; border: 1px solid #f0dfb0; border-radius: 999px; padding: 4px 10px; font-size: 0.78rem; margin-bottom: 16px; }
#login-form label { display: block; font-size: 0.85rem; font-weight: 600; margin: 10px 0; }
#login-form input { width: 100%; margin-top: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.primary { background: var(--navy); color: #fff; border: 0; border-radius: 12px; padding: 12px 16px; width: 100%; font-weight: 700; cursor: pointer; margin-top: 8px; }
.primary:active { transform: scale(0.99); }
.linkish { background: none; border: 0; color: var(--navy); text-decoration: underline; cursor: pointer; padding: 0; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--navy); color: #fff; }
.top-title { flex: 1; min-width: 0; }
.top-title strong { display: block; }
.top .muted { color: #b7c4d8; }
.ghost { background: transparent; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.home-btn { font-size: 1.1rem; width: 40px; padding-left: 0; padding-right: 0; }

.screen { padding: 18px 16px calc(28px + var(--safe-b)); max-width: 960px; margin: 0 auto; }
.page-h { margin: 4px 0 6px; font-size: 1.35rem; }

.biz-grid { display: grid; gap: 12px; margin: 16px 0; }
@media (min-width: 720px) { .biz-grid { grid-template-columns: repeat(3, 1fr); } }
.biz-tile { text-align: left; border: 0; border-radius: var(--radius); padding: 18px; color: #fff; cursor: pointer; box-shadow: var(--shadow); min-height: 140px; display: flex; flex-direction: column; justify-content: space-between; }
.biz-tile strong { font-size: 1.2rem; }
.biz-tile .sub { opacity: 0.9; font-size: 0.9rem; margin-top: 4px; }
.biz-tile .meta { font-size: 0.8rem; opacity: 0.85; margin-top: 16px; }
.combined-card { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; box-shadow: var(--shadow); }
.combined-card p { margin: 4px 0 0; }
.chev { font-size: 1.4rem; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.card.soft { box-shadow: none; }
.card h3 { margin: 0 0 8px; font-size: 1rem; }
.integ-list { margin: 0; padding-left: 18px; }
.integ-list li { margin: 4px 0; font-size: 0.9rem; }
.badge { display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 2px 8px; border-radius: 999px; background: #eef2f8; color: var(--muted); }
.badge.stub { background: #fff4e6; color: #a35c00; }
.badge.ok { background: #e6f6ea; color: #1b7a32; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 12px; position: sticky; top: 56px; background: var(--bg); z-index: 10; -webkit-overflow-scrolling: touch; }
.tabs button { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 12px; cursor: pointer; white-space: nowrap; color: var(--ink); }
.tabs button.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat .lbl { font-size: 0.78rem; color: var(--muted); }
.stat .val { font-size: 1.25rem; font-weight: 800; margin-top: 4px; }

.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.right { text-align: right; }
.pos { color: var(--green); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.warn { border-color: #f0dfb0; background: #fff7e6; }
form.inline { display: grid; gap: 10px; }
form.inline label { font-size: 0.85rem; font-weight: 600; display: grid; gap: 4px; }
form.inline input, form.inline select, form.inline textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.notice { background: #eef6ff; border: 1px solid #c9daf0; color: #1c3f66; border-radius: 12px; padding: 10px 12px; font-size: 0.88rem; margin: 8px 0 14px; }
.notice.warn { background: #fff7e6; border-color: #f0dfb0; color: #7a5a10; }
.split { display: grid; gap: 12px; }
@media (min-width: 800px) { .split.two { grid-template-columns: 1fr 1fr; } }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }
