/* ═══════════════════════════════════════════════════════════
   Data Sizing Assessment — Community Reference UI
   Mirrors the design tokens from index.html
   ═══════════════════════════════════════════════════════════ */

:root {
  --cisco-blue: #049FD9;
  --cisco-blue-dark: #003B8A;
  --cisco-teal: #04A4B0;
  --cisco-teal-muted: rgba(4, 164, 176, 0.12);
  --cisco-green: #6BA32A;
  --cisco-yellow: #D9B216;
  --cisco-red: #C24632;
  --cisco-orange: #F26722;
  --bg-page: #F7F7F7;
  --bg-surface: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --bg-header: #003B8A;
  --bg-elevated: #FFFFFF;
  --bg-hover: #F0F1F2;
  --bg-input: #FFFFFF;
  --bg-code: #F0F1F2;
  --text-primary: #23282E;
  --text-secondary: #464C54;
  --text-tertiary: #656C75;
  --text-inverse: #FFFFFF;
  --text-link: #1D69CC;
  --border-default: #E1E4E8;
  --border-subtle: #F0F1F2;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Roboto Mono', 'Consolas', monospace;
  --header-h: 56px;
  --sidebar-w: 340px;
  --summary-w: 360px;
}

html.dark {
  --bg-page: #0F1214;
  --bg-surface: #23282E;
  --bg-sidebar: #171B20;
  --bg-header: #171B20;
  --bg-elevated: #2A2F35;
  --bg-hover: #373C42;
  --bg-input: #171B20;
  --bg-code: #171B20;
  --text-primary: #E8EBF1;
  --text-secondary: #D0D4D9;
  --text-tertiary: #979FA8;
  --text-link: #649EF5;
  --border-default: #464C54;
  --border-subtle: #373C42;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.35);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: var(--font); cursor: pointer; }

/* ─── HEADER — Cisco blue bar ─── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--bg-header);
  display: flex; align-items: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.header-inner {
  width: 100%; max-width: 1920px; margin: 0 auto;
  padding: 0 16px 0 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; color: #fff;
}
.app-header h1 {
  font-size: 16px; font-weight: 700; color: #fff;
  letter-spacing: -0.02em; line-height: 1.2;
}
.header-sub {
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.85);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.header-actions { display: flex; align-items: center; gap: 6px; }
.header-actions .dsa-theme-btn {
  height: 34px; padding: 0 12px; background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15); border-radius: var(--radius-pill);
  color: #fff; font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 4px; cursor: pointer;
}
.header-actions .dsa-theme-btn:hover { background: rgba(255,255,255,0.2); }

/* ─── BUTTONS ─── */
.btn {
  font-family: var(--font);
  font-size: 13px; font-weight: 600;
  border: none; border-radius: var(--radius-pill);
  padding: 0 14px; height: 34px; cursor: pointer;
  transition: all .15s; display: inline-flex; align-items: center;
}
.btn-primary {
  background: var(--cisco-blue); color: #fff;
}
.btn-primary:hover { background: #038cc2; }
.btn-ghost {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
}
.btn-ghost:hover { background: rgba(255,255,255,0.2); color: #fff; }
.btn-sm { padding: 0 10px; height: 28px; font-size: 12px; }
.btn-add {
  background: rgba(107,163,42,0.12); color: var(--cisco-green);
  font-size: 12px; padding: 0 10px; height: 28px; border-radius: var(--radius-sm);
  font-weight: 600; display: inline-flex; align-items: center;
}
.btn-add:hover { background: var(--cisco-green); color: #fff; }
.btn-remove {
  background: transparent; color: var(--text-tertiary);
  font-size: 16px; padding: 2px 6px; line-height: 1; border: none;
}
.btn-remove:hover { color: var(--cisco-red); }
.btn-info {
  background: transparent; color: var(--text-tertiary);
  font-size: 14px; padding: 2px 6px; cursor: pointer; border: none;
}
.btn-info:hover { color: var(--cisco-blue); }

/* ─── LAYOUT ─── */
.app-main {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--summary-w);
  min-height: calc(100vh - var(--header-h));
}

/* ─── CATALOG PANEL (LEFT) ─── */
.catalog-panel {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-default);
  overflow-y: auto;
  max-height: calc(100vh - var(--header-h));
}
.catalog-header {
  padding: 16px; position: sticky; top: 0;
  background: var(--bg-sidebar); z-index: 5;
}
.catalog-header h2 {
  font-size: 11px; font-weight: 700; margin-bottom: 10px;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-tertiary);
}
.catalog-search {
  width: 100%; height: 34px;
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  padding: 0 12px; font-size: 13px; font-family: var(--font);
  outline: none;
}
.catalog-search:focus { border-color: var(--cisco-blue); box-shadow: 0 0 0 3px rgba(4, 159, 217, 0.12); }
.catalog-search::placeholder { color: var(--text-tertiary); }

/* Accordion */
.cat-group { border-bottom: 1px solid var(--border-default); }
.cat-group-header {
  padding: 10px 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  transition: background .1s;
  user-select: none;
}
.cat-group-header:hover { background: var(--bg-hover); }
.cat-group-header .chevron { transition: transform .2s; font-size: 11px; color: var(--text-tertiary); }
.cat-group.open .chevron { transform: rotate(90deg); }
.cat-group-body { display: none; padding: 0 8px 8px; }
.cat-group.open .cat-group-body { display: block; }

.source-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 6px;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.source-card:hover { border-color: var(--cisco-blue); box-shadow: var(--shadow-md); }
.source-card.added { border-color: var(--cisco-green); background: rgba(107,163,42,0.06); }
.source-card .source-info { flex: 1; min-width: 0; }
.source-card .source-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.source-card .source-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.source-card .source-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.source-card .source-meta span { white-space: nowrap; }
.source-card .source-actions { display: flex; flex-direction: column; gap: 4px; align-items: center; }

.tag { display: inline-block; padding: 2px 8px; border-radius: var(--radius-pill); font-size: 10px; font-weight: 600; }
.tag-protocol { background: rgba(4,159,217,.12); color: var(--cisco-blue); }
.tag-ingest  { background: var(--cisco-teal-muted); color: var(--cisco-teal); }

/* ─── CONFIG PANEL (CENTER) ─── */
.config-panel {
  padding: 20px 24px;
  overflow-y: auto;
  max-height: calc(100vh - var(--header-h));
  background: var(--bg-page);
}
.config-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.config-header h2 { font-size: 16px; font-weight: 700; }
.badge {
  background: rgba(4,159,217,.12); color: var(--cisco-blue);
  padding: 2px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600;
}

.empty-state { text-align: center; padding: 80px 40px; color: var(--text-secondary); }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; max-width: 360px; margin: 0 auto; }

.config-table-wrap { overflow-x: auto; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.config-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.config-table th {
  text-align: left; padding: 10px 14px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-default);
  position: sticky; top: 0; z-index: 2;
}
.config-table th.num, .config-table td.num { text-align: right; }
.config-table td { padding: 11px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.config-table tr:last-child td { border-bottom: none; }
.config-table tr:hover td { background: var(--bg-hover); }

.config-table input[type="number"] {
  width: 80px; background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  padding: 5px 8px; font-size: 13px; font-family: var(--font);
  text-align: right; outline: none;
}
.config-table input[type="number"]:focus { border-color: var(--cisco-blue); box-shadow: 0 0 0 3px rgba(4,159,217,0.12); }

.config-table select {
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  padding: 5px 8px; font-size: 12px; font-family: var(--font);
  outline: none; cursor: pointer;
}
.config-table select:focus { border-color: var(--cisco-blue); }

.gb-value { font-weight: 700; color: var(--cisco-blue); }
.eps-value { color: var(--text-secondary); }

.source-name-cell { font-weight: 600; }
.cat-label { font-size: 11px; color: var(--text-tertiary); }

/* ─── SUMMARY PANEL (RIGHT) ─── */
.summary-panel {
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-default);
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - var(--header-h));
}
.summary-panel h2 {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-tertiary); margin-bottom: 16px;
}
.summary-panel h3 {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-tertiary); margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.summary-section { margin-top: 24px; }
.equipment-context {
  font-size: 12px; color: var(--text-secondary); background: rgba(4,159,217,.06);
  border: 1px solid rgba(4,159,217,.15); border-radius: var(--radius-md);
  padding: 8px 12px; margin-bottom: 12px; line-height: 1.4;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.kpi-card.accent {
  border-color: var(--cisco-blue);
  background: rgba(4,159,217,.06);
}
.kpi-card.license-card {
  border-color: var(--cisco-green);
  background: rgba(107,163,42,.06);
}
.kpi-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.kpi-value {
  display: block; font-size: 36px; font-weight: 800; line-height: 1.1; letter-spacing: -0.03em;
  color: var(--cisco-blue);
}
.kpi-value.sm { font-size: 24px; }
.kpi-value.md { font-size: 28px; }
.kpi-unit { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.kpi-sub { display: block; font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }

.kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.breakdown-list { display: flex; flex-direction: column; gap: 6px; }
.breakdown-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 12px;
  box-shadow: var(--shadow-sm);
}
.breakdown-item .bd-label { color: var(--text-secondary); flex: 1; }
.breakdown-item .bd-value { font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.breakdown-item .bd-bar {
  height: 4px; border-radius: 2px; background: var(--cisco-blue);
  margin-top: 4px; transition: width .3s;
}

.storage-controls { margin-bottom: 10px; }
.storage-controls label { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.storage-controls select {
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  padding: 5px 8px; font-size: 12px; font-family: var(--font); outline: none;
}
.storage-controls select:focus { border-color: var(--cisco-blue); }

.help-tip {
  cursor: help; font-size: 12px; color: var(--text-tertiary);
  border: 1px solid var(--border-default); border-radius: 50%;
  width: 16px; height: 16px; display: inline-grid; place-items: center;
  font-style: normal;
}

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0, 0, 0, 0.45);
  display: grid; place-items: center;
  padding: 20px;
}
.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  max-width: 640px; width: 100%;
  max-height: 80vh; overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border-radius: var(--radius-md);
  border: 1px solid var(--border-default); background: var(--bg-hover);
  font-size: 22px; cursor: pointer; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--text-primary); }
.modal-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 16px; padding-right: 40px; }
.modal-card .detail-row { display: flex; gap: 12px; margin-bottom: 10px; font-size: 13px; }
.modal-card .detail-label { font-weight: 600; color: var(--text-tertiary); min-width: 140px; }
.modal-card .detail-value { color: var(--text-primary); }
.modal-card .detail-value code { font-family: var(--font-mono); font-size: 11px; background: var(--bg-code); padding: 2px 5px; border-radius: 4px; }
.modal-card .detail-range {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 12px;
}
.modal-card .range-box {
  background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: var(--radius-md);
  padding: 12px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.modal-card .range-box .rl { font-size: 10px; text-transform: uppercase; color: var(--text-tertiary); font-weight: 700; letter-spacing: .05em; }
.modal-card .range-box .rv { font-size: 18px; font-weight: 700; margin-top: 4px; }
.modal-card .notes-box {
  margin-top: 16px; padding: 12px;
  background: var(--bg-code); border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 12px; color: var(--text-secondary); line-height: 1.6;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1280px) {
  .app-main { grid-template-columns: 280px 1fr 300px; }
  :root { --sidebar-w: 280px; --summary-w: 300px; }
}
@media (max-width: 1024px) {
  .app-main { grid-template-columns: 1fr; }
  .catalog-panel, .summary-panel {
    max-height: none;
    border: none;
    border-bottom: 1px solid var(--border-default);
  }
  .config-panel { max-height: none; }
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ─── CATEGORY COLORS ─── */
.cat-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 8px; flex-shrink: 0;
}
.cat-dot-security   { background: var(--cisco-red); }
.cat-dot-it         { background: var(--cisco-blue); }
.cat-dot-ot-systems { background: var(--cisco-orange); }
.cat-dot-network    { background: #9B59B6; }
.cat-dot-ot-hw      { background: var(--cisco-teal); }
.cat-dot-protocols  { background: var(--cisco-yellow); }
.cat-dot-business   { background: #E06C75; }
.cat-dot-cisco      { background: #049FD9; }
.cat-dot-ot-vendor  { background: #00B4D8; }

.config-table .num-cell { font-variant-numeric: tabular-nums; }

/* ─── PROTOCOL ROW HIGHLIGHT ─── */
.config-table tr.proto-row td { border-left: 3px solid var(--cisco-yellow); }
.config-table tr.proto-row td:first-child { padding-left: 11px; }

.proto-label {
  display: inline-block; padding: 2px 6px; border-radius: var(--radius-pill);
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px;
  background: rgba(217,178,22,.15); color: #8a6d00;
  margin-left: 6px; vertical-align: middle;
}
html.dark .proto-label { color: var(--cisco-yellow); }

.config-table .poll-unit { font-size: 11px; color: var(--text-tertiary); margin-left: 2px; }
