/* Same look as the swiyu VCT editor (Unxos): navy on light grey, Inter and DM Mono, brand bar, tabs, footer. */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #dde3ea;
  --text: #0f1b2a;
  --text-muted: #5b6b7c;
  --accent: #17324c;
  --accent-soft: #e9f1ff;
  --danger: #c00012;
  --danger-soft: #ffedea;
  --warning: #9a4a00;
  --warning-soft: #fff1e0;
  --info: #2f4963;
  --info-soft: #eef3f8;
  --ok: #135c53;
  --ok-soft: #e5fff8;
  --radius: 10px;

  color-scheme: light;
}

* { box-sizing: border-box; }

/* An element's own display rule (grid, flex) must not win over the hidden attribute. */
[hidden] { display: none !important; }

html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font: 14px/1.45 'Inter', system-ui, sans-serif;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { margin-bottom: 12px; font-size: 18px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }

/* Brand bar, tabs and footer: the frame of the editor */
.brand-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-muted);
}
.brand-bar:hover { color: var(--text); }
.brand-logo { width: 20px; height: 20px; flex: none; }
.brand-name { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.brand-tagline { font-size: 12px; color: var(--text-muted); }

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs a, .tabs span {
  padding: 10px 14px 9px;
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.tabs span.soon { opacity: 0.6; }
.tabs small { margin-left: 4px; font-size: 11px; }

main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 8px;
  display: grid;
  gap: 16px;
  align-content: start;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 900px) {
  main { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
  .wide { grid-column: 1 / -1; }
}

.lead { margin: 0; color: var(--text-muted); }
.wallet-links { margin: 0; }
.wallet-icon { width: 28px; height: 28px; border-radius: 7px; vertical-align: middle; margin-right: 6px; }
.notice { margin: 0; padding: 10px 14px; background: var(--accent-soft); border: 1px solid var(--border); border-radius: 8px; }
.notice:empty { display: none; }

/* The page is built for the mode the server runs in (body[data-mode] comes from /api/app). */
body[data-mode="demo"] .operator-only, body[data-mode="operator"] .demo-only { display: none !important; }

fieldset { margin: 14px 0 0; padding: 0 12px 12px; border: 1px solid var(--border); border-radius: 8px; }
legend { padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
fieldset label:first-of-type { margin-top: 8px; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  padding: 6px 24px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
}

@media (max-width: 800px) {
  .brand-bar { padding: 8px 16px; }
  .brand-tagline { display: none; }
  .tabs { padding: 0 8px; gap: 0; }
  .tabs a, .tabs span { padding: 10px 10px 9px; }
  main { padding: 16px 12px 8px; }
  .site-footer { padding: 8px 16px; }
}

/* Panels and fields */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
@media (max-width: 800px) { .card { padding: 14px 12px; } }

label { display: block; margin: 14px 0 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
form > label:first-child { margin-top: 0; }
label.check { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; font-size: 14px; font-weight: 400; color: var(--text); cursor: pointer; }

input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
textarea { font: 12px/1.5 'DM Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #91abca; outline-offset: -1px; }
button:focus-visible, a.button:focus-visible { outline: 2px solid #91abca; outline-offset: 1px; }
input[type="checkbox"] { accent-color: var(--accent); }

.grid2 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 520px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.label-row label, .label-row h2 { margin-bottom: 4px; }

/* Buttons */
button, a.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
button:hover, a.button:hover { border-color: #b8c3cf; }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { margin-top: 18px; color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 600; }
button.link { padding: 0; border: 0; background: none; color: var(--accent); font-size: 12px; text-decoration: underline; }
button.danger { color: var(--danger); }

.hint { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; }
.error { margin: 8px 0 0; color: var(--danger); font-size: 12px; white-space: pre-wrap; }
.mono, .code { font-family: 'DM Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.mono { font-size: 12px; }
.code { font-size: 22px; letter-spacing: 0.12em; }

/* The offer */
#qr { width: min(100%, 280px); margin: 0 auto; padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
#qr:focus { outline: none; }
#qr svg { display: block; width: 100%; height: auto; }
#qr-wrap > .hint { text-align: center; }

.copy-row { display: flex; gap: 8px; margin-top: 10px; }
.copy-row input { min-width: 0; flex: 1; font: 12px 'DM Mono', ui-monospace, Consolas, monospace; }

#tx-code-wrap { margin: 14px 0 0; padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; text-align: center; color: var(--text-muted); }
#tx-code-wrap strong { display: block; color: var(--text); font-weight: 500; }

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 16px 0 0; }
.facts dt { color: var(--text-muted); font-size: 12px; font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--info-soft); color: var(--info); font-size: 11px; font-weight: 600; }
.badge.ok { color: var(--ok); background: var(--ok-soft); }
.badge.info { color: var(--info); background: var(--info-soft); }
.badge.warn { color: var(--warning); background: var(--warning-soft); }
.badge.bad { color: var(--danger); background: var(--danger-soft); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-muted); font-size: 12px; font-weight: 600; background: var(--surface-2); }
tr.selected td { background: var(--accent-soft); }

/* The credential as the wallet draws it (credit-card format, as in the VCT editor's preview). */
.wallet-card {
  --w: 328px;
  position: relative;
  width: min(100%, var(--w));
  aspect-ratio: 1.586;
  margin: 0 auto 14px;
  border-radius: 16px;
  overflow: hidden;
  background: #f0ede5;
  color: #000;
}
.wallet-card .gradients {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle calc(0.3 * var(--w) / 1.586) at 55% 90%, rgba(0, 0, 0, 0.1) 0, rgba(0, 0, 0, 0) 100%),
    radial-gradient(circle calc(0.6 * var(--w)) at 0% 100%, rgba(0, 0, 0, 0.3) 0, rgba(0, 0, 0, 0) 100%),
    linear-gradient(122.23deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 100%);
}
.wallet-card .content { position: relative; height: 100%; padding: 24px 24px 16px; }
.wallet-card .head { display: flex; gap: 16px; }
.wallet-card .texts { flex: 1; min-width: 0; }
.wallet-card .title, .wallet-card .subtitle {
  font: 16px/22px 'DM Mono', ui-monospace, Consolas, monospace;
  hyphens: auto;
  overflow-wrap: anywhere;
}
.wallet-card .subtitle { opacity: 0.7; min-height: 22px; }
.wallet-card .logo {
  flex: none;
  width: 32px;
  height: 32px;
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}

/* Opening the wallet by link makes sense on the phone that has it; elsewhere the QR code is the way. */
a.button.primary { justify-content: center; margin-top: 0; color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 600; }
a.open-wallet, p.open-wallet { display: none; }
@media (pointer: coarse) {
  a.open-wallet { display: flex; width: 100%; padding: 14px 16px; font-size: 16px; }
  p.open-wallet { display: block; margin: 6px 0 16px; text-align: center; }
  #qr { width: min(100%, 200px); }
}
