:root {
  color-scheme: dark;
  --sh-bg: #0a0f1d;
  --sh-bg-2: #0e1526;
  --sh-panel: #121b2f;
  --sh-panel-2: #17233b;
  --sh-panel-3: #1b2946;
  --sh-border: #283a5c;
  --sh-border-soft: #1d2a45;
  --sh-text: #edf4ff;
  --sh-muted: #94a7c5;
  --sh-faint: #687b99;
  --sh-link: #79c4ff;
  --sh-accent: #6eb7ff;
  --sh-accent-2: #8bd9ff;
  --sh-good: #7ee6aa;
  --sh-warn: #ffd17a;
  --sh-bad: #ff8e9c;
  --sh-radius: 14px;
  --sh-radius-sm: 9px;
  --sh-shadow: 0 20px 55px rgba(0,0,0,.22);
  --sh-max: 1260px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--sh-bg); }
body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--sh-text);
  background:
    radial-gradient(circle at 12% 0%, rgba(69,126,210,.15), transparent 30rem),
    radial-gradient(circle at 90% 8%, rgba(79,176,225,.08), transparent 28rem),
    linear-gradient(180deg, var(--sh-bg-2), var(--sh-bg) 42rem);
  line-height: 1.5;
}

a { color: var(--sh-link); text-decoration: none; }
a:hover { color: #b9e3ff; }
img { max-width: 100%; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
code { font-size: .92em; }

h1, h2, h3, h4 { color: var(--sh-text); line-height: 1.15; }
h1 { margin: 0; font-size: clamp(1.75rem, 3vw, 2.65rem); letter-spacing: -.035em; }
h2 { margin: 0; font-size: clamp(1.3rem, 2vw, 1.75rem); letter-spacing: -.02em; }
h3 { margin: 0; font-size: 1.05rem; }
p { margin: .65rem 0; }
small, .muted { color: var(--sh-muted); }

/* Brand */
.sh-brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; color: var(--sh-text); }
.sh-brand:hover { color: var(--sh-text); }
.sh-brand-mark {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--sh-accent), var(--sh-accent-2));
  color: #07111f;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.24), 0 8px 24px rgba(60,156,236,.18);
}
.sh-brand-copy { display: flex; flex-direction: column; min-width: 0; }
.sh-brand-name { font-size: 1rem; font-weight: 800; letter-spacing: -.01em; }
.sh-brand-sub { font-size: .68rem; color: var(--sh-muted); letter-spacing: .04em; text-transform: uppercase; }

/* Public shell */
.public-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10,15,29,.88);
  border-bottom: 1px solid rgba(40,58,92,.8);
  backdrop-filter: blur(15px);
}
.public-bar {
  width: min(var(--sh-max), calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
  display: flex; align-items: center; gap: 22px;
}
.public-nav { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.public-nav a {
  color: var(--sh-muted); padding: 8px 11px; border-radius: 9px; font-size: .9rem; font-weight: 650;
}
.public-nav a:hover, .public-nav a.active { color: var(--sh-text); background: rgba(121,196,255,.09); }
.public-nav .nav-primary { background: var(--sh-panel-3); color: #fff; border: 1px solid var(--sh-border); }
.public-main { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 72px; }
.public-footer { margin-top: 48px; border-top: 1px solid var(--sh-border-soft); }
.public-footer-inner {
  width: min(var(--sh-max), calc(100% - 32px)); margin: 0 auto; padding: 24px 0 34px;
  display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.public-footer-links { display: flex; gap: 8px; flex-wrap: wrap; }
.public-footer-links a { padding: 6px 8px; color: var(--sh-muted); font-size: .88rem; }

.public-hero { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(300px,.75fr); gap: 28px; align-items: center; }
.eyebrow { margin-bottom: 12px; color: var(--sh-accent-2); font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.lede { max-width: 740px; margin-top: 16px; color: #afbfda; font-size: clamp(1rem, 1.7vw, 1.17rem); line-height: 1.72; }
.actions-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 22px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-top: 28px; }

/* Common surface */
.card, .panel, .surface {
  background: linear-gradient(180deg, rgba(23,35,59,.96), rgba(17,27,47,.96));
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  box-shadow: 0 12px 35px rgba(0,0,0,.12);
}
.card { padding: 20px; }
.card > h3 + p { color: var(--sh-muted); }
.subtle-panel { background: rgba(16,25,44,.74); border: 1px solid var(--sh-border-soft); border-radius: var(--sh-radius-sm); }

/* Buttons */
button, .btn {
  appearance: none;
  min-height: 38px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--sh-border);
  border-radius: 9px;
  background: var(--sh-panel-3);
  color: var(--sh-text);
  font: inherit; font-size: .88rem; font-weight: 700;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, transform .14s ease;
}
button:hover, .btn:hover { color: #fff; background: #233656; border-color: #416087; }
button:active, .btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, #2f78bd, #285f98); border-color: #4387c5; }
.btn-primary:hover { background: linear-gradient(180deg, #3986ca, #2d6ca7); }
.btn-secondary { background: transparent; }
.btn-danger { color: #ffc0c8; background: rgba(134,41,55,.15); border-color: rgba(255,142,156,.35); }
.btn-small { min-height: 32px; padding: 5px 9px; font-size: .8rem; }

/* Forms */
form { margin: 0; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, label.field-label { color: #b5c5dd; font-size: .78rem; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.form-grid.cols-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.form-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=url], textarea, select {
  width: 100%; min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--sh-border);
  border-radius: 9px;
  background: #0c1425;
  color: var(--sh-text);
  font: inherit;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: #4c83b5; box-shadow: 0 0 0 3px rgba(78,137,190,.13); }
textarea { min-height: 130px; resize: vertical; }
input[type=checkbox] { accent-color: #5aa9ec; }
.check-row { display: flex; gap: 8px; align-items: center; color: #b8c7dc; font-size: .88rem; }
.check-row input { flex: 0 0 auto; }

/* Alerts / statuses */
.alert { margin: 0 0 18px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--sh-border); background: rgba(20,31,52,.9); }
.alert-good { border-color: rgba(126,230,170,.28); background: rgba(46,116,78,.12); color: #b9f5d0; }
.alert-bad { border-color: rgba(255,142,156,.3); background: rgba(133,42,55,.14); color: #ffc2ca; }
.alert-warn { border-color: rgba(255,209,122,.28); background: rgba(118,82,25,.13); color: #ffe1a8; }
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 999px; border: 1px solid var(--sh-border);
  color: #b4c4db; background: rgba(18,27,47,.8); font-size: .72rem; font-weight: 760; white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--sh-faint); }
.status-good { color: #b9f5d0; border-color: rgba(126,230,170,.25); background: rgba(46,116,78,.11); }
.status-good::before { background: var(--sh-good); }
.status-warn { color: #ffe1a8; border-color: rgba(255,209,122,.25); background: rgba(118,82,25,.11); }
.status-warn::before { background: var(--sh-warn); }
.status-bad { color: #ffc2ca; border-color: rgba(255,142,156,.25); background: rgba(133,42,55,.11); }
.status-bad::before { background: var(--sh-bad); }

/* Admin shell */
.admin-topbar {
  position: sticky; top: 0; z-index: 30;
  height: 66px;
  display: flex; align-items: center;
  background: rgba(9,14,27,.92);
  border-bottom: 1px solid var(--sh-border-soft);
  backdrop-filter: blur(16px);
}
.admin-topbar-inner { width: min(var(--sh-max), calc(100% - 28px)); margin: 0 auto; display: flex; align-items: center; gap: 18px; }
.admin-account { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.account-copy { display: grid; justify-items: end; line-height: 1.15; }
.account-name { font-size: .82rem; font-weight: 800; }
.account-role { color: var(--sh-muted); font-size: .7rem; text-transform: capitalize; }
.admin-shell { width: min(var(--sh-max), calc(100% - 28px)); margin: 0 auto; display: grid; grid-template-columns: 210px minmax(0,1fr); gap: 30px; }
.admin-sidebar { padding: 26px 0 38px; }
.admin-nav { position: sticky; top: 92px; display: grid; gap: 5px; }
.admin-nav-section { margin: 16px 10px 4px; color: #637994; font-size: .67rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.admin-nav a {
  display: flex; align-items: center; gap: 9px;
  min-height: 40px; padding: 8px 11px; border: 1px solid transparent; border-radius: 9px;
  color: #96aac5; font-size: .86rem; font-weight: 680;
}
.admin-nav a:hover { color: var(--sh-text); background: rgba(121,196,255,.06); }
.admin-nav a.active { color: #fff; background: linear-gradient(180deg, rgba(48,83,128,.42), rgba(34,59,94,.42)); border-color: #345079; }
.nav-dot { width: 7px; height: 7px; border-radius: 2px; background: #5b718e; }
.admin-nav a.active .nav-dot { background: var(--sh-accent-2); }
.admin-content { min-width: 0; padding: 34px 0 70px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-head-copy { min-width: 0; }
.page-kicker { margin-bottom: 7px; color: var(--sh-accent-2); font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.page-subtitle { margin: 8px 0 0; color: var(--sh-muted); max-width: 760px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-stack { display: grid; gap: 18px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 12px; }
.section-head p { margin: 5px 0 0; color: var(--sh-muted); font-size: .86rem; }

/* Metrics */
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; }
.metric-card { padding: 17px 18px; border-radius: 13px; background: rgba(18,28,48,.88); border: 1px solid var(--sh-border-soft); }
.metric-label { color: var(--sh-muted); font-size: .72rem; font-weight: 760; letter-spacing: .04em; text-transform: uppercase; }
.metric-value { margin-top: 5px; font-size: clamp(1.45rem,2.6vw,2.05rem); line-height: 1; font-weight: 850; letter-spacing: -.04em; }
.metric-note { margin-top: 7px; color: #7589a6; font-size: .72rem; }

/* Tables */
.table-wrap { overflow: auto; border: 1px solid var(--sh-border); border-radius: 12px; background: rgba(14,22,38,.72); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 13px; text-align: left; border-bottom: 1px solid var(--sh-border-soft); vertical-align: middle; }
th { color: #8fa4bf; background: rgba(14,22,38,.95); font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
td { font-size: .84rem; color: #dce7f7; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(87,139,194,.035); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-title { font-weight: 760; color: #f1f6ff; }
.cell-sub { margin-top: 2px; color: var(--sh-muted); font-size: .74rem; word-break: break-word; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.empty-state { padding: 42px 24px; text-align: center; color: var(--sh-muted); }

/* Resource cards */
.resource-list { display: grid; gap: 12px; }
.resource-card { padding: 16px; border: 1px solid var(--sh-border); border-radius: 12px; background: rgba(17,27,47,.78); }
.resource-head { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; }
.resource-title { font-weight: 800; }
.resource-meta { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.resource-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.banner-thumb {
  width: 242px; max-width: 100%; aspect-ratio: 728 / 90;
  object-fit: contain; background: #080d18; border: 1px solid var(--sh-border-soft); border-radius: 8px;
}
.banner-card-layout { display: grid; grid-template-columns: minmax(220px,242px) minmax(0,1fr); gap: 18px; align-items: center; }

/* Details editors */
details.editor { margin-top: 12px; border-top: 1px solid var(--sh-border-soft); padding-top: 10px; }
details.editor > summary { width: max-content; cursor: pointer; color: var(--sh-link); font-size: .82rem; font-weight: 700; list-style: none; }
details.editor > summary::-webkit-details-marker { display: none; }
.editor-body { margin-top: 14px; padding: 14px; border-radius: 10px; background: rgba(8,13,24,.42); border: 1px solid var(--sh-border-soft); }

/* Reports */
.report-toolbar { padding: 14px; margin-bottom: 16px; }
.report-toolbar form { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.report-toolbar .field { min-width: 150px; }
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.preset-row a { padding: 6px 9px; border: 1px solid var(--sh-border-soft); border-radius: 999px; color: var(--sh-muted); font-size: .76rem; font-weight: 700; }
.preset-row a.active { color: #fff; border-color: #3d628e; background: rgba(63,113,166,.22); }
.report-split { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.rank-list { display: grid; gap: 8px; margin-top: 12px; }
.rank-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--sh-border-soft); }
.rank-row:last-child { border-bottom: 0; }
.ctr-good { color: var(--sh-good); }
.ctr-warn { color: var(--sh-warn); }
.ctr-bad { color: var(--sh-bad); }

/* Integration */
.integration-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.integration-endpoint { padding: 10px 12px; border: 1px solid var(--sh-border-soft); border-radius: 9px; background: #09111f; overflow-wrap: anywhere; color: #bed6ef; }
.key-reveal { margin-bottom: 14px; padding: 13px; border-radius: 10px; border: 1px solid rgba(126,230,170,.3); background: rgba(46,116,78,.12); }

/* Auth pages */
.auth-shell { max-width: 470px; margin: 28px auto 0; }
.auth-card { padding: 24px; }
.auth-card h1 { font-size: 1.75rem; }
.auth-card .stack { display: grid; gap: 13px; }

@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; gap: 0; }
  .admin-sidebar { padding: 12px 0 0; overflow-x: auto; }
  .admin-nav { position: static; display: flex; gap: 5px; min-width: max-content; }
  .admin-nav-section { display: none; }
  .admin-nav a { min-height: 36px; }
  .admin-content { padding-top: 24px; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .public-hero { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .public-bar { min-height: 60px; }
  .sh-brand-sub, .account-copy { display: none; }
  .public-nav { gap: 2px; }
  .public-nav a { padding: 7px 8px; font-size: .82rem; }
  .public-main { padding-top: 36px; }
  .admin-topbar { height: 60px; }
  .admin-shell { width: min(100% - 20px, var(--sh-max)); }
  .page-head { display: grid; }
  .page-actions { width: 100%; }
  .form-grid, .form-grid.cols-3, .report-split, .integration-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .banner-card-layout { grid-template-columns: 1fr; }
  .banner-thumb { width: 100%; }
  th, td { padding: 10px 11px; }
}

@media (max-width: 480px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .public-bar { width: calc(100% - 20px); }
  .public-main { width: calc(100% - 20px); }
  .sh-brand-name { font-size: .92rem; }
}
