/* ─────────────────────────────────────────────────────────────
   LMS AI Analyzer — shadcn-like responsive theme
   Supports: dark / light via html[data-theme]
───────────────────────────────────────────────────────────── */

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

:root,
html[data-theme="dark"] {
  --bg: #09090b;
  --bg-2: #111113;
  --bg-3: #18181b;
  --bg-4: #202024;

  --surface: #111113;
  --surface-2: #18181b;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #fafafa;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --text-4: #52525b;

  --accent: #ffffff;
  --accent-text: #09090b;

  --shadow: 0 1px 3px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 60px rgba(0, 0, 0, .55);

  --pos: #22c55e;
  --pos-bg: rgba(34, 197, 94, .10);
  --neg: #ef4444;
  --neg-bg: rgba(239, 68, 68, .10);
  --neu: #a1a1aa;
  --neu-bg: rgba(161, 161, 170, .10);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, .10);
  --high: #f97316;
  --high-bg: rgba(249, 115, 22, .10);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, .10);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
}

html[data-theme="light"] {
  --bg: #fafafa;
  --bg-2: #ffffff;
  --bg-3: #ffffff;
  --bg-4: #f4f4f5;

  --surface: #ffffff;
  --surface-2: #f8f8f8;

  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);

  --text: #09090b;
  --text-2: #52525b;
  --text-3: #71717a;
  --text-4: #a1a1aa;

  --accent: #09090b;
  --accent-text: #ffffff;

  --shadow: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-lg: 0 18px 60px rgba(0, 0, 0, .12);
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

body.is-loading {
  cursor: progress;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

/* ── Login ─────────────────────────────────────────────────── */

#login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background:
    radial-gradient(circle at top, rgba(255,255,255,.08), transparent 34%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.login-logo,
.brand-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.logo-mark,
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: .8rem;
  letter-spacing: -.03em;
}

.login-logo {
  margin-bottom: 1.5rem;
}

.login-logo small {
  display: block;
  color: var(--text-3);
  font-size: .7rem;
  margin-top: .1rem;
}

.login-card h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: .3rem;
}

.login-card p {
  color: var(--text-2);
  font-size: .85rem;
  margin-bottom: 1.3rem;
}

.login-hint {
  margin-top: .85rem !important;
  margin-bottom: 0 !important;
  font-size: .72rem !important;
  text-align: center;
  color: var(--text-3) !important;
}

/* ── Layout ────────────────────────────────────────────────── */

#app {
  display: none;
  height: 100vh;
  overflow: hidden;
}

#app.visible {
  display: flex;
}

.sidebar {
  width: 248px;
  min-width: 248px;
  height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-nav-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .35rem 0;

  scrollbar-width: none;
  -ms-overflow-style: none;

  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    black 18px,
    black calc(100% - 18px),
    transparent 100%
  );
}

.sidebar-nav-scroll::-webkit-scrollbar {
  display: none;
}

.sidebar-header {
  padding: 1.1rem;
  border-bottom: 1px solid var(--border);
}

#app-title {
  font-size: .85rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.version {
  margin-top: .1rem;
  color: var(--text-3);
  font-size: .68rem;
}

.ai-badge {
  margin-top: .8rem;
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .2rem .55rem;
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-2);
}

.ai-badge.gemma {
  color: var(--pos);
  background: var(--pos-bg);
  border-color: rgba(34, 197, 94, .25);
}

.ai-badge.mock {
  color: var(--info);
  background: var(--info-bg);
  border-color: rgba(59, 130, 246, .25);
}

.sidebar-section {
  padding: .65rem .75rem .25rem;
}

.sidebar-section-label {
  padding: .5rem .45rem .35rem;
  color: var(--text-4);
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-2);
  border-radius: 9px;
  padding: .55rem .65rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: .82rem;
  text-align: left;
  transition: background .15s, color .15s, transform .12s;
  margin-bottom: 2px;
}

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

.nav-item.active {
  background: var(--bg-4);
  color: var(--text);
  font-weight: 700;
}

.nav-item [data-lucide],
.nav-item svg,
.btn [data-lucide],
.btn svg,
.logout-btn [data-lucide],
.logout-btn svg {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  flex-shrink: 0;
  display: inline-block;
  stroke-width: 2;
}

.nav-item .badge {
  margin-left: auto;
}

.sidebar-footer {
  margin-top: auto;
  padding: .8rem;
  border-top: 1px solid var(--border);
}

.user-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  border: 1px solid var(--border);
  background: var(--bg-3);
  border-radius: var(--radius);
  padding: .55rem;
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 900;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-info .name {
  font-size: .78rem;
  font-weight: 700;
}

.user-info .role {
  color: var(--text-3);
  font-size: .68rem;
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-3);
  border-radius: 8px;
  padding: .35rem;
  display: inline-flex;
}

.logout-btn:hover {
  color: var(--neg);
  border-color: rgba(239, 68, 68, .35);
}

.main-content {
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,.05), transparent 28%),
    var(--bg);
}

.topbar {
  height: 52px;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(12px);
}

.topbar-left {
  color: var(--text-2);
  font-size: .78rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.system-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pos);
  box-shadow: 0 0 0 5px var(--pos-bg);
}

.topbar-actions,
.action-row,
.filter-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
}

/* ── Pages ─────────────────────────────────────────────────── */

.page {
  display: none;
  min-height: calc(100vh - 52px);
  flex-direction: column;
}

.page.active {
  display: flex;
}

.page-header {
  padding: 1.35rem 1.5rem .85rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.page-header h2 {
  font-size: 1.15rem;
  font-weight: 850;
  letter-spacing: -.035em;
}

.subtitle {
  margin-top: .15rem;
  color: var(--text-2);
  font-size: .78rem;
}

.page-body {
  padding: 1.25rem 1.5rem 2rem;
}

/* ── Cards / grids ─────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.compact-card {
  padding: .8rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  margin-bottom: .75rem;
}

.card-title {
  color: var(--text-2);
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* padding: .95rem; */
  box-shadow: var(--shadow);
  padding: 16px;
  height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-label {
  color: var(--text-3);
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .055em;
  margin-bottom: .35rem;
}

.kpi-val {
  font-size: 28px;
  font-weight: 800;
  /* font-weight: 900; */
  letter-spacing: -.055em;
  line-height: 1;
}

.kpi-sub {
  margin-top: .35rem;
  color: var(--text-2);
  font-size: .72rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: .85rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
}

.mt-3 { margin-top: 1rem; }
.mb-3 { margin-bottom: 1rem; }
.text-sm { font-size: .78rem; }
.text-muted { color: var(--text-3); }
.full-width { width: 100%; }
.required { color: var(--neg); }

/* ── Form controls ─────────────────────────────────────────── */

.field {
  margin-bottom: .85rem;
}

.field label {
  display: block;
  color: var(--text-2);
  font-size: .72rem;
  font-weight: 750;
  margin-bottom: .35rem;
}

.input,
.textarea {
  width: 100%;
  min-height: 38px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  color: var(--text);
  padding: .48rem .7rem;
  font-size: .82rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;

  /* width: 72px !important; */
  min-width: 72px;
  /* height: 40px; */

  /* padding: 14px 30px 0 14px !important; */
  border-radius: 12px;

  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  /* background-color: var(--bg-2);
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 15px 15px; */
}

/* .select {
  width: 100%;
  min-height: 38px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  color: var(--text);
  padding: .48rem .7rem;
  font-size: .82rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;

  width: 72px !important;
  min-width: 72px;
  height: 40px;

  padding: 0 30px 0 14px !important;
  border-radius: 12px;

  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background-color: var(--bg-2);
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 15px 15px;
} */

.select {
  width: 100%;
  height: 42px;
  min-width: 0;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text);
  padding: 0 38px 0 14px !important;
  font-size: .82rem;
  outline: none;
}

.topbar-select {
  width: auto !important;
  height: stretch !important;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--text-3);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 8%, transparent);
}

.select option {
  background: var(--bg-2);
  color: var(--text);
}

.textarea {
  resize: vertical;
  min-height: 110px;
}

.form-grid {
  gap: .75rem;
}

/* ── Buttons ───────────────────────────────────────────────── */

.btn {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  padding: .48rem .85rem;
  font-size: .8rem;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  transition: transform .12s, background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn-secondary {
  background: var(--bg-4);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}

.btn-danger {
  color: var(--neg);
  background: var(--neg-bg);
  border: 1px solid rgba(239, 68, 68, .22);
}

.btn-sm {
  /* min-height: 32px;
  padding: .35rem .65rem;
  font-size: .74rem; */
  font-size: .74rem;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
}

/* ── Tables ────────────────────────────────────────────────── */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
}

thead th {
  background: var(--bg-4);
  color: var(--text-3);
  padding: .62rem .75rem;
  text-align: left;
  font-size: .67rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .055em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--bg-4);
}

/* ── Badges ───────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  border-radius: 999px;
  padding: .15rem .48rem;
  font-size: .66rem;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

.badge-positive {
  color: var(--pos);
  background: var(--pos-bg);
}

.badge-negative,
.badge-critical {
  color: var(--neg);
  background: var(--neg-bg);
}

.badge-neutral,
.badge-low {
  color: var(--neu);
  background: var(--neu-bg);
}

.badge-high {
  color: var(--high);
  background: var(--high-bg);
}

.badge-medium {
  color: var(--warn);
  background: var(--warn-bg);
}

.badge-outline {
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  background: transparent;
}

/* ── Charts: shadcn compact analytics ─────────────────────── */

.chart-card,
.overview-chart-card,
.trend-main-chart {
  min-height: 300px !important;
  height: auto !important;
  max-height: none !important;
  padding: .95rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: var(--surface);
}

.overview-chart-card {
  height: 300px !important;
}

.chart-card .card-header,
.overview-chart-card .card-header,
.trend-main-chart .card-header {
  flex-shrink: 0;
  margin-bottom: .65rem;
}

.chart-box,
.chart-container {
  position: relative !important;
  flex: 1 1 auto !important;
  height: 230px !important;
  min-height: 230px !important;
  max-height: 230px !important;
  overflow: hidden !important;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-2);
  padding: .65rem .75rem .95rem;
}

.overview-chart-card .chart-box {
  height: 230px !important;
  min-height: 230px !important;
  max-height: 230px !important;
}

.trend-chart-box {
  height: 310px !important;
  min-height: 310px !important;
  max-height: 310px !important;
}

.trend-main-chart {
  min-height: 390px !important;
}

.chart-box canvas,
.chart-container canvas,
.chart-card canvas,
.overview-chart-card canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  display: block !important;
}

@media (max-width: 520px) {
  .chart-card,
  .overview-chart-card {
    min-height: 300px !important;
    height: auto !important;
    max-height: none !important;
  }

  .chart-box,
  .chart-container,
  .overview-chart-card .chart-box {
    height: 230px !important;
    min-height: 230px !important;
    max-height: 230px !important;
  }
}

/* ── JSON / logs / stats ───────────────────────────────────── */

.json-viewer {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: .8rem;
  color: var(--text-2);
  font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
  font-size: .72rem;
  overflow: auto;
  max-height: 360px;
  white-space: pre;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  padding: .52rem 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
  border-bottom: 0;
}

.stat-label {
  color: var(--text-2);
  font-size: .78rem;
}

.stat-val {
  color: var(--text);
  font-size: .78rem;
  font-weight: 800;
  text-align: right;
}

.log-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) 60px minmax(160px, 1fr) minmax(220px, 2fr);
  gap: .75rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .72rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.log-row:last-child {
  border-bottom: 0;
}

.log-row b {
  font-weight: 900;
}

.log-INFO b { color: var(--info); }
.log-WARN b { color: var(--warn); }
.log-ERROR b { color: var(--neg); }

/* ── Alerts / empty / toast ───────────────────────────────── */

.alert {
  border-radius: 9px;
  padding: .7rem .85rem;
  font-size: .8rem;
  border: 1px solid var(--border);
}

.alert-warn {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: rgba(245, 158, 11, .23);
}

.alert-err {
  color: var(--neg);
  background: var(--neg-bg);
  border-color: rgba(239, 68, 68, .25);
}

.alert-success {
  color: var(--pos);
  background: var(--pos-bg);
  border-color: rgba(34, 197, 94, .25);
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-3);
}

.empty-icon {
  width: 38px;
  height: 38px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  margin: 0 auto .75rem;
  background:
    linear-gradient(135deg, transparent 45%, var(--border-strong) 45%, var(--border-strong) 55%, transparent 55%);
}

/* ── Toast Center ─────────────────────────────────────────── */

#toast-container {
  position: fixed;
  right: 1.25rem;
  top: 1.25rem;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  width: min(420px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  --toast-color: var(--info);
  --toast-bg: var(--info-bg);

  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 76px;
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--toast-color) 18%, transparent), transparent 36%),
    color-mix(in srgb, var(--surface) 96%, var(--text) 4%);
  border: 1px solid color-mix(in srgb, var(--toast-color) 34%, var(--border-strong));
  color: var(--text);
  box-shadow: var(--shadow-lg);
  border-radius: 18px;
  padding: .85rem .9rem .95rem;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: .75rem;
  pointer-events: auto;
  animation: toastIn .22s cubic-bezier(.2,.8,.2,1);
  backdrop-filter: blur(14px);
}

.toast.success {
  --toast-color: var(--pos);
  --toast-bg: var(--pos-bg);
}

.toast.error {
  --toast-color: var(--neg);
  --toast-bg: var(--neg-bg);
}

.toast.warn,
.toast.warning {
  --toast-color: var(--warn);
  --toast-bg: var(--warn-bg);
}

.toast.info {
  --toast-color: var(--info);
  --toast-bg: var(--info-bg);
}

.toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  background: var(--toast-bg);
  color: var(--toast-color);
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--toast-color) 30%, transparent);
}

.toast-icon svg {
  width: 18px !important;
  height: 18px !important;
}

.toast-content {
  min-width: 0;
}

.toast-title-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .15rem;
}

.toast-title {
  font-size: .84rem;
  font-weight: 900;
  letter-spacing: -.02em;
  color: var(--text);
}

.toast-count {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--toast-bg);
  color: var(--toast-color);
  border: 1px solid color-mix(in srgb, var(--toast-color) 24%, transparent);
  display: none;
  place-items: center;
  font-size: .65rem;
  font-weight: 950;
}

.toast.has-count .toast-count {
  display: grid;
}

.toast-text {
  font-size: .78rem;
  line-height: 1.45;
  color: var(--text-2);
  word-break: break-word;
}

.toast-meta {
  margin-top: .35rem;
  color: var(--text-4);
  font-size: .67rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.toast-actions {
  margin-top: .55rem;
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
}

.toast-action {
  height: 28px;
  border: 1px solid color-mix(in srgb, var(--toast-color) 28%, var(--border));
  background: var(--toast-bg);
  color: var(--toast-color);
  border-radius: 9px;
  padding: 0 .6rem;
  font-size: .7rem;
  font-weight: 850;
  cursor: pointer;
}

.toast-action:hover {
  filter: brightness(1.12);
}

.toast-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  border-radius: 9px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.toast-close:hover {
  color: var(--text);
  background: var(--bg-4);
}

.toast-close svg {
  width: 15px !important;
  height: 15px !important;
}

.toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: color-mix(in srgb, var(--toast-color) 70%, transparent);
  transform-origin: left center;
  animation: toastProgress linear forwards;
  animation-duration: var(--toast-duration, 4200ms);
}

.toast:hover .toast-progress {
  animation-play-state: paused;
}

.toast.removing {
  animation: toastOut .18s ease-in forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(18px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(18px) scale(.98);
  }
}

@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (max-width: 640px) {
  #toast-container {
    top: .75rem;
    right: .75rem;
    left: .75rem;
    width: auto;
  }

  .toast {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    border-radius: 16px;
  }
}

/* ── Loading / Progress System ─────────────────────────────── */

body.is-loading {
  cursor: progress;
}

body.is-loading::after {
  content: "";
  position: fixed;
  left: 248px;
  right: 0;
  top: 0;
  height: 2px;
  z-index: 30000;
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent),
    color-mix(in srgb, var(--info) 70%, var(--accent)),
    transparent
  );
  animation: topLoadingSweep 1.05s ease-in-out infinite;
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 55%, transparent);
}

@keyframes topLoadingSweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.spinner,
.ai-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  background:
    radial-gradient(circle at center, var(--accent) 0 18%, transparent 20%),
    conic-gradient(from 0deg, transparent 0 22%, var(--accent), transparent 72%);
  animation: aiSpin .85s linear infinite;
}

.spinner::after,
.ai-spinner::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: var(--surface);
}

.btn .spinner::after,
.btn .ai-spinner::after {
  background: color-mix(in srgb, currentColor 0%, transparent);
}

@keyframes aiSpin {
  to { transform: rotate(360deg); }
}

.progress-wrap {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}

.progress-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 8%, transparent), transparent);
  animation: progressRail 1.4s ease-in-out infinite;
}

.progress-bar {
  height: 100%;
  width: var(--progress, 0%);
  background:
    linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--info) 65%, var(--accent)));
  border-radius: 999px;
  position: relative;
  transition: width .35s ease;
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 35%, transparent);
}

.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: progressShine 1.15s ease-in-out infinite;
}

@keyframes progressRail {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@keyframes progressShine {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.processing-orb {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  background:
    radial-gradient(circle at center, var(--surface) 0 44%, transparent 45%),
    conic-gradient(from 0deg, transparent, var(--accent), color-mix(in srgb, var(--info) 70%, var(--accent)), transparent);
  animation: aiSpin 1.1s linear infinite;
  box-shadow:
    0 0 0 1px var(--border-strong),
    0 0 38px color-mix(in srgb, var(--accent) 18%, transparent);
}

.processing-orb::before {
  content: "";
  position: absolute;
  inset: 15px;
  border-radius: inherit;
  background: var(--accent);
  opacity: .95;
  transform: scale(.28);
  animation: orbPulse 1.25s ease-in-out infinite;
}

.processing-orb::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: inherit;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  animation: orbRing 1.4s ease-out infinite;
}

@keyframes orbPulse {
  0%, 100% { transform: scale(.25); opacity: .55; }
  50% { transform: scale(.42); opacity: 1; }
}

@keyframes orbRing {
  from { transform: scale(.78); opacity: .75; }
  to { transform: scale(1.2); opacity: 0; }
}

/* ── Modal ────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, .72);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem;
  overflow-y: auto;
}

.modal {
  width: min(920px, 100%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: .95rem;
  font-weight: 850;
}

.modal-body {
  padding: 1.25rem;
}

.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 9px;
  padding: .35rem;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 1100px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }

  .responsive-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  #app.visible {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-section {
    display: flex;
    gap: .35rem;
    overflow-x: auto;
    padding: .5rem .75rem;
  }

  .sidebar-section-label {
    display: none;
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .sidebar-footer {
    display: none;
  }

  .main-content {
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    position: sticky;
    top: 0;
    padding: 0 .9rem;
  }

  .topbar-left {
    display: none;
  }

  .page-header {
    padding: 1rem;
    align-items: flex-start;
  }

  .page-body {
    padding: 1rem;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .filter-row,
  .action-row {
    align-items: stretch;
  }

  .filter-row .field,
  .filter-row .btn {
    width: 100%;
  }

  .log-row {
    grid-template-columns: 1fr;
    gap: .2rem;
  }

  .login-card {
    padding: 1.5rem;
  }

  .modal-overlay {
    padding: .75rem;
  }
}

@media (max-width: 520px) {
  html,
  body {
    font-size: 13px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .btn {
    width: auto;
  }

  .chart-card {
    height: 230px !important;
    min-height: 230px !important;
    max-height: 230px !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   Test tahlil — Live AI Diagnostic Lab
───────────────────────────────────────────────────────────── */

.test-lab {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.test-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--text) 8%, transparent), transparent 32%),
    var(--surface);
}

.test-hero h3 {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -.04em;
  margin-bottom: .3rem;
}

.test-hero p {
  color: var(--text-2);
  max-width: 720px;
  font-size: .85rem;
}

.eyebrow {
  color: var(--text-3);
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: .35rem;
}

.test-pipeline {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-shrink: 0;
}

.pipeline-step {
  min-width: 74px;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  font-size: .72rem;
  font-weight: 800;
}

.pipeline-step svg {
  width: 14px;
  height: 14px;
}

.pipeline-step.active {
  color: var(--text);
  border-color: var(--border-strong);
}

.pipeline-line {
  width: 30px;
  height: 1px;
  background: var(--border-strong);
}

.test-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.35fr);
  gap: 1rem;
  align-items: start;
}

.test-input-card {
  position: sticky;
  top: 68px;
}

.test-textarea {
  min-height: 150px;
  font-size: .9rem;
}

.test-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.test-analyze-btn {
  min-height: 44px;
  font-size: .9rem;
  margin-top: .35rem;
}

.test-note {
  margin-top: .85rem;
  color: var(--text-3);
  font-size: .75rem;
  display: flex;
  gap: .45rem;
  align-items: flex-start;
}

.test-note svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: .1rem;
}

.test-result-panel {
  min-width: 0;
}

.test-empty h3 {
  font-size: 1rem;
  margin-bottom: .35rem;
}

.test-empty p {
  max-width: 520px;
  margin: 0 auto;
  color: var(--text-2);
}

.test-result-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.test-command-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--text) 8%, transparent), transparent 30%),
    var(--surface);
}

.test-command-card h3 {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -.04em;
  margin-bottom: .25rem;
}

.test-command-card p {
  color: var(--text-2);
  max-width: 640px;
}

.test-command-card.positive {
  border-color: rgba(34, 197, 94, .28);
  background:
    radial-gradient(circle at top right, rgba(34,197,94,.18), transparent 34%),
    var(--surface);
}

.test-command-card.negative {
  border-color: rgba(239, 68, 68, .28);
  background:
    radial-gradient(circle at top right, rgba(239,68,68,.16), transparent 34%),
    var(--surface);
}

.test-command-card.high,
.test-command-card.critical {
  border-color: rgba(245, 158, 11, .36);
  background:
    radial-gradient(circle at top right, rgba(245,158,11,.18), transparent 34%),
    var(--surface);
}

.radial-score {
  width: 108px;
  height: 108px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--bg-2);
  box-shadow: inset 0 0 0 7px color-mix(in srgb, var(--text) 5%, transparent);
}

.radial-score span {
  font-size: 1.85rem;
  font-weight: 950;
  line-height: 1;
}

.radial-score small {
  margin-top: .25rem;
  color: var(--text-3);
  font-size: .66rem;
  font-weight: 850;
  text-transform: uppercase;
}

.radial-score.positive {
  color: var(--pos);
  box-shadow: inset 0 0 0 7px var(--pos-bg);
}

.radial-score.negative,
.radial-score.critical {
  color: var(--neg);
  box-shadow: inset 0 0 0 7px var(--neg-bg);
}

.radial-score.high {
  color: var(--warn);
  box-shadow: inset 0 0 0 7px var(--warn-bg);
}

.test-insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.test-insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem;
  display: flex;
  align-items: flex-start;
  gap: .7rem;
}

.test-insight-card.signal-positive {
  border-color: rgba(34,197,94,.24);
}

.test-insight-card.signal-negative,
.test-insight-card.severity-critical,
.test-insight-card.severity-high {
  border-color: rgba(239,68,68,.24);
}

.test-insight-card.severity-medium {
  border-color: rgba(245,158,11,.25);
}

.test-insight-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.test-insight-icon svg {
  width: 17px;
  height: 17px;
}

.test-insight-label {
  color: var(--text-3);
  font-size: .66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .055em;
}

.test-insight-value {
  font-size: 1rem;
  font-weight: 900;
  margin-top: .1rem;
}

.test-insight-sub {
  color: var(--text-3);
  font-size: .72rem;
  margin-top: .1rem;
}

.test-section-card {
  min-height: 100%;
}

.score-row {
  margin-bottom: .85rem;
}

.score-row:last-child {
  margin-bottom: 0;
}

.score-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-2);
  font-size: .76rem;
  margin-bottom: .35rem;
}

.score-top b {
  color: var(--text);
}

.score-track {
  height: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.score-extra {
  color: var(--text-3);
  font-size: .68rem;
  margin-top: .25rem;
}

.test-dim-grid {
  display: grid;
  gap: .15rem;
}

.test-field-block {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: .75rem;
  align-items: start;
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
}

.test-field-block:last-child {
  border-bottom: 0;
}

.test-field-block > span:first-child {
  color: var(--text-3);
  font-size: .72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: .18rem .55rem;
  font-size: .72rem;
  margin: .12rem;
  color: var(--text-2);
  background: var(--bg-2);
}

.recommendation-box {
  display: flex;
  gap: .8rem;
  align-items: flex-start;
  padding: .9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-2);
}

.recommendation-box svg {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}

.recommendation-box b {
  display: block;
  margin-bottom: .25rem;
}

.recommendation-box p {
  color: var(--text-2);
  font-size: .8rem;
}

.recommendation-box.positive {
  border-color: rgba(34,197,94,.24);
  background: var(--pos-bg);
}

.recommendation-box.negative,
.recommendation-box.high,
.recommendation-box.critical {
  border-color: rgba(245,158,11,.28);
  background: var(--warn-bg);
}

.test-audit-grid {
  display: grid;
  gap: .75rem;
}

.test-json-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
}

.test-json-details summary {
  padding: .7rem .85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-2);
  font-size: .78rem;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}

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

.test-json-details summary svg {
  width: 16px;
  height: 16px;
  transition: transform .16s;
}

.test-json-details[open] summary svg {
  transform: rotate(180deg);
}

.test-json-details .json-viewer {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  max-height: 420px;
}

.test-processing-card {
  min-height: 310px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: left;
}

.processing-orb {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(circle, var(--accent) 0 14%, transparent 16%),
    conic-gradient(from 0deg, transparent, var(--accent), transparent);
  animation: spin 1.1s linear infinite;
  flex-shrink: 0;
}

.test-error-card {
  padding: 1rem;
}

.test-error-card p {
  margin-top: .35rem;
}

/* Mobile */
@media (max-width: 1180px) {
  .test-grid {
    grid-template-columns: 1fr;
  }

  .test-input-card {
    position: static;
  }

  .test-insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .test-pipeline {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .pipeline-line {
    display: none;
  }
}

@media (max-width: 720px) {
  .test-hero,
  .test-command-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .test-meta-grid,
  .test-insight-grid {
    grid-template-columns: 1fr;
  }

  .test-field-block {
    grid-template-columns: 1fr;
    gap: .35rem;
  }

  .radial-score {
    width: 96px;
    height: 96px;
  }
}

/* ─────────────────────────────────────────────────────────────
   Keywords / Word Intelligence Lab
───────────────────────────────────────────────────────────── */

.keyword-lab {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.keyword-hero {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: stretch;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--text) 8%, transparent), transparent 34%),
    var(--surface);
}

.keyword-hero h3 {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -.04em;
  margin-bottom: .25rem;
}

.keyword-hero p {
  color: var(--text-2);
  max-width: 760px;
  font-size: .86rem;
}

.keyword-hero-metrics {
  min-width: 420px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
}

.keyword-grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr);
  gap: 1rem;
  align-items: stretch;
}

.keyword-cloud-card,
.keyword-hot-card {
  min-height: 430px;
}

.word-cloud {
  min-height: 340px;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--text) 5%, transparent), transparent 58%),
    var(--bg-2);
  display: flex;
  align-content: center;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem .65rem;
  overflow: hidden;
}

.word-token {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 999px;
  padding: .22rem .65rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  transition: transform .14s, border-color .14s, background .14s, color .14s;
  box-shadow: var(--shadow);
}

.word-token:hover {
  transform: translateY(-2px) scale(1.03);
  border-color: var(--border-strong);
  color: var(--text);
}

.word-token small {
  color: var(--text-4);
  font-size: .65em;
  font-weight: 900;
}

.word-1 { font-size: .72rem; opacity: .72; }
.word-2 { font-size: .86rem; opacity: .82; }
.word-3 { font-size: 1.05rem; opacity: .95; }
.word-4 { font-size: 1.32rem; font-weight: 850; }
.word-5 { font-size: 1.7rem; font-weight: 950; letter-spacing: -.04em; }

.word-token.negative {
  color: var(--neg);
  border-color: rgba(239, 68, 68, .25);
  background: var(--neg-bg);
}

.word-token.positive {
  color: var(--pos);
  border-color: rgba(34, 197, 94, .25);
  background: var(--pos-bg);
}

.word-token.neutral {
  color: var(--text-2);
}

.hot-keyword-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 74px;
  gap: .65rem;
  align-items: center;
  padding: .62rem 0;
  border-bottom: 1px solid var(--border);
}

.hot-keyword-row:last-child {
  border-bottom: 0;
}

.hot-rank {
  width: 34px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  font-weight: 900;
}

.hot-name {
  font-size: .82rem;
  font-weight: 850;
  margin-bottom: .28rem;
}

.hot-bar {
  height: 6px;
  background: var(--bg-2);
  border-radius: 999px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.hot-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.hot-keyword-row.negative .hot-fill {
  background: var(--neg);
}

.hot-keyword-row.positive .hot-fill {
  background: var(--pos);
}

.hot-meta {
  text-align: right;
}

.hot-meta b {
  display: block;
  font-size: .82rem;
}

.hot-meta span {
  display: block;
  color: var(--text-3);
  font-size: .65rem;
}

.keyword-signal-grid .card {
  min-height: 170px;
}

.keyword-chip-zone {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.keyword-chip {
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: .28rem .65rem;
  font-size: .75rem;
  font-weight: 760;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.keyword-chip b {
  color: var(--text);
  font-size: .68rem;
}

.keyword-chip.negative {
  color: var(--neg);
  background: var(--neg-bg);
  border-color: rgba(239, 68, 68, .22);
}

.keyword-chip.positive {
  color: var(--pos);
  background: var(--pos-bg);
  border-color: rgba(34, 197, 94, .22);
}

.keyword-insight {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .9rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.keyword-insight svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.keyword-insight p {
  color: var(--text-2);
  font-size: .85rem;
}

.keyword-focus-box {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: .9rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.keyword-focus-box h3 {
  font-size: 1.1rem;
  font-weight: 900;
  margin-bottom: .2rem;
}

.keyword-focus-box p {
  color: var(--text-2);
  font-size: .8rem;
}

@media (max-width: 1180px) {
  .keyword-hero {
    flex-direction: column;
  }

  .keyword-hero-metrics {
    min-width: 0;
  }

  .keyword-grid-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .keyword-hero-metrics,
  .keyword-signal-grid {
    grid-template-columns: 1fr;
  }

  .word-cloud {
    min-height: 260px;
  }

  .word-5 {
    font-size: 1.35rem;
  }

  .keyword-focus-box {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ─────────────────────────────────────────────────────────────
   Trends + Issues Intelligence Labs
───────────────────────────────────────────────────────────── */

.trend-lab,
.issue-lab {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Trends */

.trend-hero,
.issue-hero {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: center;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--text) 8%, transparent), transparent 35%),
    var(--surface);
}

.trend-hero h3,
.issue-hero h3 {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -.04em;
  margin-bottom: .3rem;
}

.trend-hero p,
.issue-hero p {
  color: var(--text-2);
  max-width: 760px;
  font-size: .86rem;
}

.trend-hero.positive {
  border-color: rgba(34,197,94,.25);
  background:
    radial-gradient(circle at top right, rgba(34,197,94,.16), transparent 35%),
    var(--surface);
}

.trend-hero.negative,
.issue-hero.critical {
  border-color: rgba(239,68,68,.28);
  background:
    radial-gradient(circle at top right, rgba(239,68,68,.16), transparent 35%),
    var(--surface);
}

.issue-hero.high {
  border-color: rgba(245,158,11,.30);
  background:
    radial-gradient(circle at top right, rgba(245,158,11,.16), transparent 35%),
    var(--surface);
}

.trend-hero-status,
.issue-hero-score {
  min-width: 150px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  padding: 1rem;
  text-align: center;
}

.trend-hero-status span,
.issue-hero-score span {
  display: block;
  color: var(--text-3);
  font-size: .68rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .055em;
}

.trend-hero-status b,
.issue-hero-score b {
  display: block;
  margin-top: .25rem;
  font-size: 2rem;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -.06em;
}

.trend-hero-status small {
  color: var(--text-4);
  font-size: .7rem;
}

.trend-hero-status.positive b { color: var(--pos); }
.trend-hero-status.negative b { color: var(--neg); }

.trend-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr);
  gap: 1rem;
}

.trend-main-chart {
  height: 360px !important;
  max-height: 360px !important;
}

.trend-chart-box {
  height: 270px !important;
  max-height: 270px !important;
}

.trend-chart-box canvas {
  height: 270px !important;
  max-height: 270px !important;
}

.trend-side-panel {
  min-height: 360px;
}

.trend-signal-grid {
  display: grid;
  gap: .7rem;
}

.trend-signal-card {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .85rem;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: .7rem;
}

.trend-signal-card svg {
  width: 20px;
  height: 20px;
}

.trend-signal-card span {
  color: var(--text-2);
  font-size: .78rem;
  font-weight: 760;
}

.trend-signal-card b {
  font-size: 1.1rem;
  font-weight: 950;
}

.trend-signal-card.positive {
  color: var(--pos);
  background: var(--pos-bg);
  border-color: rgba(34,197,94,.24);
}

.trend-signal-card.negative,
.trend-signal-card.critical {
  color: var(--neg);
  background: var(--neg-bg);
  border-color: rgba(239,68,68,.24);
}

.trend-timeline {
  display: grid;
  gap: .6rem;
}

.trend-timeline-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: .6rem;
  align-items: start;
}

.trend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: .33rem;
  background: var(--neu);
  box-shadow: 0 0 0 4px var(--neu-bg);
}

.trend-timeline-item.positive .trend-dot {
  background: var(--pos);
  box-shadow: 0 0 0 4px var(--pos-bg);
}

.trend-timeline-item.negative .trend-dot {
  background: var(--neg);
  box-shadow: 0 0 0 4px var(--neg-bg);
}

.trend-timeline-item b {
  display: block;
  font-size: .8rem;
}

.trend-timeline-item span {
  display: block;
  color: var(--text-3);
  font-size: .72rem;
}

/* Issues */

.issue-hero-score b {
  color: var(--warn);
}

.issue-radar-card {
  min-height: 430px;
}

.issue-radar-row {
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
}

.issue-radar-row:last-child {
  border-bottom: 0;
}

.issue-radar-label {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .4rem;
}

.issue-radar-label b {
  font-size: .82rem;
}

.issue-radar-label span {
  color: var(--text-3);
  font-size: .72rem;
}

.issue-radar-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-2);
}

.issue-radar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.issue-radar-row.medium .issue-radar-fill { background: var(--warn); }
.issue-radar-row.high .issue-radar-fill { background: var(--high); }
.issue-radar-row.critical .issue-radar-fill { background: var(--neg); }

.issue-insight-box {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .9rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.issue-insight-box svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.issue-insight-box p {
  color: var(--text-2);
  font-size: .86rem;
}

.issue-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
}

.issue-matrix-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem;
  background: var(--bg-2);
  display: flex;
  justify-content: space-between;
  gap: .7rem;
}

.issue-matrix-item b {
  display: block;
  font-size: .78rem;
}

.issue-matrix-item span {
  display: block;
  color: var(--text-3);
  font-size: .68rem;
}

.issue-matrix-item small {
  color: var(--text);
  font-weight: 900;
}

.issue-matrix-item.high {
  border-color: rgba(249,115,22,.24);
  background: var(--high-bg);
}

.issue-matrix-item.critical {
  border-color: rgba(239,68,68,.24);
  background: var(--neg-bg);
}

.issue-command-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.issue-command-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: .85rem;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: .75rem;
  position: relative;
  overflow: hidden;
}

.issue-command-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--text-4);
}

.issue-command-card.medium::before { background: var(--warn); }
.issue-command-card.high::before { background: var(--high); }
.issue-command-card.critical::before { background: var(--neg); }

.issue-command-rank {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 950;
  font-size: .75rem;
}

.issue-command-main h4 {
  font-size: .9rem;
  font-weight: 900;
  margin-bottom: .15rem;
}

.issue-command-main p {
  color: var(--text-3);
  font-size: .72rem;
}

.issue-severity-mini {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .5rem;
}

.issue-severity-mini span {
  font-size: .62rem;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .12rem .42rem;
}

.issue-command-action {
  grid-column: 2;
  color: var(--text-2);
  font-size: .74rem;
  margin-top: .3rem;
}

@media (max-width: 1180px) {
  .trend-hero,
  .issue-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .trend-dashboard-grid,
  .issue-command-board {
    grid-template-columns: 1fr;
  }

  .trend-hero-status,
  .issue-hero-score {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .issue-matrix {
    grid-template-columns: 1fr;
  }

  .issue-radar-label {
    flex-direction: column;
    gap: .1rem;
  }
}

/* ─────────────────────────────────────────────────────────────
   University Mood Intelligence Lab
───────────────────────────────────────────────────────────── */

.mood-lab {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mood-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--text) 8%, transparent), transparent 34%),
    var(--surface);
}

.mood-hero h3 {
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: -.045em;
  margin-bottom: .25rem;
}

.mood-hero p {
  max-width: 760px;
  color: var(--text-2);
  font-size: .86rem;
}

.mood-hero.positive {
  border-color: rgba(34,197,94,.25);
  background:
    radial-gradient(circle at top right, rgba(34,197,94,.16), transparent 36%),
    var(--surface);
}

.mood-hero.warning {
  border-color: rgba(245,158,11,.28);
  background:
    radial-gradient(circle at top right, rgba(245,158,11,.16), transparent 36%),
    var(--surface);
}

.mood-hero.critical {
  border-color: rgba(239,68,68,.28);
  background:
    radial-gradient(circle at top right, rgba(239,68,68,.16), transparent 36%),
    var(--surface);
}

.mood-orb {
  width: 132px;
  height: 132px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 9px color-mix(in srgb, var(--text) 5%, transparent);
  flex-shrink: 0;
}

.mood-orb span {
  font-size: 2.35rem;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -.06em;
}

.mood-orb small {
  margin-top: .25rem;
  color: var(--text-3);
  font-size: .65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.mood-orb.positive {
  color: var(--pos);
  box-shadow: inset 0 0 0 9px var(--pos-bg);
}

.mood-orb.warning {
  color: var(--warn);
  box-shadow: inset 0 0 0 9px var(--warn-bg);
}

.mood-orb.critical {
  color: var(--neg);
  box-shadow: inset 0 0 0 9px var(--neg-bg);
}

.mood-command-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
}

.mood-command-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  box-shadow: var(--shadow);
}

.mood-command-card.positive {
  border-color: rgba(34,197,94,.24);
  background: var(--pos-bg);
}

.mood-command-card.negative,
.mood-command-card.critical {
  border-color: rgba(239,68,68,.24);
  background: var(--neg-bg);
}

.mood-command-card.warning {
  border-color: rgba(245,158,11,.25);
  background: var(--warn-bg);
}

.mood-command-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mood-command-icon svg {
  width: 18px;
  height: 18px;
}

.mood-command-card span {
  color: var(--text-3);
  font-size: .66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .055em;
}

.mood-command-card b {
  display: block;
  font-size: 1rem;
  font-weight: 950;
  margin-top: .1rem;
}

.mood-command-card small {
  display: block;
  color: var(--text-3);
  font-size: .7rem;
  margin-top: .05rem;
}

.mood-map-card,
.mood-insight-card {
  min-height: 390px;
}

.mood-emotion-map {
  display: grid;
  gap: .65rem;
}

.mood-emotion-row {
  display: grid;
  grid-template-columns: minmax(150px, .65fr) minmax(0, 1fr) 46px;
  gap: .75rem;
  align-items: center;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
}

.mood-emotion-row:last-child {
  border-bottom: 0;
}

.mood-emotion-name {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  column-gap: .5rem;
  align-items: center;
}

.mood-emotion-name b {
  font-size: .82rem;
}

.mood-emotion-name small {
  grid-column: 2;
  color: var(--text-3);
  font-size: .68rem;
}

.emotion-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--neu);
  box-shadow: 0 0 0 4px var(--neu-bg);
}

.mood-emotion-row.positive .emotion-dot {
  background: var(--pos);
  box-shadow: 0 0 0 4px var(--pos-bg);
}

.mood-emotion-row.negative .emotion-dot {
  background: var(--neg);
  box-shadow: 0 0 0 4px var(--neg-bg);
}

.mood-emotion-row.warning .emotion-dot {
  background: var(--warn);
  box-shadow: 0 0 0 4px var(--warn-bg);
}

.mood-emotion-bar {
  height: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.mood-emotion-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.mood-emotion-row.positive .mood-emotion-fill { background: var(--pos); }
.mood-emotion-row.negative .mood-emotion-fill { background: var(--neg); }
.mood-emotion-row.warning .mood-emotion-fill { background: var(--warn); }

.mood-emotion-count {
  text-align: right;
  font-size: .8rem;
  font-weight: 900;
}

.mood-insight-box {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
}

.mood-insight-box svg {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}

.mood-insight-box p {
  color: var(--text-2);
  font-size: .86rem;
}

.mood-insight-box.positive {
  border-color: rgba(34,197,94,.22);
  background: var(--pos-bg);
}

.mood-insight-box.warning {
  border-color: rgba(245,158,11,.24);
  background: var(--warn-bg);
}

.mood-insight-box.critical {
  border-color: rgba(239,68,68,.24);
  background: var(--neg-bg);
}

.mood-pulse-bars {
  height: 150px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: .75rem;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: .45rem;
}

.mood-pulse-item {
  flex: 1;
  min-width: 28px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mood-pulse-period {
  color: var(--text-4);
  font-size: .58rem;
  max-width: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: .35rem;
}

.mood-pulse-track {
  flex: 1;
  width: 100%;
  max-width: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  display: flex;
  align-items: end;
  overflow: hidden;
}

.mood-pulse-fill {
  width: 100%;
  background: var(--neu);
  border-radius: 999px;
}

.mood-pulse-item.positive .mood-pulse-fill { background: var(--pos); }
.mood-pulse-item.warning .mood-pulse-fill { background: var(--warn); }
.mood-pulse-item.critical .mood-pulse-fill { background: var(--neg); }

.mood-pulse-score {
  margin-top: .3rem;
  color: var(--text-3);
  font-size: .65rem;
  font-weight: 850;
}

.mood-dimension-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .75rem;
}

.mood-dimension-card {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .85rem;
}

.mood-dimension-card.positive {
  border-color: rgba(34,197,94,.22);
}

.mood-dimension-card.warning {
  border-color: rgba(245,158,11,.24);
}

.mood-dimension-card.critical {
  border-color: rgba(239,68,68,.24);
}

.mood-dimension-top {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-2);
  font-size: .74rem;
  font-weight: 850;
}

.mood-dimension-top svg {
  width: 17px;
  height: 17px;
}

.mood-dimension-score {
  margin-top: .7rem;
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -.05em;
}

.mood-dimension-track {
  margin-top: .65rem;
  height: 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
}

.mood-dimension-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.mood-dimension-card.positive .mood-dimension-fill { background: var(--pos); }
.mood-dimension-card.warning .mood-dimension-fill { background: var(--warn); }
.mood-dimension-card.critical .mood-dimension-fill { background: var(--neg); }

@media (max-width: 1180px) {
  .mood-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .mood-orb {
    width: 100%;
    height: 108px;
    border-radius: var(--radius-lg);
  }

  .mood-command-grid,
  .mood-dimension-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .mood-command-grid,
  .mood-dimension-grid {
    grid-template-columns: 1fr;
  }

  .mood-emotion-row {
    grid-template-columns: 1fr;
    gap: .35rem;
  }

  .mood-emotion-count {
    text-align: left;
  }
}

/* ─────────────────────────────────────────────────────────────
   Overview / Main Command Center — Palantir-like Showcase
───────────────────────────────────────────────────────────── */

.overview-command-center {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.overview-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--text) 8%, transparent), transparent 36%),
    var(--surface);
}

.overview-hero h3 {
  font-size: 1.45rem;
  font-weight: 950;
  letter-spacing: -.05em;
  margin-bottom: .25rem;
}

.overview-hero p {
  max-width: 820px;
  color: var(--text-2);
  font-size: .88rem;
}

.overview-hero.positive {
  border-color: rgba(34,197,94,.25);
  background:
    radial-gradient(circle at top right, rgba(34,197,94,.16), transparent 36%),
    var(--surface);
}

.overview-hero.warning {
  border-color: rgba(245,158,11,.28);
  background:
    radial-gradient(circle at top right, rgba(245,158,11,.16), transparent 36%),
    var(--surface);
}

.overview-hero.critical {
  border-color: rgba(239,68,68,.28);
  background:
    radial-gradient(circle at top right, rgba(239,68,68,.16), transparent 36%),
    var(--surface);
}

.overview-main-orb,
.overview-health-orb {
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 9px color-mix(in srgb, var(--text) 5%, transparent);
  flex-shrink: 0;
}

.overview-main-orb {
  width: 132px;
  height: 132px;
}

.overview-health-orb {
  width: 150px;
  height: 150px;
}

.overview-main-orb span,
.overview-health-orb span {
  font-size: 2.35rem;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -.06em;
}

.overview-main-orb small,
.overview-health-orb small {
  margin-top: .25rem;
  color: var(--text-3);
  font-size: .65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.overview-main-orb.positive,
.overview-health-orb.positive {
  color: var(--pos);
  box-shadow: inset 0 0 0 9px var(--pos-bg);
}

.overview-main-orb.warning,
.overview-health-orb.warning {
  color: var(--warn);
  box-shadow: inset 0 0 0 9px var(--warn-bg);
}

.overview-main-orb.critical,
.overview-health-orb.critical {
  color: var(--neg);
  box-shadow: inset 0 0 0 9px var(--neg-bg);
}

.overview-command-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .75rem;
}

.overview-command-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem;
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  box-shadow: var(--shadow);
  /* min-height: 104px; */
}

.overview-command-card.positive {
  border-color: rgba(34,197,94,.24);
  background: var(--pos-bg);
}

.overview-command-card.warning {
  border-color: rgba(245,158,11,.25);
  background: var(--warn-bg);
}

.overview-command-card.critical {
  border-color: rgba(239,68,68,.24);
  background: var(--neg-bg);
}

.overview-command-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.overview-command-icon svg {
  width: 17px;
  height: 17px;
}

.overview-command-card span {
  display: block;
  color: var(--text-3);
  font-size: .62rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .055em;
}

.overview-command-card b {
  display: block;
  margin-top: .12rem;
  font-size: 1.05rem;
  line-height: 1.08;
  font-weight: 950;
  letter-spacing: -.035em;
  word-break: break-word;
}

.overview-command-card small {
  display: block;
  margin-top: .2rem;
  color: var(--text-3);
  font-size: .68rem;
}

.overview-grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
  gap: 1rem;
}

.overview-map-card,
.overview-mission-card {
  min-height: 330px;
}

.overview-health-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.overview-signal-list {
  display: grid;
  gap: .75rem;
}

.overview-signal-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem;
  background: var(--bg-2);
}

.overview-signal-row.positive {
  border-color: rgba(34,197,94,.22);
}

.overview-signal-row.warning {
  border-color: rgba(245,158,11,.25);
}

.overview-signal-row.critical {
  border-color: rgba(239,68,68,.24);
}

.overview-signal-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .42rem;
}

.overview-signal-top span {
  color: var(--text-2);
  font-size: .76rem;
  font-weight: 760;
}

.overview-signal-top b {
  font-weight: 950;
}

.overview-signal-track {
  height: 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}

.overview-signal-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.overview-signal-row.positive .overview-signal-fill { background: var(--pos); }
.overview-signal-row.warning .overview-signal-fill { background: var(--warn); }
.overview-signal-row.critical .overview-signal-fill { background: var(--neg); }

.mission-list {
  display: grid;
  gap: .65rem;
}

.mission-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .78rem;
  background: var(--bg-2);
}

.mission-item.positive {
  border-color: rgba(34,197,94,.22);
}

.mission-item.warning {
  border-color: rgba(245,158,11,.25);
}

.mission-item.critical {
  border-color: rgba(239,68,68,.24);
}

.mission-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mission-icon svg {
  width: 17px;
  height: 17px;
}

.mission-item b {
  font-size: .84rem;
  font-weight: 900;
}

.mission-item p {
  color: var(--text-2);
  font-size: .74rem;
  margin-top: .1rem;
}

.mission-item span {
  display: inline-flex;
  margin-top: .35rem;
  color: var(--text-3);
  font-size: .66rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.overview-chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
}

.overview-mini-dist {
  display: grid;
  gap: .55rem;
}

.overview-dist-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 44px;
  gap: .65rem;
  align-items: center;
}

.overview-dist-row span {
  color: var(--text-2);
  font-size: .75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-dist-bar {
  height: 7px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.overview-dist-bar div {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.overview-dist-row b {
  text-align: right;
  font-size: .75rem;
  font-weight: 900;
}

.overview-live-feed {
  overflow: hidden;
}

.overview-live-list {
  display: grid;
  gap: .65rem;
}

.overview-live-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: .8rem;
}

.overview-live-item.high,
.overview-live-item.critical,
.overview-live-item.negative {
  border-color: rgba(239,68,68,.24);
}

.overview-live-item.positive {
  border-color: rgba(34,197,94,.22);
}

.overview-live-head {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: center;
  margin-bottom: .35rem;
}

.overview-live-head b {
  font-size: .8rem;
  font-weight: 900;
}

.overview-live-item p {
  color: var(--text-2);
  font-size: .8rem;
}

.overview-live-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .5rem;
}

.overview-live-meta span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .12rem .45rem;
  color: var(--text-3);
  font-size: .64rem;
  font-weight: 760;
}

.overview-exec-box {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
}

.overview-exec-box svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.overview-exec-box p {
  color: var(--text-2);
  font-size: .86rem;
}

.overview-exec-box.positive {
  border-color: rgba(34,197,94,.22);
  background: var(--pos-bg);
}

.overview-exec-box.warning {
  border-color: rgba(245,158,11,.24);
  background: var(--warn-bg);
}

.overview-exec-box.critical {
  border-color: rgba(239,68,68,.24);
  background: var(--neg-bg);
}

@media (max-width: 1320px) {
  .overview-command-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .overview-chart-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 1020px) {
  .overview-hero,
  .overview-grid-main {
    grid-template-columns: 1fr;
  }

  .overview-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .overview-main-orb {
    width: 100%;
    height: 104px;
    border-radius: var(--radius-lg);
  }

  .overview-health-layout {
    grid-template-columns: 1fr;
  }

  .overview-health-orb {
    width: 100%;
    height: 110px;
    border-radius: var(--radius-lg);
  }

  .overview-grid-main,
  .overview-chart-grid {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .overview-command-grid {
    grid-template-columns: 1fr;
  }

  .overview-dist-row {
    grid-template-columns: 1fr;
    gap: .25rem;
  }

  .overview-dist-row b {
    text-align: left;
  }
}

/* ─────────────────────────────────────────────────────────────
   Batch Operations Center — Dataset Ingestion + AI Batch
───────────────────────────────────────────────────────────── */

.batch-lab {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.batch-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--text) 8%, transparent), transparent 36%),
    var(--surface);
}

.batch-hero h3 {
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: -.045em;
  margin-bottom: .25rem;
}

.batch-hero p {
  max-width: 820px;
  color: var(--text-2);
  font-size: .86rem;
}

.batch-pipeline {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-shrink: 0;
}

.batch-pipeline-node {
  min-width: 82px;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  font-size: .7rem;
  font-weight: 850;
}

.batch-pipeline-node svg {
  width: 14px;
  height: 14px;
}

.batch-pipeline-node.active {
  color: var(--text);
  border-color: var(--border-strong);
}

.batch-pipeline-line {
  width: 28px;
  height: 1px;
  background: var(--border-strong);
}

.batch-main-grid {
  display: grid;
  grid-template-columns: minmax(360px, .8fr) minmax(0, 1.2fr);
  gap: 1rem;
  align-items: stretch;
}

.batch-upload-card,
.batch-status-card {
  min-height: 430px;
}

.batch-dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  background:
    radial-gradient(circle at top, color-mix(in srgb, var(--text) 7%, transparent), transparent 40%),
    var(--bg-2);
  transition: border-color .16s, background .16s, transform .16s;
}

.batch-dropzone.dragging {
  border-color: var(--accent);
  transform: scale(1.01);
}

.batch-drop-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .75rem;
}

.batch-drop-icon svg {
  width: 24px;
  height: 24px;
}

.batch-dropzone h4 {
  font-size: .98rem;
  font-weight: 900;
  margin-bottom: .25rem;
}

.batch-dropzone p {
  color: var(--text-2);
  font-size: .8rem;
  max-width: 440px;
  margin: 0 auto .85rem;
}

.batch-options-grid {
  display: grid;
  gap: .45rem;
}

.batch-check {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--text-2);
  font-size: .78rem;
}

.batch-idle,
.batch-processing {
  min-height: 330px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: left;
}

.batch-idle {
  flex-direction: column;
  text-align: center;
  color: var(--text-3);
}

.batch-idle svg {
  width: 42px;
  height: 42px;
}

.batch-idle h4,
.batch-processing h4 {
  font-size: 1rem;
  font-weight: 900;
  color: var(--text);
}

.batch-idle p,
.batch-processing p {
  color: var(--text-2);
  font-size: .82rem;
  max-width: 520px;
}

.batch-intel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.batch-schema-score,
.batch-intel-score {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .95rem;
  background: var(--bg-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.batch-schema-score span,
.batch-intel-score span {
  color: var(--text-3);
  font-size: .66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .055em;
}

.batch-schema-score b,
.batch-intel-score b {
  display: block;
  margin-top: .1rem;
  font-size: 2rem;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -.06em;
}

.batch-schema-score small,
.batch-intel-score small {
  display: block;
  margin-top: .25rem;
  color: var(--text-3);
  font-size: .72rem;
}

.batch-schema-score svg,
.batch-intel-score svg {
  width: 34px;
  height: 34px;
}

.batch-schema-score.positive,
.batch-intel-score.positive {
  border-color: rgba(34,197,94,.24);
  background: var(--pos-bg);
  color: var(--pos);
}

.batch-schema-score.warning,
.batch-intel-score.warning {
  border-color: rgba(245,158,11,.25);
  background: var(--warn-bg);
  color: var(--warn);
}

.batch-schema-score.critical,
.batch-intel-score.critical {
  border-color: rgba(239,68,68,.24);
  background: var(--neg-bg);
  color: var(--neg);
}

.batch-schema-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
}

.batch-validation-list {
  display: grid;
  gap: .45rem;
}

.batch-validation-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: .65rem;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: .55rem .65rem;
  background: var(--bg-2);
  font-size: .75rem;
}

.batch-validation-row b {
  font-weight: 950;
}

.batch-validation-row.warning {
  border-color: rgba(245,158,11,.25);
  background: var(--warn-bg);
}

.batch-validation-row.critical {
  border-color: rgba(239,68,68,.24);
  background: var(--neg-bg);
}

.batch-validation-row.positive {
  border-color: rgba(34,197,94,.24);
  background: var(--pos-bg);
}

.batch-success-card,
.batch-complete-card {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.batch-success-card svg {
  width: 54px;
  height: 54px;
  color: var(--pos);
}

.batch-success-card h4,
.batch-complete-card h4 {
  font-size: 1.1rem;
  font-weight: 950;
  margin-bottom: .25rem;
}

.batch-success-card p,
.batch-complete-card p {
  color: var(--text-2);
}

.batch-complete-orb {
  width: 104px;
  height: 104px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid rgba(34,197,94,.24);
  color: var(--pos);
  box-shadow: inset 0 0 0 8px var(--pos-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  flex-shrink: 0;
}

.batch-complete-orb span {
  font-size: 2rem;
  font-weight: 950;
  line-height: 1;
}

.batch-complete-orb small {
  color: var(--text-3);
  font-size: .65rem;
  font-weight: 900;
  text-transform: uppercase;
}

.batch-timeline {
  display: grid;
  gap: .55rem;
}

.batch-timeline-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: .65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .65rem;
  background: var(--bg-2);
}

.batch-timeline-step svg {
  width: 19px;
  height: 19px;
  margin-top: .1rem;
}

.batch-timeline-step b {
  display: block;
  font-size: .8rem;
  font-weight: 900;
}

.batch-timeline-step span {
  display: block;
  color: var(--text-3);
  font-size: .72rem;
}

.batch-timeline-step.positive {
  border-color: rgba(34,197,94,.22);
}

.batch-timeline-step.critical {
  border-color: rgba(239,68,68,.24);
}

@media (max-width: 1180px) {
  .batch-hero,
  .batch-main-grid,
  .batch-intel-grid {
    grid-template-columns: 1fr;
  }

  .batch-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .batch-pipeline {
    flex-wrap: wrap;
  }

  .batch-pipeline-line {
    display: none;
  }

  .batch-schema-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .batch-schema-grid {
    grid-template-columns: 1fr;
  }

  .batch-success-card,
  .batch-complete-card,
  .batch-processing {
    flex-direction: column;
    text-align: center;
  }
}

/* ─────────────────────────────────────────────────────────────
   Simulation Scenario Lab
───────────────────────────────────────────────────────────── */

.simulation-lab {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.simulation-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--text) 8%, transparent), transparent 36%),
    var(--surface);
}

.simulation-hero h3 {
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: -.045em;
  margin-bottom: .25rem;
}

.simulation-hero p {
  max-width: 820px;
  color: var(--text-2);
  font-size: .86rem;
}

.simulation-pipeline {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-shrink: 0;
}

.sim-pipeline-node {
  min-width: 86px;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  font-size: .7rem;
  font-weight: 850;
}

.sim-pipeline-node svg {
  width: 14px;
  height: 14px;
}

.sim-pipeline-node.active {
  color: var(--text);
  border-color: var(--border-strong);
}

.sim-pipeline-line {
  width: 28px;
  height: 1px;
  background: var(--border-strong);
}

.simulation-main-grid {
  display: grid;
  grid-template-columns: minmax(360px, .8fr) minmax(0, 1.2fr);
  gap: 1rem;
  align-items: stretch;
}

.simulation-control-card,
.simulation-result-panel > .card,
.simulation-empty,
.simulation-processing-card {
  min-height: 430px;
}

.simulation-scenario-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .55rem;
}

.sim-scenario-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text);
  padding: .75rem;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: .65rem;
  text-align: left;
  transition: transform .14s, border-color .14s, background .14s;
}

.sim-scenario-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: var(--bg-4);
}

.sim-scenario-card svg {
  width: 19px;
  height: 19px;
  margin-top: .15rem;
}

.sim-scenario-card b {
  display: block;
  font-size: .82rem;
  font-weight: 900;
}

.sim-scenario-card span {
  display: block;
  color: var(--text-3);
  font-size: .72rem;
  margin-top: .05rem;
}

.simulation-note {
  margin-top: .85rem;
  color: var(--text-3);
  font-size: .75rem;
  display: flex;
  align-items: flex-start;
  gap: .45rem;
}

.simulation-note svg {
  width: 15px;
  height: 15px;
  margin-top: .1rem;
  flex-shrink: 0;
}

.simulation-empty h3 {
  font-size: 1rem;
  margin-bottom: .35rem;
}

.simulation-empty p {
  color: var(--text-2);
}

.simulation-intel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.sim-intel-score,
.sim-analysis-score {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .95rem;
  background: var(--bg-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.sim-intel-score span,
.sim-analysis-score span {
  color: var(--text-3);
  font-size: .66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .055em;
}

.sim-intel-score b,
.sim-analysis-score b {
  display: block;
  margin-top: .1rem;
  font-size: 2rem;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -.06em;
}

.sim-intel-score small,
.sim-analysis-score small {
  display: block;
  margin-top: .25rem;
  color: var(--text-3);
  font-size: .72rem;
}

.sim-intel-score svg,
.sim-analysis-score svg {
  width: 34px;
  height: 34px;
}

.sim-intel-score.positive,
.sim-analysis-score.positive {
  border-color: rgba(34,197,94,.24);
  background: var(--pos-bg);
  color: var(--pos);
}

.sim-analysis-score.warning {
  border-color: rgba(245,158,11,.25);
  background: var(--warn-bg);
  color: var(--warn);
}

.sim-analysis-score.critical {
  border-color: rgba(239,68,68,.24);
  background: var(--neg-bg);
  color: var(--neg);
}

.sim-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
}

.sim-mini-block {
  display: grid;
  gap: .55rem;
}

.sim-mini-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 32px;
  gap: .55rem;
  align-items: center;
}

.sim-mini-row span {
  color: var(--text-2);
  font-size: .72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sim-mini-track {
  height: 7px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.sim-mini-track div {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.sim-mini-row b {
  text-align: right;
  font-size: .72rem;
  font-weight: 900;
}

.sim-language-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem;
}

.sim-language-pill {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: .65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sim-language-pill span {
  color: var(--text-3);
  font-size: .68rem;
  font-weight: 900;
}

.sim-language-pill b {
  font-size: 1rem;
  font-weight: 950;
}

.simulation-processing-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.simulation-processing-card h3 {
  font-size: 1.1rem;
  font-weight: 950;
  margin-bottom: .25rem;
}

.simulation-processing-card p {
  color: var(--text-2);
  max-width: 520px;
}

.simulation-ready-card,
.simulation-complete-card {
  min-height: 430px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--text) 8%, transparent), transparent 38%),
    var(--surface);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.simulation-complete-card.positive {
  border-color: rgba(34,197,94,.24);
  background:
    radial-gradient(circle at top right, rgba(34,197,94,.16), transparent 38%),
    var(--surface);
}

.simulation-complete-card.warning {
  border-color: rgba(245,158,11,.25);
  background:
    radial-gradient(circle at top right, rgba(245,158,11,.16), transparent 38%),
    var(--surface);
}

.simulation-complete-card.critical {
  border-color: rgba(239,68,68,.24);
  background:
    radial-gradient(circle at top right, rgba(239,68,68,.16), transparent 38%),
    var(--surface);
}

.simulation-ready-orb,
.simulation-complete-orb {
  width: 112px;
  height: 112px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid rgba(34,197,94,.24);
  color: var(--pos);
  box-shadow: inset 0 0 0 8px var(--pos-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  flex-shrink: 0;
}

.simulation-ready-orb span,
.simulation-complete-orb span {
  font-size: 2.15rem;
  font-weight: 950;
  line-height: 1;
}

.simulation-ready-orb small,
.simulation-complete-orb small {
  color: var(--text-3);
  font-size: .65rem;
  font-weight: 900;
  text-transform: uppercase;
}

.simulation-ready-card h3,
.simulation-complete-card h3 {
  font-size: 1.15rem;
  font-weight: 950;
  margin-bottom: .25rem;
}

.simulation-ready-card p,
.simulation-complete-card p {
  color: var(--text-2);
  max-width: 560px;
}

.simulation-preview-card {
  overflow: hidden;
}

.sim-feedback-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.sim-feedback-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: .8rem;
}

.sim-feedback-card.positive {
  border-color: rgba(34,197,94,.22);
}

.sim-feedback-card.negative {
  border-color: rgba(239,68,68,.22);
}

.sim-feedback-head {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .45rem;
}

.sim-feedback-head b {
  font-size: .78rem;
  font-weight: 900;
}

.sim-feedback-head span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .12rem .45rem;
  color: var(--text-2);
  font-size: .66rem;
  font-weight: 850;
}

.sim-feedback-card p {
  color: var(--text-2);
  font-size: .8rem;
}

.sim-feedback-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .55rem;
}

.sim-feedback-meta span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .1rem .42rem;
  color: var(--text-3);
  font-size: .62rem;
  font-weight: 760;
}

@media (max-width: 1180px) {
  .simulation-hero,
  .simulation-main-grid,
  .simulation-intel-grid {
    grid-template-columns: 1fr;
  }

  .simulation-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .simulation-pipeline {
    flex-wrap: wrap;
  }

  .sim-pipeline-line {
    display: none;
  }

  .sim-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .simulation-ready-card,
  .simulation-complete-card,
  .simulation-processing-card {
    flex-direction: column;
    text-align: center;
  }

  .sim-kpi-grid,
  .sim-language-strip,
  .sim-feedback-grid {
    grid-template-columns: 1fr;
  }

  .sim-mini-row {
    grid-template-columns: 1fr;
    gap: .25rem;
  }

  .sim-mini-row b {
    text-align: left;
  }
}

/* ─────────────────────────────────────────────────────────────
   Integration Command Center
───────────────────────────────────────────────────────────── */

.integration-lab {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.integration-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--text) 8%, transparent), transparent 36%),
    var(--surface);
}

.integration-hero h3 {
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: -.045em;
  margin-bottom: .25rem;
}

.integration-hero p {
  max-width: 820px;
  color: var(--text-2);
  font-size: .86rem;
}

.integration-pipeline {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-shrink: 0;
}

.integration-node {
  min-width: 84px;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  font-size: .7rem;
  font-weight: 850;
}

.integration-node svg {
  width: 14px;
  height: 14px;
}

.integration-node.active {
  color: var(--text);
  border-color: var(--border-strong);
}

.integration-line {
  width: 28px;
  height: 1px;
  background: var(--border-strong);
}

.integration-grid-main {
  display: grid;
  grid-template-columns: minmax(360px, .8fr) minmax(0, 1.2fr);
  gap: 1rem;
}

.integration-control-card,
.integration-status-card {
  min-height: 380px;
}

.integration-token-panel {
  margin-top: 1rem;
}

.integration-token-box {
  border: 1px solid rgba(34,197,94,.24);
  background: var(--pos-bg);
  border-radius: var(--radius);
  padding: .85rem;
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  align-items: flex-start;
}

.integration-token-box code {
  display: block;
  word-break: break-all;
  color: var(--text);
  font-size: .78rem;
  margin-bottom: .45rem;
}

.integration-token-box p {
  color: var(--text-2);
  font-size: .75rem;
}

.integration-idle,
.integration-processing {
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.integration-idle {
  flex-direction: column;
  text-align: center;
  color: var(--text-3);
}

.integration-idle svg {
  width: 42px;
  height: 42px;
}

.integration-idle h4,
.integration-processing h4 {
  color: var(--text);
  font-size: 1rem;
  font-weight: 900;
}

.integration-idle p,
.integration-processing p {
  color: var(--text-2);
  font-size: .82rem;
}

.integration-status-score {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .95rem;
  background: var(--bg-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.integration-status-score.positive {
  border-color: rgba(34,197,94,.24);
  background: var(--pos-bg);
  color: var(--pos);
}

.integration-status-score span {
  color: var(--text-3);
  font-size: .66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .055em;
}

.integration-status-score b {
  display: block;
  margin-top: .1rem;
  font-size: 1.4rem;
  line-height: 1;
  font-weight: 950;
}

.integration-status-score small {
  display: block;
  margin-top: .25rem;
  color: var(--text-3);
  font-size: .72rem;
}

.integration-status-score svg {
  width: 34px;
  height: 34px;
}

.integration-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}

.integration-list {
  display: grid;
  gap: .5rem;
}

.integration-list-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: .65rem;
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  align-items: center;
}

.integration-list-row b {
  display: block;
  font-size: .82rem;
}

.integration-list-row span {
  display: block;
  color: var(--text-3);
  font-size: .72rem;
}

.integration-list-row small {
  color: var(--text-2);
  font-weight: 850;
}

.integration-code {
  max-height: 340px;
}

.integration-security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.integration-security-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: .85rem;
}

.integration-security-card.positive {
  border-color: rgba(34,197,94,.22);
  background: var(--pos-bg);
}

.integration-security-card.warning {
  border-color: rgba(245,158,11,.24);
  background: var(--warn-bg);
}

.integration-security-card svg {
  width: 22px;
  height: 22px;
  margin-bottom: .6rem;
}

.integration-security-card b {
  display: block;
  font-size: .85rem;
  font-weight: 900;
}

.integration-security-card span {
  display: block;
  margin-top: .15rem;
  color: var(--text-3);
  font-size: .72rem;
}

.integration-result-success {
  border: 1px solid rgba(34,197,94,.24);
  background: var(--pos-bg);
  border-radius: var(--radius);
  padding: .9rem;
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}

.integration-result-success svg {
  width: 28px;
  height: 28px;
  color: var(--pos);
  flex-shrink: 0;
}

.integration-result-success h4 {
  font-size: .95rem;
  font-weight: 900;
  margin-bottom: .25rem;
}

.integration-result-success p {
  color: var(--text-2);
  font-size: .78rem;
}

@media (max-width: 1180px) {
  .integration-hero,
  .integration-grid-main {
    grid-template-columns: 1fr;
  }

  .integration-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .integration-pipeline {
    flex-wrap: wrap;
  }

  .integration-line {
    display: none;
  }
}

@media (max-width: 720px) {
  .integration-kpi-grid,
  .integration-security-grid {
    grid-template-columns: 1fr;
  }

  .integration-token-box,
  .integration-result-success,
  .integration-processing {
    flex-direction: column;
  }
}

.palantir-brand {
  align-items: flex-start;
}

.brand-mark-domain {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.35), transparent 28%),
    linear-gradient(135deg, #09090b, #27272a);
  color: #fff;
  border: 1px solid var(--border-strong);
  box-shadow:
    0 10px 30px rgba(0,0,0,.18),
    inset 0 0 0 1px rgba(255,255,255,.08);
  font-size: .95rem;
  letter-spacing: -.05em;
}

.brand-copy {
  min-width: 0;
}

#app-title {
  font-size: .86rem;
  font-weight: 900;
  letter-spacing: -.035em;
  line-height: 1.1;
}

.brand-domain {
  margin-top: .12rem;
  font-size: .72rem;
  font-weight: 800;
  color: var(--text);
  opacity: .88;
  letter-spacing: .02em;
}

.version {
  margin-top: .18rem;
  color: var(--text-3);
  font-size: .66rem;
  line-height: 1.25;
}

.brand-status-row {
  margin-top: .9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.ai-badge-online {
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  padding: .28rem .58rem;
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 850;
  color: #16a34a;
  background: rgba(34,197,94,.10);
  border: 1px solid rgba(34,197,94,.28);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94,.55);
  animation: pulseOnline 1.45s infinite;
}

@keyframes pulseOnline {
  70% {
    box-shadow: 0 0 0 7px rgba(34,197,94,0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34,197,94,0);
  }
}

.brand-about-btn {
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-2);
  border-radius: 999px;
  padding: .24rem .55rem;
  font-size: .65rem;
  font-weight: 800;
}

.brand-about-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-4);
}

/* ── Settings: command-center polish ───────────────────────── */

#nav-settings {
  margin-top: .35rem;
  border: 1px solid transparent;
  overflow: hidden;
}

#nav-settings::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.14), transparent);
  transform: translateX(-120%);
  opacity: 0;
}

#nav-settings:hover::after {
  opacity: 1;
  animation: navScan 1.15s ease-out;
}

#nav-settings.active {
  color: var(--text);
  background:
    radial-gradient(circle at 12% 50%, rgba(255,255,255,.16), transparent 30%),
    linear-gradient(90deg, rgba(255,255,255,.13), rgba(255,255,255,.035));
  border-color: var(--border-strong);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.05),
    0 10px 28px rgba(0,0,0,.22);
}

#nav-settings.active svg {
  animation: settingsSpinGlow 3.4s linear infinite;
}

@keyframes navScan {
  to {
    transform: translateX(120%);
  }
}

@keyframes settingsSpinGlow {
  0% {
    transform: rotate(0deg);
    filter: drop-shadow(0 0 0 rgba(255,255,255,0));
  }
  45% {
    filter: drop-shadow(0 0 6px rgba(255,255,255,.42));
  }
  100% {
    transform: rotate(360deg);
    filter: drop-shadow(0 0 0 rgba(255,255,255,0));
  }
}

.settings-page .page-header {
  border-bottom: 1px solid var(--border);
}

.settings-hero {
  background:
    radial-gradient(circle at 8% 15%, color-mix(in srgb, var(--text) 10%, transparent), transparent 26%),
    radial-gradient(circle at 90% 0%, rgba(59,130,246,.10), transparent 28%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

.settings-hero h2 {
  font-size: 1.45rem;
  font-weight: 950;
  letter-spacing: -.055em;
}

.settings-about-btn {
  min-width: 118px;
}

.settings-body {
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.035), transparent 34%),
    var(--bg);
}

.settings-command-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, minmax(130px, 1fr));
  gap: .85rem;
}

.settings-status-card,
.settings-metric-card,
.settings-panel,
.settings-danger-panel {
  position: relative;
  overflow: hidden;
}

.settings-status-card {
  min-height: 150px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1rem;
  background:
    radial-gradient(circle at 0% 0%, rgba(255,255,255,.13), transparent 32%),
    linear-gradient(135deg, var(--surface), var(--bg-3));
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

.settings-status-card::after,
.settings-metric-card::after,
.settings-panel::after,
.settings-danger-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, transparent 35%, rgba(255,255,255,.08), transparent 65%);
  transform: translateX(-120%);
  opacity: 0;
}

.settings-status-card:hover::after,
.settings-metric-card:hover::after,
.settings-panel:hover::after,
.settings-danger-panel:hover::after {
  opacity: 1;
  animation: settingsCardScan 1.2s ease-out;
}

@keyframes settingsCardScan {
  to {
    transform: translateX(120%);
  }
}

.settings-orb {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: var(--text);
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.34), transparent 30%),
    var(--bg-4);
  border: 1px solid var(--border-strong);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.05),
    0 14px 34px rgba(0,0,0,.22);
}

.settings-orb svg {
  width: 24px;
  height: 24px;
  animation: settingsPulse 1.9s ease-in-out infinite;
}

@keyframes settingsPulse {
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 8px rgba(255,255,255,.35));
  }
}

.settings-status-card h3 {
  font-size: 1.05rem;
  font-weight: 950;
  letter-spacing: -.04em;
  margin-bottom: .2rem;
}

.settings-status-card p {
  color: var(--text-2);
  font-size: .78rem;
}

.settings-live-badge {
  position: absolute;
  right: .9rem;
  top: .9rem;
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  border: 1px solid rgba(34,197,94,.28);
  color: var(--pos);
  background: var(--pos-bg);
  border-radius: 999px;
  padding: .26rem .6rem;
  font-size: .68rem;
  font-weight: 900;
}

.settings-metric-card {
  min-height: 150px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  background:
    linear-gradient(145deg, rgba(255,255,255,.035), transparent),
    var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.settings-metric-card span {
  color: var(--text-3);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.settings-metric-card b {
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 950;
  letter-spacing: -.045em;
  line-height: 1.1;
  word-break: break-word;
}

.settings-panel,
.settings-danger-panel {
  border-radius: var(--radius-lg);
  padding: 1rem;
  background:
    linear-gradient(145deg, rgba(255,255,255,.035), transparent),
    var(--surface);
  border-color: var(--border);
}

.settings-danger-panel {
  border-color: rgba(239,68,68,.20);
}

.settings-panel-icon {
  width: 22px;
  height: 22px;
  color: var(--text-3);
}

.settings-danger-panel .settings-panel-icon {
  color: var(--neg);
}

@media (max-width: 1180px) {
  .settings-command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-status-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .settings-command-grid {
    grid-template-columns: 1fr;
  }

  .settings-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-about-btn {
    width: 100%;
  }
}

.about-project-modal {
  max-width: 760px;
  overflow: hidden;
}

.about-project-modal .modal-header {
  background:
    radial-gradient(circle at top left, rgba(255,255,255,.12), transparent 34%),
    linear-gradient(135deg, var(--surface), var(--bg-3));
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.about-card {
  border: 1px solid var(--border);
  background: var(--bg-3);
  border-radius: 14px;
  padding: .9rem;
}

.about-card span {
  display: block;
  color: var(--text-3);
  font-size: .68rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .3rem;
}

.about-card b {
  color: var(--text);
  font-size: .9rem;
}

.about-project-box {
  margin-top: .85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  background:
    linear-gradient(135deg, rgba(255,255,255,.04), transparent),
    var(--bg-2);
}

.about-project-box h4 {
  margin-bottom: .35rem;
  font-size: .86rem;
}

.about-project-box p {
  color: var(--text-2);
  font-size: .8rem;
  line-height: 1.65;
}

.about-links {
  margin-top: .85rem;
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.about-links a {
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border-strong);
  background: var(--bg-4);
  border-radius: 999px;
  padding: .45rem .7rem;
  font-size: .75rem;
  font-weight: 800;
}

.about-links a:hover {
  background: var(--accent);
  color: var(--accent-text);
}

/* ─────────────────────────────────────────────────────────────
   Records / Yozuvlar — Intelligence redesign
───────────────────────────────────────────────────────────── */

.records-page .records-hero {
  background:
    radial-gradient(circle at 8% 20%, color-mix(in srgb, var(--text) 10%, transparent), transparent 30%),
    radial-gradient(circle at 95% 0%, rgba(59,130,246,.12), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

.records-page .records-hero h2 {
  font-size: 1.45rem;
  font-weight: 950;
  letter-spacing: -.055em;
}

.records-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.records-command-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .85rem;
}

.records-command-card {
  padding: .9rem;
  border-color: var(--border-strong);
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--text) 6%, transparent), transparent 26%),
    var(--surface);
}

.records-search-box {
  position: relative;
  margin-bottom: .85rem;
}

.records-search-box svg,
.records-search-box [data-lucide] {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px !important;
  height: 16px !important;
  color: var(--text-3);
  pointer-events: none;
}

.records-search-box .input {
  height: 44px;
  padding-left: 2.45rem !important;
  padding-right: .9rem !important;
  min-width: 0;
}

.records-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  gap: .7rem;
  align-items: end;
}

.records-filter-grid .field {
  margin-bottom: 0;
  min-width: 0;
}

.records-filter-grid .select {
  height: 42px;
  min-width: 0;
}

.records-clear-btn {
  height: 42px;
}

.records-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: .75rem;
}

.record-metric-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: .85rem;
  box-shadow: var(--shadow);
}

.record-metric-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 35%, rgba(255,255,255,.06), transparent 65%);
  transform: translateX(-120%);
  opacity: 0;
}

.record-metric-card:hover::after {
  opacity: 1;
  animation: recordsScan 1.1s ease-out;
}

@keyframes recordsScan {
  to { transform: translateX(120%); }
}

.record-metric-label {
  color: var(--text-3);
  font-size: .66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.record-metric-value {
  margin-top: .25rem;
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: -.05em;
}

.record-metric-sub {
  margin-top: .15rem;
  color: var(--text-3);
  font-size: .72rem;
}

.records-list {
  display: grid;
  gap: .75rem;
}

.record-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 96%, var(--text) 4%), var(--surface));
  box-shadow: var(--shadow);
  padding: .95rem;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.record-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--text) 7%, transparent), transparent 24%),
    var(--surface);
}

.record-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: .9rem;
  bottom: .9rem;
  width: 3px;
  border-radius: 999px;
  background: var(--text-4);
}

.record-card.is-positive::before { background: var(--pos); }
.record-card.is-negative::before { background: var(--neg); }
.record-card.is-neutral::before { background: var(--neu); }
.record-card.is-critical::before { background: var(--neg); }
.record-card.is-high::before { background: var(--high); }

.record-card-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
}

.record-title-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .45rem;
}

.record-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .75rem;
  font-weight: 900;
  color: var(--text);
}

.record-summary {
  color: var(--text-2);
  font-size: .84rem;
  line-height: 1.55;
  max-width: 980px;
}

.record-meta-grid {
  margin-top: .8rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: .6rem;
}

.record-meta {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .55rem .65rem;
  background: var(--bg-2);
  min-width: 0;
}

.record-meta span {
  display: block;
  color: var(--text-4);
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.record-meta b {
  display: block;
  margin-top: .15rem;
  color: var(--text-2);
  font-size: .76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-side {
  width: 170px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .5rem;
}

.record-score {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .65rem;
  background: var(--bg-2);
}

.record-score-top {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  color: var(--text-3);
  font-size: .68rem;
  font-weight: 850;
}

.record-score-bar {
  margin-top: .45rem;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-4);
}

.record-score-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.record-open-hint {
  color: var(--text-3);
  font-size: .68rem;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}

.record-open-hint svg {
  width: 13px !important;
  height: 13px !important;
}

.records-empty {
  padding: 3rem 1rem;
}

@media (max-width: 1100px) {
  .records-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .records-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .records-clear-btn {
    width: 100%;
  }

  .record-card-main {
    grid-template-columns: 1fr;
  }

  .record-side {
    width: 100%;
    align-items: stretch;
  }

  .record-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .records-metrics,
  .records-filter-grid,
  .record-meta-grid {
    grid-template-columns: 1fr;
  }

  .records-page .records-hero {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ─────────────────────────────────────────────────────────────
   Loglar — Audit Observability Console
───────────────────────────────────────────────────────────── */

.logs-page .logs-hero {
  background:
    radial-gradient(circle at 8% 20%, color-mix(in srgb, var(--text) 10%, transparent), transparent 30%),
    radial-gradient(circle at 95% 0%, rgba(245,158,11,.14), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

.logs-page .logs-hero h2 {
  font-size: 1.45rem;
  font-weight: 950;
  letter-spacing: -.055em;
}

.logs-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.logs-command-card {
  padding: .9rem;
  border-color: var(--border-strong);
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--text) 6%, transparent), transparent 26%),
    var(--surface);
}

.logs-search-box {
  position: relative;
  margin-bottom: .85rem;
}

.logs-search-box svg,
.logs-search-box [data-lucide] {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px !important;
  height: 16px !important;
  color: var(--text-3);
  pointer-events: none;
}

.logs-search-box .input {
  height: 44px;
  padding-left: 2.45rem !important;
  padding-right: .9rem !important;
  min-width: 0;
}

.logs-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  gap: .7rem;
  align-items: end;
}

.logs-filter-grid .field {
  margin-bottom: 0;
}

.logs-filter-grid .select,
.logs-clear-btn {
  height: 42px;
}

.logs-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: .75rem;
}

.log-metric-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: .85rem;
  box-shadow: var(--shadow);
}

.log-metric-card::after,
.log-event-card::after,
.logs-inspector::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 35%, rgba(255,255,255,.06), transparent 65%);
  transform: translateX(-120%);
  opacity: 0;
}

.log-metric-card:hover::after,
.log-event-card:hover::after,
.logs-inspector:hover::after {
  opacity: 1;
  animation: logsScan 1.1s ease-out;
}

@keyframes logsScan {
  to { transform: translateX(120%); }
}

.log-metric-label {
  color: var(--text-3);
  font-size: .66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.log-metric-value {
  margin-top: .25rem;
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: -.05em;
}

.log-metric-sub {
  margin-top: .15rem;
  color: var(--text-3);
  font-size: .72rem;
}

.logs-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: .85rem;
  align-items: start;
}

.logs-stream,
.logs-inspector {
  position: relative;
  overflow: hidden;
}

.logs-stream {
  min-height: 520px;
}

.logs-inspector {
  position: sticky;
  top: 68px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
}

.log-timeline {
  position: relative;
  display: grid;
  gap: .75rem;
}

.log-timeline::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--border-strong);
}

.log-event-card {
  position: relative;
  overflow: hidden;
  margin-left: 1.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: .8rem;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.log-event-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--bg-3);
}

.log-event-card::before {
  content: "";
  position: absolute;
  left: -1.52rem;
  top: 1rem;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid var(--surface);
  background: var(--info);
  box-shadow: 0 0 0 4px var(--info-bg);
}

.log-event-card.level-WARN::before {
  background: var(--warn);
  box-shadow: 0 0 0 4px var(--warn-bg);
}

.log-event-card.level-ERROR::before {
  background: var(--neg);
  box-shadow: 0 0 0 4px var(--neg-bg);
}

.log-event-top {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
  margin-bottom: .45rem;
}

.log-event-name {
  color: var(--text);
  font-size: .83rem;
  font-weight: 900;
}

.log-event-time {
  margin-left: auto;
  color: var(--text-4);
  font-size: .68rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.log-event-details {
  color: var(--text-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .72rem;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-event-meta {
  margin-top: .65rem;
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}

.log-scope-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  border-radius: 999px;
  padding: .14rem .48rem;
  font-size: .64rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.logs-compact-table {
  display: grid;
  gap: .45rem;
}

.logs-compact-row {
  display: grid;
  grid-template-columns: 160px 72px minmax(160px, 1fr) minmax(240px, 1.4fr);
  gap: .65rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-2);
  padding: .55rem .65rem;
  cursor: pointer;
}

.logs-compact-row:hover {
  background: var(--bg-3);
  border-color: var(--border-strong);
}

.logs-compact-row span,
.logs-compact-row code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logs-json-view {
  max-height: 620px;
}

.logs-inspector-empty {
  min-height: 320px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-3);
  gap: .65rem;
}

.logs-inspector-empty svg {
  width: 34px !important;
  height: 34px !important;
  color: var(--text-4);
}

.log-inspector-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
}

.log-inspector-title h3 {
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: -.035em;
}

.log-inspector-section {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .75rem;
  background: var(--bg-2);
  margin-bottom: .7rem;
}

.log-inspector-section h4 {
  color: var(--text-3);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: .45rem;
}

.log-inspector-kv {
  display: grid;
  gap: .45rem;
}

.log-inspector-kv div {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .4rem;
}

.log-inspector-kv div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.log-inspector-kv span {
  color: var(--text-3);
  font-size: .72rem;
}

.log-inspector-kv b {
  color: var(--text);
  font-size: .72rem;
  text-align: right;
  word-break: break-word;
}

@media (max-width: 1180px) {
  .logs-main-grid {
    grid-template-columns: 1fr;
  }

  .logs-inspector {
    position: relative;
    top: auto;
    max-height: none;
  }

  .logs-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .logs-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .logs-clear-btn {
    width: 100%;
  }
}

@media (max-width: 680px) {
  .logs-metrics,
  .logs-filter-grid {
    grid-template-columns: 1fr;
  }

  .logs-page .logs-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .log-event-time {
    width: 100%;
    margin-left: 0;
  }

  .logs-compact-row {
    grid-template-columns: 1fr;
  }
}

/* ── Clean custom select ───────────────────────────────────── */

.custom-select {
  position: relative;
  width: 100%;
}

.custom-select > select.select {
  display: none !important;
}

.custom-select-btn {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-2);
  color: var(--text);
  padding: 0 12px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  font-size: .82rem;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}

.custom-select-btn:hover {
  background: var(--bg-3);
  border-color: var(--border-strong);
}

.custom-select.open .custom-select-btn {
  border-color: var(--text-3);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 8%, transparent);
}

.custom-select-btn span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.custom-select-btn svg {
  width: 16px !important;
  height: 16px !important;
  color: var(--text-3);
  transition: transform .15s ease;
}

.custom-select.open .custom-select-btn svg {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  z-index: 9000;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  background: color-mix(in srgb, var(--surface) 96%, var(--text) 4%);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: .35rem;
  display: none;
}

.custom-select.open .custom-select-menu {
  display: grid;
  gap: .2rem;
}

.custom-select-option {
  border: 0;
  width: 100%;
  background: transparent;
  color: var(--text-2);
  text-align: left;
  border-radius: 10px;
  padding: .58rem .7rem;
  font-size: .8rem;
  font-weight: 650;
  cursor: pointer;
}

.custom-select-option:hover {
  background: var(--bg-4);
  color: var(--text);
}

.custom-select-option.active {
  background: var(--accent);
  color: var(--accent-text);
}

.topbar .custom-select {
  width: 76px;
}

/* ── Skeleton states ───────────────────────────────────────── */

.skeleton-card {
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
}

.skeleton-card::after,
.skeleton-line::after,
.skeleton-pill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    color-mix(in srgb, var(--text) 7%, transparent) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  animation: skeletonSweep 1.25s ease-in-out infinite;
}

.skeleton-line,
.skeleton-pill {
  position: relative;
  overflow: hidden;
  background: var(--bg-4);
}

.skeleton-line {
  height: 12px;
  border-radius: 999px;
  margin-bottom: .7rem;
}

.skeleton-pill {
  height: 26px;
  width: 90px;
  border-radius: 999px;
}

.skeleton-line.w-100 { width: 100%; }
.skeleton-line.w-85 { width: 85%; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-55 { width: 55%; }
.skeleton-line.w-35 { width: 35%; }

@keyframes skeletonSweep {
  to { transform: translateX(100%); }
}

.loading-panel {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(circle at top, color-mix(in srgb, var(--text) 7%, transparent), transparent 36%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.loading-panel-inner {
  display: grid;
  place-items: center;
  gap: .85rem;
}

.loading-title {
  font-size: .92rem;
  font-weight: 900;
  letter-spacing: -.02em;
}

.loading-subtitle {
  color: var(--text-3);
  font-size: .76rem;
  max-width: 360px;
}

.ai-loading-dots {
  display: inline-flex;
  gap: .28rem;
}

.ai-loading-dots span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--text-3);
  animation: dotPulse 1s ease-in-out infinite;
}

.ai-loading-dots span:nth-child(2) { animation-delay: .14s; }
.ai-loading-dots span:nth-child(3) { animation-delay: .28s; }

@keyframes dotPulse {
  0%, 100% { opacity: .25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

@media (max-width: 760px) {
  body.is-loading::after {
    left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner,
  .ai-spinner,
  .processing-orb,
  .progress-wrap::before,
  .progress-bar::after,
  .skeleton-card::after,
  .skeleton-line::after,
  .skeleton-pill::after,
  .ai-loading-dots span,
  body.is-loading::after {
    animation: none !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   Executive One-Page PDF Report
───────────────────────────────────────────────────────────── */

#executive-report-root {
  position: fixed;
  left: -99999px;
  top: 0;
  width: 1123px;
  height: 794px;
  background: #09090b;
  color: #fafafa;
  z-index: -1;
}

.exec-report {
  width: 1123px;
  height: 794px;
  padding: 30px;
  background:
    radial-gradient(circle at 0% 0%, rgba(59,130,246,.18), transparent 28%),
    radial-gradient(circle at 100% 0%, rgba(245,158,11,.12), transparent 25%),
    linear-gradient(135deg, #09090b, #111113);
  color: #fafafa;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

.exec-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  padding-bottom: 16px;
  margin-bottom: 18px;
}

.exec-kicker {
  color: #a1a1aa;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.exec-title {
  margin-top: 5px;
  font-size: 30px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -.06em;
}

.exec-subtitle {
  margin-top: 8px;
  color: #a1a1aa;
  font-size: 12px;
  max-width: 650px;
}

.exec-stamp {
  text-align: right;
  font-size: 11px;
  color: #a1a1aa;
}

.exec-stamp b {
  display: block;
  color: #fafafa;
  font-size: 13px;
  margin-bottom: 4px;
}

.exec-main {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 16px;
}

.exec-left,
.exec-right {
  display: grid;
  gap: 14px;
}

.exec-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.exec-card {
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.045);
  border-radius: 16px;
  padding: 13px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.exec-kpi-label {
  color: #71717a;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.exec-kpi-value {
  margin-top: 7px;
  font-size: 25px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -.05em;
}

.exec-kpi-sub {
  margin-top: 6px;
  color: #a1a1aa;
  font-size: 10px;
}

.exec-section-title {
  color: #fafafa;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: -.02em;
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.exec-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 900;
  background: rgba(255,255,255,.08);
  color: #a1a1aa;
}

.exec-badge.good {
  color: #22c55e;
  background: rgba(34,197,94,.12);
}

.exec-badge.warn {
  color: #f59e0b;
  background: rgba(245,158,11,.12);
}

.exec-badge.bad {
  color: #ef4444;
  background: rgba(239,68,68,.12);
}

.exec-summary {
  color: #d4d4d8;
  font-size: 13px;
  line-height: 1.55;
}

.exec-bars {
  display: grid;
  gap: 8px;
}

.exec-bar-row {
  display: grid;
  grid-template-columns: 115px 1fr 44px;
  gap: 9px;
  align-items: center;
  font-size: 10px;
  color: #a1a1aa;
}

.exec-bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}

.exec-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fafafa, #3b82f6);
}

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

.exec-list {
  display: grid;
  gap: 7px;
}

.exec-list-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  color: #d4d4d8;
  font-size: 11px;
  line-height: 1.35;
}

.exec-list-index {
  width: 18px;
  height: 18px;
  border-radius: 7px;
  background: rgba(255,255,255,.10);
  display: grid;
  place-items: center;
  color: #fafafa;
  font-size: 9px;
  font-weight: 900;
}

.exec-risk-box {
  border-color: rgba(239,68,68,.25);
  background:
    radial-gradient(circle at 0 0, rgba(239,68,68,.15), transparent 40%),
    rgba(255,255,255,.045);
}

.exec-mood-box {
  border-color: rgba(59,130,246,.22);
}

.exec-footer {
  margin-top: 14px;
  border-top: 1px solid rgba(255,255,255,.10);
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  color: #71717a;
  font-size: 9px;
}

@media print {
  body * {
    visibility: hidden !important;
  }

  #executive-report-root,
  #executive-report-root * {
    visibility: visible !important;
  }

  #executive-report-root {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 297mm !important;
    height: 210mm !important;
    z-index: 999999 !important;
  }

  @page {
    size: A4 landscape;
    margin: 0;
  }
}

/* ── SentPro runtime identity ─────────────────────────────── */

.sentpro-badge {
  color: var(--pos);
  background:
    radial-gradient(circle at 0 0, rgba(34,197,94,.18), transparent 42%),
    var(--pos-bg);
  border-color: rgba(34,197,94,.28);
}

.sentpro-health-card {
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 0 0, rgba(59,130,246,.12), transparent 32%),
    var(--bg-2);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.sentpro-health-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: .8rem;
  align-items: center;
  margin-bottom: 1rem;
}

.sentpro-health-head h4 {
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: -.035em;
}

.sentpro-health-head p {
  color: var(--text-3);
  font-size: .76rem;
  margin-top: .15rem;
}

.sentpro-orb-small {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 950;
  font-size: 1rem;
}

.sentpro-runtime-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
}

.sentpro-runtime-grid div {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: .7rem;
  min-width: 0;
}

.sentpro-runtime-grid span {
  display: block;
  color: var(--text-4);
  font-size: .65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.sentpro-runtime-grid b {
  display: block;
  margin-top: .2rem;
  color: var(--text);
  font-size: .78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Settings practical control surface ───────────────────── */

.settings-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: .9rem;
  align-items: start;
}

.settings-sidebar {
  position: sticky;
  top: 68px;
  padding: .55rem;
  display: grid;
  gap: .35rem;
}

.settings-tab {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  border-radius: 12px;
  padding: .7rem .75rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .8rem;
  font-weight: 800;
  text-align: left;
}

.settings-tab:hover {
  background: var(--bg-4);
  color: var(--text);
}

.settings-tab.active {
  background: var(--accent);
  color: var(--accent-text);
}

.settings-tab.danger.active {
  background: var(--neg);
  color: white;
}

.settings-tab svg {
  width: 16px !important;
  height: 16px !important;
}

.settings-section {
  display: none;
}

.settings-section.active {
  display: block;
}

.settings-codearea {
  min-height: 360px;
  font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
  font-size: .76rem;
  line-height: 1.55;
}

.settings-prompt-actions {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
}

.settings-range {
  width: 100%;
  accent-color: var(--accent);
}

.settings-switch {
  min-height: 46px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: 12px;
  padding: .65rem .75rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: .6rem;
  color: var(--text-2);
  font-size: .82rem;
  font-weight: 750;
}

.settings-switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.settings-switch:hover {
  border-color: var(--border-strong);
  background: var(--bg-3);
  color: var(--text);
}

@media (max-width: 980px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-sidebar {
    position: relative;
    top: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Settings top status row fix ───────────────────────────── */

.settings-command-grid {
  display: grid;
  grid-template-columns: 1.45fr repeat(4, minmax(150px, 1fr));
  gap: .85rem;
  align-items: stretch;
}

.settings-status-card,
.settings-metric-card {
  min-height: 128px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.settings-status-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: .85rem;
  align-items: center;
  padding: 1rem;
}

.settings-status-card h3 {
  font-size: .98rem;
  font-weight: 950;
  letter-spacing: -.035em;
  line-height: 1.1;
}

.settings-status-card p {
  margin-top: .35rem;
  max-width: 340px;
  color: var(--text-2);
  font-size: .78rem;
  line-height: 1.45;
}

.settings-orb {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}

.settings-orb svg {
  width: 24px !important;
  height: 24px !important;
}

.settings-live-badge {
  align-self: start;
  height: 30px;
  padding: 0 .7rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .7rem;
  font-weight: 900;
  color: var(--pos);
  background: var(--pos-bg);
  border: 1px solid rgba(34, 197, 94, .25);
  white-space: nowrap;
}

.settings-metric-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .65rem;
}

.settings-metric-card span {
  color: var(--text-3);
  font-size: .68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.settings-metric-card b {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 950;
  letter-spacing: -.035em;
  word-break: break-word;
}

@media (max-width: 1200px) {
  .settings-command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-status-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .settings-command-grid {
    grid-template-columns: 1fr;
  }

  .settings-status-card {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .settings-live-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* ── Compact visual elements alignment ────────────────────── */

.overview-chart-grid,
.trend-dashboard-grid {
  gap: .85rem;
}

.overview-chart-grid .card,
.trend-dashboard-grid .card {
  border-radius: 14px;
}

.overview-dist-row,
.stat-row {
  min-height: 34px;
  padding: .45rem 0;
}

.badge {
  border-radius: 8px;
  padding: .18rem .48rem;
}

.kpi-card {
  min-height: 104px;
  height: auto;
  border-radius: 14px;
  padding: .9rem;
}

.kpi-val {
  font-size: 24px;
}

.kpi-label {
  font-size: .64rem;
}

/* ─────────────────────────────────────────────────────────────
   SentPro Copilot / Admin Assistant
───────────────────────────────────────────────────────────── */

.assistant-hero {
  background:
    radial-gradient(circle at 8% 20%, color-mix(in srgb, var(--text) 10%, transparent), transparent 30%),
    radial-gradient(circle at 95% 0%, rgba(59,130,246,.14), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

.assistant-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: .9rem;
  align-items: start;
}

.assistant-chat {
  min-height: calc(100vh - 180px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.assistant-chat-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: .8rem;
}

.assistant-avatar {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  font-weight: 950;
  font-size: 1rem;
}

.assistant-messages {
  flex: 1;
  min-height: 360px;
  max-height: calc(100vh - 370px);
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--text) 4%, transparent), transparent 30%),
    var(--bg);
}

.assistant-msg {
  max-width: 82%;
  display: grid;
  gap: .35rem;
}

.assistant-msg.user {
  align-self: flex-end;
}

.assistant-msg.assistant {
  align-self: flex-start;
}

.assistant-bubble {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: .8rem .9rem;
  font-size: .84rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.assistant-msg.user .assistant-bubble {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
  border-bottom-right-radius: 6px;
}

.assistant-msg.assistant .assistant-bubble {
  background: var(--surface);
  color: var(--text-2);
  border-bottom-left-radius: 6px;
}

.assistant-msg-meta {
  color: var(--text-4);
  font-size: .65rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.assistant-msg.user .assistant-msg-meta {
  text-align: right;
}

.assistant-quick-row {
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .45rem;
  overflow-x: auto;
}

.assistant-quick-row button {
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: .42rem .65rem;
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}

.assistant-quick-row button:hover {
  background: var(--bg-4);
  color: var(--text);
}

.assistant-input-row {
  padding: 1rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: end;
  background: var(--surface);
}

.assistant-input-row .textarea {
  min-height: 54px;
  max-height: 140px;
  resize: vertical;
}

.assistant-context {
  display: grid;
  gap: .9rem;
  position: sticky;
  top: 68px;
}

.assistant-context-card {
  overflow: hidden;
}

.assistant-context-box {
  margin-top: .8rem;
  display: grid;
  gap: .55rem;
}

.assistant-context-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .7rem;
  background: var(--bg-2);
}

.assistant-context-item span {
  display: block;
  color: var(--text-4);
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.assistant-context-item b {
  display: block;
  margin-top: .15rem;
  color: var(--text);
  font-size: .9rem;
  font-weight: 950;
}

.assistant-action-list {
  margin-top: .8rem;
  display: grid;
  gap: .45rem;
}

.assistant-action-list button {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-2);
  border-radius: 12px;
  padding: .65rem .75rem;
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .78rem;
  font-weight: 800;
  text-align: left;
}

.assistant-action-list button:hover {
  background: var(--bg-4);
  color: var(--text);
  border-color: var(--border-strong);
}

.assistant-action-list svg {
  width: 16px !important;
  height: 16px !important;
}

@media (max-width: 1100px) {
  .assistant-layout {
    grid-template-columns: 1fr;
  }

  .assistant-context {
    position: relative;
    top: auto;
  }
}

@media (max-width: 680px) {
  .assistant-msg {
    max-width: 94%;
  }

  .assistant-input-row {
    grid-template-columns: 1fr;
  }
}

/* ─────────────────────────────────────────────────────────────
   S-Pilot Copilot Drawer
───────────────────────────────────────────────────────────── */

/* ── S-Pilot edge reveal button ────────────────────────────── */

.spilot-fab {
  position: fixed;
  right: 0;
  bottom: 1.35rem;
  z-index: 15000;

  width: 54px;
  height: 52px;
  padding: 0;

  border: 1px solid var(--border-strong);
  border-right: 0;
  border-radius: 50px 0 0 50px;

  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--text) 12%, transparent), transparent 42%),
    var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow-lg);

  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: .6rem;

  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;

  transition:
    width .22s cubic-bezier(.2,.8,.2,1),
    transform .18s ease,
    box-shadow .18s ease,
    background .18s ease;
}

.spilot-fab:hover {
  width: 100px;
  transform: translateX(0);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .45);
}

.spilot-fab svg {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  margin-left: 18px;
  flex-shrink: 0;
}

.spilot-fab span {
  opacity: 0;
  transform: translateX(8px);
  font-size: .82rem;
  font-weight: 950;
  letter-spacing: -.02em;
  transition: opacity .16s ease, transform .2s ease;
}

.spilot-fab:hover span {
  opacity: 1;
  transform: translateX(0);
}

.spilot-fab::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--accent-text) 14%, transparent),
    transparent
  );
  transform: translateX(-110%);
  opacity: 0;
}

.spilot-fab:hover::before {
  opacity: 1;
  animation: spilotFabShine .85s ease-out;
}

@keyframes spilotFabShine {
  to {
    transform: translateX(110%);
  }
}

@media (max-width: 640px) {
  .spilot-fab {
    bottom: 1rem;
    height: 50px;
    width: 52px;
  }

  .spilot-fab:hover {
    width: 128px;
  }

  .spilot-fab svg {
    margin-left: 17px;
  }
}

.spilot-overlay {
  position: fixed;
  inset: 0;
  z-index: 14990;
  background: rgba(0,0,0,.48);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.spilot-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.spilot-drawer {
  position: fixed;
  top: .9rem;
  right: .9rem;
  bottom: .9rem;
  width: min(520px, calc(100vw - 1.8rem));
  z-index: 15000;
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--info) 14%, transparent), transparent 32%),
    var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(calc(100% + 1.5rem));
  transition: transform .22s cubic-bezier(.2,.8,.2,1);
}

.spilot-drawer.open {
  transform: translateX(0);
}

.spilot-head {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.spilot-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}

.spilot-logo {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  font-weight: 950;
}

.spilot-title {
  font-size: .95rem;
  font-weight: 950;
  letter-spacing: -.035em;
}

.spilot-subtitle {
  margin-top: .1rem;
  color: var(--text-3);
  font-size: .72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spilot-icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-2);
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.spilot-icon-btn:hover {
  background: var(--bg-4);
  color: var(--text);
}

.spilot-icon-btn svg {
  width: 16px !important;
  height: 16px !important;
}

.spilot-status {
  height: 38px;
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  color: var(--text-3);
  font-size: .72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: .45rem;
}

.spilot-status.thinking {
  color: var(--info);
}

.spilot-status.error {
  color: var(--neg);
}

.spilot-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--text) 4%, transparent), transparent 30%),
    var(--bg);
}

.spilot-msg {
  max-width: 88%;
  display: grid;
  gap: .28rem;
}

.spilot-msg.user {
  align-self: flex-end;
}

.spilot-msg.assistant {
  align-self: flex-start;
}

.spilot-bubble {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: .8rem .9rem;
  font-size: .84rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.spilot-msg.user .spilot-bubble {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
  border-bottom-right-radius: 6px;
}

.spilot-msg.assistant .spilot-bubble {
  background: var(--surface);
  color: var(--text-2);
  border-bottom-left-radius: 6px;
}

.spilot-meta {
  color: var(--text-4);
  font-size: .65rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.spilot-msg.user .spilot-meta {
  text-align: right;
}

.spilot-actions {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  margin-top: .4rem;
}

.spilot-action {
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: .38rem .6rem;
  font-size: .72rem;
  font-weight: 850;
}

.spilot-action:hover {
  background: var(--bg-4);
  color: var(--text);
}

.spilot-thinking {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.spilot-thinking span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--text-3);
  animation: dotPulse 1s ease-in-out infinite;
}

.spilot-thinking span:nth-child(2) { animation-delay: .14s; }
.spilot-thinking span:nth-child(3) { animation-delay: .28s; }

.spilot-suggestions {
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .45rem;
  overflow-x: auto;
}

.spilot-suggestions button {
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: .42rem .65rem;
  font-size: .72rem;
  font-weight: 850;
  white-space: nowrap;
}

.spilot-suggestions button:hover {
  background: var(--bg-4);
  color: var(--text);
}

.spilot-input-wrap {
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: .65rem;
  align-items: end;
}

.spilot-input {
  min-height: 48px;
  max-height: 130px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--bg-2);
  color: var(--text);
  padding: .75rem .85rem;
  font-size: .82rem;
  outline: none;
}

.spilot-input:focus {
  border-color: var(--text-3);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 8%, transparent);
}

.spilot-send {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-text);
  display: grid;
  place-items: center;
}

.spilot-send svg {
  width: 17px !important;
  height: 17px !important;
}

@media (max-width: 620px) {
  .spilot-drawer {
    inset: .5rem;
    width: auto;
    border-radius: 18px;
  }

  .spilot-msg {
    max-width: 94%;
  }
}

body:not(.authenticated) .spilot-fab,
body:not(.authenticated) .spilot-overlay,
body:not(.authenticated) .spilot-drawer {
  display: none !important;
}

.spilot-msg.assistant[data-thinking="true"] .spilot-bubble {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .85rem 1rem;
}

.spilot-thinking {
  width: 100%;
  justify-content: center;
  color: var(--text-2);
  font-size: .82rem;
}

#overview-body > div > div.overview-grid-main > div.card.overview-map-card > div.overview-health-layout > div.overview-health-orb.positive {
  margin-left: 14px !important;
}

/* ─────────────────────────────────────────────────────────────
   Notifier / Alert Orchestration
───────────────────────────────────────────────────────────── */

.notifier-hero {
  background:
    radial-gradient(circle at 8% 20%, color-mix(in srgb, var(--warn) 16%, transparent), transparent 30%),
    radial-gradient(circle at 95% 0%, color-mix(in srgb, var(--info) 14%, transparent), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

.notifier-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.notifier-command-grid {
  display: grid;
  grid-template-columns: 1.65fr repeat(3, minmax(150px, 1fr));
  gap: .85rem;
  align-items: stretch;
}

.notifier-status-card,
.notifier-mini-card {
  min-height: 128px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.notifier-status-card {
  padding: 1rem;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: .85rem;
}

.notifier-status-card h3 {
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: -.035em;
}

.notifier-status-card p {
  margin-top: .25rem;
  color: var(--text-2);
  font-size: .78rem;
  line-height: 1.45;
}

.notifier-orb {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
}

.notifier-orb svg {
  width: 25px !important;
  height: 25px !important;
}

.notifier-live-badge {
  align-self: start;
  height: 30px;
  padding: 0 .7rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .7rem;
  font-weight: 900;
  color: var(--text-2);
  background: var(--bg-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.notifier-live-badge.active {
  color: var(--pos);
  background: var(--pos-bg);
  border-color: rgba(34,197,94,.25);
}

.notifier-live-badge.warn {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: rgba(245,158,11,.25);
}

.notifier-mini-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .65rem;
}

.notifier-mini-card span {
  color: var(--text-3);
  font-size: .68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.notifier-mini-card b {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 950;
  letter-spacing: -.035em;
}

.notifier-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: .9rem;
  align-items: start;
}

.notifier-side {
  position: sticky;
  top: 68px;
}

.notifier-panel {
  overflow: hidden;
}

.notifier-hint {
  margin-top: .35rem;
  color: var(--text-4);
  font-size: .7rem;
}

.notifier-monitor-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
}

.notifier-monitor-box > div {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: 14px;
  padding: .75rem;
}

.notifier-monitor-box span {
  display: block;
  color: var(--text-4);
  font-size: .65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.notifier-monitor-box b {
  display: block;
  margin-top: .2rem;
  color: var(--text);
  font-size: .86rem;
}

.notifier-inline-input {
  width: 58px;
  background: transparent;
  color: var(--text);
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  outline: none;
  font-weight: 900;
}

.notifier-rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
}

.notifier-rule {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: 14px;
  padding: .8rem;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: .65rem;
  cursor: pointer;
}

.notifier-rule:hover {
  background: var(--bg-3);
  border-color: var(--border-strong);
}

.notifier-rule input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  margin-top: .12rem;
}

.notifier-rule b {
  display: block;
  color: var(--text);
  font-size: .82rem;
  font-weight: 900;
}

.notifier-rule span {
  display: block;
  margin-top: .15rem;
  color: var(--text-3);
  font-size: .72rem;
  line-height: 1.4;
}

.notifier-thresholds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
}

.notifier-channel-list {
  margin-top: .85rem;
  display: grid;
  gap: .5rem;
}

.notifier-channel {
  min-height: 42px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: 12px;
  padding: .55rem .65rem;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: .55rem;
}

.notifier-channel svg {
  width: 16px !important;
  height: 16px !important;
  color: var(--text-3);
}

.notifier-channel span {
  color: var(--text-2);
  font-size: .78rem;
  font-weight: 800;
}

.notifier-channel b {
  color: var(--text-4);
  font-size: .66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.notifier-channel.active {
  border-color: rgba(34,197,94,.25);
  background: var(--pos-bg);
}

.notifier-channel.active svg,
.notifier-channel.active span,
.notifier-channel.active b {
  color: var(--pos);
}

.notifier-history {
  margin-top: .8rem;
  display: grid;
  gap: .5rem;
  max-height: 340px;
  overflow-y: auto;
}

.notifier-history-item {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: 12px;
  padding: .65rem;
}

.notifier-history-item b {
  display: block;
  color: var(--text);
  font-size: .76rem;
}

.notifier-history-item span {
  display: block;
  margin-top: .15rem;
  color: var(--text-4);
  font-size: .68rem;
}

@media (max-width: 1180px) {
  .notifier-command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notifier-status-card {
    grid-column: 1 / -1;
  }

  .notifier-layout {
    grid-template-columns: 1fr;
  }

  .notifier-side {
    position: relative;
    top: auto;
  }
}

@media (max-width: 720px) {
  .notifier-command-grid,
  .notifier-rules-grid,
  .notifier-thresholds,
  .notifier-monitor-box {
    grid-template-columns: 1fr;
  }

  .notifier-status-card {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .notifier-live-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

.btn-loading,
.btn:disabled {
  opacity: .72;
  cursor: wait !important;
  pointer-events: none;
}

.btn-loading .spinner {
  width: 15px;
  height: 15px;
}

.notifier-live-badge {
  border: 0px !important;
}

.integration-command-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 18%, transparent), transparent 38%),
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 92%, var(--accent)), var(--surface));
}

.integration-command-hero h3 {
  font-size: 1.45rem;
  font-weight: 950;
  letter-spacing: -.045em;
}

.integration-command-hero p {
  max-width: 820px;
  color: var(--text-2);
  font-size: .88rem;
}

.integration-flow {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.integration-flow-step {
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--bg-2) 82%, var(--accent));
  border-radius: 999px;
  padding: .58rem .72rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .72rem;
  font-weight: 900;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.integration-flow-step svg {
  width: 15px;
  height: 15px;
}

.integration-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
}

.integration-command-grid {
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(0, 1.1fr);
  gap: 1rem;
}

.integration-panel {
  min-height: 360px;
}

.integration-preset-card {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .85rem;
  margin-bottom: 1rem;
}

.integration-preset-title {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .35rem;
}

.integration-preset-title svg {
  width: 17px;
  height: 17px;
}

.integration-preset-card b {
  font-size: .86rem;
  font-weight: 950;
}

.integration-preset-card p {
  color: var(--text-2);
  font-size: .76rem;
}

.integration-json-input {
  min-height: 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
}

.integration-system-list,
.integration-log-list {
  display: grid;
  gap: .65rem;
}

.integration-system-row {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
}

.integration-system-row.disabled {
  opacity: .62;
}

.integration-system-main {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}

.integration-system-main b {
  display: block;
  font-size: .86rem;
  font-weight: 950;
}

.integration-system-main span {
  display: block;
  color: var(--text-3);
  font-size: .72rem;
  margin-top: .12rem;
}

.integration-system-side {
  display: grid;
  justify-items: end;
  gap: .25rem;
  min-width: 160px;
}

.integration-system-side small {
  color: var(--text-2);
  font-weight: 800;
  font-size: .7rem;
}

.integration-health-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--text-3);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--text-3) 14%, transparent);
}

.integration-health-dot.positive {
  background: var(--pos);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pos) 16%, transparent);
}

.integration-health-dot.warning {
  background: var(--warn);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 16%, transparent);
}

.integration-health-dot.danger {
  background: var(--neg);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--neg) 16%, transparent);
}

.integration-ratebar {
  width: 130px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-3);
  overflow: hidden;
  border: 1px solid var(--border);
}

.integration-ratebar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
}

.btn-xs {
  min-height: 26px;
  padding: .28rem .5rem;
  font-size: .68rem;
  border-radius: 999px;
}

.btn-danger {
  background: var(--neg-bg);
  color: var(--neg);
  border-color: color-mix(in srgb, var(--neg) 28%, transparent);
}

.integration-map-grid {
  display: grid;
  grid-template-columns: .75fr 1.25fr;
  gap: .75rem;
}

.integration-result-panel {
  margin-top: 1rem;
}

.integration-log-row {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .7rem;
  display: flex;
  justify-content: space-between;
  gap: .8rem;
}

.integration-log-row b {
  display: block;
  font-size: .82rem;
  font-weight: 950;
}

.integration-log-row span,
.integration-log-row small {
  display: block;
  color: var(--text-3);
  font-size: .7rem;
}

.integration-log-row.accepted,
.integration-log-row.test_accepted {
  border-color: color-mix(in srgb, var(--pos) 24%, var(--border));
}

.integration-log-row.partial {
  border-color: color-mix(in srgb, var(--warn) 28%, var(--border));
}

.integration-log-row.rejected,
.integration-log-row.rejected_invalid_token,
.integration-log-row.rate_limited {
  border-color: color-mix(in srgb, var(--neg) 28%, var(--border));
}

@media (max-width: 1180px) {
  .integration-command-hero,
  .integration-command-grid {
    grid-template-columns: 1fr;
  }

  .integration-command-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .integration-metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .integration-map-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .integration-metrics-row,
  .integration-command-grid {
    grid-template-columns: 1fr;
  }

  .integration-system-row,
  .integration-log-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .integration-system-side {
    justify-items: start;
    width: 100%;
  }

  .integration-ratebar {
    width: 100%;
  }
}

/* ─────────────────────────────────────────────
   Integration Command Center — UI repair patch
   ───────────────────────────────────────────── */

#page-integration .page-body,
.integration-lab {
  max-width: 100%;
  overflow-x: hidden;
}

#page-integration .card {
  min-width: 0;
}

.integration-command-grid {
  align-items: start;
}

.integration-panel {
  min-height: unset !important;
  height: auto;
  overflow: hidden;
}

.integration-command-grid > .card {
  align-self: start;
}

/* Fix ugly huge empty white panels */
.integration-mapper-panel,
.integration-result-panel,
.integration-logs-panel,
.integration-token-panel,
#integration-status-panel {
  min-height: 0;
}

/* Main JSON/code containment */
#page-integration .json-viewer,
#page-integration pre,
#page-integration code {
  max-width: 100%;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Make JSON blocks compact and professional */
#page-integration .json-viewer {
  max-height: 320px;
  font-size: .7rem;
  line-height: 1.55;
}

/* Sample payload textarea */
.integration-json-input {
  min-height: 190px !important;
  max-height: 260px;
  resize: vertical;
}

/* Mapper should not create broken giant columns */
.integration-map-grid {
  grid-template-columns: 1fr 1fr !important;
  gap: .75rem;
  min-width: 0;
}

.integration-map-grid > div {
  min-width: 0;
}

/* Result details should stay inside card */
.integration-result-panel .test-json-details {
  max-width: 100%;
}

.integration-result-panel .test-json-details .json-viewer {
  max-height: 300px;
}

/* cURL card should not stretch page */
.integration-code {
  max-height: 260px !important;
}

/* Better success result card */
.integration-result-success {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  border: 1px solid color-mix(in srgb, var(--pos) 30%, var(--border));
  background: var(--pos-bg);
  border-radius: var(--radius);
  padding: 1rem;
}

.integration-result-success svg {
  width: 28px;
  height: 28px;
  color: var(--pos);
  flex: 0 0 auto;
}

.integration-result-success h4 {
  font-size: .95rem;
  font-weight: 950;
  margin-bottom: .25rem;
}

.integration-result-success p {
  font-size: .78rem;
  color: var(--text-2);
  margin: .1rem 0;
}

/* Fix request log visual balance */
.integration-log-row {
  min-height: 58px;
  align-items: center;
}

.integration-log-row div:last-child {
  text-align: right;
}

/* Better responsive behavior */
@media (max-width: 1280px) {
  .integration-command-grid {
    grid-template-columns: 1fr !important;
  }

  .integration-map-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (min-width: 1281px) {
  .integration-command-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) !important;
  }
}

.batch-job-card {
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 12%, transparent), transparent 38%),
    var(--surface);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.batch-job-card.completed {
  border-color: color-mix(in srgb, var(--pos) 32%, var(--border));
}

.batch-job-card.partial_failed,
.batch-job-card.cancelling {
  border-color: color-mix(in srgb, var(--warn) 36%, var(--border));
}

.batch-job-card.cancelled,
.batch-job-card.failed {
  border-color: color-mix(in srgb, var(--neg) 34%, var(--border));
}

.batch-job-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.batch-job-top h4 {
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: -.03em;
}

.batch-job-top p {
  color: var(--text-2);
  font-size: .78rem;
  margin-top: .2rem;
}

.batch-job-percent {
  min-width: 92px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .75rem;
  text-align: center;
}

.batch-job-percent b {
  display: block;
  font-size: 1.25rem;
  font-weight: 950;
}

.batch-job-percent span {
  display: block;
  font-size: .7rem;
  color: var(--text-3);
  font-weight: 800;
}

.batch-job-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
}

@media (max-width: 900px) {
  .batch-job-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .batch-job-top {
    flex-direction: column;
  }

  .batch-job-percent {
    width: 100%;
  }

  .batch-job-grid {
    grid-template-columns: 1fr;
  }
}

/* ─────────────────────────────────────────────
   Schema v1.2 / outputFromAI v1 frontend patch
───────────────────────────────────────────── */

.record-card-v12 {
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 8%, transparent), transparent 38%),
    var(--surface);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 1rem;
  cursor: pointer;
  transition: border-color .15s, transform .15s, background .15s;
}

.record-card-v12:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.record-card-v12.critical {
  border-color: color-mix(in srgb, var(--neg) 36%, var(--border));
}

.record-card-v12.warning {
  border-color: color-mix(in srgb, var(--warn) 36%, var(--border));
}

.record-card-v12.positive {
  border-color: color-mix(in srgb, var(--pos) 22%, var(--border));
}

.record-main {
  min-width: 0;
}

.record-topline,
.record-id-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}

.record-id-row {
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
}

.record-id-row b {
  font-size: .92rem;
  font-weight: 950;
}

.schema-version-tag {
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-3);
  border-radius: 999px;
  padding: .14rem .45rem;
  font-size: .62rem;
  font-weight: 850;
}

.record-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .45rem;
}

.record-summary {
  color: var(--text-2);
  font-size: .84rem;
  margin: .75rem 0;
  line-height: 1.55;
}

.record-topic-strip,
.record-mini-tags,
.keyword-chip-zone {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.keyword-chip.muted {
  opacity: .65;
}

.record-confidence-ring {
  min-width: 82px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .6rem;
  text-align: center;
}

.record-confidence-ring b {
  display: block;
  font-size: 1.05rem;
  font-weight: 950;
}

.record-confidence-ring span {
  display: block;
  color: var(--text-3);
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.schema-detail-layout {
  display: grid;
  gap: 1rem;
}

.schema-hero-card {
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 12%, transparent), transparent 40%),
    var(--surface);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.schema-hero-card h3 {
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.45;
  max-width: 820px;
}

.schema-score-stack {
  display: grid;
  gap: .45rem;
  min-width: 190px;
}

.schema-pill {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .55rem .7rem;
}

.schema-pill span {
  display: block;
  color: var(--text-3);
  font-size: .64rem;
  font-weight: 850;
  text-transform: uppercase;
  margin-bottom: .1rem;
}

.schema-pill b {
  font-size: .9rem;
  font-weight: 950;
}

.schema-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
}

.schema-panel {
  min-width: 0;
}

.schema-list {
  display: grid;
  gap: .55rem;
}

.schema-list div {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .45rem;
}

.schema-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.schema-list span {
  color: var(--text-3);
  font-size: .72rem;
}

.schema-list b {
  color: var(--text);
  text-align: right;
  font-size: .76rem;
  max-width: 60%;
  word-break: break-word;
}

.schema-dimension-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}

.schema-dimension {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .7rem;
  overflow: hidden;
}

.schema-dimension div {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .5rem;
}

.schema-dimension span {
  color: var(--text-2);
  font-size: .72rem;
  font-weight: 800;
}

.schema-dimension b {
  font-size: .75rem;
  font-weight: 950;
}

.schema-dimension i {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  opacity: .9;
}

.schema-json-tabs {
  display: grid;
  gap: .65rem;
}

.schema-json-tabs details {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .75rem;
}

.schema-json-tabs summary {
  cursor: pointer;
  font-weight: 850;
  color: var(--text-2);
  margin-bottom: .5rem;
}

.compact-json {
  max-height: 360px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 1120px) {
  .record-card-v12 {
    grid-template-columns: 1fr;
  }

  .schema-hero-card {
    flex-direction: column;
  }

  .schema-score-stack {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .schema-grid-3 {
    grid-template-columns: 1fr;
  }

  .schema-dimension-grid {
    grid-template-columns: 1fr;
  }
}

.field-hint {
  display: block;
  margin-top: .25rem;
  color: var(--text-3);
  font-size: .68rem;
  line-height: 1.35;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: .45rem;
  color: var(--text-2);
  font-size: .78rem;
}

.charts-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.chart-card {
  min-width: 0;
}

.chart-host {
  min-height: 360px;
}

.fallback-bars {
  display: grid;
  gap: .6rem;
  padding-top: .5rem;
}

.fallback-bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 60px;
  gap: .75rem;
  align-items: center;
}

.fallback-bar-row span {
  font-size: .78rem;
  color: var(--text-2);
  font-weight: 700;
}

.fallback-bar-row b {
  font-size: .78rem;
  text-align: right;
  font-weight: 900;
}

.fallback-bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-3);
  overflow: hidden;
  border: 1px solid var(--border);
}

.fallback-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.trend-fallback-grid {
  display: grid;
  gap: .55rem;
}

.trend-fallback-row {
  display: flex;
  gap: .8rem;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .7rem .8rem;
  flex-wrap: wrap;
}

.dominant-emotion-list {
  display: grid;
  gap: .55rem;
}

.dominant-emotion-row {
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .75rem;
}

.dominant-emotion-row span {
  color: var(--text-2);
  font-size: .76rem;
  font-weight: 700;
}

.dominant-emotion-row b {
  font-size: .82rem;
  font-weight: 900;
}

.dominant-emotion-row small {
  color: var(--text-3);
  font-size: .72rem;
}

@media (max-width: 1100px) {
  .charts-grid-2 {
    grid-template-columns: 1fr;
  }

  .fallback-bar-row {
    grid-template-columns: 1fr;
  }
}

.charts-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.chart-card {
  min-width: 0;
}

.chart-host {
  min-height: 420px;
}

.dominant-emotion-list {
  display: grid;
  gap: .55rem;
}

.dominant-emotion-row {
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .75rem;
}

.dominant-emotion-row span {
  color: var(--text-2);
  font-size: .76rem;
  font-weight: 700;
}

.dominant-emotion-row b {
  font-size: .82rem;
  font-weight: 900;
}

.dominant-emotion-row small {
  color: var(--text-3);
  font-size: .72rem;
}

@media (max-width: 1100px) {
  .charts-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Records v1.2 cleanup */
.records-list,
#records-list {
  display: grid;
  gap: .85rem;
}

.record-card-v12 {
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 7%, transparent), transparent 36%),
    var(--surface);
  border-radius: 18px;
  padding: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 1rem;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.record-card-v12:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 10%, transparent), transparent 38%),
    var(--surface);
}

.record-card-v12.critical {
  border-color: color-mix(in srgb, var(--neg) 34%, var(--border));
}

.record-card-v12.warning {
  border-color: color-mix(in srgb, var(--warn) 34%, var(--border));
}

.record-card-v12.positive {
  border-color: color-mix(in srgb, var(--pos) 24%, var(--border));
}

.record-main,
.record-side {
  min-width: 0;
}

.record-side {
  border-left: 1px solid var(--border);
  padding-left: 1rem;
  display: grid;
  align-content: space-between;
  gap: .8rem;
}

.record-topline,
.record-id-row {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
}

.record-id-row {
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
}

.record-id-row b {
  font-size: .92rem;
  font-weight: 950;
  letter-spacing: -.02em;
}

.schema-version-tag {
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-3);
  border-radius: 999px;
  padding: .14rem .45rem;
  font-size: .62rem;
  font-weight: 850;
}

.record-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .45rem;
}

.record-summary {
  color: var(--text-2);
  font-size: .84rem;
  line-height: 1.55;
  margin: .75rem 0;
}

.record-topic-strip,
.record-mini-tags,
.keyword-chip-zone {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.record-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .6rem;
  margin-top: .85rem;
}

.record-meta {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: 12px;
  padding: .65rem;
  min-width: 0;
}

.record-meta span {
  display: block;
  color: var(--text-3);
  font-size: .63rem;
  font-weight: 850;
  text-transform: uppercase;
  margin-bottom: .15rem;
}

.record-meta b {
  display: block;
  font-size: .76rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-confidence-ring {
  min-width: 82px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: 14px;
  padding: .6rem;
  text-align: center;
}

.record-confidence-ring b {
  display: block;
  font-size: 1.05rem;
  font-weight: 950;
}

.record-confidence-ring span {
  display: block;
  color: var(--text-3);
  font-size: .62rem;
  font-weight: 850;
  text-transform: uppercase;
}

.record-score {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: 14px;
  padding: .7rem;
}

.record-score-top {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .45rem;
}

.record-score-top span {
  color: var(--text-3);
  font-size: .68rem;
  font-weight: 850;
}

.record-score-top b {
  font-size: .75rem;
  font-weight: 950;
}

.record-score-bar {
  height: 7px;
  border-radius: 999px;
  background: var(--bg-4);
  overflow: hidden;
}

.record-score-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.record-open-hint {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--text-3);
  font-size: .72rem;
  font-weight: 800;
}

/* Modal fix */
#record-modal.show {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

#record-modal .modal {
  width: min(1180px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#record-modal .modal-body {
  overflow: auto;
  padding: 1rem;
}

@media (max-width: 1150px) {
  .record-card-v12 {
    grid-template-columns: 1fr;
  }

  .record-side {
    border-left: 0;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 1rem;
  }

  .record-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .record-topline {
    flex-direction: column;
  }

  .record-meta-grid {
    grid-template-columns: 1fr;
  }
}

/* ─────────────────────────────────────────────
   Chart v1.2 polish
───────────────────────────────────────────── */

.charts-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.chart-card-v12,
.chart-card {
  min-width: 0;
  overflow: hidden;
}

.chart-host {
  width: 100%;
  min-height: 420px;
  height: 420px;
}

.chart-host-wide {
  min-height: 460px;
  height: 460px;
}

.empty-chart {
  min-height: 220px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
}

.trend-v12 {
  display: grid;
  gap: 1rem;
}

.trend-v12-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 10%, transparent), transparent 38%),
    var(--surface);
}

.trend-v12-hero h3 {
  font-size: 1.3rem;
  font-weight: 950;
  letter-spacing: -.04em;
}

.trend-v12-hero p {
  color: var(--text-2);
  font-size: .82rem;
  max-width: 720px;
  margin-top: .25rem;
}

.trend-v12-status {
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius-lg);
  padding: 1rem;
  min-width: 230px;
}

.trend-v12-status span {
  display: block;
  color: var(--text-3);
  font-size: .68rem;
  font-weight: 850;
  text-transform: uppercase;
  margin-bottom: .25rem;
}

.trend-v12-status b {
  display: block;
  font-size: 1.25rem;
  font-weight: 950;
}

.trend-v12-status small {
  color: var(--text-3);
}

.dominant-emotion-list {
  display: grid;
  gap: .55rem;
}

.dominant-emotion-row {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: .75rem;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: .75rem;
}

.dominant-emotion-row span {
  color: var(--text-2);
  font-size: .76rem;
  font-weight: 750;
}

.dominant-emotion-row b {
  font-size: .84rem;
  font-weight: 950;
}

.dominant-emotion-row small {
  color: var(--text-3);
  font-size: .72rem;
}

/* Record modal fix */
#record-modal.show {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

#record-modal .modal {
  width: min(1180px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#record-modal .modal-body {
  overflow: auto;
  padding: 1rem;
}

@media (max-width: 1100px) {
  .charts-grid-2 {
    grid-template-columns: 1fr;
  }

  .trend-v12-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .trend-v12-status {
    width: 100%;
  }

  .dominant-emotion-row {
    grid-template-columns: 1fr;
  }
}

#page-trends .chart-host {
  height: 440px;
  min-height: 440px;
}

#page-trends .chart-card {
  overflow: hidden;
}

#page-trends .js-plotly-plot,
#page-trends .plot-container,
#page-trends .svg-container {
  width: 100% !important;
}

.dominant-emotion-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: .75rem;
  align-items: center;
}

.radar-control-bar {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: center;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}

.radar-mode-group {
  display: flex;
  gap: .35rem;
}

.radar-mode-btn {
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: .32rem .62rem;
  font-size: .7rem;
  font-weight: 850;
}

.radar-mode-btn.active {
  background: var(--accent);
  color: var(--accent-text);
}

.radar-chip-zone {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .8rem;
}

.radar-chip {
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: .28rem .58rem;
  font-size: .68rem;
  font-weight: 800;
}

.radar-chip.active {
  background: var(--info-bg);
  border-color: color-mix(in srgb, var(--info) 40%, var(--border));
  color: var(--info);
}

.timeline-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}

.timeline-toolbar span {
  color: var(--text-3);
  font-size: .76rem;
  font-weight: 800;
}

.dominant-emotion-list.compact {
  max-height: 420px;
  overflow: auto;
}

.records-toolbar {
  display: grid;
  grid-template-columns: 2fr 150px 150px 140px 140px;
  gap: .65rem;
  align-items: center;
  margin-bottom: 1rem;
}

.records-count-row {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  margin-bottom: .75rem;
  color: var(--text-2);
}

.records-count-row b {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 950;
}

.records-count-row small {
  margin-left: auto;
  color: var(--text-3);
}

.records-pagination {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: 1rem;
}

@media (max-width: 1100px) {
  .records-toolbar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .records-toolbar {
    grid-template-columns: 1fr;
  }

  .records-count-row {
    flex-wrap: wrap;
  }
}