:root {
  color-scheme: light;
  --ink: #17222f;
  --muted: #66717e;
  --line: #dce2e8;
  --surface: #ffffff;
  --canvas: #f4f6f8;
  --nav: #172b3a;
  --nav-soft: #253d4d;
  --blue: #1677ff;
  --blue-dark: #0d63dc;
  --green: #16845b;
  --red: #c83d4d;
  --amber: #a86500;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); letter-spacing: 0; }
button, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(120deg, #eef3f7 0%, #f8fafb 52%, #e6eef1 100%); }
.login-panel { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 36px; box-shadow: 0 18px 55px rgba(23,34,47,.09); }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 7px; background: #20a87a; color: white; font-size: 15px; font-weight: 800; }
.brand-mark.small { width: 36px; height: 36px; font-size: 12px; flex: 0 0 auto; }
.eyebrow { margin: 18px 0 5px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
h1 { margin: 0; font-size: 26px; line-height: 1.25; }
h2 { margin: 0; font-size: 18px; }
label { display: grid; gap: 8px; font-size: 13px; font-weight: 650; }
.login-panel form { display: grid; gap: 16px; margin-top: 32px; }
input[type="text"], input[type="password"], input[type="number"], input:not([type]) { width: 100%; height: 42px; border: 1px solid #bdc7d0; border-radius: 6px; background: white; color: var(--ink); padding: 0 12px; outline: none; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22,119,255,.12); }
.primary, .secondary, .quiet, .text-button { min-height: 38px; border-radius: 6px; padding: 0 16px; font-weight: 700; }
.primary { border: 1px solid var(--blue); background: var(--blue); color: white; }
.primary:hover { background: var(--blue-dark); }
.secondary { border: 1px solid #cbd4dc; background: white; color: var(--ink); }
.quiet, .text-button { border: 0; background: transparent; color: inherit; }
.text-button { color: var(--blue-dark); padding: 0; min-height: 30px; }
.wide { width: 100%; }
.form-error { min-height: 18px; margin: -4px 0 0; color: var(--red); font-size: 13px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--nav); color: #eff5f7; padding: 22px 14px; }
.brand { display: flex; gap: 11px; align-items: center; padding: 0 9px 24px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; }
.brand span { margin-top: 2px; color: #9cb0bd; font-size: 11px; }
nav { display: grid; gap: 4px; }
.nav-item { height: 42px; border: 0; border-radius: 5px; padding: 0 13px; background: transparent; color: #bdcad2; text-align: left; font-weight: 650; }
.nav-item:hover, .nav-item.active { background: var(--nav-soft); color: white; }
.sidebar-foot { margin-top: auto; padding: 14px 9px 0; border-top: 1px solid #314756; display: grid; gap: 8px; }
.environment { color: #94a8b5; font-size: 11px; text-transform: uppercase; }
.sidebar-foot .quiet { color: #c8d4db; padding: 0; text-align: left; }
.workspace { min-width: 0; padding: 0 34px 50px; }
.topbar { min-height: 116px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.topbar .eyebrow { margin-top: 0; }
.view { display: none; padding-top: 28px; }
.active-view { display: block; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px,1fr)); border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.metric { min-height: 104px; padding: 22px; border-right: 1px solid var(--line); display: grid; align-content: center; gap: 10px; }
.metric:last-child { border-right: 0; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { font-size: 23px; }
.good { color: var(--green); }
.bad { color: var(--red); }
.section-heading { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.muted { color: var(--muted); font-size: 13px; }
.request-list, .settings-list, .settings-form, .table-wrap { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); overflow: hidden; }
.request-row { min-height: 72px; display: grid; grid-template-columns: minmax(180px,2fr) minmax(100px,.8fr) minmax(110px,.8fr) minmax(120px,1fr); align-items: center; gap: 18px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.request-row:last-child { border-bottom: 0; }
.request-title strong, .request-title span { display: block; }
.request-title span { color: var(--muted); font-size: 12px; margin-top: 4px; }
.amount { font-variant-numeric: tabular-nums; }
.status { display: inline-flex; width: fit-content; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 13px; background: #edf1f4; color: #52606c; font-size: 12px; font-weight: 700; }
.status.issued { background: #e5f5ef; color: var(--green); }
.status.failed, .status.creation_unknown { background: #fdebed; color: var(--red); }
.status.requested, .status.issuing { background: #fff4dc; color: var(--amber); }
.error-text { color: var(--red); font-size: 12px; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; vertical-align: top; }
th { background: #f8fafb; color: var(--muted); font-size: 11px; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.settings-form { padding: 22px; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(220px,1fr)); gap: 20px; }
.toggle-row { margin-top: 24px; min-height: 64px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row small { margin-top: 4px; color: var(--muted); font-weight: 400; }
input[role="switch"] { appearance: none; width: 42px; height: 24px; border-radius: 12px; background: #c7d0d7; padding: 3px; transition: .15s; }
input[role="switch"]::before { content: ""; display: block; width: 18px; height: 18px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .15s; }
input[role="switch"]:checked { background: var(--green); }
input[role="switch"]:checked::before { transform: translateX(18px); }
.form-actions { display: flex; justify-content: flex-end; padding-top: 20px; }
.setting-row { min-height: 86px; display: grid; grid-template-columns: minmax(220px,1.6fr) minmax(130px,.7fr) minmax(200px,1fr) auto; align-items: center; gap: 20px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-label strong, .setting-label span { display: block; }
.setting-label span { max-width: 570px; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.setting-value { color: #3d4a55; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }
.setting-actions { display: flex; gap: 8px; }
.danger { border: 0; background: transparent; color: var(--red); font-weight: 700; padding: 9px; }
.empty { padding: 34px; color: var(--muted); text-align: center; }
dialog { width: min(500px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 8px; padding: 0; box-shadow: 0 22px 70px rgba(20,32,45,.24); }
dialog::backdrop { background: rgba(17,29,39,.5); }
dialog form { padding: 24px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.dialog-head .eyebrow { margin: 0 0 4px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 26px; line-height: 1; }
.privacy-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 440px; min-height: 44px; display: none; align-items: center; border-radius: 6px; padding: 10px 14px; background: #1b2a35; color: white; box-shadow: 0 10px 35px rgba(0,0,0,.2); font-size: 13px; }
.toast.show { display: flex; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; padding: 12px 14px; }
  .brand { padding: 0 4px 12px; }
  nav { grid-template-columns: repeat(4, minmax(0,1fr)); overflow-x: auto; }
  .nav-item { text-align: center; padding: 0 7px; white-space: nowrap; }
  .sidebar-foot { display: none; }
  .workspace { padding: 0 18px 36px; }
  .topbar { min-height: 92px; }
  .metrics { grid-template-columns: repeat(2,1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .request-row { grid-template-columns: 1fr 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .setting-row { grid-template-columns: 1fr auto; gap: 8px 14px; }
  .setting-label { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
  .login-panel { padding: 26px 22px; }
  nav { grid-template-columns: repeat(4, 116px); }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 88px; padding: 16px; }
  .metric strong { font-size: 19px; }
  .request-row { grid-template-columns: 1fr; }
  .setting-row { grid-template-columns: 1fr; }
  .setting-actions { justify-content: flex-start; }
}
