:root {
  --ink: #17202a;
  --muted: #64717f;
  --line: #dbe1e6;
  --surface: #ffffff;
  --canvas: #f4f6f7;
  --navy: #18354d;
  --blue: #256b98;
  --green: #16815d;
  --red: #c2413a;
  --amber: #d99614;
  --radius: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--canvas); }
body { margin: 0; min-width: 320px; }
a { color: var(--blue); }

/* ── App shell: fixed sidebar + scrollable main column ── */
.app-shell { display: flex; min-height: 100vh; }
.sidebar-toggle-input { display: none; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 16px;
  color: white;
  background: var(--navy);
  border-right: 4px solid #4da3c7;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: white; font-weight: 760; text-decoration: none; letter-spacing: .01em; padding: 6px 8px 22px; }
.brand-mark { width: 14px; height: 14px; display: inline-block; border: 3px solid #7dc7e5; border-radius: 50%; box-shadow: 0 0 0 3px rgba(125,199,229,.18); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: #dcebf1; text-decoration: none; padding: 11px 12px; border-radius: 6px; font-size: .94rem; font-weight: 600; }
.sidebar nav a:hover { background: rgba(255,255,255,.1); color: white; }
.sidebar nav a.active { background: rgba(255,255,255,.14); color: white; box-shadow: inset 3px 0 0 #7dc7e5; }
.sidebar-spacer { flex: 1; }
.logout-link { color: #b9cddb; text-decoration: none; padding: 11px 12px; border-radius: 6px; font-size: .88rem; font-weight: 600; border-top: 1px solid rgba(255,255,255,.12); margin-top: 8px; padding-top: 16px; }
.logout-link:hover { color: white; }

.sidebar-scrim { display: none; }

.main-column { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar { display: none; align-items: center; gap: 14px; min-height: 56px; padding: 0 4vw; background: var(--navy); color: white; }
.topbar-brand { font-weight: 760; }
.menu-button { display: flex; flex-direction: column; justify-content: center; gap: 4px; width: 30px; height: 30px; cursor: pointer; }
.menu-button span { display: block; width: 100%; height: 2px; background: white; border-radius: 2px; }

.page-shell { width: min(1440px, 94vw); margin: 0 auto; padding: 38px 0 64px; flex: 1; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 6px; color: var(--blue); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; }
h1, h2 { margin: 0; color: #10283b; letter-spacing: -.025em; }
h1 { font-size: clamp(2rem, 4vw, 3.5rem); line-height: 1; }
h2 { font-size: 1.35rem; }
.lede { max-width: 760px; margin: 10px 0 0; color: var(--muted); }
.summary-chip { padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); white-space: nowrap; }
.button, button { border: 0; border-radius: 6px; padding: 10px 15px; color: white; background: var(--blue); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.button:hover, button:hover { background: #1c557a; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 12px rgba(18,43,59,.045); }
.table-wrap.flush { border: 0; border-radius: 0 0 var(--radius) var(--radius); box-shadow: none; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 13px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid #e7ebee; }
th { background: #edf2f5; color: #486070; font-size: .7rem; text-transform: uppercase; letter-spacing: .075em; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafb; }
.strong-link { font-weight: 750; text-decoration: none; }
.status-dot { width: 9px; height: 9px; display: inline-block; margin-right: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(194,65,58,.10); }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 3px rgba(22,129,93,.12); }
.status-dot.offline { background: var(--red); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; }
.compact { max-width: 580px; white-space: normal; overflow-wrap: anywhere; color: var(--muted); }
.empty { padding: 34px; text-align: center; color: var(--muted); }

.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.metric { min-height: 120px; padding: 18px; display: flex; flex-direction: column; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid #6aaac4; border-radius: var(--radius); }
.metric span { color: var(--muted); font-size: .73rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.metric strong { font-size: 1.4rem; line-height: 1.1; overflow-wrap: anywhere; }
.metric small { color: var(--muted); }
.panel { margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-heading { padding: 18px 20px 15px; }
.method-note { margin: 18px 0 0; padding: 16px 18px; color: #4e5d68; background: #eaf2f5; border-left: 4px solid #6aaac4; border-radius: 0 var(--radius) var(--radius) 0; font-size: .88rem; line-height: 1.55; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.filter-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding: 15px; margin-bottom: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.filter-bar label { min-width: 180px; display: grid; gap: 6px; color: var(--muted); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .055em; }
select, input { width: 100%; min-height: 40px; border: 1px solid #c8d1d8; border-radius: 5px; padding: 8px 10px; color: var(--ink); background: white; font: inherit; }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.sample-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 14px rgba(18,43,59,.06); }
.sample-card img { width: 100%; aspect-ratio: 16 / 9; display: block; object-fit: cover; background: #dce4e8; }
.sample-body { padding: 15px; }
.sample-topline { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #e8ecef; }
.sample-topline span { color: var(--muted); }
dl { margin: 12px 0 0; }
dl div { display: grid; grid-template-columns: 88px 1fr; gap: 10px; margin-top: 8px; }
dt { color: var(--muted); font-size: .78rem; }
dd { margin: 0; font-size: .88rem; overflow-wrap: anywhere; }
.uuid { font-size: .7rem; }
.empty-card { grid-column: 1 / -1; padding: 50px; text-align: center; color: var(--muted); background: white; border: 1px dashed #bdc7ce; border-radius: var(--radius); }
.site-footer { padding: 22px 4vw 32px; color: #75818a; text-align: center; font-size: .78rem; }

/* ── Danger zone (gallery flush) ── */
.danger-zone { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; padding: 16px 18px; background: #fdf3f2; border: 1px solid #f0cfc9; border-radius: var(--radius); }
.danger-zone-info strong { color: #7c2a23; }
.danger-zone-info p { margin: 4px 0 0; color: #8a5a51; font-size: .85rem; }
.danger-zone-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button.danger, button.danger { background: var(--red); }
.button.danger:hover, button.danger:hover { background: #9e332d; }
.button.danger-strong, button.danger-strong { background: #7c2a23; }
.button.danger-strong:hover, button.danger-strong:hover { background: #611f19; }

/* ── Banners ── */
.banner { padding: 12px 16px; margin-bottom: 18px; border-radius: var(--radius); font-weight: 650; }
.banner-success { color: #0f5c40; background: #e3f5ee; border: 1px solid #b9e3d2; }

/* ── Login page ── */
.login-body { margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.login-card { width: min(380px, 90vw); padding: 34px 30px; background: var(--surface); border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 760; color: var(--navy); margin-bottom: 22px; }
.login-brand .brand-mark { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,107,152,.14); }
.login-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.login-card .lede { margin: 0 0 20px; color: var(--muted); font-size: .88rem; }
.login-error { padding: 10px 12px; margin-bottom: 16px; color: #8a231d; background: #fdf0ee; border: 1px solid #f2c9c3; border-radius: 6px; font-size: .85rem; }
.login-card form { display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.login-card button { width: 100%; margin-top: 4px; padding: 11px; font-size: .95rem; }

@media (max-width: 1050px) { .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ── Mobile: collapse sidebar into an off-canvas panel behind a topbar ── */
@media (max-width: 900px) {
  .topbar { display: flex; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(15,25,35,.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .sidebar-toggle-input:checked ~ .sidebar { transform: translateX(0); }
  .sidebar-toggle-input:checked ~ .sidebar-scrim { opacity: 1; pointer-events: auto; }
}
@media (max-width: 680px) {
  .page-shell { padding-top: 28px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .danger-zone { flex-direction: column; align-items: flex-start; }
  .danger-zone-actions { width: 100%; }
  .danger-zone-actions form { flex: 1; }
  .danger-zone-actions button { width: 100%; }
}
@media (max-width: 430px) { .metric-grid { grid-template-columns: 1fr; } }
