/* ============================================================
   FTG Silver Tier Visualizer — minimal layout CSS
   ============================================================ */

:root {
  --nav-w: 220px;
  --nav-bg: #1a1f2e;
  --nav-border: #2d3550;
  --accent: #4f8ef7;
  --accent-dark: #3570d4;
  --bg: #f0f2f7;
  --card-bg: #ffffff;
  --text: #1e2230;
  --muted: #6b7280;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --border: #e2e8f0;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
  --radius: 8px;
  /* Dark surface tones used by BFE / FGE / Gold data panels */
  --surface:  #1a1f2e;
  --surface2: #242938;
  /* Text colours for content rendered on --surface / --surface2 backgrounds */
  --surface-text:  #e2e8f0;
  --surface-muted: #94a3b8;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

/* ── Layout ── */
#layout { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar nav ── */
#nav {
  width: var(--nav-w);
  background: var(--nav-bg);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: width 0.2s;
  overflow: hidden;
}
#nav.collapsed { width: 0; }

#nav-header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--nav-border);
}
#nav-logo {
  font-size: 15px; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 8px;
}
#nav-logo span.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); display: inline-block;
}
#nav-subtitle { font-size: 11px; color: #8a9bc4; margin-top: 3px; }

#nav-menu { list-style: none; padding: 10px 0; flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
#nav-menu li a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: #8a9bc4; text-decoration: none;
  font-size: 13px; border-left: 3px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
#nav-menu li a:hover { color: #fff; background: rgba(255,255,255,0.05); }
#nav-menu li a.active { color: #fff; border-left-color: var(--accent); background: rgba(79,142,247,0.12); }
#nav-menu li a .icon { width: 18px; text-align: center; font-style: normal; flex-shrink: 0; }
#nav-menu li.nav-spacer { flex: 1; min-height: 16px; pointer-events: none; }

/* ── Main area ── */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

#topbar {
  background: var(--card-bg); border-bottom: 1px solid var(--border);
  padding: 0 20px; height: 52px;
  display: flex; align-items: center; gap: 12px;
}
#topbar-toggle {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--muted); padding: 4px;
  line-height: 1;
}
#topbar-toggle:hover { color: var(--text); }
#topbar-title { font-weight: 600; font-size: 15px; }
#topbar-status { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ── Tabs ── */
#tab-bar {
  background: var(--card-bg); border-bottom: 1px solid var(--border);
  display: flex; gap: 0; padding: 0 20px; overflow-x: auto;
}
.tab-btn {
  padding: 12px 18px; border: none; background: none; cursor: pointer;
  font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent;
  white-space: nowrap; transition: all 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ── Content pane ── */
#content { flex: 1; overflow-y: auto; padding: 24px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Cards ── */
.card {
  background: var(--card-bg); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 20px;
}
.card-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 10px; }

/* ── Stat grid ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--card-bg); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat-card .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat-card .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Tenant cards row ── */
.tenant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-bottom: 24px; }
.tenant-card { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 18px; }
.tenant-card .tc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tenant-card .tc-id { font-size: 16px; font-weight: 700; }
.tenant-card .tc-badge { font-size: 10px; background: #eef3ff; color: var(--accent); border-radius: 4px; padding: 2px 7px; font-weight: 600; }
.tenant-card .tc-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.tenant-card .tc-row:last-child { border-bottom: none; }
.tenant-card .tc-row .k { color: var(--muted); }
.tenant-card .tc-row .v { font-weight: 600; }
.tenant-card .tc-row .v.warn { color: var(--warn); }
.tenant-card .tc-row .v.good { color: var(--success); }

/* ── Type breakdown bars ── */
.type-bars { margin-top: 8px; }
.type-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 12px; }
.type-bar-row .lbl { width: 56px; color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: 0.04em; }
.type-bar-row .bar-track { flex: 1; height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.type-bar-row .bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s; }
.bar-ip      { background: #6366f1; }
.bar-user    { background: #22c55e; }
.bar-asset   { background: #f59e0b; }
.bar-service { background: #06b6d4; }
.bar-net     { background: #6366f1; }
.bar-auth    { background: #22c55e; }
.bar-file    { background: #f59e0b; }
.bar-api     { background: #06b6d4; }
.bar-proc    { background: #ec4899; }
.type-bar-row .cnt { width: 30px; text-align: right; font-weight: 600; font-size: 12px; }

/* ── Weight gauge ── */
.weight-row { display: flex; gap: 10px; margin-top: 10px; }
.weight-box { flex: 1; background: #f8fafc; border-radius: 6px; padding: 10px; text-align: center; }
.weight-box .wlabel { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.weight-box .wval { font-size: 20px; font-weight: 700; margin-top: 2px; }

/* ── Windows table ── */
.windows-table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th { text-align: left; padding: 8px 12px; background: #f8fafc; border-bottom: 2px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
table.data-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: #f8fafc; }
.pill { display: inline-block; border-radius: 4px; padding: 1px 7px; font-size: 11px; font-weight: 600; }
.pill-tumbling { background: #eef3ff; color: #4f8ef7; }
.pill-sliding  { background: #fef3c7; color: #d97706; }
.pill-ok     { background: #dcfce7; color: #15803d; }
.pill-warn   { background: #fef3c7; color: #b45309; }
.pill-danger { background: #fee2e2; color: #dc2626; }
.pill-open   { background: #eef3ff; color: #4f8ef7; }
.pill-aggregating { background: #fef3c7; color: #b45309; }
.pill-complete    { background: #dcfce7; color: #15803d; }
.pill-expired     { background: #f1f5f9; color: #64748b; }
.pill-failed      { background: #fee2e2; color: #dc2626; }

/* ── Tenant selector ── */
.tenant-selector { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tenant-btn { padding: 6px 14px; border: 1px solid var(--border); background: var(--card-bg); border-radius: 6px; cursor: pointer; font-size: 13px; transition: all 0.15s; }
.tenant-btn:hover { border-color: var(--accent); color: var(--accent); }
.tenant-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Loading / error ── */
.loading { color: var(--muted); font-size: 13px; padding: 20px 0; }
.error-msg { color: var(--danger); background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px; padding: 10px 14px; font-size: 13px; }

/* ── Section header ── */
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.section-sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; margin-top: -10px; }

/* ── Version stamp ── */
.version-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.version-badge { background: #f1f5f9; border-radius: 4px; padding: 3px 9px; font-size: 11px; color: var(--muted); }
.version-badge span { font-weight: 600; color: var(--text); }

/* ── Settings sections ── */
.settings-section { margin-bottom: 32px; }
.settings-section-title {
  font-size: 15px; font-weight: 700; margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.settings-section-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.settings-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Info tooltip ── */
.info-wrap {
  position: relative; display: inline-flex; align-items: center;
}
.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: #e2e8f0; color: var(--muted);
  font-size: 10px; font-weight: 700; font-style: normal;
  cursor: default; margin-left: 6px; flex-shrink: 0;
  user-select: none; transition: background 0.15s, color 0.15s;
}
.info-icon:hover { background: var(--accent); color: #fff; }
.info-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 300px;
  background: #1e2230;
  color: #d1d5db;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.6;
  padding: 11px 13px;
  border-radius: 7px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  z-index: 9999;
  pointer-events: none;
  white-space: normal;
}
.info-tooltip b   { color: #fff; }
.info-tooltip code {
  font-family: 'Courier New', monospace;
  background: rgba(255,255,255,0.12);
  padding: 1px 5px; border-radius: 3px; color: #93c5fd;
}
.info-tooltip .tip-row { margin-bottom: 5px; }
.info-tooltip .tip-row:last-child { margin-bottom: 0; }
.info-wrap:hover .info-tooltip { display: block; }

/* ── Responsive ── */
@media (max-width: 700px) {
  #nav { position: absolute; z-index: 100; height: 100%; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .tenant-grid { grid-template-columns: 1fr; }
}
