:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-3: #eef2f7;
  --border: #dbe2ec;
  --border-strong: #b9c4d3;
  --text: #111827;
  --muted: #5f6b7a;
  --faint: #8995a5;
  --primary: #d90000;
  --primary-2: #b60000;
  --primary-soft: #fff0f0;
  --success: #15803d;
  --warning: #b45309;
  --danger: #c0262d;
  --info: #2563eb;
  --sidebar: #141821;
  --sidebar-2: #202633;
  --sidebar-text: #f8fafc;
  --mono: "Roboto Mono", monospace;
  --shadow: 0 18px 42px rgba(17, 24, 39, 0.12);
}

* { box-sizing: border-box; }
html, body, #root { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.58; }
a { color: inherit; }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(390px, 500px) 1fr;
  background: #f8fafc;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px;
  background: #ffffff;
  border-right: 1px solid var(--border);
  box-shadow: 18px 0 36px rgba(17, 24, 39, 0.08);
  z-index: 1;
}

.login-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px;
  overflow: hidden;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(20, 24, 33, 0.96), rgba(65, 18, 23, 0.92)),
    linear-gradient(90deg, rgba(217, 0, 0, 0.28) 0 1px, transparent 1px 72px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 72px);
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 9% 7%;
  background: url("/kubernesis-logo.png") center / min(72vw, 760px) auto no-repeat;
  opacity: 0.08;
}

.login-visual::after {
  content: "";
  position: absolute;
  width: min(62vw, 780px);
  aspect-ratio: 1.6;
  border: 1px solid rgba(255, 255, 255, 0.16);
  transform: rotate(-8deg);
}

.login-visual-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
  padding: 0 16px;
}

.login-kicker,
.brand-caption,
.stat-label,
.nav-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-kicker {
  color: #ffb3b3;
  margin-bottom: 14px;
}

.login-quote-text {
  margin: 0 0 24px;
  max-width: 640px;
  font-size: clamp(30px, 4.4vw, 56px);
  line-height: 1.04;
  font-weight: 800;
  color: #ffffff;
}

.login-metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 560px;
}

.login-metric-strip > div {
  min-height: 82px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px);
}

.login-metric-strip strong {
  display: block;
  margin-bottom: 7px;
  font-family: var(--mono);
  font-size: 19px;
  color: #ffffff;
}

.login-metric-strip span {
  display: block;
  color: #dce4ef;
  font-size: 12px;
  line-height: 1.35;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  min-width: 0;
}

.brand-mark {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: visible;
}

.brand-logo {
  display: block;
  width: min(100%, 300px);
  height: auto;
  max-height: 84px;
  object-fit: contain;
}

.brand-caption {
  margin-bottom: 10px;
  color: var(--primary);
}

.brand-title { font-size: 18px; font-weight: 800; letter-spacing: 0; }
.brand-subtitle { color: #c7d1df; font-size: 12px; font-weight: 700; white-space: nowrap; }
.login-title { font-size: 34px; line-height: 1.12; margin: 0 0 12px; letter-spacing: 0; }
.login-copy { color: var(--muted); line-height: 1.65; margin: 0 0 30px; max-width: 420px; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  width: 272px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  box-shadow: 14px 0 28px rgba(17, 24, 39, 0.16);
}

.sidebar .brand-lockup {
  margin: 0;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.sidebar .brand-logo {
  width: 168px;
  max-height: 54px;
  filter: drop-shadow(0 8px 18px rgba(217, 0, 0, 0.2));
}

.nav { padding: 14px 10px; flex: 1; overflow: auto; }
.nav-label { color: #8995a5; padding: 12px 12px 8px; }

.nav-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c7d1df;
  padding: 0 12px;
  text-align: left;
  font-weight: 700;
}

.nav-item:hover { background: var(--sidebar-2); color: #ffffff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(217, 0, 0, 0.24), rgba(217, 0, 0, 0.08));
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--primary);
}
.nav-icon {
  width: 28px;
  min-width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: #f3b1b1;
  font-family: var(--mono);
  font-size: 11px;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e5ecf6;
  color: #1f2937;
  font-weight: 800;
  flex: 0 0 auto;
}

.avatar.dark { background: rgba(217, 0, 0, 0.18); color: #ffffff; }
.user-lines { min-width: 0; flex: 1; }
.user-name, .truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { margin-top: 2px; color: #a7b1c1; font-size: 12px; }

.main {
  margin-left: 272px;
  min-width: 0;
  width: calc(100% - 272px);
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.topbar strong { font-size: 15px; }
.page { padding: 24px 26px 36px; }
.page-title { font-size: 24px; margin: 0; letter-spacing: 0; }
.page-kicker { margin: 5px 0 0; color: var(--muted); line-height: 1.45; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
  color: var(--text);
  background: var(--panel);
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #ffffff; box-shadow: 0 10px 22px rgba(217, 0, 0, 0.18); }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn-outline { border-color: var(--border); background: var(--panel); }
.btn-outline:hover { border-color: var(--border-strong); background: var(--panel-2); }
.btn-danger { color: #ffffff; background: var(--danger); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.btn-icon { width: 34px; padding: 0; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.05);
}
.stat-value { margin-top: 8px; font-family: var(--mono); font-size: 28px; font-weight: 800; }
.stat-value.primary { color: var(--primary); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.danger { color: var(--danger); }
.stat-value.info { color: var(--info); }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.05);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-title { margin: 0; font-size: 15px; font-weight: 800; }
.panel-body { padding: 16px; }

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 8px 8px 0 0;
}
.table-tools-left, .table-tools-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-wrap { position: relative; }
.search-input {
  width: min(330px, 58vw);
  min-height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}
.search-wrap::before {
  content: "Q";
  position: absolute;
  left: 12px;
  top: 8px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
}

.input, .select, .textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 0 10px;
  outline: none;
}
.textarea { min-height: 90px; padding: 10px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus, .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(217, 0, 0, 0.11);
}

.table-scroller { overflow: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}
.data-table th, .data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.data-table th {
  font-size: 11px;
  color: #4b5563;
  background: #f8fafc;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
  vertical-align: middle;
}
.th-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.th-label { line-height: 1.2; }
.th-filter-wrap {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
}
.th-filter-wrap:hover { border-color: var(--primary); }
.th-filter-wrap.active { border-color: var(--primary); background: var(--primary-soft); }
.th-filter-arrow {
  pointer-events: none;
  font-size: 10px;
  line-height: 1;
  color: var(--muted);
  text-transform: none;
}
.th-filter-wrap.active .th-filter-arrow { color: var(--primary); }
.data-table th .table-filter {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.data-table tr.interactive { cursor: pointer; }
.data-table tbody tr:hover { background: #fff7f7; }
.table-empty {
  padding: 38px 16px;
  text-align: center;
  color: var(--muted);
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}
.pager-actions { display: flex; align-items: center; gap: 8px; }
.page-size { min-height: 32px; border-radius: 8px; border: 1px solid var(--border); background: #ffffff; color: var(--text); padding: 0 8px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-open, .badge-low { background: #e8eefb; color: #315183; }
.badge-in_progress, .badge-medium { background: #fff4d6; color: #8a5a00; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-high { background: #ffedd5; color: #9a3412; }
.badge-critical { background: #fee2e2; color: #991b1b; }
.badge-type { background: #f1f5f9; color: #42526b; border: 1px solid #e2e8f0; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #f1f5f9; color: #64748b; }
.badge-sent { background: #dcfce7; color: #166534; }
.badge-queued { background: #e8eefb; color: #315183; }
.badge-sending { background: #fff4d6; color: #8a5a00; }
.badge-retrying { background: #ffedd5; color: #9a3412; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-cancelled { background: #f1f5f9; color: #556173; }
.badge-customer { background: #eef2f7; color: #42526b; }
.badge-spoc { background: #e0f2fe; color: #075985; }
.badge-admin { background: #fee2e2; color: #991b1b; }

.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 130px;
}
.progress-track {
  height: 8px;
  flex: 1;
  background: #e8edf5;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill { height: 100%; background: var(--primary); border-radius: 999px; }
.progress-fill.done { background: var(--success); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
}
.detail-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.detail-title { margin: 0 0 8px; font-size: 24px; letter-spacing: 0; }
.detail-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.info-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
}
.info-item label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 800; margin-bottom: 5px; }
.milestone-list { display: grid; gap: 8px; }
.milestone-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}
.milestone-row.done { background: #f0fdf4; border-color: #bbf7d0; }
.check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  background: #ffffff;
}
.milestone-row.done .check { background: var(--success); color: #ffffff; border-color: var(--success); }

.chat-panel { height: calc(100vh - 128px); display: flex; flex-direction: column; }
.messages { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.message { max-width: 88%; }
.message.own { align-self: flex-end; }
.message-bubble {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  background: #ffffff;
  line-height: 1.5;
}
.message.own .message-bubble { background: #fff1f1; border-color: #ffc7c7; }
.message-meta { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.chat-composer { padding: 12px; border-top: 1px solid var(--border); background: var(--panel-2); }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.composer-file {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  padding: 7px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  font-size: 12px;
  word-break: break-all;
}
.attachment { display: block; margin-top: 8px; text-decoration: none; color: inherit; }
.attachment-image img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.attachment-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
}
.attachment-file:hover { border-color: var(--primary); background: #ffffff; }
.attachment-icon {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  color: #ffffff;
  background: var(--primary);
  border-radius: 4px;
  padding: 3px 5px;
  flex-shrink: 0;
}
.attachment-name { font-weight: 700; word-break: break-all; }
.attachment-size { color: var(--muted); margin-left: auto; flex-shrink: 0; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.54);
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal {
  width: min(680px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.modal.narrow { width: min(460px, 100%); }
.modal-header, .modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-footer { border-top: 1px solid var(--border); border-bottom: 0; justify-content: flex-end; }
.modal-title { margin: 0; font-size: 17px; letter-spacing: 0; }
.modal-body { padding: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-field > span { color: var(--muted); font-weight: 800; font-size: 12px; }
.error { padding: 10px 12px; margin-bottom: 14px; border-radius: 8px; background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.success { padding: 10px 12px; margin-bottom: 14px; border-radius: 8px; background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.warn { padding: 10px 12px; margin-bottom: 14px; border-radius: 8px; background: #fff4d6; color: #8a5a00; border: 1px solid #fde68a; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.permission-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
}
.escalation-matrix { display: flex; flex-direction: column; gap: 10px; }
.escalation-chain { display: flex; flex-direction: column; gap: 8px; }
.escalation-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  flex-wrap: wrap;
}
.escalation-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}
.escalation-name { font-weight: 700; }
.escalation-pool { border-top: 1px dashed var(--border); padding-top: 10px; }
.escalation-pool-list { display: flex; flex-wrap: wrap; gap: 8px; }
.color-row { display: flex; flex-wrap: wrap; gap: 8px; }
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid #ffffff;
  outline: 1px solid var(--border);
}
.color-swatch.selected { outline: 3px solid rgba(217, 0, 0, 0.28); }

.time-range-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.time-range-label { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.time-range-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}
.time-range-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  padding: 7px 12px;
  border-right: 1px solid var(--border);
}
.time-range-btn:last-child { border-right: 0; }
.time-range-btn:hover { background: var(--panel-2); color: var(--text); }
.time-range-btn.active { background: var(--primary); color: #ffffff; }

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.chart-panel-wide { grid-column: 1 / -1; }

.drill-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(217, 0, 0, 0.26);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--text);
  font-size: 13px;
}

.chart-empty {
  padding: 30px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.chart-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 999px;
  display: inline-block;
}

.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row {
  display: grid;
  grid-template-columns: 112px 1fr auto;
  align-items: center;
  gap: 10px;
  position: relative;
  padding: 3px 4px;
  border-radius: 6px;
}
.bar-row.clickable { cursor: pointer; }
.bar-row.clickable:hover { background: var(--panel-2); }
.bar-row.selected { background: var(--primary-soft); }
.bar-row-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text);
  min-width: 0;
}
.bar-track {
  height: 20px;
  background: var(--panel-3);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 0 4px 4px 0;
  transition: filter 0.12s ease;
}
.bar-fill.lift { filter: brightness(1.06); }
.bar-value {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.chart-tooltip {
  position: absolute;
  right: 4px;
  bottom: calc(100% + 4px);
  background: #111827;
  color: #ffffff;
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 5;
  pointer-events: none;
}

.trend-chart { position: relative; }
.trend-svg { width: 100%; height: 220px; display: block; }
.trend-gridline { stroke: var(--border); stroke-width: 1; }
.trend-baseline { stroke: var(--border-strong); stroke-width: 1; }
.trend-area { fill: rgba(217, 0, 0, 0.08); stroke: none; }
.trend-line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-crosshair { stroke: var(--border-strong); stroke-width: 1; }
.trend-dot { fill: var(--primary); stroke: #ffffff; stroke-width: 2; }
.trend-axis-label { fill: var(--muted); font-size: 10.5px; font-weight: 600; }
.trend-tooltip {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  background: #111827;
  color: #ffffff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}
.trend-tooltip strong { font-size: 13px; }
.trend-tooltip .muted { color: #cbd5e1; }

@media (max-width: 1100px) {
  .analytics-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .chat-panel { height: 620px; }
}

@media (max-width: 760px) {
  .login-page { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 30px 22px; }
  .brand-logo { width: min(100%, 250px); }
  .sidebar { position: static; width: 100%; min-height: auto; }
  .sidebar .brand-lockup { padding: 14px 16px; }
  .app-shell { flex-direction: column; }
  .main { margin-left: 0; width: 100%; }
  .nav { display: flex; overflow-x: auto; gap: 6px; padding: 10px; }
  .nav-label, .sidebar-footer, .sidebar .brand-subtitle { display: none; }
  .nav-item { white-space: nowrap; width: auto; }
  .topbar { padding: 0 14px; }
  .page { padding: 16px; }
  .page-header, .table-toolbar, .pagination { align-items: stretch; flex-direction: column; }
  .form-grid, .permission-grid, .info-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 92px 1fr auto; }
}
