/* Munshian VAT: the munshian.com look (Plus Jakarta Sans, navy and sky blue, rounded cards, pill buttons) */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(/fonts/plus-jakarta-sans-latin.woff2) format('woff2');
}
:root {
  /* Brand */
  --primary: #114688;
  --primary-hover: #0d3a72;
  --primary-press: #0a2f5d;
  --navy: #192B4F;
  --navy-2: #0F1D38;
  --accent: #13B5EA;
  --accent-hover: #2FC4F5;
  --accent-soft: #E3F6FD;
  --coral: #EA5246;

  /* Surfaces */
  --bg: #F5F8FC;
  --card: #FFFFFF;
  --subtle: #F5F8FC;
  --blue-surface: #EAF2FB;

  /* Text */
  --text: #192B4F;
  --text-2: #5B6B85;
  --text-3: #98A2B3;

  /* Lines */
  --line: #E3E8EF;
  --line-strong: #CDD5E1;

  /* Status */
  --ok: #067647;
  --ok-bg: #E7F8EF;
  --ok-line: #ABEFC6;
  --err: #B42318;
  --err-bg: #FEF3F2;
  --err-line: #FECDCA;
  --warn: #93370D;
  --warn-bg: #FFFAEB;
  --warn-line: #FEDF89;

  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 16px;
  --pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 28px -14px rgba(16, 24, 40, 0.16);
  --shadow-md: 0 30px 60px -20px rgba(15, 29, 56, 0.55);
  --focus: 0 0 0 3px rgba(19, 181, 234, 0.25);
  --hero: radial-gradient(700px 300px at 90% 0%, rgba(19, 181, 234, 0.28), transparent 60%),
          radial-gradient(600px 300px at 0% 100%, rgba(122, 90, 248, 0.18), transparent 60%),
          linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 14.5px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1 { font-size: 28px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); margin: 0 0 8px; }
h2 { font-size: 18px; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; color: var(--navy); margin: 32px 0 12px; }
p { margin: 0 0 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
strong { font-weight: 700; }
code { font: 12.5px var(--mono); background: var(--subtle); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--navy); }
pre { white-space: pre-wrap; word-break: break-word; font: 12.5px/1.6 var(--mono); background: var(--subtle); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; color: var(--navy); }
ul, ol { padding-left: 20px; margin: 0 0 14px; }
li { margin: 4px 0; }
.muted { color: var(--text-2); font-size: 13px; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Header: dark navy bar, pill menu (as in the ledger) */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--navy-2); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.topbar-inner { max-width: 1160px; margin: 0 auto; height: 64px; padding: 0 24px; display: flex; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: flex-end; gap: 8px; color: #fff; font-weight: 700; font-size: 15.5px; letter-spacing: -0.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { display: block; height: 34px; width: auto; }
.env { font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; padding: 3px 10px; border-radius: var(--pill); background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); white-space: nowrap; }
.topbar nav { display: flex; gap: 2px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border-radius: var(--pill); color: #EAF1FB; font-weight: 600; font-size: 14.5px; white-space: nowrap; transition: background-color .15s, color .15s; }
.topbar nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; text-decoration: none; }
.topbar nav a[aria-current="page"] { color: #fff; background: rgba(19, 181, 234, 0.18); box-shadow: inset 0 0 0 1px rgba(19, 181, 234, 0.35); }
.topbar nav svg { width: 16px; height: 16px; flex: none; }
.topbar form { margin-left: auto; }
.signout { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; height: 34px !important; padding: 0 14px !important; border: 1px solid rgba(255, 255, 255, 0.4) !important; border-radius: var(--pill) !important; color: #fff !important; font-weight: 600 !important; }
.signout:hover { background: rgba(255, 255, 255, 0.1) !important; text-decoration: none !important; }
.signout svg { width: 16px; height: 16px; }

/* Page */
main { max-width: 1160px; margin: 0 auto; padding: 36px 24px 64px; }
.page-head { margin-bottom: 24px; }
.page-head p { color: var(--text-2); max-width: 720px; margin: 0; }
.page-head p + p { margin-top: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 20px 24px; margin-bottom: 20px; }
.card > :last-child { margin-bottom: 0; }
.card-title { font-size: 15.5px; font-weight: 700; color: var(--navy); margin: 20px 0 10px; }
.card-title:first-child { margin-top: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-title { padding: 16px 20px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; }
.back { margin-top: 24px; font-size: 14px; }

/* Signed-out screens: the website's hero, with a white card on top */
body.auth { min-height: 100vh; background: var(--hero); background-attachment: fixed; position: relative; }
body.auth::before { content: ''; position: fixed; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px); background-size: 48px 48px; -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent); mask-image: linear-gradient(to bottom, #000 30%, transparent); }
body.auth .topbar { position: relative; background: transparent; border-bottom-color: transparent; }
body.auth main { position: relative; max-width: 480px; padding-top: 40px; }
body.auth .card { padding: 36px; border: 0; border-radius: 20px; box-shadow: var(--shadow-md); }
body.auth h1 { font-size: 26px; }
body.auth .page-head { margin-bottom: 20px; }
body.auth .stack button { height: 46px; font-size: 15px; background: var(--accent); border-color: var(--accent); color: var(--navy-2); box-shadow: 0 8px 20px -6px rgba(19, 181, 234, 0.6); }
body.auth .stack button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.auth-foot { text-align: center; margin-top: 20px; }
body.auth .auth-foot { color: rgba(255, 255, 255, 0.8); }
body.auth .auth-foot a { color: #fff; font-weight: 600; }

/* Buttons */
.button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px; border: 1px solid var(--primary); border-radius: var(--pill);
  background: var(--primary); color: #fff; font: 700 14px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: 0 8px 18px -10px rgba(17, 70, 136, 0.8); transition: background-color .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.button:hover, button:hover { background: var(--primary-hover); border-color: var(--primary-hover); text-decoration: none; transform: translateY(-1px); }
.button:active, button:active { background: var(--primary-press); }
.button:focus-visible, button:focus-visible { outline: none; box-shadow: var(--focus); }
button:disabled { background: var(--line-strong); border-color: var(--line-strong); box-shadow: none; transform: none; cursor: not-allowed; }
.button.secondary { background: var(--card); color: var(--navy); border-color: var(--line-strong); box-shadow: none; }
.button.secondary:hover { background: var(--subtle); }
button.link { height: auto; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--primary); font-weight: 600; }
button.link:hover { background: none; transform: none; text-decoration: underline; text-underline-offset: 3px; }
button.link:focus-visible { box-shadow: none; outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }

/* Forms */
label { color: var(--text-2); font-size: 13px; font-weight: 600; }
input, select {
  font: 400 14px var(--font); color: var(--text); height: 40px; padding: 0 12px;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--text-3); }
input:hover, select:hover { border-color: #b4bfcf; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input[type="checkbox"] { width: 16px; height: 16px; padding: 0; margin: 0; box-shadow: none; accent-color: var(--primary); cursor: pointer; flex: none; }
input[type="file"] { height: auto; padding: 6px; width: 100%; max-width: 420px; color: var(--text-2); }
input[type="file"]::file-selector-button { font: 700 13px var(--font); height: 30px; padding: 0 14px; margin-right: 12px; border: 1px solid var(--line-strong); border-radius: var(--pill); background: #fff; color: var(--navy); cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--line); }
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin: 0; }
.filters label { display: flex; flex-direction: column; gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.stack label { display: flex; flex-direction: column; gap: 6px; }
.stack button { width: 100%; margin-top: 4px; }
input[name="code"] { font-variant-numeric: tabular-nums; letter-spacing: 0.2em; font-size: 16px; }

/* Messages */
.error, .notice { display: block; border: 1px solid; border-radius: var(--r-md); padding: 12px 14px; margin: 0 0 16px; font-size: 14px; }
.error { background: var(--err-bg); border-color: var(--err-line); color: var(--err); }
.error strong { color: var(--err); }
.error pre { margin: 10px 0 0; background: #fff; border-color: var(--err-line); color: var(--navy); }
.notice { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.problems { margin: 6px 0 0; padding-left: 16px; font-size: 13px; color: var(--err); }
.problems li { margin: 2px 0; }

/* Status tags */
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; line-height: 22px; padding: 0 10px; border-radius: var(--pill); border: 1px solid; white-space: nowrap; }
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.open { background: var(--err-bg); border-color: var(--err-line); color: var(--err); }
.tag.done { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 700; color: var(--text-2); background: var(--subtle); white-space: nowrap; padding-top: 10px; padding-bottom: 10px; }
tbody tr:last-child > td { border-bottom: 0; }
.table-wrap > table > tbody > tr:hover > td { background: #FAFBFD; }
td .muted { font-size: 12.5px; }
tr.detail td { padding-top: 0; }
tr.has-errors + tr.detail td, tr:has(+ tr.detail) td { border-bottom: 0; }
.table-wrap > table > tbody > tr:has(+ tr.detail):hover > td, .table-wrap > table > tbody > tr:has(+ tr.detail):hover + tr.detail > td,
.table-wrap > table > tbody > tr.detail:hover > td { background: #FAFBFD; }
table.boxes { width: auto; min-width: 360px; margin: 8px 0 4px; border: 1px solid var(--line); border-radius: var(--r-md); border-collapse: separate; border-spacing: 0; overflow: hidden; }
table.boxes td { padding: 6px 12px; font-size: 13px; border-bottom: 1px solid var(--line); background: var(--card) !important; }
table.boxes tr:last-child td { border-bottom: 0; }
table.boxes td:first-child { color: var(--text-2); white-space: nowrap; }
details summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--primary); font-size: 13px; font-weight: 600; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
details[open] summary::before { transform: rotate(45deg); }
td form.inline { display: inline; margin-left: 10px; }
form.inline { display: inline; margin-left: 8px; }

.pdf-link { white-space: nowrap; font-weight: 500; }

/* Upload summary */
.summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 6px; }
.summary .file { font-weight: 600; color: var(--navy); }
.summary .count { color: var(--text-2); }
.summary .count strong { color: var(--navy); }

/* Declaration */
.declaration { margin-top: 4px; padding: 20px 24px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.declaration h2 { margin: 0 0 8px; font-size: 16px; }
.declaration p { color: var(--text-2); }
.declaration label { display: flex; gap: 10px; align-items: flex-start; color: var(--text); font-size: 14px; font-weight: 400; line-height: 1.5; margin-bottom: 18px; }
.declaration label input { margin-top: 3px; }
.declaration p:last-child { margin: 0; }

/* Dashboard */
.connection { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.connection p { margin: 8px 0 0; }
.connection .actions { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 16px 20px; }
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.stat-note { font-size: 12px; color: var(--text-3); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.dash-grid h2 { margin-top: 24px; }
.quick { padding: 6px; }
.quick a { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); color: var(--navy); transition: background-color .15s; }
.quick a:hover { background: var(--subtle); text-decoration: none; }
.quick a > svg { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: var(--accent-soft); color: #0B6E91; flex: none; margin-top: 0; }
.quick a > span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.quick strong { font-weight: 700; }

/* MFA setup */
.qr { display: inline-block; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); margin: 4px 0 12px; }
.qr img { display: block; }
.steps { color: var(--text-2); }
.secret code { word-spacing: 4px; display: inline-block; margin-top: 4px; }

@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

@media (max-width: 760px) {
  .topbar-inner { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 8px 12px; }
  .topbar nav { order: 3; width: 100%; margin: 0 -4px; }
  .topbar nav a { height: 34px; padding: 0 10px; }
  .brand img { height: 28px; }
  .signout { height: 30px !important; padding: 0 12px !important; }
  .env { font-size: 10.5px; padding: 2px 6px; }
  main { padding: 24px 16px 48px; }
  h1 { font-size: 24px; }
  .card { padding: 16px; }
  body.auth main { padding-top: 32px; }
  body.auth .card { padding: 24px 20px; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters input, .filters select, .filters button { width: 100%; }
  .declaration { padding: 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 24px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  table.boxes { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media print {
  .topbar, button { display: none; }
  body { background: #fff; }
  .table-wrap, .card { box-shadow: none; border-color: #ccc; }
  th { background: #f3f3f3; }
}
.button svg { width: 16px; height: 16px; flex: none; }
.batch-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 20px 0 12px; }
.batch-bar .select-all { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--navy); cursor: pointer; }
.batch-bar button { margin-left: auto; }
.batch-bar button:disabled { opacity: .5; cursor: not-allowed; }
td.nowrap { white-space: nowrap; }
@media (max-width: 760px) { .batch-bar button { margin-left: 0; width: 100%; } }
td.business { min-width: 170px; }
