:root {
  --bg: #09131f;
  --bg-alt: #0f1e30;
  --panel: #13253a;
  --line: #27435f;
  --text: #e6f2ff;
  --muted: #9fc1dd;
  --accent: #16a34a;
  --warn: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 5% -10%, #1e3a5f55, transparent),
    radial-gradient(900px 600px at 90% -20%, #1665343f, transparent),
    linear-gradient(180deg, var(--bg), var(--bg-alt));
  min-height: 100vh;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  background: #0a1624cc;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #1f3852;
}
.site-header.site-header-nav-only { justify-content: flex-end; }

.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
}
.brand-with-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.brand-logo {
  display: block;
  height: 56px;
  width: auto;
  max-width: min(76vw, 420px);
  object-fit: contain;
}
.brand .dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(45deg, #22c55e, #0ea5e9);
  box-shadow: 0 0 0 6px #22c55e22;
}
.brand strong { display: block; letter-spacing: .03em; }
.brand small { color: var(--muted); display: block; margin-top: -2px; }

.site-nav {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.site-nav-toggle {
  display: none;
  border: 1px solid #33557a;
  border-radius: .65rem;
  padding: .38rem .6rem;
  background: #10253a;
  color: var(--text);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}
.site-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  padding: .38rem .6rem;
  border-radius: .65rem;
}
.site-nav a.active, .site-nav a:hover { color: var(--text); border-color: var(--line); background: #17304a; }
.site-nav .logout { color: #ffd29d; }

.shell { width: min(1200px, 95vw); margin: 1rem auto 2rem; }
.whoami { color: var(--muted); font-size: .92rem; margin-bottom: .7rem; }

.site-footer {
  margin-top: 1.2rem;
  padding: .75rem 1rem;
  background: #0a1624cc;
  backdrop-filter: blur(8px);
  border-top: 1px solid #1f3852;
}

.site-footer-inner {
  width: min(1200px, 95vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .8rem;
}

.site-license-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #33557a;
  border-radius: 999px;
  padding: .16rem .52rem;
  color: #bfe3ff;
  text-decoration: none;
  background: #0f2236;
  letter-spacing: .02em;
}

.site-license-badge:hover {
  border-color: #4a7198;
  background: #13314e;
}

.site-license-copy {
  color: #9fc1dd;
}

.legal-wrap {
  max-width: 980px;
  margin-inline: auto;
}

.legal-intro {
  margin: 0 0 .7rem;
  color: #cde3f8;
}

.legal-license-text {
  margin: 0;
  padding: .8rem;
  border: 1px solid #294a67;
  border-radius: .7rem;
  background: #0d1d2e;
  color: #d7e8f9;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.legal-actions {
  margin-top: .85rem;
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}

.hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: .9rem;
  padding: 1.1rem 1.2rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: linear-gradient(125deg, #13314e 0%, #173026 100%);
  animation: slideUp .45s ease;
}
.hero-main { flex: 1 1 auto; }
.hero h1 { margin: 0; font-size: clamp(1.4rem, 2.3vw, 2.1rem); }
.hero p { color: #d2e8ff; max-width: 66ch; }
.dashboard-live-status {
  margin: .45rem 0 0;
  color: #a7f3d0;
  font-size: .92rem;
}
.hero-action {
  display: flex;
  align-self: stretch;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  width: auto;
  max-width: 190px;
  padding: .8rem;
  background: #22c55e;
  color: #06210f;
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  text-decoration: none;
  border-radius: .7rem;
}

.scan-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
}

.scan-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 14, 24, 0.76);
}

.scan-modal-dialog {
  position: relative;
  width: min(560px, 94vw);
  margin: 5vh auto;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #0d1d2e;
  padding: .9rem;
}

.scan-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  margin-bottom: .45rem;
}

.scan-modal-head h2 {
  margin: 0;
}

.scan-modal-copy {
  margin: .2rem 0 .65rem;
}

.scan-modal-reader {
  width: min(440px, 100%);
  margin: .3rem auto 0;
}

body.scan-modal-open {
  overflow: hidden;
}

@media (max-width: 820px) {
  .hero {
    flex-direction: column;
  }

  .hero-action {
    align-self: flex-start;
    aspect-ratio: auto;
    max-width: none;
    width: 100%;
    min-height: 64px;
  }

  .scan-modal-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

.metrics {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: .7rem;
}
.metric {
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: #12253a;
  padding: .7rem;
}
.metric h3 { margin: 0; font-size: .9rem; color: var(--muted); }
.metric p { margin: .3rem 0 0; font-size: 1.7rem; font-weight: 700; }

.panel {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #102337;
  padding: 1rem;
  animation: fadeIn .45s ease;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: .7rem; }
.panel h1, .panel h2 { margin: 0 0 .45rem; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .56rem .52rem; border-bottom: 1px solid #1f3852; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .86rem; font-weight: 600; }

.chip, .badge-ok, .badge-busy, .badge-warn, .badge-info, .badge-accent, .badge-neutral {
  display: inline-flex;
  border-radius: 999px;
  padding: .18rem .55rem;
  font-size: .8rem;
  border: 1px solid transparent;
  text-transform: lowercase;
}
.badge-ok { background: #064e3b; border-color: #0f766e; }
.badge-busy { background: #1e3a8a; border-color: #2563eb; }
.badge-warn { background: #78350f; border-color: #f59e0b; }
.badge-info { background: #0c4a6e; border-color: #0ea5e9; }
.badge-accent { background: #4a044e; border-color: #c026d3; }
.badge-neutral { background: #1f2937; border-color: #475569; }

.notice {
  padding: .56rem .64rem;
  border-radius: .72rem;
  border: 1px solid #33557a;
  background: #102942;
}
.notice.ok { border-color: #15803d; background: #0d2f1c; }
.notice.danger { border-color: #b91c1c; background: #3a1212; }

.inline-form, .stack-form { display: grid; gap: .55rem; }
.inline-form { grid-template-columns: 1fr auto; align-items: end; }
.inline-form select { min-width: 180px; }
.stack-form input, .stack-form textarea, .stack-form select,
.inline-form input, .inline-form textarea, .inline-form select {
  width: 100%;
  padding: .58rem .62rem;
  border: 1px solid #33557a;
  border-radius: .68rem;
  background: #0d1b2c;
  color: var(--text);
}
.stack-form button, .inline-form button, button, .button-link {
  border: 0;
  border-radius: .68rem;
  padding: .6rem .85rem;
  background: linear-gradient(135deg, #22c55e, #14b8a6);
  color: #082111;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.split-actions { margin-top: .7rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.scan-dashboard-button { width: 100%; text-align: center; }
.auth-panel { max-width: 540px; margin: 4vh auto 0; }
.auth-title,
.auth-subtitle {
  text-align: center;
}
.auth-subtitle {
  margin-top: 0;
  margin-bottom: .9rem;
}
.auth-card-logo-link {
  display: block;
  width: fit-content;
  margin: 0 auto .8rem;
}
.auth-card-logo {
  display: block;
  width: min(88vw, 340px);
  height: auto;
}
.auth-register-button {
  width: 100%;
  margin-top: .7rem;
  text-align: center;
}
code {
  background: #0b1a2b;
  border: 1px solid #33557a;
  padding: .1rem .32rem;
  border-radius: .36rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

@keyframes slideUp { from { transform: translateY(8px); opacity: .2; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: .25; } to { opacity: 1; } }

@media (max-width: 760px) {
  .inline-form { grid-template-columns: 1fr; }
  .site-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .site-header.site-header-nav-only { justify-content: flex-end; }
  .site-nav { width: auto; margin-left: auto; }
  .site-nav-toggle { display: inline-flex; align-items: center; }
  .site-nav-links {
    display: none;
    position: absolute;
    top: calc(100% + .45rem);
    right: 0;
    min-width: 220px;
    padding: .5rem;
    border: 1px solid #1f3852;
    border-radius: .7rem;
    background: #0c1b2ccc;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px #02061755;
    flex-direction: column;
    align-items: stretch;
    z-index: 20;
  }
  .site-nav.is-open .site-nav-links { display: flex; }
  .site-nav-links a { display: block; }
  .brand-logo { height: 44px; max-width: 88vw; }
  .site-footer { padding: .65rem .8rem; }
  .site-footer-inner { font-size: .76rem; }
  .legal-license-text { font-size: .76rem; }
}

.signage-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.signage-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 14, 24, 0.72);
}

.signage-modal-dialog {
  position: relative;
  width: min(980px, 96vw);
  max-height: 92vh;
  margin: 3vh auto;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #0d1d2e;
  padding: .9rem;
}

.signage-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  margin-bottom: .8rem;
}

.signage-modal-head h2 {
  margin: 0;
}

.signage-sheet {
  background: #ffffff;
  color: #0f172a;
  border: 2px solid #0f172a;
  border-radius: 16px;
  padding: 1rem 1.2rem 1.3rem;
}

.signage-sheet-title {
  border-bottom: 2px dashed #94a3b8;
  padding-bottom: .8rem;
  margin-bottom: .9rem;
}

.signage-sheet-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0b1a2b;
  border: 1px solid #1f3852;
  border-radius: 10px;
  padding: .42rem .6rem;
  margin: 0 0 .45rem;
}

.signage-sheet-logo {
  display: block;
  width: min(320px, 72vw);
  height: auto;
  margin: 0;
}

.signage-sheet-title h1 {
  margin: .1rem 0;
  font-size: 2rem;
  line-height: 1.1;
}

.signage-sheet-meta {
  font-size: .92rem;
  color: #334155;
}

.signage-sheet-grid {
  display: grid;
  grid-template-columns: 1.15fr .95fr;
  gap: 1rem;
  align-items: start;
}

.signage-sheet-notes {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: .8rem;
}

.signage-sheet-notes h2 {
  margin: .1rem 0 .5rem;
}

.signage-sheet-notes p {
  margin: .5rem 0;
}

.signage-sheet-warn {
  margin-top: .6rem;
  padding: .6rem;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
}

.signage-sheet-qr {
  display: grid;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: .7rem;
  background: #fff;
}

.signage-sheet-qr img {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1 / 1;
}

.signage-sheet-url {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .75rem;
  word-break: break-all;
  color: #334155;
}

body.signage-modal-open {
  overflow: hidden;
}

@media (max-width: 760px) {
  .signage-sheet-grid {
    grid-template-columns: 1fr;
  }

  .signage-modal-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media print {
  body.signage-print-active .site-header,
  body.signage-print-active .whoami,
  body.signage-print-active .panel,
  body.signage-print-active .signage-modal-backdrop,
  body.signage-print-active .signage-modal-head {
    display: none !important;
  }

  body.signage-print-active .shell {
    width: auto;
    margin: 0;
  }

  body.signage-print-active .signage-modal {
    position: static;
    inset: auto;
  }

  body.signage-print-active .signage-modal-dialog {
    width: auto;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    overflow: visible;
  }

  body.signage-print-active .signage-sheet {
    border: 0;
    border-radius: 0;
    max-width: none;
    padding: .4in;
  }
}
