:root {
  /* --- Brand grays --- */
  --bg:       #131212;   /* darkest — page background */
  --surface:  #1b1a19;   /* cards, nav, panels */
  --surface2: #242220;   /* inputs, code bg, action cards */
  --surface3: #2e2b28;   /* hover rows, secondary borders */
  --border:   #2d2b28;

  /* --- Brand yellows --- */
  --yellow:        #ffc83d;  /* primary — buttons, brand, active links */
  --yellow-bright: #fbe601;  /* hover highlight */
  --yellow-dim:    #c99400;  /* pressed / darker shade */
  --on-yellow:     #131212;  /* text on yellow backgrounds */

  /* --- Text --- */
  --text:   #e2e2e2;   /* neutral light gray — body copy */
  --muted:  #909090;   /* neutral medium gray — secondary info, labels */
  --muted2: #5a5a5a;   /* neutral dark gray — very muted */

  /* --- Status — keep semantic colors readable on dark bg --- */
  --ok:      #2ecc71;   /* running / reachable */
  --ok-bg:   #0d3d20;
  --warn:    #e67e22;   /* caution / slow op warning */
  --warn-bg: #3d2200;
  --err:     #e05252;   /* error / down */
  --err-bg:  #3d1010;

  --font: 'Segoe UI', system-ui, sans-serif;
  --mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

/* ============================================================
   Navigation / Banner
   ============================================================ */
nav {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 1.5rem;
  height: 52px;
  background: var(--surface);
  border-bottom: 2px solid var(--yellow);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* brand block — left stripe with accent bg */
nav .brand {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 1.25rem 0 0;
  margin-right: 1.5rem;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--yellow);
  text-decoration: none;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
nav .brand::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--yellow);
  border-radius: 50%;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

/* nav links */
nav a {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 0.9rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px; /* sit on the nav border */
  transition: color 0.15s, border-color 0.15s;
}
nav a:hover { color: var(--text); }
nav a.active {
  color: var(--yellow);
  border-bottom-color: var(--yellow);
}

nav .logout {
  margin-left: auto;
  color: var(--muted2);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 0.75rem;
  height: 28px;
  display: flex;
  align-items: center;
  margin-bottom: 0;
  border-bottom-color: var(--border);
}
nav .logout:hover { color: var(--yellow); border-color: var(--yellow-dim); }

/* ============================================================
   Main content
   ============================================================ */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem;
}

h1 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.85rem;
}
h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}
/* left-accent strip on cards */
.card-accent {
  border-left: 3px solid var(--yellow);
}

/* ============================================================
   Tables
   ============================================================ */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--yellow);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface3); }

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge-ok   { background: var(--ok-bg);   color: var(--ok);   border-color: var(--ok-bg);   }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bg); }
.badge-err  { background: var(--err-bg);  color: var(--err);  border-color: var(--err-bg);  }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 6px 16px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Primary — solid yellow */
.btn-primary {
  background: var(--yellow);
  color: var(--on-yellow);
  border-color: var(--yellow);
}
.btn-primary:not(:disabled):hover {
  background: var(--yellow-bright);
  border-color: var(--yellow-bright);
}
.btn-primary:not(:disabled):active { background: var(--yellow-dim); }

/* Secondary — outlined yellow */
.btn-secondary {
  background: transparent;
  color: var(--yellow);
  border-color: var(--yellow-dim);
}
.btn-secondary:not(:disabled):hover {
  background: rgba(255, 200, 61, 0.08);
  border-color: var(--yellow);
}

/* Warning — outlined orange */
.btn-warn {
  background: transparent;
  color: var(--warn);
  border-color: var(--warn);
}
.btn-warn:not(:disabled):hover { background: var(--warn-bg); }

/* Danger — outlined red */
.btn-danger {
  background: transparent;
  color: var(--err);
  border-color: var(--err);
}
.btn-danger:not(:disabled):hover { background: var(--err-bg); }

.btn-sm { padding: 3px 10px; font-size: 11px; }

/* ============================================================
   Forms / Inputs
   ============================================================ */
input[type="text"],
input[type="password"],
select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--font);
  transition: border-color 0.15s;
}
input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
  outline: none;
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(255, 200, 61, 0.15);
}
select option { background: var(--surface2); }
label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* ============================================================
   Typography helpers
   ============================================================ */
.mono   { font-family: var(--mono); font-size: 12px; }
.muted  { color: var(--muted); font-size: 12px; }
.error  { color: var(--err); font-size: 13px; }
.loading { color: var(--muted); font-style: italic; }

code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface2);
  color: var(--yellow-bright);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

pre {
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

/* ============================================================
   Dashboard status rows
   ============================================================ */
.status-row {
  margin: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 13px;
}
.status-row strong { color: var(--yellow); font-size: 12px; min-width: 100px; }

/* ============================================================
   Services — action grid
   ============================================================ */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.85rem;
  margin-top: 0.85rem;
}
.action-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.action-card h3 { color: var(--yellow); font-size: 14px; }
.action-card p  { font-size: 12px; color: var(--muted); flex: 1; }
.action-card button { width: 100%; margin-top: auto; }

#op-output {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  border-radius: 4px;
  max-height: 500px;
  overflow-y: auto;
  color: var(--text);
}

/* ============================================================
   Log viewer
   ============================================================ */
.log-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.log-controls .badge {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 4px;
}
.log-card { padding: 0; overflow: hidden; }
.log-pre {
  background: var(--bg);
  padding: 0.85rem 1rem;
  border-radius: 6px;
  height: 65vh;
  overflow-y: auto;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text);
}

/* ============================================================
   Subscribers
   ============================================================ */
.sub-toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}
.form-row input { width: 100%; margin-top: 4px; }

/* ============================================================
   Login
   ============================================================ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--yellow);
  border-radius: 8px;
  padding: 2.25rem 2rem;
  width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
}
.login-logo .dot {
  width: 12px;
  height: 12px;
  background: var(--yellow);
  border-radius: 50%;
}
.login-logo h1 {
  font-size: 18px;
  font-weight: 800;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.login-box form { display: flex; flex-direction: column; gap: 0.85rem; }
.login-box label { color: var(--muted); font-size: 12px; }
.login-box input { width: 100%; padding: 9px 12px; margin-top: 4px; }
.login-box button { width: 100%; padding: 10px; margin-top: 0.5rem; font-size: 14px; }
.login-box .hint  { font-size: 11px; color: var(--muted2); margin-top: 1.25rem; text-align: center; }
.login-box .error { color: var(--err); font-size: 13px; margin-bottom: 0.5rem; text-align: center; }
