/**
 * CounterMeasure Threat Library and platform console product overlay.
 * Source: CounterMeasure Design System/ui_kits/threat-library/styles.css.
 */

@import "./no-fonts.css";

:root {
  --color-bg-base: var(--color-bg);
}

/* ==========================================================================
   Threat Library UI Kit — styles
   Imports tokens from ../../colors_and_type.css. Layers a component-level
   stylesheet that mirrors tenant-ui's Tailwind classes faithfully.
   ========================================================================== */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg-base);
  color: var(--color-text);
  font: var(--type-body);
  min-height: 100vh;
}

button { font: inherit; color: inherit; cursor: pointer; }

/* ── Sidebar / shell layout ────────────────────────────────────── */
.tl-shell { position: relative; min-height: 100vh; }

.tl-bg-mesh {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(249,115,22,0.10), transparent 60%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(100,116,139,0.10), transparent 60%);
}
.tl-bg-noise {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.018;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* sidebar */
.tl-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 248px; z-index: 40;
  background: var(--color-bg-tertiary, #111);
  border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column;
  transition: width 0.3s ease;
}
.tl-sidebar[data-collapsed="true"] { width: 64px; }

.tl-sidebar-glow {
  position: absolute; left: 0; right: 0; top: 0; height: 128px;
  background: linear-gradient(to bottom, rgba(249,115,22,0.04), transparent);
  pointer-events: none;
}

.tl-sidebar-logo {
  position: relative;
  display: flex; align-items: center; padding: 16px;
  height: 64px;
}
.tl-sidebar[data-collapsed="true"] .tl-sidebar-logo { justify-content: center; padding: 16px 0; }

.tl-sidebar-toggle {
  position: absolute; right: -12px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg-tertiary, #111);
  color: var(--color-text-dim);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s ease;
  z-index: 2;
}
.tl-sidebar:hover .tl-sidebar-toggle { opacity: 1; }
.tl-sidebar-toggle:hover { color: var(--color-text); background: var(--color-bg-hover, rgba(255,255,255,0.05)); }
.tl-rotate-180 { transform: rotate(180deg); }

.tl-logo { display: inline-flex; align-items: center; gap: 8px; }
.tl-logo-wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tl-logo-w-fg { color: var(--color-text); }
.tl-logo-w-orange { color: var(--color-orange-500); }

/* nav */
.tl-nav {
  flex: 1; overflow-y: auto;
  padding: 8px 16px 16px;
  display: flex; flex-direction: column; gap: 24px;
}
.tl-sidebar[data-collapsed="true"] .tl-nav { padding: 8px; gap: 16px; }

.tl-section {
  display: flex; align-items: center; gap: 12px;
  padding: 0 12px; margin-bottom: 12px;
}
.tl-section span:first-child {
  font: var(--type-eyebrow);
  letter-spacing: var(--letter-eyebrow);
  text-transform: uppercase;
  color: var(--color-text-dim);
  font-size: 10.5px;
  font-weight: 700;
}
.tl-section-rule {
  flex: 1; height: 1px;
  background: linear-gradient(to right, var(--color-border), transparent);
}
.tl-sidebar[data-collapsed="true"] .tl-section { display: none; }
.tl-sidebar[data-collapsed="true"] .tl-section-rule { display: block; margin: 12px 8px; }

.tl-nav-list { display: flex; flex-direction: column; gap: 2px; }
.tl-nav-children { display: flex; flex-direction: column; gap: 2px; padding-left: 8px; max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.2s ease, opacity 0.2s ease; }
.tl-nav-children[data-open="true"] { max-height: 400px; opacity: 1; margin-top: 4px; }

.tl-nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: transparent; border: none;
  color: var(--color-text-muted);
  font: 500 13px/1 var(--font-sans);
  text-align: left; width: 100%;
  transition: color 0.3s ease, background 0.3s ease;
}
.tl-nav-item:hover { background: rgba(255,255,255,0.05); color: var(--color-text); }
.tl-nav-item[data-active="true"] {
  background: var(--color-orange-50, rgba(249,115,22,0.10));
  color: var(--color-orange-500);
  font-weight: 600;
}
.tl-nav-item[data-indent="true"] { padding-left: 12px; font-size: 12px; color: var(--color-text-dim); }
.tl-nav-item[data-indent="true"][data-active="true"] { background: rgba(255,255,255,0.05); color: var(--color-text); }

.tl-nav-bar {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0; border-radius: 0 2px 2px 0;
  background: var(--color-orange-500);
  transition: height 0.3s ease;
}
.tl-nav-item[data-active="true"][data-indent="false"] .tl-nav-bar {
  height: 20px;
  box-shadow: 0 0 10px rgba(249,115,22,0.5);
}

.tl-nav-icon { display: inline-flex; flex-shrink: 0; width: 18px; height: 18px; color: var(--color-text-dim); }
.tl-nav-item:hover .tl-nav-icon { color: var(--color-text-muted); }
.tl-nav-item[data-active="true"] .tl-nav-icon { color: var(--color-orange-500); }
.tl-nav-item[data-indent="true"] .tl-nav-icon { width: 14px; height: 14px; }

.tl-nav-label { flex: 1; transition: transform 0.3s ease; }
.tl-nav-item:hover .tl-nav-label { transform: translateX(2px); }
.tl-sidebar[data-collapsed="true"] .tl-nav-label { display: none; }
.tl-sidebar[data-collapsed="true"] .tl-nav-item { justify-content: center; padding: 10px 8px; }
.tl-sidebar[data-collapsed="true"] .tl-nav-chev { display: none; }

.tl-nav-badge {
  font: 600 10px/1 var(--font-sans); padding: 3px 8px; border-radius: 6px;
  background: linear-gradient(to right, rgba(244,63,94,0.20), rgba(167,139,250,0.20));
  color: var(--color-text);
  border: 1px solid rgba(255,255,255,0.10);
}

.tl-nav-chev { color: var(--color-text-dim); transition: transform 0.2s ease; }
.tl-nav-chev[data-open="true"] { transform: rotate(180deg); }

.tl-sidebar-footer {
  border-top: 1px solid var(--color-border);
  padding: 12px 16px; display: flex; flex-direction: column; gap: 2px;
}
.tl-sidebar[data-collapsed="true"] .tl-sidebar-footer { padding: 8px; }

/* ── Header ──────────────────────────────────────────────────── */
.tl-header {
  position: fixed; top: 0; right: 0; left: 248px; z-index: 30;
  height: 56px;
  display: flex; align-items: center; padding: 0 24px;
  background: rgba(28,28,28,0.70);
  backdrop-filter: blur(40px);
  border-bottom: 1px solid var(--color-border);
  transition: left 0.3s ease;
}
.tl-shell[data-sidebar-collapsed="true"] .tl-header { left: 64px; }

.tl-header-actions { display: flex; align-items: center; gap: 12px; }

.tl-header-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 10px; min-width: 240px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: rgba(255,255,255,0.03);
  color: var(--color-text-dim);
  font: 400 13px/1.4 var(--font-sans);
}
.tl-header-btn:hover { border-color: var(--color-border-strong); color: var(--color-text-muted); }
.tl-header-btn span { flex: 1; text-align: left; }

.tl-header-icon {
  position: relative;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
}
.tl-header-icon:hover { background: rgba(255,255,255,0.05); color: var(--color-text); }
.tl-header-dot {
  position: absolute; top: 8px; right: 8px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-orange-500);
  box-shadow: 0 0 6px var(--color-orange-500);
}

.tl-header-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--color-orange-500), #ea580c);
  color: #fff;
  font: 700 11px/1 var(--font-sans);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.10);
}
.tl-header-avatar:hover { box-shadow: 0 0 0 2px rgba(249,115,22,0.20); }

/* ── Main / page ─────────────────────────────────────────────── */
.tl-main {
  margin-left: 248px;
  padding-top: 56px;
  position: relative; z-index: 5;
  transition: margin 0.3s ease;
  min-height: 100vh;
}
.tl-shell[data-sidebar-collapsed="true"] .tl-main { margin-left: 64px; }

.tl-main-inner {
  max-width: 1600px; margin: 0 auto;
  padding: 24px 32px 64px;
}

.tl-page { display: flex; flex-direction: column; gap: 24px; }

/* ── PageHeader ─────────────────────────────────────────────── */
.tl-pageheader {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  backdrop-filter: blur(20px);
}
.tl-pageheader-back { padding: 16px 24px 0; }
.tl-backlink {
  display: inline-flex; align-items: center; gap: 4px;
  font: var(--type-body-sm);
  color: var(--color-text-muted);
  text-decoration: none;
}
.tl-backlink:hover { color: var(--color-text); }

.tl-pageheader-body {
  display: flex; gap: 24px; align-items: flex-start;
  padding: 12px 24px 24px;
}
.tl-pageheader-badges {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
}

.tl-pageheader-title {
  font: 700 24px/1.2 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin: 0 0 4px;
}
.tl-pageheader-desc {
  font: var(--type-body); color: var(--color-text-muted);
  margin: 0; max-width: 720px;
  line-height: 1.55;
}
.tl-pageheader-meta {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin-top: 16px;
  font: var(--type-body-sm); color: var(--color-text-muted);
}
.tl-pageheader-meta-item {
  display: inline-flex; align-items: center; gap: 6px;
}
.tl-pageheader-meta-item svg { color: var(--color-text-dim); }

/* ── Pills / Badges ─────────────────────────────────────────── */
.tl-pill, .tl-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 9999px;
  font: 700 11px/1 var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}
.tl-badge[data-variant="default"]      { background: linear-gradient(135deg, rgba(244,63,94,0.30), rgba(167,139,250,0.30)); color: #fff; }
.tl-badge[data-variant="secondary"],
.tl-badge[data-variant="glass"]        { background: rgba(255,255,255,0.04); color: var(--color-text-muted); border-color: var(--color-border); }
.tl-badge[data-variant="outline"]      { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.tl-badge[data-variant="cyan"]         { background: rgba(34,211,238,0.10); color: #67e8f9; border-color: rgba(34,211,238,0.30); }
.tl-badge[data-variant="rose"]         { background: rgba(244,63,94,0.10); color: #fb7185; border-color: rgba(244,63,94,0.30); }
.tl-badge[data-variant="amber"]        { background: rgba(245,158,11,0.10); color: #fbbf24; border-color: rgba(245,158,11,0.30); }
.tl-badge[data-variant="violet"]       { background: rgba(167,139,250,0.10); color: #a78bfa; border-color: rgba(167,139,250,0.30); }
.tl-badge[data-variant="destructive"]  { background: rgba(244,63,94,0.90); color: #fff; }

.tl-pill[data-variant="default"]       { background: rgba(255,255,255,0.04); color: var(--color-text); border-color: var(--color-border); }
.tl-pill[data-variant="cyan"]          { background: rgba(34,211,238,0.10); color: #67e8f9; border-color: rgba(34,211,238,0.30); }
.tl-pill[data-variant="rose"]          { background: rgba(244,63,94,0.10); color: #fb7185; border-color: rgba(244,63,94,0.30); }
.tl-pill[data-variant="amber"]         { background: rgba(245,158,11,0.10); color: #fbbf24; border-color: rgba(245,158,11,0.30); }
.tl-pill[data-variant="violet"]        { background: rgba(167,139,250,0.10); color: #a78bfa; border-color: rgba(167,139,250,0.30); }
.tl-pill[data-variant="glass"]         { background: rgba(255,255,255,0.04); color: var(--color-text-muted); border-color: var(--color-border); }

/* ── Buttons ──────────────────────────────────────────────── */
.tl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap;
  border-radius: 12px;
  font: 600 13px/1 var(--font-sans);
  border: 1px solid transparent;
  transition: all 0.25s ease;
  background: transparent;
  color: inherit;
}
.tl-btn:hover { transform: translateY(-1px); }
.tl-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.tl-btn[data-size="default"] { height: 40px; padding: 0 18px; }
.tl-btn[data-size="sm"]      { height: 32px; padding: 0 12px; font-size: 12px; }
.tl-btn[data-size="lg"]      { height: 44px; padding: 0 24px; }
.tl-btn[data-size="icon-sm"] { width: 32px; height: 32px; padding: 0; }
.tl-btn[data-size="icon"]    { width: 40px; height: 40px; padding: 0; }

.tl-btn[data-variant="default"] {
  background: var(--color-orange-500); color: #fff;
  box-shadow: 0 0 20px -4px rgba(249,115,22,0.50);
}
.tl-btn[data-variant="default"]:hover { background: #ea580c; }

.tl-btn[data-variant="outline"],
.tl-btn[data-variant="secondary"],
.tl-btn[data-variant="glass"] {
  background: rgba(255,255,255,0.03);
  border-color: var(--color-border);
  color: var(--color-text);
}
.tl-btn[data-variant="outline"]:hover,
.tl-btn[data-variant="secondary"]:hover,
.tl-btn[data-variant="glass"]:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--color-orange-500);
}

.tl-btn[data-variant="ghost"] {
  background: transparent; color: var(--color-text-muted);
}
.tl-btn[data-variant="ghost"]:hover {
  background: rgba(255,255,255,0.05); color: var(--color-text);
}

.tl-btn[data-variant="destructive"] {
  background: #f43f5e; color: #fff;
  box-shadow: 0 0 20px -4px rgba(244,63,94,0.50);
}
.tl-btn[data-variant="destructive"]:hover { background: #e11d48; }

/* ── Cards ──────────────────────────────────────────────── */
.tl-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
  backdrop-filter: blur(20px);
}
.tl-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.tl-card-title { font: 600 16px/1.3 var(--font-display); color: var(--color-text); }
.tl-eyebrow {
  font: 600 10.5px/1.3 var(--font-sans);
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--color-text-dim);
  margin-bottom: 4px;
}

/* ── Grids ──────────────────────────────────────────────── */
.tl-grid { display: grid; gap: 16px; }
.tl-grid-2 { grid-template-columns: 1fr 1fr; }
.tl-grid-3 { grid-template-columns: repeat(3, 1fr); }
.tl-grid-4 { grid-template-columns: repeat(4, 1fr); }
.tl-grid-3-1 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px) {
  .tl-grid-2, .tl-grid-3, .tl-grid-4, .tl-grid-3-1 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .tl-grid-2, .tl-grid-3, .tl-grid-4, .tl-grid-3-1 { grid-template-columns: 1fr; }
}

/* ── Metric tile ────────────────────────────────────────── */
.tl-metric {
  position: relative;
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--color-border);
  overflow: hidden;
}
.tl-metric::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--color-orange-500);
}
.tl-metric[data-accent="violet"]::before { background: #a78bfa; }
.tl-metric[data-accent="cyan"]::before   { background: #22d3ee; }
.tl-metric[data-accent="rose"]::before   { background: #f43f5e; }
.tl-metric-head {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 10.5px/1.3 var(--font-sans);
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--color-text-dim);
}
.tl-metric-head svg { color: var(--color-text-muted); }
.tl-metric-value {
  font: 700 28px/1.0 var(--font-display);
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
  color: var(--color-text);
}
.tl-metric-delta {
  font: var(--type-caption); margin-top: 4px;
  color: var(--color-text-dim);
}
.tl-metric-delta[data-tone="pos"]  { color: #34d399; }
.tl-metric-delta[data-tone="warn"] { color: #fbbf24; }
.tl-metric-delta[data-tone="neg"]  { color: #fb7185; }

/* ── Status dots & inputs ───────────────────────────────── */
.tl-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tl-dot[data-tone="success"] { background: #34d399; box-shadow: 0 0 6px rgba(52,211,153,0.50); }
.tl-dot[data-tone="warn"]    { background: #fbbf24; }
.tl-dot[data-tone="error"]   { background: #fb7185; }
.tl-dot[data-tone="info"]    { background: #60a5fa; }

.tl-input {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: rgba(255,255,255,0.03);
  min-width: 280px;
}
.tl-input:focus-within { border-color: var(--color-orange-500); box-shadow: 0 0 0 2px rgba(249,115,22,0.15); }
.tl-input input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--color-text); font: var(--type-body-sm);
}
.tl-input input::placeholder { color: var(--color-text-dim); }
.tl-input svg { color: var(--color-text-dim); }

.tl-kbd {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 1px 6px; min-width: 18px;
  border-radius: 4px;
  font: 500 11px/1.4 var(--font-mono);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

/* ── Stack rows / bars (status distribution) ────────────── */
.tl-stack { display: flex; flex-direction: column; gap: 12px; }
.tl-stack-row {
  display: grid; grid-template-columns: 220px 1fr 60px;
  align-items: center; gap: 16px;
}
.tl-stack-label { display: flex; align-items: center; gap: 10px; }
.tl-stack-count { font-variant-numeric: tabular-nums; color: var(--color-text); font-weight: 600; }
.tl-stack-pct  { font-variant-numeric: tabular-nums; color: var(--color-text-dim); font: var(--type-code-sm); text-align: right; }

.tl-bar { height: 8px; background: rgba(255,255,255,0.04); border-radius: 4px; overflow: hidden; }
.tl-bar > span { display: block; height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.tl-bar > span[data-tone="cyan"]    { background: linear-gradient(to right, #22d3ee, #06b6d4); }
.tl-bar > span[data-tone="amber"]   { background: linear-gradient(to right, #fbbf24, #f59e0b); }
.tl-bar > span[data-tone="glass"]   { background: rgba(255,255,255,0.20); }
.tl-bar > span[data-tone="outline"] { background: rgba(255,255,255,0.08); }
.tl-bar > span[data-tone="pos"]     { background: linear-gradient(to right, #34d399, #10b981); }
.tl-bar > span[data-tone="warn"]    { background: linear-gradient(to right, #fbbf24, #f59e0b); }
.tl-bar > span[data-tone="neg"]     { background: linear-gradient(to right, #fb7185, #f43f5e); }

/* ── Tactic coverage ──────────────────────────────────── */
.tl-tactics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; }
.tl-tactic { display: grid; grid-template-columns: 140px 1fr 36px; align-items: center; gap: 12px; }
.tl-tactic-name { font: var(--type-body-sm); color: var(--color-text-muted); }
.tl-tactic-bar { height: 6px; background: rgba(255,255,255,0.04); border-radius: 3px; overflow: hidden; }
.tl-tactic-bar > span { display: block; height: 100%; background: linear-gradient(to right, var(--color-orange-500), #fb923c); border-radius: 3px; }
.tl-tactic-pct { font: var(--type-code-sm); color: var(--color-text-muted); text-align: right; font-variant-numeric: tabular-nums; }

/* ── Recent runs ──────────────────────────────────────── */
.tl-runs { display: flex; flex-direction: column; }
.tl-run {
  display: grid; grid-template-columns: 12px 110px 1fr 80px;
  align-items: center; gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
}
.tl-run:first-child { border-top: none; }
.tl-run-time { font: var(--type-caption); color: var(--color-text-dim); }
.tl-run-txt  { font: var(--type-body-sm); color: var(--color-text); }
.tl-run-id   { font: var(--type-code-sm); color: var(--color-text-dim); text-align: right; }

/* ── Tabs ─────────────────────────────────────────────── */
.tl-tabs { display: flex; gap: 2px; padding: 4px; background: rgba(255,255,255,0.03); border-radius: 8px; border: 1px solid var(--color-border); }
.tl-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: 6px; border: none; background: transparent;
  font: 600 12px/1 var(--font-sans);
  color: var(--color-text-muted);
}
.tl-tab[aria-selected="true"] { background: rgba(255,255,255,0.06); color: var(--color-text); }
.tl-tab:hover { color: var(--color-text); }
.tl-tab-count {
  font: 600 10.5px/1 var(--font-mono);
  padding: 2px 6px; border-radius: 4px;
  background: rgba(255,255,255,0.05);
  color: var(--color-text-dim);
  font-variant-numeric: tabular-nums;
}

/* ── Listcard / table ─────────────────────────────────── */
.tl-listcard { padding: 0; overflow: hidden; }
.tl-listcard-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
}

.tl-table { display: flex; flex-direction: column; }
.tl-thead, .tl-trow {
  display: grid;
  grid-template-columns: minmax(280px,2.4fr) 92px 92px 76px 130px 96px 130px 110px;
  align-items: center;
  gap: 12px; padding: 0 16px;
}
.tl-thead {
  height: 36px;
  font: 600 10.5px/1 var(--font-sans);
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--color-text-dim);
  border-bottom: 1px solid var(--color-border);
  background: rgba(255,255,255,0.02);
}
.tl-trow {
  min-height: 52px;
  border: none; background: transparent;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  font: var(--type-body-sm); color: var(--color-text);
}
.tl-trow:hover { background: rgba(255,255,255,0.03); }
.tl-trow:last-child { border-bottom: none; }
.tl-cell-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tl-cell-id   { font: var(--type-code-sm); color: var(--color-text-dim); }
.tl-cell-mut  { color: var(--color-text-muted); }
.tl-cell-mono { font: var(--type-code-sm); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.tl-cell-conf { display: flex; align-items: center; gap: 8px; }
.tl-conf-bar { flex: 1; height: 6px; background: rgba(255,255,255,0.04); border-radius: 3px; overflow: hidden; }
.tl-conf-bar > span { display: block; height: 100%; border-radius: 3px; }
.tl-conf-bar > span[data-tone="pos"]  { background: linear-gradient(to right, #34d399, #10b981); }
.tl-conf-bar > span[data-tone="warn"] { background: linear-gradient(to right, #fbbf24, #f59e0b); }
.tl-conf-bar > span[data-tone="neg"]  { background: linear-gradient(to right, #fb7185, #f43f5e); }

.tl-tag {
  display: inline-flex; padding: 2px 8px;
  border-radius: 4px;
  font: 500 10.5px/1.4 var(--font-mono);
  text-transform: uppercase;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

/* ── Detail screen extras ───────────────────────────── */
.tl-stack-cards { display: flex; flex-direction: column; gap: 16px; }

.tl-code {
  font: 500 12.5px/1.6 var(--font-mono);
  color: var(--color-text);
  background: #0e0e0e;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

.tl-conf-big { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 16px; }
.tl-conf-num {
  font: 700 36px/1 var(--font-display);
  font-variant-numeric: tabular-nums; color: var(--color-text);
}
.tl-conf-num span { font-size: 16px; color: var(--color-text-dim); margin-left: 4px; font-weight: 500; }
.tl-conf-bar-lg { height: 10px; }
.tl-conf-factors { display: flex; flex-direction: column; gap: 8px; }
.tl-conf-factor {
  display: grid; grid-template-columns: 130px 1fr 36px;
  align-items: center; gap: 12px;
  font: var(--type-body-sm); color: var(--color-text-muted);
}

.tl-spark {
  display: flex; align-items: flex-end; gap: 3px; height: 80px;
  margin: 12px 0 8px;
}
.tl-spark > span {
  flex: 1;
  background: linear-gradient(to top, var(--color-orange-500), rgba(249,115,22,0.30));
  border-radius: 2px 2px 0 0;
  min-height: 2px;
}
.tl-spark-meta {
  display: flex; gap: 16px;
  font: var(--type-caption); color: var(--color-text-dim);
}

/* ── Connectors ─────────────────────────────────────── */
.tl-connector { display: flex; flex-direction: column; gap: 16px; }
.tl-connector-head { display: flex; align-items: center; gap: 12px; }
.tl-connector-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 14px/1 var(--font-display);
  color: #fff;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}
.tl-connector-icon[data-type="splunk"]      { background: linear-gradient(135deg, #65a30d, #3f6212); }
.tl-connector-icon[data-type="crowdstrike"] { background: linear-gradient(135deg, #dc2626, #7f1d1d); }
.tl-connector-icon[data-type="azure"]       { background: linear-gradient(135deg, #2563eb, #1e40af); }
.tl-connector-icon[data-type="aws"]         { background: linear-gradient(135deg, #f59e0b, #b45309); }
.tl-connector-icon[data-type="github"]      { background: linear-gradient(135deg, #475569, #1e293b); }
.tl-connector-icon[data-type="okta"]        { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.tl-connector-icon[data-type="google"]      { background: linear-gradient(135deg, #ef4444, #b45309); }
.tl-connector-name { font: 600 14px/1.3 var(--font-display); color: var(--color-text); }
.tl-connector-meta { font: var(--type-caption); color: var(--color-text-dim); margin-top: 2px; }
.tl-connector-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

/* ── Empty state ────────────────────────────────────── */
.tl-empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 8px;
  padding: 32px 16px;
}
.tl-empty-icon {
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: rgba(249,115,22,0.10);
  color: var(--color-orange-500);
  margin-bottom: 8px;
}
.tl-empty h3 { font: var(--type-h3); color: var(--color-text); margin: 0; }
.tl-empty p { font: var(--type-body-sm); color: var(--color-text-muted); max-width: 360px; margin: 0; }

/* ── Modals (search & menu) ─────────────────────────── */
.tl-modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 96px;
}
.tl-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.50); backdrop-filter: blur(8px); }

.tl-search {
  position: relative;
  width: min(640px, calc(100% - 48px));
  background: #1c1c1c;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.50);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.tl-search-input {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}
.tl-search-input input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--color-text); font: 500 15px/1.2 var(--font-sans);
}
.tl-search-input input::placeholder { color: var(--color-text-dim); }

.tl-search-results { max-height: 360px; overflow-y: auto; padding: 8px; }
.tl-search-section {
  font: 600 10.5px/1.3 var(--font-sans);
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--color-text-dim);
  padding: 8px 12px 4px;
}
.tl-search-row {
  display: grid; grid-template-columns: 24px 1fr auto 80px;
  align-items: center; gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  background: transparent; border: none;
  text-align: left;
  font: var(--type-body-sm); color: var(--color-text);
}
.tl-search-row:hover, .tl-search-row:focus-visible { background: rgba(255,255,255,0.05); outline: none; }
.tl-search-row-icon { color: var(--color-orange-500); }
.tl-search-row-label { color: var(--color-text); font-weight: 500; }
.tl-search-row-meta  { color: var(--color-text-dim); font: var(--type-code-sm); }
.tl-search-row-kind  {
  font: 600 10px/1 var(--font-sans);
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--color-text-dim);
  text-align: right;
}
.tl-search-empty { padding: 24px; color: var(--color-text-dim); text-align: center; }
.tl-search-foot {
  display: flex; gap: 16px; padding: 8px 16px;
  border-top: 1px solid var(--color-border);
  font: var(--type-caption); color: var(--color-text-dim);
}

/* user menu */
.tl-menu-backdrop { position: fixed; inset: 0; z-index: 50; }
.tl-usermenu {
  position: fixed; right: 16px; top: 64px; z-index: 51;
  width: 280px;
  background: #1c1c1c;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.50);
  overflow: hidden;
}
.tl-usermenu-head {
  display: flex; gap: 12px; padding: 16px;
  border-bottom: 1px solid var(--color-border);
}
.tl-usermenu-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--color-orange-500), #ea580c);
  color: #fff;
  font: 700 13px/1 var(--font-sans);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tl-usermenu-name  { font: 600 14px/1.3 var(--font-display); color: var(--color-text); }
.tl-usermenu-email { font: var(--type-caption); color: var(--color-text-dim); }
.tl-usermenu-role  { font: 600 10.5px/1.3 var(--font-sans); letter-spacing: 0.10em; text-transform: uppercase; color: var(--color-orange-500); margin-top: 4px; }

.tl-usermenu-list, .tl-usermenu-foot { padding: 8px; }
.tl-usermenu-foot { border-top: 1px solid var(--color-border); display: flex; align-items: center; gap: 8px; }
.tl-usermenu-row {
  display: inline-flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px; border: none; background: transparent;
  font: var(--type-body-sm); color: var(--color-text-muted);
  text-align: left;
}
.tl-usermenu-row:hover { background: rgba(255,255,255,0.05); color: var(--color-text); }
.tl-usermenu-row[data-tone="danger"] { color: #fb7185; }
.tl-usermenu-row[data-tone="danger"]:hover { background: rgba(244,63,94,0.10); color: #fb7185; }
.tl-usermenu-version {
  font: var(--type-code-sm); color: var(--color-text-dim);
  margin-left: auto;
}
