/* CTISys standalone portal — WP-P3-3b-FE theme.
 *
 * Dark toolbar + light sidebar + card layout, modelled on the appliance
 * local webUI (WP-UIX) but self-contained (no imports from partner_firmware).
 * Accent: #000080 navy (WP-BRAND-DS, 2026-09-23; Phase-3 245ABA superseded).
 * Gold #DBA545 is reserved for the
 * threat-map home-pin / legend (defined as --cti-home-pin; page usage in
 * WP-P3-3c).
 *
 * Vanilla CSS only. No CDN. No frameworks.
 */

/* ── Theme tokens ──────────────────────────────────────────────────── */
:root {
  --cti-accent: #000080;
  --cti-home-pin: #DBA545;           /* reserved — used by WP-P3-3c maps */
  --cti-toolbar: #4a4a4a;
  --cti-toolbar-fg: #ffffff;
  --cti-bg: #f4f5f7;
  --cti-card: #ffffff;
  --cti-text: #1f2328;
  --cti-text-muted: #656d76;
  --cti-border: #d0d7de;
  --cti-sidebar-bg: #f6f8fa;
  --cti-sidebar-fg: #1f2328;
  --cti-sidebar-active: #e1e4e8;
  --cti-sidebar-hover: #eaedf1;
  --cti-ok: #1a7f37;
  --cti-warn: #9a6700;
  --cti-bad: #cf222e;
  --cti-link: #0969da;
  --cti-focus: rgba(36, 90, 186, 0.4);
  --cti-radius: 6px;
  --cti-shadow: 0 1px 2px rgba(27, 31, 36, 0.06);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--cti-bg);
  color: var(--cti-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--cti-link); }
a:hover { color: var(--cti-accent); }

/* Focus outline — visible on every interactive control */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--cti-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Top toolbar ───────────────────────────────────────────────────── */
.cti-topbar {
  background: var(--cti-toolbar);
  color: var(--cti-toolbar-fg);
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 100;
  gap: 12px;
}

.cti-topbar .cti-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--cti-toolbar-fg);
  text-decoration: none;
  letter-spacing: 0.2px;
}

.cti-topbar .cti-brand:hover { color: var(--cti-toolbar-fg); }

.cti-topbar .cti-brand-mark {
  width: 26px;
  height: 26px;
  background: var(--cti-accent);
  color: #fff;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.cti-topbar .cti-topbar-spacer { flex: 1; }

.cti-topbar .cti-topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}

.cti-topbar .cti-user {
  opacity: 0.9;
}

.cti-topbar .cti-role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: var(--cti-accent);
  color: #fff;
}

.cti-topbar .cti-role-badge.role-superadmin { background: var(--cti-accent); }
.cti-topbar .cti-role-badge.role-partner   { background: #475467; }
.cti-topbar .cti-role-badge.role-reseller  { background: #667085; }
.cti-topbar .cti-role-badge.role-anonymous { background: #656d76; }

.cti-topbar a.cti-toplink {
  color: var(--cti-toolbar-fg);
  text-decoration: none;
  opacity: 0.85;
  padding: 4px 6px;
  border-radius: 3px;
}

.cti-topbar a.cti-toplink:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
}

/* ── Body: sidebar + content ───────────────────────────────────────── */
.cti-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.cti-sidebar {
  width: 220px;
  background: var(--cti-sidebar-bg);
  border-right: 1px solid var(--cti-border);
  flex-shrink: 0;
  padding: 16px 0;
  overflow-y: auto;
}

.cti-sidebar .cti-nav-section {
  padding: 0 12px;
  margin-bottom: 16px;
}

.cti-sidebar .cti-nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--cti-text-muted);
  padding: 4px 10px;
  margin-bottom: 4px;
  font-weight: 600;
}

.cti-sidebar .cti-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 4px;
  color: var(--cti-sidebar-fg);
  text-decoration: none;
  font-size: 13px;
  transition: background 0.12s;
  cursor: pointer;
}

.cti-sidebar .cti-nav-item:hover {
  background: var(--cti-sidebar-hover);
}

.cti-sidebar .cti-nav-item.active {
  background: var(--cti-sidebar-active);
  font-weight: 600;
}

.cti-sidebar .cti-nav-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.cti-sidebar .cti-nav-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

/* ── Main content ──────────────────────────────────────────────────── */
.cti-main {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
  min-width: 0;
}

.cti-main > h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--cti-text);
}

.cti-page-subtitle {
  font-size: 12px;
  color: var(--cti-text-muted);
  margin-bottom: 20px;
}

/* ── Footer ────────────────────────────────────────────────────────── */
.cti-footer {
  padding: 10px 28px;
  font-size: 11px;
  color: var(--cti-text-muted);
  border-top: 1px solid var(--cti-border);
  background: var(--cti-sidebar-bg);
  flex-shrink: 0;
}

/* ── Flash messages ────────────────────────────────────────────────── */
.cti-messages {
  margin-bottom: 16px;
}

.cti-message {
  padding: 8px 12px;
  border-radius: var(--cti-radius);
  margin: 0 0 6px 0;
  font-size: 13px;
  border-left: 3px solid var(--cti-accent);
  background: #eff6ff;
  color: #1e3a8a;
}

.cti-message.ok, .cti-message.success {
  border-left-color: var(--cti-ok);
  background: #ecfdf3;
  color: #065f46;
}

.cti-message.error, .cti-message.danger {
  border-left-color: var(--cti-bad);
  background: #fef2f2;
  color: #991b1b;
}

/* ── Cards ─────────────────────────────────────────────────────────── */
.cti-card {
  background: var(--cti-card);
  border: 1px solid var(--cti-border);
  border-radius: var(--cti-radius);
  box-shadow: var(--cti-shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.cti-card h1, .cti-card h2 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
}

.cti-card h2 { font-size: 14px; }

/* ── Login card (centred) ──────────────────────────────────────────── */
.cti-login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 48px - 40px); /* toolbar + footer */
  padding: 24px;
}

.cti-login-card {
  background: var(--cti-card);
  border: 1px solid var(--cti-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(27, 31, 36, 0.08);
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
}

.cti-login-card .cti-login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.cti-login-card .cti-login-brand-mark {
  width: 36px;
  height: 36px;
  background: var(--cti-accent);
  color: #fff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.cti-login-card .cti-login-brand-text {
  font-size: 18px;
  font-weight: 600;
}

.cti-login-card h1 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px 0;
}

/* ── Forms ─────────────────────────────────────────────────────────── */
form { display: block; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--cti-text);
  margin: 10px 0 4px 0;
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--cti-border);
  border-radius: 4px;
  background: #fff;
  color: var(--cti-text);
  font-family: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--cti-accent);
  box-shadow: 0 0 0 3px var(--cti-focus);
  outline: none;
}

input:disabled, select:disabled, textarea:disabled {
  background: #f6f8fa;
  color: var(--cti-text-muted);
  cursor: not-allowed;
}

button,
.cti-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}

.cti-btn-primary {
  background: var(--cti-accent);
  color: #fff;
  border-color: var(--cti-accent);
}

.cti-btn-primary:hover { background: #1d4a96; }

.cti-btn-secondary {
  background: #fff;
  color: var(--cti-text);
  border-color: var(--cti-border);
}

.cti-btn-secondary:hover { background: #f6f8fa; }

button:disabled,
.cti-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button[type="submit"] {
  background: var(--cti-accent);
  color: #fff;
  border: 1px solid var(--cti-accent);
  padding: 8px 18px;
  border-radius: 4px;
  font-weight: 600;
  margin-top: 16px;
  cursor: pointer;
}

button[type="submit"]:hover { background: #1d4a96; }
button[type="submit"]:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Errors / notices ──────────────────────────────────────────────── */
.cti-error, .cti-errors {
  color: var(--cti-bad);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 13px;
  margin: 0 0 12px 0;
}

.cti-errors {
  list-style: none;
  padding: 8px 12px;
}

.cti-errors li { margin: 2px 0; }

.cti-notice {
  color: #1e3a8a;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 13px;
  margin: 0 0 12px 0;
}

/* ── Dashboard layout ──────────────────────────────────────────────── */
.cti-dashboard { }

.cti-dash-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.cti-dash-header h1 { margin: 0; }

.cti-tier-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: var(--cti-accent);
  color: #fff;
}

.cti-tier-badge.tier-standard   { background: #475467; }
.cti-tier-badge.tier-premium    { background: var(--cti-accent); }
.cti-tier-badge.tier-evaluation { background: #667085; }
.cti-tier-badge.tier-blocked    { background: var(--cti-bad); }

.cti-expires-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--cti-border);
  background: #fff;
}

.cti-expires-chip.exp-ok      { border-color: var(--cti-ok);   color: var(--cti-ok); }
.cti-expires-chip.exp-warn    { border-color: var(--cti-warn); color: var(--cti-warn); }
.cti-expires-chip.exp-bad     { border-color: var(--cti-bad);  color: var(--cti-bad); }

/* ── Stat cards row ────────────────────────────────────────────────── */
.cti-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.cti-stat-card {
  background: var(--cti-card);
  border: 1px solid var(--cti-border);
  border-radius: var(--cti-radius);
  padding: 16px;
  box-shadow: var(--cti-shadow);
}

.cti-stat-card .cti-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--cti-text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.cti-stat-card .cti-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--cti-text);
  line-height: 1;
}

.cti-stat-card .cti-stat-note {
  font-size: 11px;
  color: var(--cti-text-muted);
  margin-top: 6px;
}

.cti-stat-card.placeholder {
  border-style: dashed;
  opacity: 0.85;
}

/* 3-column variant for superadmin KPIs */
.cti-stat-row.three { grid-template-columns: repeat(3, 1fr); }

/* ── Tables ────────────────────────────────────────────────────────── */
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--cti-text-muted);
  font-weight: 600;
  padding: 8px 12px;
  border-bottom: 1px solid var(--cti-border);
  background: #f6f8fa;
}

tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #eaedf1;
  vertical-align: top;
}

tbody tr:hover { background: #f6f8fa; }

.cti-empty-state {
  padding: 24px;
  text-align: center;
  color: var(--cti-text-muted);
  font-size: 13px;
  font-style: italic;
}

/* ── Navigation links (in-dashboard) ───────────────────────────────── */
.cti-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.cti-nav a {
  padding: 6px 12px;
  border: 1px solid var(--cti-border);
  border-radius: 4px;
  text-decoration: none;
  font-size: 13px;
  color: var(--cti-text);
  background: #fff;
}

.cti-nav a:hover {
  border-color: var(--cti-accent);
  color: var(--cti-accent);
}

/* ── Notification banner slot ──────────────────────────────────────── */
.cti-notice-slot {
  display: none; /* hidden by default; JS or server-side adds content */
  margin-bottom: 16px;
}

.cti-notice-slot:empty { display: none; }

/* ── Responsive: collapse sidebar below 900px ─────────────────────── */
@media (max-width: 899px) {
  .cti-body { flex-direction: column; }
  .cti-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--cti-border);
    padding: 10px 0;
  }
  .cti-sidebar .cti-nav-section {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 12px;
    margin-bottom: 0;
  }
  .cti-sidebar .cti-nav-label { display: none; }
  .cti-sidebar .cti-nav-item { padding: 6px 10px; }
  .cti-main { padding: 16px; }
  .cti-stat-row { grid-template-columns: repeat(2, 1fr); }
  .cti-stat-row.three { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .cti-topbar { padding: 0 10px; gap: 8px; }
  .cti-topbar .cti-brand { font-size: 14px; }
  .cti-topbar .cti-topbar-right { gap: 8px; font-size: 12px; }
  .cti-stat-row { grid-template-columns: 1fr; }
  .cti-stat-row.three { grid-template-columns: 1fr; }
  .cti-login-card { padding: 24px 18px; }
  .cti-dash-header { flex-direction: column; align-items: flex-start; }
}

/* ── Threat map (WP-P3-3c) ────────────────────────────────────────── */
/* Ported marker conventions from partner_firmware/static/app.css:
 * .cti-pulse-marker (pulsing red dot) and .cti-home-pin (gold circle). */

.cti-map-container {
  border: 1px solid var(--cti-border);
  border-radius: var(--cti-radius);
  overflow: hidden;
  background: #1a1a2e;
}

.cti-map-help {
  font-size: 11px;
  color: var(--cti-text-muted);
  margin-bottom: 8px;
}

.cti-pulse-marker {
  border-radius: 50%;
  background: rgba(221, 0, 0, 0.6);
  border: 2px solid rgba(221, 0, 0, 0.9);
  position: relative;
}

.cti-pulse-marker::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  border-radius: 50%;
  border: 2px solid rgba(221, 0, 0, 0.5);
  animation: cti-pulse 2s ease-out infinite;
}

@keyframes cti-pulse {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

.cti-home-pin {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--cti-home-pin, #DBA545);
  border: 2px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.cti-map-legend {
  background: rgba(255,255,255,0.92);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 11px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  color: #333;
}

.cti-map-legend .cti-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

/* ── Telemetry notice (amber banner) ─────────────────────────────── */
.cti-telemetry-notice {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 10px;
}

/* ── Events panel (WP-P3-3c) ─────────────────────────────────────── */
.cti-tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--cti-border);
  margin-bottom: 12px;
}

.cti-tab-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  color: var(--cti-text-muted);
  border-radius: 0;
  transition: color 0.12s, border-color 0.12s;
}

.cti-tab-btn:hover {
  color: var(--cti-text);
}

.cti-tab-btn.active {
  color: var(--cti-accent);
  border-bottom-color: var(--cti-accent);
}

.cti-events-empty {
  text-align: center;
  padding: 20px;
  color: var(--cti-text-muted);
  font-style: italic;
}

/* Severity badges */
.cti-sev-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.cti-sev-badge.critical { background: #fef2f2; color: #991b1b; }
.cti-sev-badge.high     { background: #fff7ed; color: #9a3412; }
.cti-sev-badge.medium   { background: #fffbeb; color: #92400e; }
.cti-sev-badge.low      { background: #ecfdf3; color: #065f46; }

/* Action pills */
.cti-action-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.cti-action-pill.action-blocked { background: #fef2f2; color: #991b1b; }
.cti-action-pill.action-allowed { background: #ecfdf3; color: #065f46; }

/* Event detail dialog */
.cti-event-dialog {
  border: 1px solid var(--cti-border);
  border-radius: 8px;
  padding: 24px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(27, 31, 36, 0.16);
}

.cti-event-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.cti-event-dialog h3 {
  margin: 0 0 12px 0;
  font-size: 15px;
  font-weight: 600;
}

.cti-dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--cti-text-muted);
  padding: 4px 8px;
  line-height: 1;
}

.cti-dialog-close:hover { color: var(--cti-text); }

.cti-detail-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 4px 12px;
  font-size: 13px;
  margin: 0;
}

.cti-detail-grid dt {
  font-weight: 600;
  color: var(--cti-text-muted);
}

.cti-detail-grid dd {
  margin: 0;
  word-break: break-all;
}

/* Screen-reader-only (for aria-live region) */
.cti-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Event table rows — keyboard focusable */
#events-tbody tr[data-idx] {
  cursor: pointer;
}

#events-tbody tr[data-idx]:focus-visible {
  outline: 2px solid var(--cti-accent);
  outline-offset: -2px;
}

/* ── prefers-reduced-motion: disable pulse + arc animations ───────── */
@media (prefers-reduced-motion: reduce) {
  .cti-pulse-marker::after {
    animation: none;
  }
}

/* ── Responsive: map + events ────────────────────────────────────── */
@media (max-width: 899px) {
  .cti-map-container { height: 240px !important; }
}

@media (max-width: 480px) {
  .cti-map-container { height: 200px !important; }
  .cti-detail-grid { grid-template-columns: 1fr; }
  .cti-detail-grid dt { margin-top: 6px; }
}

/* ── WP-P3-3d-FE: superadmin template restyle ────────────────────── */

/* Fieldsets */
.cti-fieldset {
  border: 1px solid var(--cti-border);
  border-radius: var(--cti-radius);
  padding: 16px 20px;
  margin: 0 0 16px 0;
}

.cti-fieldset legend {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--cti-text-muted);
  padding: 0 6px;
}

/* Info notes */
.cti-info-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--cti-text-muted);
  background: #f6f8fa;
  border: 1px solid var(--cti-border);
  border-radius: 4px;
  padding: 8px 12px;
  margin: 0 0 16px 0;
}

.cti-info-icon {
  color: var(--cti-accent);
  font-size: 14px;
  flex-shrink: 0;
}

/* Required field marker */
.cti-required {
  color: var(--cti-bad);
  font-weight: 700;
}

/* Status chips */
.cti-status-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.cti-status-chip.status-active {
  background: #ecfdf3;
  color: var(--cti-ok);
}

.cti-status-chip.status-suspended,
.cti-status-chip.status-inactive {
  background: #fef2f2;
  color: var(--cti-bad);
}

/* Status td styling (for partner dashboard) */
.td-active {
  color: var(--cti-ok);
  font-weight: 600;
}

.td-suspended {
  color: var(--cti-bad);
  font-weight: 600;
}

/* Small buttons */
.cti-btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.cti-btn-success {
  background: var(--cti-ok);
  color: #fff;
  border-color: var(--cti-ok);
}

.cti-btn-success:hover { background: #155d27; }

.cti-btn-warning {
  background: var(--cti-warn);
  color: #fff;
  border-color: var(--cti-warn);
}

.cti-btn-warning:hover { background: #7a5200; }

.cti-btn-danger {
  background: var(--cti-bad);
  color: #fff;
  border-color: var(--cti-bad);
}

.cti-btn-danger:hover { background: #a31b24; }

/* Inline forms (for table actions) */
.cti-inline-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.cti-inline-form button[type="submit"] {
  margin: 0;
  padding: 4px 10px;
  font-size: 12px;
}

/* Small select/input for inline forms */
.cti-select-sm,
.cti-input-sm {
  padding: 4px 8px;
  font-size: 12px;
  width: auto;
  min-width: 80px;
}

/* ── Traffic Monitoring (WP-TRAF-3) ──────────────────────────────── */
.cti-traffic-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.cti-traffic-label {
  font-size: 12px;
  color: var(--cti-muted, #6c757d);
}

.cti-select {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  background: #fff;
  color: inherit;
}

.cti-traffic-updated {
  margin-left: auto;
  font-size: 11px;
  color: var(--cti-muted, #6c757d);
}

.cti-traffic-chart {
  margin-top: 12px;
  min-height: 120px;
}

.cti-traffic-chart svg {
  width: 100%;
  height: 120px;
  display: block;
}

.cti-traffic-bar-track {
  display: inline-block;
  vertical-align: middle;
  width: 80px;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
}

.cti-traffic-bar-fill {
  display: block;
  height: 100%;
}

.cti-traffic-bar-label {
  margin-left: 8px;
  font-size: 11px;
  color: var(--cti-muted, #6c757d);
}

/* Table scroll wrapper */
.cti-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Filter form */
.cti-filter-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.cti-filter-form label {
  margin: 0;
}

.cti-filter-form select {
  min-width: 200px;
}

/* Details/summary collapsible */
.cti-details-summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
}

.cti-details-summary::-webkit-details-marker { display: none; }

.cti-details-summary h2 {
  margin: 0;
}

.cti-details-toggle {
  font-size: 14px;
  color: var(--cti-text-muted);
  transition: transform 0.15s;
}

details[open] .cti-details-toggle {
  transform: rotate(180deg);
}

details > form {
  margin-top: 16px;
}

/* Prominent card (for one-time displays) */
.cti-card-prominent {
  border: 2px solid var(--cti-accent);
  box-shadow: 0 2px 8px rgba(36, 90, 186, 0.12);
}

/* Warning banner */
.cti-warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--cti-radius);
  padding: 12px 16px;
  margin: 16px 0;
}

.cti-warning-icon {
  font-size: 20px;
  color: #d97706;
  flex-shrink: 0;
  line-height: 1;
}

.cti-warning-body {
  flex: 1;
}

.cti-warning-title {
  margin: 0 0 4px 0;
  font-size: 13px;
}

.cti-warning-body p {
  margin: 0;
  font-size: 13px;
}

/* Token display */
.cti-token-display {
  background: #f6f8fa;
  border: 1px solid var(--cti-border);
  border-radius: var(--cti-radius);
  padding: 16px;
  margin: 12px 0;
  text-align: center;
}

.cti-token-value {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  word-break: break-all;
  color: var(--cti-text);
  line-height: 1.5;
}

/* Monospace inline */
.cti-mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}

/* Small text */
.cti-small {
  font-size: 11px;
}

/* Responsive: forms full-width at 480px */
@media (max-width: 480px) {
  .cti-card {
    padding: 16px;
  }
  
  .cti-filter-form {
    flex-direction: column;
    align-items: stretch;
  }
  
  .cti-filter-form select {
    width: 100%;
    min-width: 0;
  }
  
  .cti-inline-form {
    flex-wrap: wrap;
  }
  
  .cti-select-sm,
  .cti-input-sm {
    width: 100%;
    min-width: 0;
  }
}
