@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/outfit-latin.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: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin.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;
}

:root {
  --bg: #0a0d16;
  --bg-elevated: #11172380;
  --panel: #131826;
  --panel-2: #181f30;
  --panel-edge: rgba(255, 255, 255, 0.06);
  --border: #262f42;
  --border-soft: #1d2536;
  --text: #edf1f7;
  --muted: #8b93a7;
  --muted-2: #626c82;
  --accent: #5b8cff;
  --accent-2: #7aa2ff;
  --accent-bg: rgba(91, 140, 255, 0.12);
  --accent-shadow: rgba(48, 90, 219, 0.35);
  --warn: #e6a93c;
  --warn-bg: rgba(230, 169, 60, 0.12);
  --ok: #3ecf8e;
  --ok-bg: rgba(62, 207, 142, 0.12);
  --err: #f0616f;
  --err-bg: rgba(240, 97, 111, 0.12);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 18px;
  /* Tinted toward the accent hue rather than neutral black, and a single
     consistent light source (soft from above) across every shadowed
     element on the page. */
  --shadow: 0 1px 2px rgba(6, 8, 16, 0.35), 0 14px 32px -14px rgba(15, 22, 48, 0.65);
  --shadow-lg: 0 4px 10px rgba(6, 8, 16, 0.35), 0 24px 48px -20px rgba(15, 22, 48, 0.75);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --font: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, "Roboto Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  /* Layered radial glows (top-left accent, faint warm counterpoint bottom
     right) plus a fixed noise layer for texture — replaces the old single
     flat gradient, which read a little sterile. */
  background:
    radial-gradient(1200px 620px at 12% -12%, rgba(91, 140, 255, 0.1), transparent 60%),
    radial-gradient(900px 500px at 108% 110%, rgba(230, 169, 60, 0.045), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  margin: 0;
  padding: 1.75rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  position: relative;
}

/* Fixed, pointer-events-none grain layer for depth — a flat vector UI on
   a flat gradient reads sterile; a whisper of noise breaks that up
   without being visible as "texture" at a glance. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body > * { position: relative; z-index: 1; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .35rem;
}

h1 {
  font-size: 1.3rem;
  font-weight: 650;
  margin: 0;
  letter-spacing: -.02em;
  display: flex;
  align-items: center;
  gap: .65rem;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--accent-2), var(--accent) 70%);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 3px 10px -2px var(--accent-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

h1 .tag {
  font-size: .68rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: .18rem .6rem;
  border-radius: 999px;
  letter-spacing: .01em;
}

.nav-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.nav-actions svg { flex-shrink: 0; }

.sub { color: var(--muted); font-size: .84rem; margin: .35rem 0 1.5rem; }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  max-width: 1120px;
}
@media (min-width: 720px) {
  .grid { grid-template-columns: 1fr 1fr; }
}

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: var(--shadow);
  min-width: 0;
  position: relative;
  /* A hairline highlight along the top edge simulates a soft light source
     hitting the card from above — the difference between a flat rectangle
     and something that reads as a physical surface. */
  isolation: isolate;
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, var(--panel-edge), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: -1;
}

.panel h2 {
  font-size: .94rem;
  font-weight: 600;
  margin: 0 0 1.1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .55rem;
  letter-spacing: -.005em;
}
.panel h2 svg { color: var(--accent-2); flex-shrink: 0; opacity: .9; }

.panel h2 .hint { color: var(--muted); font-weight: 400; font-size: .74rem; letter-spacing: 0; }

label {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  margin: .75rem 0 .32rem;
  font-weight: 500;
}
label:first-of-type { margin-top: 0; }

input, select {
  width: 100%;
  background: #080b13;
  border: 1px solid var(--border);
  color: var(--text);
  padding: .64rem .72rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: inherit;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}
input:hover, select:hover { border-color: #33405a; }
input:focus, select:focus, button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg), inset 0 1px 2px rgba(0, 0, 0, 0.25);
}
input::placeholder { color: var(--muted-2); }

button {
  margin-top: 1rem;
  background: linear-gradient(165deg, var(--accent-2), var(--accent) 75%);
  color: white;
  border: 1px solid transparent;
  padding: .64rem 1.15rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -.005em;
  transition: transform .12s var(--ease), box-shadow .18s var(--ease), opacity .15s var(--ease), filter .15s var(--ease);
  min-height: 40px;
  line-height: 1.2;
  box-shadow: 0 2px 8px -2px var(--accent-shadow);
}
button:hover { filter: brightness(1.07); box-shadow: 0 4px 14px -3px var(--accent-shadow); transform: translateY(-1px); }
button:active { transform: translateY(0) scale(.98); box-shadow: 0 1px 4px -1px var(--accent-shadow); }
button:disabled { opacity: .5; cursor: wait; transform: none; filter: none; box-shadow: none; }

/* Secondary / nav-style button: same shape and size as a primary button,
   but visually quieter — for actions like "Log out" or "Settings" that
   sit next to primary actions (Mint, Send, Deploy) without competing.
   Self-contained (not reliant on the bare `button` selector) so it looks
   identical whether applied to an <a> or a <button>. */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin-top: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  font-family: inherit;
  min-height: 38px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-2);
  background: var(--accent-bg);
  opacity: 1;
  text-decoration: none;
}
.btn-ghost:active { transform: scale(.98); }

button.link {
  background: none;
  border: none;
  color: var(--err);
  padding: .25rem 0;
  margin: 0;
  font-size: .78rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  min-height: auto;
  transition: opacity .15s var(--ease);
}
button.link.accent { color: var(--accent-2); }
button.link:hover { opacity: .75; }

a.txlink { color: var(--accent-2); font-family: var(--mono); font-size: .82em; }

.note {
  font-size: .78rem;
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid rgba(230, 169, 60, .3);
  padding: .65rem .75rem;
  border-radius: var(--radius-sm);
  margin-top: .75rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.result {
  font-size: .8rem;
  margin-top: .75rem;
  padding: .65rem .75rem;
  border-radius: var(--radius-sm);
  word-break: break-all;
  line-height: 1.5;
  animation: resultIn .22s var(--ease);
}
.result.ok { background: var(--ok-bg); border: 1px solid rgba(62, 207, 142, .3); color: var(--ok); }
.result.err { background: var(--err-bg); border: 1px solid rgba(240, 97, 111, .3); color: var(--err); }
.result.warn { background: var(--warn-bg); border: 1px solid rgba(230, 169, 60, .3); color: var(--warn); }
.result:empty { display: none; }

@keyframes resultIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: .84rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.status-row:last-child { border-bottom: none; }
.status-row span:first-child { color: var(--muted); flex-shrink: 0; }
.status-row span:last-child { text-align: right; word-break: break-word; font-variant-numeric: tabular-nums; }

.full { grid-column: 1 / -1; }

.table-wrap { overflow-x: auto; margin: 0 -.25rem; padding: 0 .25rem; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { text-align: left; padding: .6rem .45rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; white-space: nowrap; }
td.wrap, th.wrap { white-space: normal; }
th { color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr { transition: background .12s var(--ease); }
tbody tr:hover { background: rgba(122, 162, 255, .045); }

.mono { font-family: var(--mono); font-size: .78rem; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  padding: .17rem .58rem;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent-2);
  margin-left: .4rem;
  vertical-align: middle;
  letter-spacing: .01em;
}
.badge-ok { color: var(--ok); }
.badge-fail { color: var(--err); }
.badge-pending { color: var(--warn); }
.badge-in { color: var(--ok); background: var(--ok-bg); }
.badge-out { color: var(--warn); background: var(--warn-bg); }
.badge-mint { color: var(--accent-2); background: var(--accent-bg); }
.badge-burn { color: var(--err); background: var(--err-bg); }
.badge-transfer { color: var(--muted); background: var(--panel-2); }

.filter-row { display: flex; flex-wrap: wrap; gap: .85rem; align-items: flex-end; }
.filter-item { flex: 1 1 160px; min-width: 140px; }
.filter-item label { margin-top: 0; }
.filter-item-btn { flex: 0 0 auto; }
.filter-item-btn .btn-ghost { margin-top: 0; }

.hidden { display: none !important; }

.perm-list { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.perm-list label {
  display: flex; align-items: center; gap: .35rem;
  font-size: .76rem; color: var(--text); margin: 0;
  background: #080b13; border: 1px solid var(--border);
  padding: .35rem .6rem; border-radius: 999px;
  cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.perm-list label:hover { border-color: var(--muted-2); }
.perm-list label:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-2); }
.perm-list input { width: auto; }

.card-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.card-row:last-child { border-bottom: none; }

.group-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem;
  margin-bottom: .75rem; background: rgba(255, 255, 255, .015);
  transition: border-color .15s var(--ease);
}
.group-card:hover { border-color: #33405a; }
.group-card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }

.logtable { max-height: 520px; overflow-y: auto; }

/* Empty-state placeholder inside tables/lists — a plain muted sentence
   read as "unfinished"; a centered icon + line reads as "composed". */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .5rem; padding: 2rem 1rem; color: var(--muted); font-size: .82rem; text-align: center;
}
.empty-state svg { opacity: .5; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, .7);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  opacity: 0;
  transition: opacity .18s var(--ease);
}
.modal-overlay.modal-visible { opacity: 1; }
.modal-overlay.hidden { display: none !important; }
.modal-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.35rem;
  width: 100%;
  max-width: 380px;
  transform: scale(.96) translateY(4px);
  transition: transform .2s var(--ease-spring);
}
.modal-overlay.modal-visible .modal-card { transform: scale(1) translateY(0); }
.modal-message { margin: 0 0 .85rem; font-size: .88rem; line-height: 1.5; color: var(--text); }
.modal-card input { margin-bottom: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.15rem; }
.modal-actions button { margin-top: 0; }
.btn-danger { background: linear-gradient(165deg, #f5808c, var(--err) 75%); box-shadow: 0 2px 8px -2px rgba(240, 97, 111, .4); }
.btn-danger:hover { box-shadow: 0 4px 14px -3px rgba(240, 97, 111, .45); }

/* Login page */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.1rem;
  width: 100%;
  max-width: 320px;
  animation: cardIn .35s var(--ease);
}
.login-card h1 { font-size: 1.1rem; margin-bottom: 1.3rem; justify-content: center; }
.login-card button { width: 100%; margin-top: 1.15rem; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Staggered panel entrance — panels fade/rise in with a slight cascade
   instead of all mounting at once. Respects reduced-motion. */
.grid > .panel {
  animation: panelIn .4s var(--ease) backwards;
}
.grid > .panel:nth-child(1) { animation-delay: .02s; }
.grid > .panel:nth-child(2) { animation-delay: .06s; }
.grid > .panel:nth-child(3) { animation-delay: .1s; }
.grid > .panel:nth-child(4) { animation-delay: .14s; }
.grid > .panel:nth-child(5) { animation-delay: .18s; }
.grid > .panel:nth-child(6) { animation-delay: .22s; }
.grid > .panel:nth-child(n+7) { animation-delay: .24s; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .grid > .panel, .login-card, .result { animation: none; }
  button, .btn-ghost, input, select, .modal-card, .modal-overlay { transition: none; }
}

@media (max-width: 640px) {
  body { padding: 1rem; }
  .grid { grid-template-columns: 1fr; gap: .85rem; }
  .panel { padding: 1.1rem; border-radius: var(--radius-sm); }
  h1 { font-size: 1.15rem; }
  .topbar { gap: .5rem; }
  th, td { padding: .5rem .35rem; font-size: .78rem; }
  .panel button:not(.link) { width: 100%; }
  .perm-list label { font-size: .72rem; }

  /* iOS Safari auto-zooms the page on focusing any form control with a
     computed font-size under 16px — bumping to 16px here (mobile only, so
     desktop density is untouched) eliminates that jump entirely. */
  input, select { font-size: 16px; }

  /* Bigger touch targets on mobile (~44px per Apple/Google guidance) —
     desktop keeps the denser 38-40px sizing since precision-pointer input
     doesn't need it. */
  button, .btn-ghost { min-height: 44px; }
  button.link { padding: .45rem 0; }
}
