@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Syne:wght@600;700;800&display=swap');

:root {
  --ink: #10221f;
  --muted: #5b726c;
  --paper: #f3faf7;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --line: rgba(11, 61, 58, 0.12);
  --teal: #0b3d3a;
  --teal-2: #14635d;
  --mint: #3dffb5;
  --mint-dim: #b8ffe3;
  --coral: #ff6b4a;
  --amber: #f0b429;
  --danger: #d64545;
  --ok: #1f9d6a;
  --shadow: 0 18px 50px rgba(11, 61, 58, 0.12);
  --radius: 18px;
  --sidebar: 260px;
  --font: "Figtree", system-ui, sans-serif;
  --display: "Syne", "Figtree", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 0% -10%, rgba(61, 255, 181, 0.22), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(255, 107, 74, 0.14), transparent 50%),
    linear-gradient(160deg, #eef8f4 0%, #f7fffb 45%, #e7f3ef 100%);
}

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

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background:
    linear-gradient(180deg, #0b3d3a 0%, #0f4a46 55%, #123f3b 100%);
  color: #eafff6;
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.06);
}

.brand-block {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  min-width: 0;
}
.brand-logo,
img.brand-logo {
  width: 44px !important;
  height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  border-radius: 12px !important;
  object-fit: cover !important;
  background: #062826;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  flex: 0 0 44px !important;
  display: block !important;
}
.brand-text { min-width: 0; }
.brand-text .name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.brand-text .name span { color: var(--mint); }
.brand-text .tag {
  margin-top: 4px;
  font-size: 0.78rem;
  color: rgba(234, 255, 246, 0.65);
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  margin-bottom: 6px;
  border-radius: 12px;
  color: rgba(234, 255, 246, 0.86);
  text-decoration: none;
  font-weight: 600;
  transition: background .18s ease, transform .18s ease;
}
.nav a:hover { background: rgba(61, 255, 181, 0.12); text-decoration: none; }
.nav a.active {
  background: linear-gradient(90deg, rgba(61,255,181,0.22), rgba(61,255,181,0.06));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--mint);
}

.main { padding: 28px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.5rem, 2vw, 2rem);
  letter-spacing: -0.03em;
}
h3 {
  margin: 0 0 12px;
  font-family: var(--display);
  letter-spacing: -0.02em;
}
.muted { color: var(--muted); }

.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: 1.15fr 0.85fr; }
.grid.health { grid-template-columns: 1.2fr 1fr; }
.grid.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.stat-card {
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(61,255,181,0.28), transparent 70%);
}
.stat-label { color: var(--muted); font-size: 0.85rem; margin-bottom: 8px; font-weight: 600; }
.stat-value {
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge.online { background: rgba(31, 157, 106, 0.14); color: var(--ok); }
.badge.offline { background: rgba(214, 69, 69, 0.12); color: var(--danger); }
.badge.disabled { background: rgba(91, 114, 108, 0.14); color: var(--muted); }
.badge.active, .badge.unused { background: rgba(11, 61, 58, 0.1); color: var(--teal); }
.badge.revoked, .badge.expired { background: rgba(214, 69, 69, 0.12); color: var(--danger); }
.badge.paid { background: rgba(31, 157, 106, 0.14); color: var(--ok); }
.badge.failed, .badge.pending { background: rgba(240, 180, 41, 0.16); color: #9a6b00; }

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tr:hover td { background: rgba(11, 61, 58, 0.03); }

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: var(--teal);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: transform .15s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); text-decoration: none; }
.btn.secondary { background: #d9ebe5; color: var(--teal); }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--ok); }
.btn.small { padding: 7px 10px; font-size: 0.85rem; }

.form-row { margin-bottom: 14px; }
label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.flash {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  background: rgba(61, 255, 181, 0.16);
  border: 1px solid rgba(20, 99, 93, 0.2);
}
.flash.error { background: rgba(214, 69, 69, 0.1); border-color: rgba(214, 69, 69, 0.3); }
.flash.success { background: rgba(31, 157, 106, 0.12); border-color: rgba(31, 157, 106, 0.28); }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); }
.kpi-row { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); padding: 18px 0; }

.metric-pill {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.metric-pill .label { color: var(--muted); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.metric-pill .value {
  margin-top: 6px;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 800;
}
.metric-pill .hint { margin-top: 4px; color: var(--muted); font-size: 0.8rem; }

.chart-wrap {
  position: relative;
  height: 260px;
  width: 100%;
}
.chart-wrap.sm { height: 200px; }

.hero-board {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(31,157,106,0.5);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(31,157,106,0.45); }
  70% { box-shadow: 0 0 0 10px rgba(31,157,106,0); }
  100% { box-shadow: 0 0 0 0 rgba(31,157,106,0); }
}

@media (max-width: 1100px) {
  .grid.stats, .grid.metrics, .grid.health, .grid.two { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-radius: 0 0 22px 22px;
  }
  .grid.stats, .grid.metrics, .grid.health, .grid.two { grid-template-columns: 1fr; }
  .main { padding: 18px; }
  .chart-wrap { height: 220px; }
}
