/* ═══════════════════════════════════════════════════════════════════════════
   USSD Telecom Studio & Management Platform — Enterprise Design System
   Standard Enterprise Light Theme (Clean, Solid, No Gradients, High Contrast)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces & Backgrounds */
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #f8fafc;
  --bg-active: #eff6ff;

  /* Borders */
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-input: #cbd5e1;
  --border-focus: #2563eb;
  --border-light: #e2e8f0;

  /* High Contrast Typography */
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  /* Brand / Primary Accent (Solid Colors, Zero Gradients) */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-subtle: #eff6ff;
  --primary-border: #bfdbfe;

  /* Semantic Status Palette (Accessible, Solid) */
  --accent-cyan: #0284c7;
  --accent-blue: #2563eb;
  --accent-green: #059669;
  --accent-amber: #d97706;
  --accent-red: #dc2626;
  --accent-purple: #7c3aed;

  /* Border Radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Shadows (Crisp Elevation, Zero Neon/Glow) */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.06);

  /* Typography Fonts */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, .studio-body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── STUDIO LAYOUT ── */
.studio-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  background-color: var(--bg-base);
}

/* ── SIDEBAR NAVIGATION ── */
.studio-sidebar {
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.brand-badge {
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  padding: 5px 9px;
  border-radius: var(--radius-md);
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-subtitle {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 14px 12px 6px;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-align: left;
  font-family: inherit;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 600;
}

.nav-icon {
  width: 17px;
  height: 17px;
  stroke-width: 2;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

.system-status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-green);
  flex-shrink: 0;
}

.status-meta {
  display: flex;
  flex-direction: column;
}

.status-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.status-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── MAIN CONTENT AREA ── */
.studio-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
}

/* Topbar Header */
.studio-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
  z-index: 10;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
}

.page-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.active-badge-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
}

/* Content Body */
.studio-content-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background-color: var(--bg-base);
}

.studio-view {
  display: none;
}

.studio-view.active {
  display: block;
}

/* ── BUTTONS (CLEAN ENTERPRISE) ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1.4;
  box-shadow: var(--shadow-xs);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-secondary);
  border-color: var(--border-input);
}
.btn-secondary:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--text-muted);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-input);
}
.btn-outline:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.btn-danger {
  background: #ffffff;
  color: var(--accent-red);
  border-color: #fca5a5;
}
.btn-danger:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #f87171;
}

.btn-sm {
  padding: 4px 9px;
  font-size: 12px;
}

.btn-icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

/* ── KPI METRICS CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrapper svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.stat-icon-wrapper.blue { background: #eff6ff; color: #2563eb; }
.stat-icon-wrapper.green { background: #ecfdf5; color: #059669; }
.stat-icon-wrapper.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon-wrapper.amber { background: #fffbeb; color: #d97706; }

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-val {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin-top: 2px;
}

/* ── CARDS & GRIDS ── */
.cards-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.studio-card, .card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body {
  padding: 20px;
}

.card-body.p-0 {
  padding: 0;
}

/* ── DATA TABLES ── */
.table-container {
  overflow-x: auto;
}

.studio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.studio-table th {
  padding: 11px 16px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.studio-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.studio-table tbody tr:hover td {
  background: var(--bg-hover);
}

/* Badges (Crisp Solid Standard Tags) */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  line-height: 1.4;
  border: 1px solid transparent;
}

.badge.success, .badge-success { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }
.badge.info, .badge-info { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.badge.warning, .badge-warning { background: #fffbeb; color: #d97706; border-color: #fde68a; }
.badge.danger, .badge-danger { background: #fef2f2; color: #dc2626; border-color: #fecaca; }

/* ── FORMS & INPUTS ── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-text, .input-select, .code-editor {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-input);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-text:focus, .input-select:focus, .code-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.code-editor {
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
}

.code-response {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-main);
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-main);
  font-weight: 500;
}

/* ── SIMULATOR VIEW LAYOUT ── */
.simulator-view-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  height: calc(100vh - 130px);
}

.simulator-frame-wrapper {
  width: 410px;
  height: 800px;
  border-radius: 36px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 4px solid #cbd5e1;
  flex-shrink: 0;
  background: #000;
}

.simulator-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.simulator-controls-panel {
  flex: 1;
}

/* ── API TESTER VIEW ── */
.api-request-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.method-select {
  width: 110px;
  background: #ffffff;
  border: 1px solid var(--border-input);
  color: var(--primary);
  font-weight: 700;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-mono);
}

.preset-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-pill {
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
  box-shadow: var(--shadow-xs);
}

.preset-pill:hover {
  background: var(--primary-subtle);
  color: var(--primary);
  border-color: var(--primary-border);
}

/* ── AUTOMATED SCENARIOS ── */
.scenario-steps-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scenario-step-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-xs);
}

.scenario-step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scenario-step-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.scenario-step-body {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  border: 1px solid var(--border-color);
}

/* ── USSD MENU TOPOLOGY (generated; see public/js/menuTopology.js) ── */
.topo-header { flex-wrap: wrap; gap: 12px; }
.topo-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.topo-field { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.topo-field .input-select { min-width: 200px; }
.topo-search { width: 220px; }
.topo-segmented { display: inline-flex; border: 1px solid var(--border-input); border-radius: var(--radius-md); overflow: hidden; }
.topo-segmented button { border: 0; background: var(--bg-surface); padding: 6px 12px; font: inherit; font-size: 12px; color: var(--text-secondary); cursor: pointer; }
.topo-segmented button + button { border-left: 1px solid var(--border-input); }
.topo-segmented button.active { background: var(--primary); color: #fff; }
.topo-segmented button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }

.topo-stats { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px 0; }
.topo-stat { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-subtle); min-width: 96px; max-width: 360px; }
.topo-stat span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.topo-stat strong { font-size: 13px; color: var(--text-main); overflow-wrap: anywhere; }
.topo-stat.good strong { color: var(--accent-green); }
.topo-stat.bad strong { color: var(--accent-red); }
.topo-stat.warn strong { color: var(--accent-amber); }
.topo-warnings { margin: 12px 20px 0; padding: 10px 14px; border: 1px solid #fcd34d; background: #fffbeb; border-radius: var(--radius-lg); font-size: 12.5px; color: #92400e; }
.topo-warnings ul { margin: 6px 0 0 18px; }

.topo-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 16px; padding: 16px 20px 20px; align-items: start; }
.topo-tree-panel { border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-surface); max-height: 72vh; overflow: auto; }
.topo-legend { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; background: var(--bg-subtle); border-bottom: 1px solid var(--border-color); }

.topo-tree, .topo-tree ul { list-style: none; margin: 0; padding: 0; }
.topo-tree { padding: 6px 4px 10px; font-size: 12.5px; }
.topo-tree ul { margin-left: 18px; border-left: 1px dashed var(--border-input); padding-left: 4px; }
.topo-item:focus { outline: none; }
.topo-item:focus-visible > .topo-row { outline: 2px solid var(--border-focus); outline-offset: -2px; }
.topo-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: var(--radius-md); cursor: pointer; min-height: 28px; flex-wrap: wrap; }
.topo-row:hover { background: var(--bg-hover); }
.topo-row.selected { background: var(--bg-active); box-shadow: inset 2px 0 0 var(--primary); }
.topo-row.hit .topo-title { background: #fef08a; border-radius: 3px; padding: 0 2px; }
.topo-twisty { width: 18px; height: 18px; border: 0; background: none; color: var(--text-muted); cursor: pointer; padding: 0; font-size: 11px; flex: none; }
.topo-twisty-space { width: 18px; flex: none; }
.topo-keychip { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--radius-sm); background: var(--text-main); color: #fff; font-family: var(--font-mono); font-size: 11px; font-weight: 700; flex: none; }
.topo-keychip.root { background: var(--primary); }
.topo-edge-label { color: var(--text-secondary); }
.topo-arrow { color: var(--text-dim); }
.topo-title { font-weight: 700; color: var(--text-main); }
.topo-ref .topo-row { cursor: default; opacity: .8; }
.topo-reflink, .topo-goto { border: 0; background: none; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-align: left; }
.topo-reflink:hover, .topo-goto:hover { text-decoration: underline; }
.topo-empty { padding: 24px; text-align: center; color: var(--text-muted); }

.topo-kind, .topo-effect { display: inline-block; padding: 1px 7px; border-radius: var(--radius-full); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; border: 1px solid transparent; flex: none; }
.topo-kind.menu { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.topo-kind.input { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.topo-kind.confirm { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.topo-kind.info { background: #f8fafc; color: #475569; border-color: #e2e8f0; }
.topo-kind.branch { background: #fdf4ff; color: #a21caf; border-color: #f5d0fe; }
.topo-kind.end { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.topo-kind.external { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.topo-effect.debit { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.topo-effect.credit { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.topo-effect.setting { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.topo-warn { font-size: 10.5px; font-weight: 700; color: var(--accent-red); }

.topo-detail { position: sticky; top: 12px; border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--bg-surface); padding: 16px; max-height: 72vh; overflow: auto; font-size: 13px; }
.topo-detail-head h4 { margin: 0 0 6px; font-size: 16px; }
.topo-detail-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--text-muted); font-size: 12px; }
.topo-detail-meta code { font-family: var(--font-mono); background: var(--bg-subtle); padding: 1px 6px; border-radius: var(--radius-sm); }
.topo-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 12px 0; font-size: 12px; }
.topo-crumb { background: var(--bg-subtle); border: 1px solid var(--border-color); border-radius: var(--radius-full); padding: 2px 8px; }
.topo-crumb b { font-family: var(--font-mono); }
.topo-crumb.root { background: var(--primary-subtle); border-color: var(--primary-border); color: var(--primary); }
.topo-crumb-sep { color: var(--text-dim); }

.topo-phone { background: #1f2024; color: #f8fafc; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-md); max-width: 340px; }
.topo-phone-head { padding: 8px 14px; background: #17181b; color: #94a3b8; font-size: 11px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.topo-sample { margin-left: auto; color: #fbbf24; font-weight: 700; text-transform: uppercase; font-size: 9.5px; letter-spacing: .04em; }
.topo-phone-text { margin: 0; padding: 12px 14px; white-space: pre-wrap; word-break: break-word; font-family: var(--font-sans); font-size: 13px; line-height: 1.45; }
.topo-phone-foot { display: flex; justify-content: space-between; padding: 8px 18px; border-top: 1px solid #32343a; font-size: 12px; font-weight: 700; color: #38bdf8; }
.topo-phone-foot span:first-child { color: #9ca3af; }
.topo-meter { position: relative; height: 22px; margin: 8px 0 14px; max-width: 340px; background: var(--bg-subtle); border-radius: var(--radius-full); overflow: hidden; border: 1px solid var(--border-color); }
.topo-meter div { position: absolute; inset: 0 auto 0 0; }
.topo-meter.good div { background: #bbf7d0; }
.topo-meter.warn div { background: #fde68a; }
.topo-meter.bad div { background: #fecaca; }
.topo-meter span { position: relative; display: block; text-align: center; font-size: 11px; line-height: 20px; color: var(--text-secondary); font-weight: 600; }
.topo-branchbox { padding: 12px; border: 1px dashed #f5d0fe; background: #fdf4ff; border-radius: var(--radius-lg); color: #86198f; margin-bottom: 14px; }

.topo-options { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 12.5px; }
.topo-options th { text-align: left; font-size: 10.5px; text-transform: uppercase; color: var(--text-muted); padding: 4px 6px; border-bottom: 1px solid var(--border-color); }
.topo-options td { padding: 6px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.topo-input-spec { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.topo-notes { margin: 6px 0 12px 18px; color: var(--text-secondary); font-size: 12.5px; }
.topo-notes li { margin: 3px 0; }
.topo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.topo-hint { margin: 8px 0 0; font-size: 11.5px; color: var(--text-muted); }

@media (max-width: 1100px) {
  .topo-layout { grid-template-columns: 1fr; }
  .topo-detail { position: static; max-height: none; }
  .topo-tree-panel { max-height: 60vh; }
}
@media (max-width: 640px) {
  .topo-search, .topo-field .input-select { width: 100%; min-width: 0; }
  .topo-toolbar { width: 100%; }
  .topo-layout, .topo-stats { padding-left: 12px; padding-right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .topo-item, .topo-row { scroll-behavior: auto; }
}

/* ── LOGS ── */
.full-logs-console {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 16px;
  height: 560px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: var(--radius-md);
  color: var(--text-main);
}

.mini-logs-list {
  max-height: 380px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 11px;
}

.log-row-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-row-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text-muted);
}

/* ── MODALS (CLEAN ENTERPRISE DIALOG) ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.btn-close:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-surface);
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-subtle);
}

/* ── UTILITIES ── */
.flex-1 { flex: 1; }
.flex-row { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.max-w-700 { max-width: 700px; }

/* ── MULTI-WORKSPACE STYLES (STANDARD ENTERPRISE LIGHT) ── */
.workspace-topbar-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  padding: 5px 10px;
  box-shadow: var(--shadow-xs);
}

.workspace-topbar-pill .ws-icon {
  color: var(--primary);
  flex-shrink: 0;
}

.workspace-topbar-pill .ws-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.topbar-ws-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}

.topbar-ws-select option {
  background: #ffffff;
  color: var(--text-main);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ENTERPRISE MULTI-WORKSPACE ENVIRONMENT HUB (100% RESPONSIVE)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Top KPI Stats Strip */
.ws-stats-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.ws-stat-pill {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ws-stat-pill:hover {
  box-shadow: var(--shadow-sm);
  border-color: #cbd5e1;
}

.ws-stat-pill-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}
.ws-stat-pill-icon.blue { background: #eff6ff; color: #2563eb; }
.ws-stat-pill-icon.green { background: #ecfdf5; color: #059669; }
.ws-stat-pill-icon.amber { background: #fffbeb; color: #d97706; }
.ws-stat-pill-icon.purple { background: #faf5ff; color: #7c3aed; }

.ws-stat-pill-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ws-stat-pill-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.ws-stat-pill-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Active Environment Hero Card */
.ws-active-showcase {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.08), 0 8px 10px -6px rgba(37, 99, 235, 0.04);
  position: relative;
  overflow: hidden;
}

.ws-active-showcase::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2563eb, #10b981, #f59e0b);
}

.ws-active-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.ws-active-brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ws-active-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
  flex-shrink: 0;
}

.ws-active-avatar.airtel {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
}

.ws-active-avatar.custom {
  background: linear-gradient(135deg, #6366f1, #4338ca);
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.25);
}

.ws-active-titles h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ws-pulse-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ws-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: wsPulse 2s infinite;
}

@keyframes wsPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.ws-active-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.ws-active-specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.ws-spec-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ws-spec-key {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.ws-spec-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.ws-active-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Filter and Search Bar */
.ws-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.ws-search-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.ws-search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  background: #ffffff;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  transition: all 0.15s ease;
}

.ws-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ws-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.ws-filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ws-tab-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ws-tab-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.ws-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* 100% Responsive Workspace Cards Grid */
.workspace-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.ws-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.ws-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.08), 0 6px 12px -4px rgba(0, 0, 0, 0.04);
}

.ws-card.active {
  border: 2px solid var(--primary);
  box-shadow: 0 12px 28px -6px rgba(37, 99, 235, 0.15);
}

/* Card Brand Stripes */
.ws-card-stripe {
  height: 4px;
  width: 100%;
}
.ws-card-stripe.tnm { background: linear-gradient(90deg, #10b981, #059669); }
.ws-card-stripe.airtel { background: linear-gradient(90deg, #ef4444, #dc2626); }
.ws-card-stripe.mtn { background: linear-gradient(90deg, #f59e0b, #d97706); }
.ws-card-stripe.mpesa { background: linear-gradient(90deg, #16a34a, #15803d); }
.ws-card-stripe.custom { background: linear-gradient(90deg, #6366f1, #4f46e5); }

.ws-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ws-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.ws-card-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ws-card-badge-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: #ffffff;
  flex-shrink: 0;
}
.ws-card-badge-icon.tnm { background: #10b981; }
.ws-card-badge-icon.airtel { background: #ef4444; }
.ws-card-badge-icon.mtn { background: #f59e0b; }
.ws-card-badge-icon.mpesa { background: #16a34a; }
.ws-card-badge-icon.custom { background: #6366f1; }

.ws-card-title-group h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 2px 0;
}

.ws-card-status-pill {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.ws-card-status-pill.active {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}
.ws-card-status-pill.standby {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.ws-card-desc-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

/* Key Value Metadata 2x2 Grid */
.ws-card-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.ws-card-meta-item {
  display: flex;
  flex-direction: column;
}

.ws-card-meta-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.ws-card-meta-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-card-meta-value.mono {
  font-family: var(--font-mono);
  color: var(--primary);
}

.ws-card-db-chip {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.ws-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.ws-card-actions .btn {
  flex: 1;
  text-align: center;
  justify-content: center;
  white-space: nowrap;
}

/* Deployment Studio Section */
.ws-deploy-studio {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 32px;
}

.ws-deploy-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: #f8fafc;
}

.ws-deploy-title-group h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 2px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-template-chips-row {
  padding: 14px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ws-template-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-right: 4px;
}

.ws-template-pill {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.ws-template-pill:hover {
  background: var(--primary-subtle);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.ws-deploy-body-split {
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: start;
}

.ws-live-preview-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 18px;
}

.ws-live-preview-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── SMALL PHONES & TABLETS RESPONSIVENESS OVERRIDES ── */
@media (max-width: 900px) {
  .ws-deploy-body-split {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 600px) {
  .ws-stats-banner {
    grid-template-columns: 1fr 1fr;
  }
  .ws-active-showcase {
    padding: 16px;
  }
  .ws-active-specs-grid {
    grid-template-columns: 1fr 1fr;
  }
  .ws-card-actions {
    flex-direction: column;
  }
  .ws-card-actions .btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .ws-stats-banner {
    grid-template-columns: 1fr;
  }
}

/* ── RESPONSIVE NAVIGATION CONTROLS ── */
.btn-sidebar-toggle {
  display: none;
  background: #ffffff;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  padding: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
  margin-right: 12px;
}

.btn-sidebar-toggle:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--text-muted);
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: auto;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.sidebar-close-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN BREAKPOINTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── TABLETS & SMALL DESKTOPS (<= 1024px) ── */
@media (max-width: 1024px) {
  .btn-sidebar-toggle {
    display: inline-flex;
  }

  .sidebar-close-btn {
    display: block;
  }

  .sidebar-backdrop {
    display: block;
    pointer-events: none;
  }

  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  .studio-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: 280px;
    max-width: 85vw;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-modal);
  }

  .studio-sidebar.open {
    transform: translateX(0);
  }

  .studio-main {
    width: 100%;
  }

  .studio-topbar {
    padding: 12px 20px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .studio-content-body {
    padding: 20px;
  }

  .cards-grid-2 {
    grid-template-columns: 1fr;
  }

  .simulator-view-layout {
    flex-direction: column;
    align-items: center;
    height: auto;
  }

  .simulator-frame-wrapper {
    width: 100%;
    max-width: 380px;
    height: 720px;
  }
}

/* ── PHONES & SMALL TABLETS (<= 768px) ── */
@media (max-width: 768px) {
  body, .studio-body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }

  .studio-container {
    height: auto;
    min-height: 100vh;
    flex-direction: column;
  }

  .studio-main {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .studio-content-body {
    overflow-y: visible;
    padding: 16px 14px;
    height: auto;
  }

  .studio-topbar {
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topbar-left {
    width: 100%;
  }

  .page-title {
    font-size: 16px;
  }

  .page-desc {
    font-size: 11px;
  }

  .topbar-right {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }

  .workspace-topbar-pill {
    flex: 1;
    min-width: 180px;
  }

  .topbar-ws-select {
    width: 100%;
    max-width: none;
  }

  .grid-2 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 12px 14px;
    gap: 12px;
  }

  .stat-val {
    font-size: 18px;
  }

  .stat-label {
    font-size: 11px;
  }

  .card-header {
    padding: 12px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .card-body {
    padding: 14px;
  }

  .table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }

  .studio-table {
    min-width: 580px;
  }

  .studio-table th, .studio-table td {
    padding: 10px 12px;
    font-size: 12px;
  }


  .api-request-bar {
    flex-direction: column;
  }

  .method-select {
    width: 100%;
  }

  .modal-box {
    width: 95%;
    max-height: 85vh;
  }

  .modal-header, .modal-footer {
    padding: 12px 16px;
  }

  .modal-body {
    padding: 16px;
  }
}

/* ── SMALL PHONES (<= 480px) ── */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar-right {
    flex-direction: column;
    align-items: stretch;
  }

  .active-badge-pill {
    align-self: flex-start;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .workspace-topbar-pill {
    width: 100%;
  }

  .ws-card-actions {
    flex-direction: column;
  }

  .ws-card-actions .btn {
    width: 100%;
  }

  .full-logs-console {
    height: 420px;
    font-size: 11px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   VISUAL FLOW STORYBOARD MODAL & CANVAS PREVIEW
   ═══════════════════════════════════════════════════════════════════════════ */
.flow-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.flow-modal-container {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 1320px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
}

.flow-modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #ffffff;
  flex-wrap: wrap;
}

.flow-modal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.flow-modal-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--primary);
  text-transform: uppercase;
}

.flow-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-color);
}

.flow-modal-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.flow-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.flow-select-preset {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-color);
  outline: none;
}

.btn-flow-action {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  border: none;
  font-family: inherit;
}

.btn-flow-action.primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-flow-action.primary:hover {
  background: var(--primary-hover);
}

.btn-flow-action.secondary {
  background: #f1f5f9;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}
.btn-flow-action.secondary:hover {
  background: #e2e8f0;
}

.flow-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.flow-modal-close:hover {
  background: #f1f5f9;
  color: var(--text-color);
}

.flow-modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f8fafc;
}

.flow-preview-toolbar {
  padding: 10px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.preview-mode-switch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-mode-switch .toolbar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.preview-mode-switch .theme-btn {
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  background: #f8fafc;
  color: var(--text-muted);
  cursor: pointer;
}
.preview-mode-switch .theme-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.flow-storyboard-stage {
  flex: 1;
  overflow: auto;
  padding: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.flow-mini-select {
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--panel-border);
  background: #f8fafc;
  color: #0f172a;
  outline: none;
}

.flow-color-pickers {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #cbd5e1;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}

.color-dot:hover {
  transform: scale(1.15);
}

.color-dot.active {
  transform: scale(1.25);
  box-shadow: 0 0 0 2px #0f172a;
}

.flow-zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zoom-btn {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid var(--panel-border);
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  line-height: 1.2;
}

.zoom-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.zoom-val {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  min-width: 38px;
  text-align: center;
}

.flow-canvas-preview {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  max-width: 100%;
  height: auto;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top center;
}


/* ── OPERATIONS DASHBOARD (public/js/dashboard.js) ── */
.dash { display: flex; flex-direction: column; gap: 16px; transition: opacity .15s; }
.dash.is-loading { opacity: .6; } /* refetch keeps the frame */

.dash-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dash-range { display: inline-flex; border: 1px solid var(--border-input); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-surface); }
.dash-range button { border: 0; background: none; padding: 7px 14px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); cursor: pointer; }
.dash-range button + button { border-left: 1px solid var(--border-input); }
.dash-range button:hover { background: var(--bg-hover); }
.dash-range button.active { background: var(--text-main); color: #fff; }
.dash-range button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
.dash-field { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.dash-field .input-select { min-width: 210px; }
.dash-updated { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.dash-auto { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }

.dash-head { display: grid; grid-template-columns: minmax(340px, 1.2fr) 3fr; gap: 16px; }
.dash-hero, .dash-tile, .dash-card, .dash-snapshot { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); }
.dash-hero { padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; }
.dash-hero-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.dash-hero-value { white-space: nowrap; font-size: 48px; line-height: 1.05; font-weight: 700; letter-spacing: -.02em; color: var(--text-main); overflow-wrap: anywhere; }
.dash-hero-sub { font-size: 12.5px; color: var(--text-muted); }
.dash-hero .dash-spark { margin-top: auto; width: 100%; height: 40px; }

.dash-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dash-tile { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dash-tile-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.dash-tile-value { font-size: 22px; font-weight: 700; color: var(--text-main); overflow-wrap: anywhere; }
.dash-tile-sub { font-size: 11.5px; color: var(--text-muted); }
.dash-tile .dash-spark { margin-top: 4px; }

.dash-delta { font-size: 12px; font-weight: 600; }
.dash-delta.good { color: #006300; }
.dash-delta.bad { color: #b42323; }
.dash-delta.neutral { color: var(--text-muted); font-weight: 500; }
.dash-delta-vs { font-weight: 400; color: var(--text-muted); }

.dash-snapshot { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; padding: 0; overflow: hidden; }
.dash-snap-title { display: flex; align-items: center; gap: 8px; padding: 12px 18px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); background: var(--bg-subtle); }
.dash-snap { display: flex; flex-direction: column; justify-content: center; padding: 10px 18px; border-left: 1px solid var(--border-color); min-width: 160px; }
.dash-snap span { font-size: 11.5px; color: var(--text-muted); }
.dash-snap strong { font-size: 16px; color: var(--text-main); }
.dash-snap small { font-size: 11px; color: var(--text-muted); }
.dash-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #0ca30c; box-shadow: 0 0 0 3px rgba(12, 163, 12, .18); }

.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.dash-card { padding: 16px 18px; min-width: 0; display: flex; flex-direction: column; }
.dash-card.span-2 { grid-column: span 2; }
.dash-card.span-3 { grid-column: span 3; }
.dash-card > header { margin-bottom: 12px; }
.dash-card h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-main); }
.dash-card header p { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.dash-card-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dash-card-foot { margin-top: 8px; text-align: right; }
.dash-subhead { margin: 16px 0 8px; font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.dash-empty { color: var(--text-muted); font-size: 13px; padding: 18px 0; text-align: center; }
.dash-link { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; font-weight: 600; color: var(--primary); cursor: pointer; }
.dash-link:hover { text-decoration: underline; }

.dash-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; margin: 0 0 8px; padding: 0; font-size: 12px; color: var(--text-secondary); }
.dash-legend li { display: inline-flex; align-items: center; gap: 6px; }
.dash-key.line { width: 14px; height: 2px; border-radius: 2px; background: var(--k); display: inline-block; }
.dash-key.rect { width: 10px; height: 10px; border-radius: 3px; background: var(--k); display: inline-block; }

.dash-chart { width: 100%; height: auto; display: block; overflow: visible; }
.dash-chart:focus { outline: none; }
.dash-chart:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: 4px; }
.dash-axis { font-size: 11px; fill: #898781; font-variant-numeric: tabular-nums; }
.dash-endlabel { font-size: 11.5px; fill: #52514e; font-weight: 600; }
.dash-colhit { cursor: default; }
.dash-colhit.on, .dash-colhit:focus { fill: rgba(42, 120, 214, .08); outline: none; }

.dash-tooltip { position: fixed; z-index: 10000; pointer-events: none; background: #fff; border: 1px solid rgba(11, 11, 11, .1); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 8px 10px; font-size: 12px; min-width: 150px; }
.dash-tt-title { font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.dash-tt-row { display: grid; grid-template-columns: 14px auto 1fr; align-items: center; gap: 8px; padding: 1px 0; }
.dash-tt-row strong { color: var(--text-main); font-variant-numeric: tabular-nums; }
.dash-tt-row span:last-child { color: var(--text-muted); }

.dash-hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dash-hbars li { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 10px; font-size: 12.5px; border-radius: var(--radius-sm); }
.dash-hbars li:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.dash-hbar-label { color: var(--text-secondary); overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.dash-hbar-track { height: 12px; display: block; }
.dash-hbar { display: block; height: 12px; border-radius: 0 4px 4px 0; }
.dash-hbar-value { font-weight: 600; color: var(--text-main); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-hbar-value small { font-weight: 400; color: var(--text-muted); }

.dash-funnel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.dash-funnel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 12.5px; margin-bottom: 4px; }
.dash-funnel-head span { color: var(--text-secondary); }
.dash-funnel-head strong { color: var(--text-main); }
.dash-funnel-head small { color: var(--text-muted); }
.dash-funnel .dash-hbar-track, .dash-funnel .dash-hbar { height: 16px; }

.dash-seg { display: flex; gap: 2px; height: 28px; margin: 4px 0 8px; }
.dash-seg-part { display: flex; align-items: center; padding-left: 8px; border-radius: 4px; font-size: 11.5px; font-weight: 700; min-width: 4px; }
.dash-seg-part:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

.dash-status { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--radius-full); font-size: 10.5px; font-weight: 700; white-space: nowrap; border: 1px solid; }
.dash-status.critical { color: #9f1f1f; background: #fdecec; border-color: #f3b4b4; }
.dash-status.serious { color: #9a3d16; background: #fdf0ea; border-color: #f3c3ad; }
.dash-status.warning { color: #7a5200; background: #fff6df; border-color: #f7d58a; }
.dash-status.good { color: #006300; background: #e8f6e8; border-color: #a6dca6; }
.dash-status.info { color: #1c5cab; background: #eaf2fc; border-color: #b7d3f6; }

.dash-insights { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dash-insight { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 10px 12px; border-radius: var(--radius-lg); background: var(--bg-subtle); }
.dash-insight strong { font-size: 13px; color: var(--text-main); }
.dash-insight p { margin: 2px 0 4px; font-size: 12.5px; color: var(--text-secondary); }
.dash-note { font-size: 12.5px; color: var(--text-secondary); margin: 10px 0 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dash-overdue { margin: 0 0 10px 18px; font-size: 12.5px; color: var(--text-secondary); }

.dash-engagement { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.dash-engagement div, .dash-integrations div { background: var(--bg-subtle); border-radius: var(--radius-lg); padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.dash-engagement span, .dash-integrations span { font-size: 11.5px; color: var(--text-muted); }
.dash-engagement strong, .dash-integrations strong { font-size: 15px; color: var(--text-main); }
.dash-integrations { display: grid; grid-template-columns: 1fr; gap: 8px; }
.dash-integrations small { font-size: 11.5px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.dash-kv { display: flex; flex-direction: column; margin: 0 0 6px; }
.dash-kv span { font-size: 12px; color: var(--text-muted); }
.dash-kv strong { font-size: 18px; color: var(--text-main); }
.dash-kv small { font-size: 11.5px; color: var(--text-muted); }

.dash-heat { display: flex; flex-direction: column; gap: 3px; overflow-x: auto; }
.dash-heat-row { display: grid; grid-template-columns: 38px repeat(24, minmax(12px, 1fr)); gap: 3px; align-items: center; }
.dash-heat-day { font-size: 11px; color: var(--text-muted); }
.dash-heat-cell { height: 18px; border-radius: 3px; }
.dash-heat-cell:hover, .dash-heat-cell:focus { outline: 2px solid var(--text-main); outline-offset: -1px; }
.dash-heat-hours span { font-size: 10px; color: var(--text-muted); text-align: left; }
.dash-heat-scale { display: flex; align-items: center; gap: 3px; margin-top: 10px; font-size: 11px; color: var(--text-muted); }
.dash-heat-scale i { width: 18px; height: 10px; border-radius: 2px; display: inline-block; }
.dash-heat-scale span:first-child { margin-right: 4px; }
.dash-heat-scale span:last-child { margin-left: 4px; }

.dash-table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dash-table th { text-align: left; font-size: 11px; font-weight: 700; color: var(--text-muted); padding: 6px 8px; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.dash-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.dash-table.compact { margin-top: 12px; }
.dash-table small { color: var(--text-muted); }

@media (max-width: 1280px) {
  .dash-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-card.span-3 { grid-column: span 2; }
}
@media (max-width: 900px) {
  .dash-head { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-card.span-2, .dash-card.span-3 { grid-column: auto; }
  .dash-engagement { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-updated { margin-left: 0; width: 100%; }
}
@media (max-width: 560px) {
  .dash-tiles { grid-template-columns: 1fr; }
  .dash-hero-value { font-size: 40px; }
  .dash-field, .dash-field .input-select { width: 100%; min-width: 0; }
  .dash-snap { border-left: 0; border-top: 1px solid var(--border-color); width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .dash { transition: none; } }

/* ═════════════════ Played Tickets page + ticket viewer ═════════════════ */
.tk-page { display: flex; flex-direction: column; gap: 16px; }
.tk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tk-title { font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin: 0; }
.tk-sub { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }
.tk-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tk-head-actions svg, .tk-actions svg, .tk-row-actions svg, .tk-search svg, #cfgPreviewTicket svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tk-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.tk-kpi { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.tk-kpi-label { display: block; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.tk-kpi-value { display: block; margin-top: 6px; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-kpi-note { display: block; margin-top: 2px; font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 14px; padding: 12px; }
.tk-filters .input-select { width: auto; min-width: 150px; }
.tk-search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-input); border-radius: 10px; padding: 0 12px; height: 38px; color: var(--text-muted); background: var(--bg-surface); }
.tk-search input { border: 0; outline: none; flex: 1; font: inherit; font-size: 13.5px; background: transparent; color: var(--text-main); min-width: 0; }
.tk-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-subtle); }
.tk-seg { display: inline-flex; background: var(--bg-subtle); border: 1px solid var(--border-color); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.tk-seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 8px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--text-muted); cursor: pointer; }
.tk-seg button.active { background: var(--bg-surface); color: var(--primary); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.tk-date { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); }
.tk-date input { border: 1px solid var(--border-input); border-radius: 9px; height: 36px; padding: 0 8px; font: inherit; font-size: 13px; color: var(--text-main); }
.tk-card { padding: 0; overflow: hidden; }
.tk-table td { vertical-align: middle; }
.tk-id { font-weight: 800; font-family: var(--font-mono, ui-monospace, monospace); }
.tk-when { display: block; font-size: 11.5px; color: var(--text-muted); }
.tk-game { font-weight: 700; }
.tk-balls { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tk-ball { min-width: 24px; height: 24px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 800; background: var(--primary-subtle); color: var(--primary); border: 1px solid var(--primary-border); font-variant-numeric: tabular-nums; }
.tk-ball.pb { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.tk-outcome { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.tk-outcome::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tk-outcome.played { background: #eff6ff; color: #1d4ed8; }
.tk-outcome.won { background: #ecfdf5; color: #047857; }
.tk-outcome.lost { background: #f1f5f9; color: #475569; }
.tk-outcome.void { background: #fef2f2; color: #b91c1c; }
.tk-prize { display: block; margin-top: 3px; font-size: 12px; font-weight: 800; color: #047857; }
.tk-row-actions { display: inline-flex; gap: 6px; }
.tk-row-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.tk-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border-color); font-size: 13px; }
.tk-pager-btns { display: flex; gap: 8px; align-items: center; }
.tk-pager-btns .input-select { width: auto; }

.tk-viewer-backdrop { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: clamp(8px, 3vw, 28px);
  background: rgba(15, 23, 42, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.tk-viewer { width: min(1080px, 100%); max-height: calc(100dvh - 16px); display: flex; flex-direction: column; background: var(--bg-surface); border-radius: 20px; overflow: hidden; box-shadow: 0 30px 70px -20px rgba(15, 23, 42, .5); }
.tk-viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border-color); }
.tk-viewer-head h3 { margin: 2px 0 0; font-size: 17px; font-weight: 800; }
.tk-viewer-kicker { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.tk-viewer-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-height: 0; flex: 1; }
.tk-paper-stage { overflow: auto; padding: 26px; display: flex; justify-content: center; align-items: flex-start;
  background: radial-gradient(circle at 1px 1px, rgba(15, 23, 42, .08) 1px, transparent 0) 0 0 / 16px 16px, #eef2f7; }
.tk-paper-stage canvas { max-width: 100%; height: auto !important; border-radius: 6px; box-shadow: 0 2px 4px rgba(15, 23, 42, .08), 0 20px 40px -18px rgba(15, 23, 42, .45); background: #fff; }
.tk-side { border-left: 1px solid var(--border-color); padding: 18px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.tk-verify { background: var(--bg-subtle); border: 1px solid var(--border-color); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.tk-verify strong { font-family: var(--font-mono, ui-monospace, monospace); font-size: 20px; letter-spacing: .04em; }
.tk-side-label { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.tk-side-note { font-size: 12px; color: var(--text-muted); line-height: 1.45; margin: 0; }
.tk-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.tk-facts dt { color: var(--text-muted); }
.tk-facts dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.tk-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tk-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; }
.tk-actions .btn-primary, .tk-actions .btn-danger { grid-column: 1 / -1; }

.cfg-section-title { margin: 22px 0 12px; padding-top: 18px; border-top: 1px solid var(--border-color); font-size: 13px; font-weight: 800; letter-spacing: .02em; }
.cfg-brand { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; margin-bottom: 8px; }
.cfg-logo { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.cfg-logo-preview { width: 120px; height: 120px; border-radius: 18px; border: 1px dashed var(--border-input); display: grid; place-items: center; background: var(--bg-subtle); overflow: hidden; color: var(--text-muted); font-size: 12px; }
.cfg-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cfg-logo-actions { display: flex; gap: 6px; }
.cfg-color { display: flex; align-items: center; gap: 10px; }
.cfg-color input[type="color"] { width: 46px; height: 38px; border: 1px solid var(--border-input); border-radius: 10px; padding: 2px; background: var(--bg-surface); cursor: pointer; }
#cfgPreviewTicket { display: inline-flex; align-items: center; gap: 7px; }

@media (max-width: 1280px) { .tk-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .tk-viewer-body { grid-template-columns: minmax(0, 1fr); overflow: auto; }
  .tk-side { border-left: 0; border-top: 1px solid var(--border-color); overflow: visible; }
  .tk-paper-stage { overflow: visible; }
  .cfg-brand { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .tk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tk-kpi-value { font-size: 17px; white-space: normal; overflow-wrap: anywhere; }
  .tk-filters .input-select, .tk-date, .tk-seg { flex: 1 1 100%; }
  .tk-date input { flex: 1; }
  .tk-table thead { display: none; }
  .tk-table tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border-color); }
  .tk-table td { border: 0 !important; padding: 0 !important; }
  .tk-table td:nth-child(3), .tk-table td:last-child { grid-column: 1 / -1; }
  .tk-row-actions { margin-top: 6px; }
}
