/* ═══════════════════════════════════════════════════
   CUSTOM CONFIGURATION & COLOR SCHEME (from index.html)
═══════════════════════════════════════════════════ */
:root {
  --brand-primary: #1e3a5f;
  --brand-accent: #e8a020;
  --risk-high: #dc2626;
  --risk-medium: #f59e0b;
  --risk-low: #16a34a;
  --header-strip-height: 72px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f0f4f8;
  color: #334155;
}

.public-main-shell {
  min-height: 100vh;
}

.page-shell {
  position: relative;
}

.page-loading-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  z-index: 30;
  background: rgba(240, 244, 248, 0.68);
  backdrop-filter: blur(2px);
}

.page-loading-overlay.active {
  display: flex;
}

.page-loading-spinner {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 4px solid rgba(30, 58, 95, 0.22);
  border-top-color: var(--brand-primary);
  animation: page-spin 0.8s linear infinite;
}

.page-loading-text {
  font-size: 12px;
  font-weight: 600;
  color: #244566;
  letter-spacing: 0.02em;
}

@keyframes page-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.public-landing-shell {
  min-height: 100vh;
  padding: 28px;
  background:
    radial-gradient(circle at top left, rgba(232, 160, 32, 0.18), transparent 26%),
    radial-gradient(circle at right 18%, rgba(37, 99, 235, 0.14), transparent 24%),
    linear-gradient(180deg, #f7fbff 0%, #eef4fb 52%, #e8f0f8 100%);
}

.public-hero-card {
  max-width: 1380px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 28px;
  align-items: start;
}

.public-hero-copy,
.public-access-card {
  border-radius: 28px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.10);
}

.public-hero-copy {
  position: relative;
  overflow: hidden;
  padding: 42px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(245, 249, 255, 0.93));
  border: 1px solid rgba(148, 163, 184, 0.20);
}

.public-hero-copy::after {
  content: "";
  position: absolute;
  inset: auto -60px -120px auto;
  width: 240px;
  height: 240px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(232, 160, 32, 0.18), transparent 68%);
}

.public-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(30, 58, 95, 0.08);
  color: #1e3a5f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.public-hero-title {
  max-width: 11ch;
  margin: 0;
  color: #10233b;
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  line-height: 0.96;
  font-weight: 800;
}

.public-hero-subtitle {
  max-width: 30ch;
  margin: 14px 0 12px;
  color: #1f3a59;
  font-size: clamp(1.06rem, 2vw, 1.4rem);
  line-height: 1.35;
  font-weight: 600;
}

.public-hero-lead {
  max-width: 760px;
  margin: 0 0 28px;
  color: #44566c;
  font-size: 1.02rem;
  line-height: 1.7;
}

.public-trust-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}

.public-trust-badge {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(244, 248, 255, 0.88));
}

.public-trust-title {
  color: #173755;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.public-trust-copy {
  margin-top: 4px;
  color: #4a6178;
  font-size: 0.78rem;
  line-height: 1.45;
}

.public-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 24px;
}

.public-kpi-card {
  padding: 14px 14px 13px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.public-kpi-value {
  color: #0f2d4a;
  font-size: 1.16rem;
  font-weight: 800;
  line-height: 1.05;
}

.public-kpi-label {
  margin-top: 5px;
  color: #1b4268;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.public-kpi-note {
  margin-top: 6px;
  color: #5a6f86;
  font-size: 0.74rem;
  line-height: 1.35;
}

.public-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.public-feature-card,
.public-story-card,
.public-session-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(203, 213, 225, 0.70);
  backdrop-filter: blur(8px);
}

.public-feature-card {
  padding: 18px;
  border-radius: 20px;
}

.public-feature-card h2,
.public-story-card h2,
.public-access-card h2 {
  margin: 0 0 8px;
  color: #16324f;
  font-size: 1.05rem;
  font-weight: 700;
}

.public-feature-card p,
.public-story-card li,
.public-access-card p,
.public-session-card,
.public-admin-hint,
.public-form-note,
.public-status {
  color: #526173;
  font-size: 0.95rem;
  line-height: 1.6;
}

.public-story-card {
  padding: 22px;
  border-radius: 22px;
}

.public-story-card ul {
  margin: 0;
  padding-left: 20px;
}

.public-story-card li + li {
  margin-top: 10px;
}

.public-aside-stack {
  width: 100%;
  max-width: 430px;
  justify-self: stretch;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.public-access-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  padding: 18px;
  background: linear-gradient(180deg, #16324f 0%, #10263d 100%);
  color: #f8fafc;
}

.public-access-panel-card {
  width: 100%;
  max-width: 430px;
  justify-self: stretch;
  align-self: start;
}

.public-access-card.is-compact {
  min-height: 200px;
}

.public-access-card.is-authenticated {
  min-height: 220px;
  padding: 24px;
  gap: 14px;
}

.public-access-kicker {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #f2c774;
  font-weight: 700;
}

.public-access-card h2,
.public-access-card p,
.public-access-card label,
.public-session-card,
.public-admin-hint,
.public-form-note {
  color: #d9e6f2;
}

.public-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.public-form-grid-compact {
  grid-template-columns: 1fr 1fr;
}

.public-form-grid label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.84rem;
  font-weight: 600;
}

.public-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.public-input {
  width: 100%;
  border: 1px solid rgba(203, 213, 225, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.public-input:focus {
  border-color: rgba(242, 199, 116, 0.82);
  box-shadow: 0 0 0 4px rgba(242, 199, 116, 0.12);
  background: rgba(255, 255, 255, 0.14);
}

.public-action-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.public-primary-btn,
.public-secondary-btn,
.public-admin-btn {
  border: none;
  border-radius: 14px;
  padding: 13px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.public-primary-btn {
  background: linear-gradient(135deg, #f2c774 0%, #e8a020 100%);
  color: #16253a;
  box-shadow: 0 14px 28px rgba(232, 160, 32, 0.24);
}

.public-admin-btn {
  background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
  color: #15355d;
}

.public-secondary-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.public-primary-btn:hover,
.public-secondary-btn:hover,
.public-admin-btn:hover {
  transform: translateY(-1px);
}

.public-primary-btn:disabled {
  cursor: progress;
  opacity: 0.7;
}

.public-session-card {
  padding: 16px 18px;
  border-radius: 18px;
}

.public-form-note {
  margin: 0;
  font-size: 0.8rem;
}

.public-admin-hint {
  font-size: 0.84rem;
}

.public-status {
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 0.88rem;
}

.public-status.success {
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.28);
  color: #dcfce7;
}

.public-status.error {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #fee2e2;
}

.public-aside-card {
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 248, 255, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.32);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.public-aside-card h3 {
  margin: 0 0 6px;
  color: #173755;
  font-size: 0.98rem;
  font-weight: 700;
}

.public-aside-card p,
.public-aside-meta {
  margin: 0;
  color: #4f6176;
  font-size: 0.83rem;
  line-height: 1.45;
}

.public-aside-link-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.public-aside-link {
  display: block;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(255, 255, 255, 0.75);
  color: #14365a;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.public-aside-link:hover {
  background: #eff6ff;
  border-color: rgba(59, 130, 246, 0.4);
}

.public-utility-shell {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.public-utility-card {
  width: min(100%, 860px);
  padding: 32px;
  border-radius: 24px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.97), rgba(243, 248, 255, 0.93));
  border: 1px solid rgba(148, 163, 184, 0.26);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

.public-utility-card h1 {
  margin: 0 0 10px;
  color: #10233b;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
}

.public-utility-card p {
  margin: 0 0 12px;
  color: #43566d;
  line-height: 1.6;
}

.public-utility-card ul {
  margin: 0 0 18px;
  padding-left: 20px;
  color: #455b72;
}

.public-utility-card li + li {
  margin-top: 8px;
}

.topbar-user-pill {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 40px;
  padding: 7px 12px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.topbar-user-name {
  color: #123861;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.1;
}

.topbar-user-role {
  color: #4b6988;
  font-size: 0.7rem;
  line-height: 1.1;
}

/* ═══════ SIDEBAR & LAYOUT ═══════ */
.sidebar {
  width: 272px;
  height: 100vh;
  background: var(--brand-primary);
  overflow: hidden;
}

.sidebar-menu {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.app-shell {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.main-shell {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.page-shell {
  width: 100%;
}

.page-shell-inner {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
}

.app-topbar {
  min-width: 0;
}

.app-header-strip {
  min-height: var(--header-strip-height);
}

.sidebar-brand-header {
  display: flex;
  align-items: center;
}

.topbar-title-wrap {
  min-width: 0;
}

.topbar-caption-one-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  min-width: 0;
  flex-wrap: nowrap;
  gap: 10px;
}

.topbar-actions select,
.topbar-actions button,
.topbar-actions > div {
  min-height: 40px;
}

.topbar-actions button {
  padding-top: 6px;
  padding-bottom: 6px;
}

.brand-title {
  white-space: nowrap;
  line-height: 1.1;
}

.brand-subtitle {
  white-space: nowrap;
  line-height: 1.1;
}

.sidebar-item {
  transition: background 0.2s;
  font-size: 0.84rem;
  white-space: normal;
  line-height: 1.2;
}

.sidebar-item > span:first-child {
  display: inline-flex;
  width: 1.35rem;
  min-width: 1.35rem;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  line-height: 1;
}

#searchResults {
  padding-right: 4px;
}

#searchResults > div {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.sidebar-item:hover,
.sidebar-item.active {
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-section {
  padding: 8px 0;
  margin: 8px 0;
}

/* ═══════ CARD & LAYOUT ═══════ */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.card canvas {
  max-height: 220px !important;
  height: auto !important;
}

/* ═══════ CHART CONTAINER & CANVAS ═══════ */
canvas {
  display: block !important;
  height: 220px !important;
  max-height: 220px !important;
}

/* ═══════ RISK CHART CARD FILL ═══════ */
.risk-chart-card {
  display: flex;
  flex-direction: column;
}

.risk-chart-body {
  position: relative;
  min-height: 200px;
  flex: 1 1 auto;
}

.risk-chart-body-benford {
  min-height: 120px;
}

.risk-chart-canvas {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
}

#risk-anomaly .grid {
  align-items: stretch;
}

.kpi-card {
  border-left: 4px solid;
  background: white;
  border-radius: 12px;
  padding: 1rem;
}

/* ═══════ VIEW VISIBILITY ═══════ */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* ═══════ BADGES & SEVERITY ═══════ */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-high {
  background: #fee2e2;
  color: #991b1b;
}

.badge-medium {
  background: #fef3c7;
  color: #92400e;
}

.badge-low {
  background: #d1fae5;
  color: #065f46;
}

/* ═══════ RISK INDICATORS ═══════ */
.risk-bar {
  height: 8px;
  border-radius: 4px;
  background: #e5e7eb;
}

.risk-fill-high {
  background: var(--risk-high);
}

.risk-fill-medium {
  background: var(--risk-medium);
}

.risk-fill-low {
  background: var(--risk-low);
}

/* ═══════ PROGRESS BAR ═══════ */
.progress-bar {
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s;
}

/* ═══════ ALERT CARDS ═══════ */
.alert-item {
  border-left: 4px solid;
  border-radius: 8px;
  padding: 12px 14px;
}

.alert-high {
  border-color: var(--risk-high);
  background: #fff5f5;
}

.alert-medium {
  border-color: var(--risk-medium);
  background: #fffbf0;
}

.alert-low {
  border-color: var(--risk-low);
  background: #f0fdf4;
}

/* ═══════ TABLE STYLING ═══════ */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: #f8fafc;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 600;
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

tr:hover td {
  background: #f8fafc;
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ═══════ CHIP & INLINE ELEMENTS ═══════ */
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

/* ═══════ TAB BUTTONS ═══════ */
.tab-btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background: white;
  transition: all 0.2s;
  white-space: normal;
}

.tab-btn.active {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

.tab-btn:hover:not(.active) {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* ═══════ HEATMAP CELLS ═══════ */
.heatmap-cell {
  width: 48px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}

.heatmap-cell:hover {
  transform: scale(1.05);
}

/* ═══════ NETWORK NODES ═══════ */
.network-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin: 4px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
}

.network-node:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.node-vendor {
  background: #dbeafe;
  color: #1d4ed8;
}

.node-project {
  background: #ede9fe;
  color: #6d28d9;
}

.node-opd {
  background: #d1fae5;
  color: #065f46;
}

.node-risk {
  background: #fee2e2;
  color: #991b1b;
  border: 2px solid #fca5a5;
}

/* ═══════ TIMELINE ═══════ */
.timeline-item {
  position: relative;
  padding-left: 28px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-accent);
}

.timeline-item::after {
  content: '';
  position: absolute;
  left: 12px;
  top: 18px;
  width: 2px;
  height: calc(100% - 10px);
  background: #e2e8f0;
}

.timeline-item:last-child::after {
  display: none;
}

/* ═══════ MODAL DIALOG ═══════ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ═══════ CHART ACTION BUTTON ═══════ */
.chart-action-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--brand-primary);
  border-radius: 999px;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.chart-action-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.chart-action-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.chart-action-btn-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.dashboard-chart-grid {
  align-items: stretch;
}

.dashboard-chart-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.dashboard-chart-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 78px;
}

.dashboard-chart-card-title {
  min-width: 0;
}

.dashboard-chart-card-subtitle {
  margin: 0;
}

.dashboard-chart-title-one-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-chart-card-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-chart-card-body {
  position: relative;
  height: 280px;
  min-height: 0;
  flex: none;
}

.dashboard-chart-card-body canvas {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.dashboard-chart-card-legend {
  margin-top: auto;
  min-height: 72px;
}

.dashboard-chart-card-legend-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 12px;
  color: #475569;
}

.dashboard-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-legend-line {
  width: 28px;
  height: 0;
  border-top: 3px solid #1d4ed8;
  border-radius: 999px;
}

.dashboard-legend-line-dashed {
  border-top-style: dashed;
  border-top-color: #94a3b8;
}

/* ═══════ CHAT INTERFACE ═══════ */
.chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  color: #fff;
  box-shadow: 0 10px 24px rgba(30, 58, 95, 0.35);
  z-index: 45;
  cursor: pointer;
  font-size: 22px;
  transition: transform 0.2s;
}

.chat-fab:hover {
  transform: scale(1.1);
}

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  width: min(430px, calc(100vw - 24px));
  height: 560px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  z-index: 44;
  display: none;
  overflow: hidden;
  flex-direction: column;
}

.chat-panel.active {
  display: flex;
}

.chat-header {
  background: #1e3a5f;
  color: #fff;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  background: #f8fafc;
  padding: 12px;
}

.chat-msg {
  margin-bottom: 10px;
  display: flex;
}

.chat-msg.user {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: 88%;
  max-height: 180px;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-y: auto;
  overflow-wrap: break-word;
  word-break: break-word;
}

.chat-msg.user .chat-bubble {
  background: #1d4ed8;
  color: #fff;
}

.chat-msg.bot .chat-bubble {
  background: #fff;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.chat-msg.system .chat-bubble {
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
}

.chat-input-wrap {
  border-top: 1px solid #e2e8f0;
  padding: 10px;
  background: #fff;
}

.chat-context-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.chat-select {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
  padding: 7px 9px;
  background: #fff;
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
  padding: 8px 10px;
}

.chat-send-btn {
  border: none;
  border-radius: 8px;
  background: #1e3a5f;
  color: #fff;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.chat-send-btn:hover {
  background: #1a2f4f;
}

.chat-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-meta {
  font-size: 10px;
  color: #64748b;
  margin-top: 4px;
}

/* ═══════ RESPONSIVE GRIDS ═══════ */
.grid-auto {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, 1fr);
}

/* ═══════ SIDEBAR TOGGLE (MOBILE) ═══════ */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 40;
  background: var(--brand-primary);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
}

.sidebar-toggle:active {
  opacity: 0.8;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 35;
}

.sidebar-overlay.active {
  display: block;
}

/* ═══════ ANIMATIONS ═══════ */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-in {
  animation: fadeIn 0.2s ease-in;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS (from index.html)
═══════════════════════════════════════════════════ */

/* TABLET & LANDSCAPE (768px - 1024px) */
@media (max-width: 1024px) {
  .public-landing-shell {
    padding: 18px;
  }

  .public-hero-card {
    grid-template-columns: 1fr;
  }

  .public-aside-stack {
    max-width: none;
  }

  .public-access-panel-card {
    width: 100%;
  }

  .public-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .public-trust-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .public-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .sidebar {
    width: 260px;
  }

  main {
    width: auto;
  }

  .app-topbar {
    flex-wrap: wrap;
    align-items: flex-start;
  }

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

  .sidebar-item {
    padding: 8px 10px;
    font-size: 13px;
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .heatmap-cell {
    width: 44px;
    height: 36px;
    font-size: 11px;
  }

  table th,
  table td {
    padding: 8px 10px;
    font-size: 13px;
  }

  th {
    font-size: 11px;
  }

  h1 {
    font-size: 24px;
  }

  #risk-anomaly .grid-cols-2 {
    grid-template-columns: 1fr;
  }

  h2 {
    font-size: 18px;
  }

  h3 {
    font-size: 15px;
  }

  .card {
    padding: 16px;
  }

  p {
    font-size: 13px;
    line-height: 1.5;
  }

  .tab-btn {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .kpi-card {
    padding: 12px;
  }

  .chat-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 20px;
    height: calc(100vh - 120px);
  }

  .dashboard-chart-card-body {
    height: 240px;
  }
}

/* MOBILE (480px - 768px) */
@media (max-width: 768px) {
  html,
  body {
    font-size: 14px;
  }

  .public-landing-shell {
    padding: 12px;
  }

  .public-hero-copy,
  .public-access-card,
  .public-aside-card {
    padding: 22px 18px;
    border-radius: 22px;
  }

  .public-form-grid-compact {
    grid-template-columns: 1fr;
  }

  .public-utility-card {
    padding: 22px 18px;
    border-radius: 20px;
  }

  .public-hero-title {
    max-width: none;
    font-size: 2.5rem;
  }

  .public-hero-subtitle {
    max-width: none;
    font-size: 1rem;
  }

  .public-hero-lead {
    font-size: 0.95rem;
  }

  .public-trust-badge {
    padding: 11px 12px;
  }

  .public-trust-strip {
    grid-template-columns: 1fr;
  }

  .public-trust-title {
    font-size: 0.82rem;
  }

  .public-trust-copy {
    font-size: 0.75rem;
  }

  .public-kpi-strip {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .public-feature-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .public-kpi-card {
    padding: 12px;
  }

  .public-kpi-value {
    font-size: 1.06rem;
  }

  .public-kpi-note {
    font-size: 0.72rem;
  }

  .topbar-user-pill {
    width: 100%;
  }

  .page-shell-inner {
    padding: 0;
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 260px;
    height: 100vh;
    z-index: 38;
    transition: left 0.3s ease;
    overflow: hidden;
  }

  .sidebar-menu {
    overflow-y: auto;
  }

  .sidebar.active {
    left: 0;
  }

  main {
    padding: 16px;
  }

  .app-topbar {
    padding: 12px 16px;
    gap: 10px;
  }

  .app-header-strip {
    min-height: auto;
  }

  .topbar-caption-one-line {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .app-topbar h1 {
    font-size: 18px;
    margin-bottom: 4px;
  }

  .app-topbar p {
    font-size: 11px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .topbar-actions select,
  .topbar-actions button,
  .topbar-actions .flex {
    flex: 1 1 auto;
  }

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

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

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

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

  .card {
    padding: 12px;
    border-radius: 8px;
  }

  .dashboard-chart-card {
    gap: 12px;
  }

  .dashboard-chart-card-header {
    gap: 10px;
    min-height: auto;
  }

  .dashboard-chart-title-one-line {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .dashboard-chart-card-controls {
    width: 100%;
    justify-content: space-between;
  }

  .dashboard-chart-card-body {
    height: 200px;
  }

  .card p {
    font-size: 12px;
  }

  h1 {
    font-size: 20px;
    margin-bottom: 8px;
  }

  h2 {
    font-size: 16px;
    margin-bottom: 8px;
  }

  h3 {
    font-size: 14px;
    margin-bottom: 6px;
  }

  table {
    font-size: 12px;
  }

  th,
  td {
    padding: 6px 8px;
  }

  th {
    font-size: 10px;
  }

  .kpi-card {
    border-left-width: 3px;
    padding: 12px;
  }

  .kpi-card > div:nth-child(2) {
    font-size: 18px;
  }

  .kpi-card > div:nth-child(3) {
    font-size: 11px;
  }

  .heatmap-cell {
    width: 40px;
    height: 32px;
    font-size: 10px;
  }

  .tab-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .sidebar-item {
    padding: 10px 16px;
    font-size: 13px;
  }

  .timeline-item {
    padding-left: 24px;
    font-size: 12px;
  }

  .timeline-item::before {
    width: 8px;
    height: 8px;
    left: 6px;
  }

  .timeline-item::after {
    left: 10px;
  }

  .chip {
    padding: 1px 6px;
    font-size: 10px;
  }

  button {
    padding: 8px 12px;
    font-size: 12px;
  }

  .network-node {
    padding: 4px 10px;
    font-size: 11px;
    margin: 2px;
  }

  .table-wrapper {
    margin: 0 -12px;
  }

  table {
    min-width: 500px;
  }

  .progress-bar {
    height: 4px;
  }

  .chat-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 20px;
    height: calc(100vh - 120px);
    border-radius: 10px;
  }

  .chat-fab {
    right: 16px;
    bottom: 16px;
    width: 52px;
    height: 52px;
    font-size: 20px;
  }
}

/* SMALL MOBILE (< 480px) */
@media (max-width: 480px) {
  html,
  body {
    font-size: 13px;
  }

  main {
    padding: 12px;
  }

  .app-topbar {
    padding: 10px 12px;
  }

  .app-topbar h1 {
    font-size: 16px;
  }

  .app-topbar p {
    line-height: 1.35;
  }

  .topbar-actions {
    gap: 6px;
  }

  .card {
    padding: 10px;
    border-radius: 6px;
  }

  h1 {
    font-size: 18px;
  }

  h2 {
    font-size: 14px;
  }

  h3 {
    font-size: 12px;
  }

  table {
    font-size: 11px;
  }

  th,
  td {
    padding: 4px 6px;
  }

  .kpi-card > div:nth-child(2) {
    font-size: 16px;
  }

  .kpi-card > div:nth-child(3) {
    font-size: 10px;
  }

  .heatmap-cell {
    width: 36px;
    height: 28px;
    font-size: 9px;
  }

  .tab-btn {
    padding: 4px 10px;
    font-size: 11px;
  }

  button {
    padding: 6px 10px;
    font-size: 11px;
  }

  select {
    font-size: 12px;
    padding: 6px;
  }

  .network-node {
    padding: 3px 8px;
    font-size: 10px;
    margin: 1px;
  }

  .sidebar-item {
    padding: 8px 12px;
    font-size: 12px;
  }

  .timeline-item {
    padding-left: 20px;
    font-size: 11px;
  }

  .chip {
    padding: 1px 4px;
    font-size: 9px;
  }

  .chat-fab {
    right: 12px;
    bottom: 12px;
    width: 48px;
    height: 48px;
    font-size: 18px;
  }

  .chat-panel {
    right: 8px;
    left: 8px;
    bottom: 12px;
    height: calc(100vh - 90px);
    border-radius: 10px;
  }
}

/* ═══════════════════════════════════════════════════
   BUILD.7 FIXES: Landing responsive compactness
═══════════════════════════════════════════════════ */

/* Tablet 769-1024px: restore feature-grid & trust-strip to 3 cols so no orphan card */
@media (min-width: 769px) and (max-width: 1024px) {
  .public-feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .public-trust-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .public-kpi-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Small mobile <480px: KPI 2-col + compact hero-copy padding */
@media (max-width: 480px) {
  .public-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .public-hero-copy {
    padding: 20px 16px;
  }

  .public-feature-grid {
    gap: 8px;
    margin-bottom: 14px;
  }

  .public-hero-lead {
    margin-bottom: 18px;
  }
}
