/* ============================================================
   COSINT — Dark Terminal Theme
   Cannabis Open Source Intelligence Platform
   Brand: #E85D26 orange on #1a1a1a dark
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Surfaces */
  --bg-deepest: #0a0a0a;
  --bg-deep: #111111;
  --bg-surface: #1a1a1a;
  --bg-elevated: #222222;
  --border-primary: #333333;
  --border-subtle: #262626;

  /* Text */
  --text-primary: #ededed;
  --text-secondary: #c4c4c4;
  --text-muted: #8a8a8a;
  --text-faint: #555555;

  /* Brand — COSINT Orange */
  --accent-primary: #E85D26;
  --accent-primary-dim: rgba(232, 93, 38, 0.14);
  --accent-primary-glow: rgba(232, 93, 38, 0.07);
  --accent-primary-hover: #F06D38;

  /* Semantic accents */
  --accent-green: #3fb950;
  --accent-green-dim: rgba(63, 185, 80, 0.14);
  /* Former “info/secondary” blue → brand orange (matches logo) */
  --accent-blue: var(--accent-primary);
  --accent-blue-dim: var(--accent-primary-dim);
  --accent-amber: #d29922;
  --accent-amber-dim: rgba(210, 153, 34, 0.14);
  --accent-red: #f85149;
  --accent-red-dim: rgba(248, 81, 73, 0.14);
  --accent-purple: #bc8cff;
  --accent-purple-dim: rgba(188, 140, 255, 0.14);
  --accent-cyan: #39d2c0;
  --accent-cyan-dim: rgba(57, 210, 192, 0.14);
  /* License status: in-process / pending */
  --accent-sky: #58a6ff;
  --accent-sky-dim: rgba(88, 166, 255, 0.14);

  /* Typography */
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  /* Layout */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --sidebar-width: 250px;
  --site-footer-height: 52px;
  --transition-fast: 0.15s ease;
  --transition-med: 0.25s ease;

  --nav-hover-bg: rgba(255, 255, 255, 0.04);
  --chart-tick: #555555;
  --chart-legend: #8a8a8a;
  --chart-grid: rgba(255, 255, 255, 0.06);
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-deep);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--accent-primary-hover);
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-deepest);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow: hidden;
}

.sidebar-brand {
  padding: 16px 14px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
}

.sidebar-brand-link {
  display: block;
  line-height: 0;
  text-decoration: none;
}

.sidebar-brand-link:hover .sidebar-brand-logo {
  opacity: 0.92;
}

.sidebar-brand-logo {
  display: block;
  width: 100%;
  max-width: 214px;
  height: auto;
  max-height: 52px;
  object-fit: contain;
  object-position: left center;
}

.sidebar-nav {
  list-style: none;
  padding: 10px 0;
}

.sidebar-nav--main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-account {
  flex-shrink: 0;
  border-top: 1px solid var(--border-subtle);
  padding-bottom: 4px;
}

.sidebar-account .sidebar-section-label {
  padding-top: 14px;
}

.sidebar-account .sidebar-nav {
  padding-top: 4px;
  padding-bottom: 6px;
}

.sidebar-section-label {
  padding: 16px 18px 6px;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.sidebar-nav li a,
.sidebar-nav li button,
.sidebar-nav-link,
.sidebar-nav-disabled {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 2px solid transparent;
  font-family: var(--font-sans);
}

.sidebar-nav-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sidebar-nav li a:hover,
.sidebar-nav li button:hover,
.sidebar-nav-link:hover {
  color: var(--text-secondary);
  background: var(--nav-hover-bg);
}

.sidebar-nav li.active a,
.sidebar-nav li.active .sidebar-nav-link,
.sidebar-nav-link.active {
  color: var(--accent-primary);
  background: var(--accent-primary-glow);
  border-left-color: var(--accent-primary);
}

.sidebar-nav li.sub-item a {
  padding-left: 36px;
  font-size: 12px;
}

.sidebar-nav li .badge-soon {
  font-size: 9px;
  color: var(--text-faint);
  background: var(--border-subtle);
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: auto;
  font-family: var(--font-mono);
}

.sidebar-divider {
  margin: 8px 18px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-footer {
  flex-shrink: 0;
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-deepest);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-primary-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-username {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-userrole {
  font-size: 10px;
  color: var(--text-faint);
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-nav li.active .nav-icon {
  opacity: 1;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-header {
  padding: 20px 28px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.content-header h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.content-header .subtitle {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
  font-family: var(--font-mono);
}

.content-body {
  padding: 20px 28px 32px;
  flex: 1;
  padding-bottom: calc(32px + var(--site-footer-height));
}

/* ============================================================
   SITE FOOTER (fixed)
   ============================================================ */
.site-footer {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 90;
  background: var(--bg-deepest);
  border-top: 1px solid var(--border-subtle);
  padding: 10px 28px;
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.5;
}

.site-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer-copyright {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.site-footer-copyright a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer-copyright a:hover {
  color: var(--accent-primary);
}

.site-footer-division {
  font-size: 10px;
}

.site-footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  font-size: 11px;
}

.site-footer-links a:hover {
  color: var(--accent-primary);
}

/* ============================================================
   COLORADO DISCLAIMER
   ============================================================ */
.colorado-disclaimer {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-muted);
}

.colorado-disclaimer p {
  margin: 0;
}

/* ============================================================
   LEGAL PAGES
   ============================================================ */
.legal-content {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.legal-content h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 28px 0 10px;
}

.legal-content h2:first-of-type {
  margin-top: 16px;
}

.legal-content p {
  margin: 0 0 14px;
}

.legal-content a {
  color: var(--accent-primary);
}

.legal-updated {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  margin-bottom: 20px !important;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid var(--border-primary);
  font-family: var(--font-sans);
  text-decoration: none;
}

.btn-default {
  background: var(--border-subtle);
  color: var(--text-secondary);
  border-color: var(--border-primary);
}
.btn-default:hover {
  background: var(--border-primary);
  color: var(--text-primary);
}

.btn-primary {
  background: var(--accent-primary-dim);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}
.btn-primary:hover {
  background: rgba(232, 93, 38, 0.25);
  color: var(--accent-primary-hover);
}

.btn-secondary {
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}
.btn-secondary:hover {
  background: rgba(232, 93, 38, 0.25);
  color: var(--accent-primary-hover);
}

.btn-danger {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  border-color: rgba(248, 81, 73, 0.4);
}
.btn-danger:hover {
  background: rgba(248, 81, 73, 0.25);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* Ghost/outline — Manage Users role row (matches compact select + Update) */
.btn-manage-update {
  background: transparent;
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}
.btn-manage-update:hover {
  background: var(--accent-blue-dim);
  color: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-sans);
}
.btn-link:hover {
  color: var(--accent-primary);
}

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

/* ============================================================
   METRIC CARDS
   ============================================================ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.metric-label {
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.metric-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 4px;
  line-height: 1.2;
}

.metric-value.brand   { color: var(--accent-primary); }
.metric-value.success  { color: var(--accent-green); }
.metric-value.warning  { color: var(--accent-amber); }
.metric-value.danger   { color: var(--accent-red); }
.metric-value.info     { color: var(--accent-blue); }

.metric-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-family: var(--font-mono);
}

.metric-detail.success { color: var(--accent-green); }
.metric-detail.warning { color: var(--accent-amber); }
.metric-detail.brand   { color: var(--accent-primary); }

/* ============================================================
   PANELS / CARDS
   ============================================================ */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}

.panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-action {
  font-size: 12px;
  color: var(--accent-primary);
  cursor: pointer;
  text-decoration: none;
}
.panel-action:hover {
  color: var(--accent-primary-hover);
}

.panel-body {
  padding: 18px;
}

.panel-body-flush {
  padding: 0;
}

.panel-meta {
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* LicINT detail — CDAP data history + license lifecycle timelines */
.license-timelines-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 20px;
}

@media (max-width: 960px) {
  .license-timelines-grid {
    grid-template-columns: 1fr;
  }
}

.license-timelines-grid > .panel {
  margin: 0;
}

.timeline-panel-body {
  padding: 16px 20px 24px;
}

.timeline-intro {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 16px;
  line-height: 1.55;
}

.timeline-intro strong {
  font-weight: 500;
  color: var(--text-secondary);
}

.timeline-empty {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

.license-timeline {
  margin: 0;
  padding: 0 0 0 18px;
  border-left: 2px solid var(--accent-primary);
  list-style: none;
}

.license-timeline > li {
  margin-bottom: 18px;
  list-style: none;
  position: relative;
}

.license-timeline > li::before {
  content: "";
  position: absolute;
  left: -23px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: 2px solid var(--bg-deepest);
}

.license-timeline-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.license-timeline-body {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.license-timeline-hints {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-faint);
}

.license-timeline-changes {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--accent-blue-dim);
  border: 1px solid var(--border-subtle);
}

.license-timeline-changes-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.license-timeline-changes ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.license-timeline-changes li {
  margin-bottom: 4px;
}

.license-timeline-unchanged,
.license-timeline-baseline {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-faint);
}

.license-timeline-unchanged {
  font-style: italic;
}

.license-lifecycle-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.license-lifecycle-timeline > li {
  position: relative;
  padding: 0 0 18px 22px;
  margin: 0;
  list-style: none;
}

.license-lifecycle-timeline > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: 2px solid var(--bg-deepest);
  transform: translateX(-50%);
  z-index: 1;
}

.license-lifecycle-timeline > li::after {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 0;
  width: 0;
  border-left: 2px solid var(--accent-primary);
  transform: translateX(-50%);
}

.license-lifecycle-timeline > li.license-lifecycle-connector-dotted::after {
  border-left-style: dotted;
}

.license-lifecycle-timeline > li:last-child::after {
  display: none;
}

.license-lifecycle-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.license-lifecycle-body {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.license-lifecycle-detail {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-faint);
}

.license-lifecycle-chip {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-left: 8px;
  vertical-align: middle;
}

/* ============================================================
   DATA TABLES
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  padding: 10px 18px;
  text-align: left;
  font-weight: 400;
  color: var(--text-faint);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 10px 18px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr.clickable-row {
  cursor: pointer;
}
.data-table tbody tr.clickable-row:hover {
  background: var(--accent-primary-glow);
}

.data-table .mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.data-table .muted {
  color: var(--text-muted);
}

.data-table thead th.sortable {
  cursor: pointer;
  user-select: none;
}
.data-table thead th.sortable .th-sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-block;
}
.data-table thead th.sortable:hover,
.data-table thead th.sortable:hover .th-sort-link {
  color: var(--text-secondary);
}
.data-table thead th.sorted-asc::after {
  content: ' ▲';
  font-size: 8px;
}
.data-table thead th.sorted-desc::after {
  content: ' ▼';
  font-size: 8px;
}

/* flush table in panel */
.panel .data-table thead th:first-child,
.panel .data-table tbody td:first-child {
  padding-left: 18px;
}
.panel .data-table thead th:last-child,
.panel .data-table tbody td:last-child {
  padding-right: 18px;
}

/* Manage Users — compact role select + inline Update */
.manage-users-role-form {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.manage-users-role-form .manage-users-role-select.form-control {
  width: auto;
  min-width: 6.5rem;
  max-width: 11rem;
  flex: 0 1 auto;
  padding: 6px 28px 6px 10px;
  font-size: 12px;
  line-height: 1.35;
}

.manage-users-role-form .btn-manage-update {
  flex-shrink: 0;
}

/* ============================================================
   RBAC ROLE PILLS (Manage users)
   ============================================================ */
.role-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 14px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.role-pill--superadmin {
  color: #ff8b7a;
  background: rgba(248, 81, 73, 0.18);
  border-color: rgba(248, 81, 73, 0.35);
}

.role-pill--platform-admin {
  color: #e3c36d;
  background: rgba(210, 153, 34, 0.2);
  border-color: rgba(210, 153, 34, 0.35);
}

.role-pill--app-admin {
  color: #79c0ff;
  background: rgba(56, 139, 253, 0.18);
  border-color: rgba(56, 139, 253, 0.35);
}

.role-pill--icc-user {
  color: #6ee7c8;
  background: rgba(63, 185, 160, 0.18);
  border-color: rgba(63, 185, 160, 0.35);
}

.role-pill--account-owner {
  color: #56d364;
  background: rgba(63, 185, 80, 0.18);
  border-color: rgba(63, 185, 80, 0.35);
}

.role-pill--account-admin {
  color: #d2a8ff;
  background: rgba(188, 140, 255, 0.16);
  border-color: rgba(188, 140, 255, 0.35);
}

.role-pill--account-user {
  color: #8b949e;
  background: rgba(139, 148, 158, 0.14);
  border-color: rgba(139, 148, 158, 0.28);
}

.role-pill--none {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-subtle);
  text-transform: none;
  letter-spacing: 0.04em;
}

html[data-theme="light"] .role-pill--superadmin {
  color: #b62324;
  background: rgba(248, 81, 73, 0.12);
  border-color: rgba(248, 81, 73, 0.25);
}

html[data-theme="light"] .role-pill--platform-admin {
  color: #9a6700;
  background: rgba(210, 153, 34, 0.12);
  border-color: rgba(210, 153, 34, 0.28);
}

html[data-theme="light"] .role-pill--app-admin {
  color: #0969da;
  background: rgba(56, 139, 253, 0.12);
  border-color: rgba(56, 139, 253, 0.28);
}

html[data-theme="light"] .role-pill--icc-user {
  color: #116329;
  background: rgba(63, 185, 160, 0.12);
  border-color: rgba(63, 185, 160, 0.28);
}

html[data-theme="light"] .role-pill--account-owner {
  color: #1a7f37;
  background: rgba(63, 185, 80, 0.12);
  border-color: rgba(63, 185, 80, 0.28);
}

html[data-theme="light"] .role-pill--account-admin {
  color: #8250df;
  background: rgba(188, 140, 255, 0.12);
  border-color: rgba(188, 140, 255, 0.28);
}

html[data-theme="light"] .role-pill--account-user {
  color: #57606a;
  background: rgba(139, 148, 158, 0.1);
  border-color: rgba(139, 148, 158, 0.22);
}

html[data-theme="light"] .role-pill--none {
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--border-subtle);
}

/* ============================================================
   SEARCH & FILTER BAR
   ============================================================ */
.search-filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-deepest);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(232, 93, 38, 0.1);
}

.search-input::placeholder {
  color: var(--text-faint);
}

.filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-select {
  padding: 9px 32px 9px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-deepest);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238a8a8a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  transition: border-color var(--transition-fast);
  min-width: 140px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(232, 93, 38, 0.1);
}

/* Active filter chips */
.active-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--accent-primary);
  background: var(--accent-primary-dim);
  border: 1px solid rgba(232, 93, 38, 0.3);
  border-radius: 20px;
  font-family: var(--font-mono);
}

.filter-chip .chip-remove {
  cursor: pointer;
  opacity: 0.6;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  color: inherit;
}
.filter-chip .chip-remove:hover {
  opacity: 1;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.pagination-info {
  color: var(--text-faint);
}

.pagination-controls {
  display: flex;
  gap: 4px;
}

.pagination-controls a,
.pagination-controls span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.pagination-controls a:hover {
  background: var(--border-subtle);
  color: var(--text-secondary);
}

.pagination-controls .current {
  background: var(--accent-primary-dim);
  color: var(--accent-primary);
  font-weight: 500;
}

.pagination-controls .disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ============================================================
   CHART CONTAINERS
   ============================================================ */
.chart-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  position: relative;
  min-height: 300px;
}

/* Market data (and similar): cap chart height — Chart.js + flex was stretching the canvas */
.chart-container--bounded {
  min-height: unset;
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 260px;
  max-height: min(280px, 42vh);
}

/* Doughnut: keep box from growing too tall */
.chart-canvas-wrap--short {
  height: 220px;
  max-height: min(240px, 38vh);
}

/* Full-width trend chart */
.chart-canvas-wrap--wide {
  height: 240px;
  max-height: min(280px, 40vh);
}

.chart-container canvas {
  max-width: 100%;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 11px;
  font-family: var(--font-mono);
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-deepest);
  border-radius: var(--radius-md);
  padding: 2px;
  border: 1px solid var(--border-subtle);
}

.chart-tab {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all var(--transition-fast);
}

.chart-tab:hover {
  color: var(--text-secondary);
}

.chart-tab.active {
  background: var(--accent-primary-dim);
  color: var(--accent-primary);
}

/* ============================================================
   STATUS INDICATORS
   ============================================================ */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  white-space: nowrap;
}

.status-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* License status colors — slug class via license_status_css_class() */
.status-dot.active,
.status-dot.success {
  color: var(--accent-green);
}
.status-dot.active::before,
.status-dot.success::before {
  background: var(--accent-green);
}

.status-dot.in-process,
.status-dot.pending,
.status-dot.renewal {
  color: var(--accent-sky);
}
.status-dot.in-process::before,
.status-dot.pending::before,
.status-dot.renewal::before {
  background: var(--accent-sky);
}

.status-dot.expired {
  color: var(--accent-primary);
}
.status-dot.expired::before {
  background: var(--accent-primary);
}

.status-dot.inactive {
  color: var(--accent-amber);
}
.status-dot.inactive::before {
  background: var(--accent-amber);
}

.status-dot.revoked {
  color: var(--accent-red);
}
.status-dot.revoked::before {
  background: var(--accent-red);
}

.status-dot.suspended {
  color: var(--accent-purple);
}
.status-dot.suspended::before {
  background: var(--accent-purple);
}

.status-dot.other,
.status-dot.unknown {
  color: var(--text-muted);
}
.status-dot.other::before,
.status-dot.unknown::before {
  background: var(--text-muted);
}

/* License type badges */
.license-type {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
}

.license-type.retail       { background: var(--accent-primary-dim); color: var(--accent-primary); }
.license-type.cultivator   { background: var(--accent-green-dim); color: var(--accent-green); }
.license-type.manufacturer { background: var(--accent-purple-dim); color: var(--accent-purple); }
.license-type.distributor  { background: var(--accent-blue-dim); color: var(--accent-blue); }
.license-type.testing      { background: var(--accent-cyan-dim); color: var(--accent-cyan); }
.license-type.other        { background: var(--border-subtle); color: var(--text-faint); }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.progress-row:last-child { margin-bottom: 0; }

.progress-track {
  flex: 1;
  height: 6px;
  background: var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width var(--transition-med);
}

.progress-fill.orange { background: var(--accent-primary); }
.progress-fill.green  { background: var(--accent-green); }
.progress-fill.blue   { background: var(--accent-blue); }
.progress-fill.purple { background: var(--accent-purple); }
.progress-fill.amber  { background: var(--accent-amber); }
.progress-fill.cyan   { background: var(--accent-cyan); }

.progress-label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 120px;
  font-family: var(--font-mono);
}

.progress-value {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 48px;
  text-align: right;
  font-family: var(--font-mono);
}

/* ============================================================
   STATUS ROWS
   ============================================================ */
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}
.status-row:first-child { padding-top: 0; }
.status-row:last-child  { padding-bottom: 0; }

.status-row-label {
  font-size: 13px;
  color: var(--text-muted);
}

.status-row-value {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
}

.status-row-value .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-row-value .dot.green  { background: var(--accent-green); }
.status-row-value .dot.amber  { background: var(--accent-amber); }
.status-row-value .dot.red    { background: var(--accent-red); }
.status-row-value .dot.orange { background: var(--accent-primary); }

.status-row-value.green  { color: var(--accent-green); }
.status-row-value.amber  { color: var(--accent-amber); }
.status-row-value.red    { color: var(--accent-red); }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

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

/* ============================================================
   LICINT PREVIEW VISUALIZATION TILES
   ============================================================ */
.licint-viz-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.licint-viz-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 220px;
  display: flex;
  flex-direction: column;
}

.licint-viz-tile--map {
  grid-column: span 1;
}

.licint-viz-tile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 8px;
}

.licint-viz-tile-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.licint-viz-tile-link {
  font-size: 11px;
  color: var(--accent-primary);
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-mono);
}
.licint-viz-tile-link:hover {
  color: var(--accent-primary-hover);
}

.licint-viz-tile-body {
  flex: 1;
  padding: 10px 12px 12px;
  position: relative;
}

.licint-viz-tile-body--map {
  display: flex;
  flex-direction: column;
  min-height: 180px;
}

.licint-viz-tile-body--map .freeint-us-map.licint-us-map-tile {
  min-height: 150px;
  max-height: 180px;
}

.licint-us-map {
  width: 100%;
  height: 150px;
  flex: 1;
}

.licint-us-outline {
  fill: rgba(255, 255, 255, 0.02);
  stroke: var(--border-primary);
  stroke-width: 1.5;
}

.licint-us-bubble {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1;
  transition: stroke-width 0.15s ease, filter 0.15s ease;
}

.licint-us-bubble.is-selected {
  stroke: var(--text-primary);
  stroke-width: 2;
  filter: drop-shadow(0 0 6px rgba(232, 93, 38, 0.55));
}

.licint-us-state:hover .licint-us-bubble {
  stroke: var(--accent-primary);
  stroke-width: 2;
}

.licint-us-label {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--text-muted);
  pointer-events: none;
}

.licint-us-inset-label {
  font-family: var(--font-mono);
  font-size: 8px;
  fill: var(--text-faint);
}

.licint-map-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.licint-map-legend-gradient {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(232, 93, 38, 0.15), rgba(232, 93, 38, 0.95));
  max-width: 120px;
}

.licint-map-legend-max {
  color: var(--accent-primary);
  margin-left: auto;
}

/* FreeINT choropleth map */
.freeint-us-map {
  width: 100%;
  height: auto;
  min-height: 220px;
  max-height: 340px;
  background: transparent;
}

.freeint-state-path {
  stroke: var(--border-primary);
  stroke-width: 0.75;
  vector-effect: non-scaling-stroke;
  transition: fill 0.15s ease, stroke 0.15s ease;
}

.freeint-state-path--empty {
  fill: transparent;
  stroke: rgba(255, 255, 255, 0.08);
}

.freeint-state-path--active {
  stroke: rgba(255, 255, 255, 0.35);
}

.freeint-state-path--active:hover {
  stroke: var(--accent-primary);
  stroke-width: 1.25;
  filter: drop-shadow(0 0 4px rgba(232, 93, 38, 0.45));
}

.freeint-state-path.is-selected {
  stroke: var(--text-primary);
  stroke-width: 2;
  filter: drop-shadow(0 0 6px rgba(232, 93, 38, 0.55));
}

.freeint-state-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  fill: var(--text-primary);
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 3px;
}

.freeint-map-error {
  font-family: var(--font-sans);
  font-size: 14px;
  fill: var(--text-muted);
}

.licint-viz-hint {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 4px;
  font-family: var(--font-mono);
}

.licint-viz-tile-body--chart {
  min-height: 170px;
}

.licint-viz-tile-body--chart canvas {
  width: 100% !important;
  height: 100% !important;
}

.licint-viz-tile-body--gauge {
  display: grid;
  grid-template-columns: 88px 1fr;
  grid-template-rows: auto 1fr;
  gap: 8px 12px;
  align-items: start;
}

.licint-active-gauge {
  width: 88px;
  height: 88px;
  grid-row: 1 / 3;
  transform: rotate(-90deg);
}

.licint-active-gauge-bg {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 8;
}

.licint-active-gauge-ring {
  fill: none;
  stroke: var(--accent-green);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s ease;
}

.licint-active-stat {
  grid-column: 2;
}

.licint-active-pct {
  font-size: 26px;
  font-weight: 600;
  color: var(--accent-green);
  line-height: 1.1;
}

.licint-active-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: var(--font-mono);
}

.licint-active-detail .brand {
  color: var(--accent-primary);
}

.licint-top-states {
  list-style: none;
  grid-column: 1 / -1;
  margin-top: 4px;
}

.licint-top-state-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  text-decoration: none;
  color: inherit;
  font-size: 11px;
  font-family: var(--font-mono);
}

.licint-top-state-row:hover .licint-top-state-code {
  color: var(--accent-primary);
}

.licint-top-state-code {
  color: var(--text-secondary);
  font-weight: 600;
}

.licint-top-state-bar {
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
}

.licint-top-state-bar span {
  display: block;
  height: 100%;
  background: var(--accent-primary);
  border-radius: 2px;
}

.licint-top-state-count {
  color: var(--text-muted);
  min-width: 2.5rem;
  text-align: right;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-deepest);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(232, 93, 38, 0.1);
}

.form-control::placeholder {
  color: var(--text-faint);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238a8a8a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ============================================================
   AUTH PAGES (Login, Register, Password Reset)
   ============================================================ */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-deep);
  padding: 24px;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo-link {
  display: inline-block;
  text-decoration: none;
  color: inherit;
  outline: none;
}

.auth-logo-link:hover .auth-logo-text,
.auth-logo-link:focus-visible .auth-logo-text {
  color: var(--accent-primary-hover, var(--accent-primary));
}

.auth-logo img {
  height: 48px;
  width: auto;
}

.auth-logo-text {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--accent-primary);
  letter-spacing: 3px;
}

.auth-logo-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 4px;
}

.auth-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 24px;
}

.auth-card .form-control {
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 4px;
}

.auth-card .btn {
  width: 100%;
  justify-content: center;
  padding: 10px 16px;
  font-size: 14px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-faint);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border-subtle);
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-error {
  background: var(--accent-red-dim);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--accent-red);
  font-size: 13px;
  margin-bottom: 16px;
}

/* SSO buttons */
.btn-google {
  background: var(--bg-deepest);
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
  padding: 10px 16px;
  width: 100%;
  justify-content: center;
  font-size: 14px;
}
.btn-google:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.btn-google svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-microsoft {
  background: var(--bg-deepest);
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
  padding: 10px 16px;
  width: 100%;
  justify-content: center;
  font-size: 14px;
  margin-top: 8px;
}
.btn-microsoft:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ============================================================
   PROFILE
   ============================================================ */
.profile-section-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.profile-table {
  width: 100%;
  font-size: 13px;
}

.profile-table td {
  padding: 8px 0;
  vertical-align: top;
}

.profile-table td:first-child {
  color: var(--text-muted);
  width: 180px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.profile-table td:last-child {
  color: var(--text-secondary);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
}

.badge-success { background: var(--accent-green-dim); color: var(--accent-green); }
.badge-warning { background: var(--accent-amber-dim); color: var(--accent-amber); }
.badge-danger  { background: var(--accent-red-dim); color: var(--accent-red); }
.badge-info    { background: var(--accent-blue-dim); color: var(--accent-blue); }
.badge-brand   { background: var(--accent-primary-dim); color: var(--accent-primary); }
.badge-muted   { background: var(--border-subtle); color: var(--text-faint); }

/* ============================================================
   DETAIL / LOG VIEW
   ============================================================ */
.log-output {
  background: var(--bg-deepest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}

.detail-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 16px;
  font-size: 13px;
}

.detail-key {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 12px;
}

.detail-value {
  color: var(--text-secondary);
}

/* ============================================================
   EMPTY STATES & ALERTS
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-faint);
}

.empty-state-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.empty-state-text {
  font-size: 14px;
  margin-bottom: 16px;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background: var(--accent-green-dim);
  border: 1px solid rgba(63, 185, 80, 0.3);
  color: var(--accent-green);
}

.alert-error {
  background: var(--accent-red-dim);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: var(--accent-red);
}

.alert-info {
  background: var(--accent-blue-dim);
  border: 1px solid rgba(88, 166, 255, 0.3);
  color: var(--accent-blue);
}

/* ============================================================
   TAB NAV
   ============================================================ */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.tab-nav a,
.tab-nav button {
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  margin-bottom: -1px;
}

.tab-nav a:hover,
.tab-nav button:hover {
  color: var(--text-secondary);
}

.tab-nav a.active,
.tab-nav button.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

/* ============================================================
   EXPORT OPTIONS
   ============================================================ */
.export-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.export-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-deepest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}

.export-option:hover {
  border-color: var(--border-primary);
}

.export-option-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.export-option-name {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.export-option-desc {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* ============================================================
   DATA FRESHNESS INDICATOR
   ============================================================ */
.data-freshness {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.data-freshness .pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============================================================
   MISC
   ============================================================ */
/* Logout must match Profile / Settings link padding — do not strip .sidebar-nav-link styles */
#logout-form {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .licint-viz-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-med);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content { margin-left: 0; }
  .site-footer { left: 0; padding: 10px 16px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .licint-viz-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .content-body { padding: 16px; padding-bottom: calc(16px + var(--site-footer-height)); }
  .mobile-menu-toggle { display: flex; }
  .search-filter-bar { flex-direction: column; align-items: stretch; }
  .search-input-wrap { min-width: 100%; }
  .filter-group { width: 100%; }
  .filter-select { flex: 1; min-width: 0; }
}

@media (min-width: 769px) {
  .mobile-menu-toggle { display: none; }
}

.mobile-menu-toggle {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px;
  color: var(--text-muted);
  cursor: pointer;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-primary); }

/* ============================================================
   SETTINGS — left subnav & theme toggle
   ============================================================ */
.settings-layout {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  max-width: 56rem;
}

.settings-subnav {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 168px;
  padding-right: 20px;
  border-right: 1px solid var(--border-subtle);
}

.settings-subnav button {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-md);
  border-left: 2px solid transparent;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
  font-family: var(--font-sans);
}

.settings-subnav button:hover {
  color: var(--text-secondary);
  background: var(--nav-hover-bg);
}

.settings-subnav button.active {
  color: var(--accent-primary);
  background: var(--accent-primary-glow);
  border-left-color: var(--accent-primary);
}

.settings-panels {
  flex: 1;
  min-width: 0;
}

@media (max-width: 640px) {
  .settings-layout {
    flex-direction: column;
    gap: 16px;
  }
  .settings-subnav {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
    width: 100%;
    padding-right: 0;
    padding-bottom: 12px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .settings-subnav button {
    border-left: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    border-radius: 0;
    padding: 10px 14px;
  }
  .settings-subnav button.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent-primary);
    background: transparent;
  }
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 40rem;
}

.settings-row-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.settings-row-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  max-width: 28rem;
}

.theme-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.theme-toggle-label {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-primary);
  border-radius: 24px;
  transition: background var(--transition-fast);
  border: 1px solid var(--border-subtle);
}

.theme-switch-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform var(--transition-med);
}

.theme-switch input:checked + .theme-switch-slider {
  background: var(--accent-primary-dim);
  border-color: var(--accent-primary);
}

.theme-switch input:checked + .theme-switch-slider::before {
  transform: translateX(20px);
  background: var(--accent-primary);
}

.theme-switch input:focus-visible + .theme-switch-slider {
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

/* ============================================================
   LIGHT THEME
   ============================================================ */
html[data-theme="light"] {
  --bg-deepest: #e4e7ec;
  --bg-deep: #eef1f6;
  --bg-surface: #ffffff;
  --bg-elevated: #f7f9fc;
  --border-primary: #c8ced9;
  --border-subtle: #dde2ea;
  --text-primary: #12141a;
  --text-secondary: #3a3f4d;
  --text-muted: #5c6370;
  --text-faint: #7a8290;
  --accent-primary-glow: rgba(232, 93, 38, 0.12);
  --accent-primary-dim: rgba(232, 93, 38, 0.16);
  --nav-hover-bg: rgba(0, 0, 0, 0.05);
  --chart-tick: #5c6370;
  --chart-legend: #6b7280;
  --chart-grid: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .data-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .data-table tbody tr.clickable-row:hover {
  background: var(--accent-primary-glow);
}

html[data-theme="light"] .mobile-menu-toggle {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .auth-card {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}
