@font-face { font-family: "Bodoni Moda"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/bodoni-moda-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: "Bodoni Moda"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/bodoni-moda-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Bodoni Moda"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/bodoni-moda-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap; src: url("/fonts/archivo-latin-wdth-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: "Archivo"; font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap; src: url("/fonts/archivo-latin-ext-wdth-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --paper: #e4e9e2;
  --plate: #eef1ec;
  --ink: #17322e;
  --ink-soft: #4c6560;
  --engrave: #9db1a8;
  --rule: #c3cfc8;
  --bullion: #8f6e22;
  --seal: #a3262a;
  --seal-wash: #f2dcd9;
  --ochre: #7d5300;
  --ochre-wash: #f1e4c4;
  --ok-wash: #d6e4dc;
  --on-ink: #eef1ec;
  --shadow: 0 1px 0 #ffffff inset, 0 1px 2px rgba(23, 50, 46, 0.12);
  --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --text: "Archivo", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1a2926;
    --plate: #213430;
    --ink: #dfe8e2;
    --ink-soft: #9fb3aa;
    --engrave: #4f6a62;
    --rule: #34504a;
    --bullion: #d1ae62;
    --seal: #ec7d7f;
    --seal-wash: #3d2223;
    --ochre: #e7b85a;
    --ochre-wash: #3a2f15;
    --ok-wash: #24413a;
    --on-ink: #13201d;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 1px 2px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--text);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ink); text-decoration-color: var(--engrave); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--bullion); }
:focus-visible { outline: 2px solid var(--bullion); outline-offset: 2px; }

header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px 18px;
  background: var(--plate);
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='6'%3E%3Cpath d='M0 3 Q6 0 12 3 T24 3' fill='none' stroke='%239db1a8' stroke-width='.8'/%3E%3Cpath d='M0 3 Q6 6 12 3 T24 3' fill='none' stroke='%239db1a8' stroke-width='.8'/%3E%3C/svg%3E") repeat-x;
  opacity: 0.9;
}
.wordmark {
  font: 700 1.6rem/1 var(--display);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.wordmark svg { width: 30px; height: 30px; flex: none; }
nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
nav button {
  background: none;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 8px 12px;
  color: var(--ink-soft);
  cursor: pointer;
  font-stretch: 105%;
  border-bottom: 2px solid transparent;
}
nav button:hover { color: var(--ink); }
nav button[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--bullion); }

main#view { max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; }
h1 { font: 600 2.4rem/1.1 var(--display); margin: 0 0 12px; letter-spacing: -0.005em; }
h2 { font: 600 1.35rem/1.2 var(--display); margin: 32px 0 10px; }
p { max-width: 72ch; }

button {
  padding: 8px 14px;
  border: 1px solid var(--engrave);
  background: var(--plate);
  cursor: pointer;
  border-radius: 2px;
  box-shadow: var(--shadow);
}
button:hover { border-color: var(--ink-soft); }
button:disabled { opacity: 0.6; cursor: progress; }
button.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); font-weight: 600; box-shadow: none; }
button.primary:hover { background: var(--ink-soft); border-color: var(--ink-soft); }
button.danger { color: var(--seal); }
input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--engrave);
  background: var(--paper);
  border-radius: 2px;
}
label { display: block; margin: 12px 0 0; font-size: 0.88rem; color: var(--ink-soft); }
label input, label select, label textarea { margin-top: 4px; color: var(--ink); }
.pick { width: auto; padding: 6px 8px; background: var(--plate); }
.err { color: var(--seal); min-height: 1.4em; }
.muted { color: var(--ink-soft); }

.panel {
  background: var(--plate);
  border: 3px double var(--engrave);
  padding: 4px 16px;
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: 0.82rem; color: var(--ink-soft); font-weight: 600; font-stretch: 110%; }
tr:last-child td { border-bottom: 0; }
ul { padding-left: 0; list-style: none; margin: 8px 0; }
li { padding: 8px 0; border-bottom: 1px solid var(--rule); }
li:last-child { border-bottom: 0; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 2px; font-size: 0.8rem; font-weight: 600; font-stretch: 105%; }
.pill.ok { background: var(--ok-wash); color: var(--ink); }
.pill.warn { background: var(--ochre-wash); color: var(--ochre); }
.pill.bad { background: var(--seal-wash); color: var(--seal); }
.pill.mute { background: var(--rule); color: var(--ink-soft); }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.group-title { margin: 28px 0 8px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.group-title button, .esim .row.end button, td .row.end button { padding: 2px 6px; font-size: 0.88rem; border-color: transparent; background: none; box-shadow: none; text-decoration: underline; text-decoration-color: var(--engrave); text-underline-offset: 3px; }
.group-title button:hover, .esim .row.end button:hover, td .row.end button:hover { text-decoration-color: currentColor; }

.vault { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 40px; align-items: center; margin-bottom: 8px; }
.vault-seal svg { width: 100%; height: auto; display: block; }
.verdict { font: 600 clamp(2rem, 4.4vw, 3.2rem)/1.05 var(--display); margin: 0 0 6px; }
.verdict-sub { margin: 0 0 20px; color: var(--ink-soft); }
.ledger { border-top: 3px double var(--engrave); border-bottom: 3px double var(--engrave); }
.ledger-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 2px;
  border-bottom: 1px solid var(--rule);
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  border-radius: 0;
  box-shadow: none;
  width: 100%;
  text-align: left;
}
.ledger-row:last-child { border-bottom: 0; }
.ledger-row:hover { background: var(--plate); }
.ledger-row svg { width: 22px; height: 22px; }
.ledger-name { font-weight: 600; }
.ledger-state { color: var(--ink-soft); text-align: right; }
.ledger-row.bad .ledger-state { color: var(--seal); font-weight: 600; }

.seal-band { fill: none; stroke: var(--engrave); stroke-width: 0.55; }
.seal-band.ok { stroke: var(--ink); stroke-width: 0.5; }
.seal-band.bad { stroke: var(--seal); stroke-width: 0.6; }
.seal-band.idle { stroke: var(--engrave); }
.seal-inner { fill: none; stroke: var(--bullion); stroke-width: 0.45; }
.seal-core { fill: var(--plate); stroke: var(--engrave); stroke-width: 0.8; }
.glyph { fill: var(--engrave); }
.glyph.ok { fill: var(--ink); }
.glyph.bad { fill: var(--seal); }
.seal-text { font: 600 13px var(--display); fill: var(--ink); }
.seal-num { font: 600 34px var(--display); fill: var(--ink); }
.seal-num.bad { fill: var(--seal); }

.gate { max-width: 420px; margin: 8vh auto; padding: 24px; text-align: center; }
.gate-seal { width: min(300px, 70vw); margin: 0 auto 8px; }
.gate-seal svg { width: 100%; height: auto; display: block; transform-origin: 50% 50%; }
.gate h1 { font-size: 3rem; margin: 4px 0 4px; }
.gate p { margin: 0 auto 12px; color: var(--ink-soft); }
.gate label { text-align: left; }
.gate button { margin-top: 16px; width: 100%; padding: 12px; font-size: 1rem; }
.gate.opening .gate-seal svg { animation: dial 0.9s cubic-bezier(.6,0,.2,1) forwards; }
@keyframes dial { 0% { transform: rotate(0); } 70% { transform: rotate(124deg); } 100% { transform: rotate(120deg); } }

.cards { display: none; }
.esim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.esim { background: var(--plate); border: 3px double var(--engrave); padding: 14px 16px; }
.esim.low { border-color: var(--seal); }
.esim .amount { font: 600 2.1rem/1.1 var(--display); margin: 6px 0 4px; }
.esim.low .amount { color: var(--seal); }
.esim svg { width: 100%; height: 36px; display: block; margin-top: 8px; }

.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix input { width: 18px; height: 18px; accent-color: var(--ink); }

dialog { border: 3px double var(--engrave); border-radius: 0; background: var(--plate); color: var(--ink); width: min(540px, calc(100vw - 32px)); padding: 24px; }
dialog::backdrop { background: rgba(10, 22, 20, 0.55); }
.check { display: flex; gap: 8px; align-items: center; color: var(--ink); }
.check input { width: auto; margin: 0; accent-color: var(--ink); }

.mt0 { margin-top: 0; }
.m0 { margin: 0; }
.mt8 { margin-top: 8px; }
.ml4 { margin-left: 4px; }
.tag { margin: 0 4px 4px 0; }
.spark-line { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.spark-thr { stroke: var(--seal); stroke-dasharray: 3 3; stroke-width: 1; }

@media (max-width: 760px) {
  header { padding: 12px 16px 16px; gap: 10px; }
  .wordmark { flex: 1; }
  #logout { order: 1; }
  nav { order: 2; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 12px; scrollbar-width: none; }
  nav button { white-space: nowrap; }
  #project, #lang { order: 3; flex: 1; }
  main#view { padding: 20px 16px 48px; }
  h1 { font-size: 1.9rem; }
  .vault { grid-template-columns: 1fr; gap: 16px; }
  .vault-seal { max-width: 220px; margin: 0 auto; }
  th { display: none; }
  td { display: block; padding: 4px 0; border-bottom: 0; }
  tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--rule); }
  tr:last-child { border-bottom: 0; }
  .matrix td, .matrix th { display: table-cell; padding: 8px 6px 8px 0; }
  .matrix tr { display: table-row; }
}
@media (prefers-reduced-motion: reduce) {
  .gate.opening .gate-seal svg { animation: none; }
}
