:root {
  --bg: #0b1220;
  --bg-soft: #111a2e;
  --surface: #152238;
  --surface-2: #1a2b44;
  --border: rgba(148, 163, 184, 0.18);
  --text: #e8eef8;
  --muted: #94a3b8;
  --accent: #14b8a6;
  --accent-2: #0d9488;
  --accent-soft: rgba(20, 184, 166, 0.14);
  --warn: #f59e0b;
  --danger: #f43f5e;
  --ok: #22c55e;
  --info: #38bdf8;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Syne", "DM Sans", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #5eead4; }
img { max-width: 100%; }

.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(20, 184, 166, 0.22), transparent 60%),
    radial-gradient(700px 400px at 90% 10%, rgba(56, 189, 248, 0.12), transparent 55%),
    radial-gradient(600px 500px at 50% 100%, rgba(13, 148, 136, 0.12), transparent 50%),
    linear-gradient(180deg, #0b1220 0%, #0a1424 100%);
}

.container { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; }
.container-sm { width: min(480px, calc(100% - 2rem)); margin: 0 auto; }

/* Landing nav */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
}
.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #042f2e;
}
.nav-actions { display: flex; gap: 0.75rem; align-items: center; }

/* Hero */
.hero {
  padding: 4.5rem 0 5rem;
  display: grid;
  gap: 1.25rem;
  max-width: 720px;
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin: 0;
}
.hero p {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 34rem;
  margin: 0;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 0.5rem; }
.hero-visual {
  margin-top: 2.5rem;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(20,184,166,0.15), rgba(14,165,233,0.08));
  min-height: 220px;
  position: relative;
  box-shadow: var(--shadow);
}
.hero-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0%, rgba(20,184,166,0.08) 50%, transparent 100%),
    repeating-linear-gradient(0deg, transparent, transparent 28px, rgba(148,163,184,0.06) 28px, rgba(148,163,184,0.06) 29px),
    repeating-linear-gradient(90deg, transparent, transparent 28px, rgba(148,163,184,0.06) 28px, rgba(148,163,184,0.06) 29px);
  animation: sweep 8s ease-in-out infinite;
}
.qr-preview {
  position: absolute;
  right: 8%;
  top: 50%;
  transform: translateY(-50%);
  width: 150px;
  height: 150px;
  background: #fff;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
  animation: float 4s ease-in-out infinite;
}
.qr-preview svg { width: 100%; height: 100%; }
.hero-copy {
  position: absolute;
  left: 8%;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
}
.hero-copy strong {
  display: block;
  font-family: var(--display);
  font-size: 1.4rem;
  margin-bottom: 0.35rem;
}
.hero-copy span { color: var(--muted); font-size: 0.95rem; }

@keyframes float {
  0%, 100% { transform: translateY(-50%); }
  50% { transform: translateY(calc(-50% - 10px)); }
}
@keyframes sweep {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeUp 0.7s ease both; }
.delay-1 { animation-delay: 0.12s; }
.delay-2 { animation-delay: 0.24s; }

.section { padding: 3.5rem 0; }
.section h2 {
  font-family: var(--display);
  font-size: 1.75rem;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}
.section > .lead { color: var(--muted); margin: 0 0 1.75rem; max-width: 36rem; }
.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.feature {
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
}
.feature h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-family: var(--display);
}
.feature p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.7rem 1.15rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: 0.18s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #042f2e;
}
.btn-primary:hover { filter: brightness(1.08); color: #042f2e; }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.btn-danger { background: rgba(244,63,94,0.15); color: #fda4af; border-color: rgba(244,63,94,0.3); }
.btn-sm { padding: 0.45rem 0.8rem; font-size: 0.88rem; }
.btn-block { width: 100%; }

/* Auth cards */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem 0; }
.auth-card {
  width: min(440px, calc(100% - 2rem));
  background: rgba(21, 34, 56, 0.85);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.auth-card h1 {
  font-family: var(--display);
  font-size: 1.7rem;
  margin: 0 0 0.35rem;
  letter-spacing: -0.03em;
}
.auth-card .sub { color: var(--muted); margin: 0 0 1.5rem; }

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.form-control, select.form-control, textarea.form-control {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  outline: none;
}
.form-control:focus {
  border-color: rgba(20, 184, 166, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.form-control { min-height: 90px; resize: vertical; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.form-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.3rem; }
.form-actions { margin-top: 1.25rem; }

.alert {
  padding: 0.8rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
.alert-success { background: rgba(34,197,94,0.12); color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
.alert-error { background: rgba(244,63,94,0.12); color: #fda4af; border: 1px solid rgba(244,63,94,0.25); }
.alert-info { background: rgba(56,189,248,0.12); color: #7dd3fc; border: 1px solid rgba(56,189,248,0.25); }
.alert-warn { background: rgba(245,158,11,0.12); color: #fcd34d; border: 1px solid rgba(245,158,11,0.25); }

/* Portal shell */
.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: rgba(17, 26, 46, 0.95);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand { margin-bottom: 1.75rem; padding: 0 0.4rem; }
.side-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.side-nav a {
  color: var(--muted);
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  font-weight: 500;
}
.side-nav a:hover, .side-nav a.active {
  background: var(--accent-soft);
  color: #5eead4;
}
.side-meta {
  margin-top: 1.5rem;
  padding: 0.9rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}
.main { padding: 1.5rem 1.75rem 2.5rem; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-header h1 {
  font-family: var(--display);
  font-size: 1.6rem;
  margin: 0;
  letter-spacing: -0.03em;
}
.page-header p { margin: 0.25rem 0 0; color: var(--muted); }

.panel {
  background: rgba(21, 34, 56, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.panel h2 {
  font-size: 1.05rem;
  margin: 0 0 1rem;
  font-family: var(--display);
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat {
  background: rgba(21, 34, 56, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
}
.stat .label { color: var(--muted); font-size: 0.85rem; }
.stat .value {
  font-family: var(--display);
  font-size: 1.55rem;
  margin-top: 0.2rem;
  letter-spacing: -0.03em;
}

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
table.data tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-ok { background: rgba(34,197,94,0.15); color: #86efac; }
.badge-warn { background: rgba(245,158,11,0.15); color: #fcd34d; }
.badge-danger { background: rgba(244,63,94,0.15); color: #fda4af; }
.badge-info { background: rgba(56,189,248,0.15); color: #7dd3fc; }
.badge-muted { background: rgba(148,163,184,0.15); color: #cbd5e1; }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: end;
}
.code-box {
  background: #0a1424;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  word-break: break-all;
  color: #a5f3fc;
}
.copy-row { display: flex; gap: 0.5rem; align-items: stretch; }
.copy-row .code-box { flex: 1; }
.muted { color: var(--muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.qr-box {
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  width: fit-content;
  margin: 0.75rem 0;
}
.qr-box img { display: block; width: 180px; height: 180px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .form-row, .grid-2 { grid-template-columns: 1fr; }
  .hero-visual { min-height: 280px; }
  .hero-copy { left: 6%; top: 18%; transform: none; }
  .qr-preview { right: 50%; transform: translateX(50%); top: auto; bottom: 1.25rem; animation: none; }
}
