/* ── Page progress bar ─────────────────────────────────────────────────────── */
#page-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: rgba(255,255,255,0.9);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: width .3s ease, opacity .4s ease;
}
#page-progress.active {
    opacity: 1;
}

/* shadcn preset aJ4FIki — tweakcn.com */

/* ── CSS Variables ─────────────────────────────── */
:root {
  --background: #f5f5f5;
  --foreground: #212121;
  --card: #ffffff;
  --card-foreground: #212121;
  --popover: #ffffff;
  --popover-foreground: #212121;
  --primary: #1976d2;
  --primary-foreground: #ffffff;
  --secondary: #eef2f7;
  --secondary-foreground: #212121;
  --muted: #eef2f7;
  --muted-foreground: #616161;
  --accent: #eef2f7;
  --accent-foreground: #212121;
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: #ffffff;
  --warning: #dd6b20;
  --border: #e0e0e0;
  --input: #d4dce6;
  --ring: #1976d2;
  --radius: 0.25rem;
  --shadow-color: oklch(0 0 0);
  --shadow-opacity: 0.1;
  --shadow-blur: 3px;
  --shadow-offset-y: 1px;
  --link: #1976d2;
  /* AppBar — light: primary-coloured; dark: dark surface */
  --site-header-bg: #1976d2;
  --header-shadow: 0 2px 4px rgba(0,0,0,.18);
  --nav-fg: rgba(255,255,255,.85);
  --nav-fg-active: #ffffff;
  --nav-hover-bg: rgba(255,255,255,.12);
  --nav-active-bg: rgba(255,255,255,.2);
  --chart-bar-muted: #c4d6e8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0d1117;
    --foreground: #e6edf3;
    --card: #161b22;
    --card-foreground: #e6edf3;
    --popover: #161b22;
    --popover-foreground: #e6edf3;
    --primary: #90caf9;
    --primary-foreground: #0d1117;
    --secondary: #21262d;
    --secondary-foreground: #e6edf3;
    --muted: #161b22;
    --muted-foreground: #9ba5b0;
    --accent: #21262d;
    --accent-foreground: #e6edf3;
    --destructive: oklch(0.704 0.191 22.216);
    --destructive-foreground: #e6edf3;
    --warning: #e3b341;
    --border: #526070;
    --input: #526070;
    --ring: #90caf9;
    --radius: 0.25rem;
    --shadow-color: oklch(0 0 0);
    --shadow-opacity: 0.7;
    --shadow-blur: 12px;
    --shadow-offset-y: 4px;
    --link: #90caf9;
    --site-header-bg: #010409;
    --header-shadow: none;
    --nav-fg: #9ba5b0;
    --nav-fg-active: #e6edf3;
    --nav-hover-bg: #21262d;
    --nav-active-bg: #21262d;
    --chart-bar-muted: rgba(144,202,249,.45);
  }
}

/* ── Session expired banner ───────────────────── */
.session-expired-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  background: color-mix(in oklch, var(--warning) 15%, var(--card));
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  color: var(--foreground);
  font-size: 0.875rem;
}
.session-expired-banner .btn {
  white-space: nowrap;
  padding: 0.375rem 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.8125rem;
  cursor: pointer;
  text-decoration: none;
}
.session-expired-banner .btn:hover {
  opacity: 0.9;
}

/* User forced dark — overrides OS light preference */
[data-theme="dark"] {
  --background: #0d1117;
  --foreground: #e6edf3;
  --card: #161b22;
  --card-foreground: #e6edf3;
  --popover: #161b22;
  --popover-foreground: #e6edf3;
  --primary: #90caf9;
  --primary-foreground: #0d1117;
  --secondary: #21262d;
  --secondary-foreground: #e6edf3;
  --muted: #161b22;
  --muted-foreground: #9ba5b0;
  --accent: #21262d;
  --accent-foreground: #e6edf3;
  --destructive: oklch(0.704 0.191 22.216);
  --destructive-foreground: #e6edf3;
  --warning: #e3b341;
  --border: #526070;
  --input: #526070;
  --ring: #90caf9;
  --radius: 0.25rem;
  --shadow-color: oklch(0 0 0);
  --shadow-opacity: 0.7;
  --shadow-blur: 12px;
  --shadow-offset-y: 4px;
  --link: #90caf9;
  --site-header-bg: #010409;
  --header-shadow: none;
  --nav-fg: #9ba5b0;
  --nav-fg-active: #e6edf3;
  --nav-hover-bg: #21262d;
  --nav-active-bg: #21262d;
  --chart-bar-muted: rgba(144,202,249,.45);
}

/* User forced light — overrides OS dark preference */
[data-theme="light"] {
  --background: #f5f5f5;
  --foreground: #212121;
  --card: #ffffff;
  --card-foreground: #212121;
  --popover: #ffffff;
  --popover-foreground: #212121;
  --primary: #1976d2;
  --primary-foreground: #ffffff;
  --secondary: #eef2f7;
  --secondary-foreground: #212121;
  --muted: #eef2f7;
  --muted-foreground: #616161;
  --accent: #eef2f7;
  --accent-foreground: #212121;
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: #ffffff;
  --warning: #dd6b20;
  --border: #e0e0e0;
  --input: #d4dce6;
  --ring: #1976d2;
  --radius: 0.25rem;
  --shadow-color: oklch(0 0 0);
  --shadow-opacity: 0.1;
  --shadow-blur: 3px;
  --shadow-offset-y: 1px;
  --link: #1976d2;
  --site-header-bg: #1976d2;
  --header-shadow: 0 2px 4px rgba(0,0,0,.18);
  --nav-fg: rgba(255,255,255,.85);
  --nav-fg-active: #ffffff;
  --nav-hover-bg: rgba(255,255,255,.12);
  --nav-active-bg: rgba(255,255,255,.2);
}

/* ── Reset ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0;
  height: 100vh;   /* definite size — makes flex children's % calculations resolve correctly */
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Content-area links (tables, detail panels, dashboard) get a distinct colour
   and a hover underline so they're visually distinguishable from plain text.
   Nav links, buttons, back-links and chips have their own styles — excluded. */
main a:not(.btn):not(.nav-link):not(.back-link):not(.login-btn) {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color .15s;
}
main a:not(.btn):not(.nav-link):not(.back-link):hover {
  text-decoration-color: currentColor;
}

/* ── Header / Nav ──────────────────────────────── */
.site-header {
  border-bottom: 1px solid transparent;
  background-color: var(--site-header-bg);
  box-shadow: var(--header-shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-nav {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-brand {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--nav-fg-active);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
}

.nav-brand svg {
  width: 1rem;
  height: 1rem;
}

.nav-separator {
  color: var(--nav-fg);
  font-size: 1.25rem;
  font-weight: 200;
  opacity: 0.5;
}

.nav-links {
  display: flex;
  gap: 0.125rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  font-size: 0.875rem;
  color: var(--nav-fg);
  padding: 0.375rem 0.625rem;
  border-radius: calc(var(--radius) - 2px);
  transition: color 0.15s, background-color 0.15s;
  display: block;
}

.nav-link:hover {
  color: var(--nav-fg-active);
  background-color: var(--nav-hover-bg);
}

.nav-link.active {
  color: var(--nav-fg-active);
  background-color: var(--nav-active-bg);
  font-weight: 500;
}

/* ── User menu dropdown ────────────────────────── */
.nav-user-menu {
  margin-left: auto;
  position: relative;
  flex-shrink: 0;
}

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: .375rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-family: inherit;
  color: var(--nav-fg);
  padding: .375rem .625rem;
  border-radius: calc(var(--radius) - 2px);
  transition: color .15s, background-color .15s;
  white-space: nowrap;
}

.nav-user-btn:hover {
  color: var(--nav-fg-active);
  background-color: var(--nav-hover-bg);
}

.nav-user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + .375rem);
  min-width: 11rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  z-index: 100;
  padding: .25rem;
}

.nav-user-menu.open .nav-user-dropdown { display: block; }

.nav-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-family: inherit;
  color: var(--foreground);
  padding: .45rem .75rem;
  border-radius: calc(var(--radius) - 2px);
  transition: background-color .1s;
  text-decoration: none;
  white-space: nowrap;
}

.nav-dropdown-item:hover {
  background-color: var(--muted);
  color: var(--foreground);
}

.nav-dropdown-separator {
  height: 1px;
  background: var(--border);
  margin: .25rem 0;
}

/* ── Main ──────────────────────────────────────── */
.site-main {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* <main> is a plain semantic element between .site-main and .split-view —
   it must participate in the flex chain so .split-view can fill the space.
   overflow-y: auto makes it the scroll container for page content, keeping
   the footer always visible at the bottom of the viewport. */
.site-main > main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* ── Footer ────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.site-footer a {
  text-decoration: underline;
  text-underline-offset: 4px;
  color: var(--muted-foreground);
  transition: color 0.15s;
}

.site-footer a:hover {
  color: var(--foreground);
}

/* ── Typography ────────────────────────────────── */
h1, h2, h3 {
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--foreground);
  margin-top: 0;
}

h1 { font-size: 1.875rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem;   margin-bottom: 1.5rem; }
h3 { font-size: 1.25rem;  margin-bottom: 0.75rem; }

p { margin: 0 0 1rem; }

code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-size: 0.875em;
  background-color: var(--muted);
  padding: 0.125em 0.375em;
  border-radius: calc(var(--radius) - 4px);
}

/* ── Alert ─────────────────────────────────────── */
.alert {
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  border: 1px solid;
}

.alert-danger {
  background-color: color-mix(in oklch, var(--destructive) 8%, var(--background));
  border-color: color-mix(in oklch, var(--destructive) 25%, var(--border));
  color: var(--destructive);
}

/* ── Table ─────────────────────────────────────── */
.table-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: clip;
  background: var(--card);
  box-shadow: 0 1px 3px color-mix(in oklch, var(--shadow-color) calc(var(--shadow-opacity) * 100%), transparent),
              0 1px 2px color-mix(in oklch, var(--shadow-color) calc(var(--shadow-opacity) * 80%), transparent);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background-color: var(--background);
}

thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background-color: var(--background);
  z-index: 1;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 0.1s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background-color: color-mix(in srgb, var(--foreground) 4%, var(--card));
}

tbody tr.row-selected {
  background-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--primary);
}

tbody td {
  padding: 0.875rem 1rem;
  color: var(--muted-foreground);
  vertical-align: middle;
  white-space: nowrap;
}

/* Primary column anchors the row visually; all others recede */
tbody td:first-child {
  color: var(--foreground);
  font-weight: 500;
}

/* opt-in wrapping for name / description / free-text columns */
td.wrap {
  white-space: normal;
}

.text-muted {
  color: var(--muted-foreground);
}

.text-center {
  text-align: center;
}

.text-danger {
  color: var(--destructive);
}

/* ── Button ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  height: 2.25rem;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--border);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1;
  white-space: nowrap;
}

.btn:hover:not(.disabled) {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

.btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Pagination ────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.page-info {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  padding: 0 0.25rem;
}

/* ── Status Badges ─────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 3px;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
/* Base (light) badge colors */
.badge-active   { background-color: #e0f0e8; color: #1e6e3a; }
.badge-expiring { background-color: #faecd4; color: #7a4a12; }
.badge-expired  { background-color: #f5dada; color: #8a1a1a; }

/* Dark badge colors — OS preference */
@media (prefers-color-scheme: dark) {
  .badge-active   { background-color: #1a3a2a; color: #56d364; }
  .badge-expiring { background-color: #3a2f1a; color: #e3b341; }
  .badge-expired  { background-color: #3a1a1a; color: #f85149; }
}

/* Dark badge colors — explicit user choice */
[data-theme="dark"] .badge-active   { background-color: #1a3a2a; color: #56d364; }
[data-theme="dark"] .badge-expiring { background-color: #3a2f1a; color: #e3b341; }
[data-theme="dark"] .badge-expired  { background-color: #3a1a1a; color: #f85149; }

/* Light badge colors — explicit user choice (overrides OS dark media query) */
[data-theme="light"] .badge-active   { background-color: #e0f0e8; color: #1e6e3a; }
[data-theme="light"] .badge-expiring { background-color: #faecd4; color: #7a4a12; }
[data-theme="light"] .badge-expired  { background-color: #f5dada; color: #8a1a1a; }


/* ── Density: compact mode ─────────────────────── */
[data-density="compact"] {
  font-size: 13px;
}

[data-density="compact"] .site-nav {
  height: 2.75rem;
}

[data-density="compact"] .site-main {
  padding: 1rem 1.5rem;
}

[data-density="compact"] thead th {
  padding: 0.5rem 0.75rem;
}

[data-density="compact"] tbody td {
  padding: 0.5rem 0.75rem;
}

[data-density="compact"] .dashboard-panel {
  padding: 0.875rem 1rem;
}

[data-density="compact"] .dashboard-grid {
  gap: 0.875rem;
  margin-top: 0.875rem;
}

[data-density="compact"] .back-link {
  margin-bottom: 0.875rem;
}

[data-density="compact"] .stat-cards {
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

[data-density="compact"] .stat-card {
  padding: 0.375rem 0.625rem;
}

[data-density="compact"] .stat-card-value {
  font-size: 1.25rem;
}

[data-density="compact"] h1 { font-size: 1.5rem;  margin-bottom: 0.625rem; }
[data-density="compact"] h2 { font-size: 1.25rem; margin-bottom: 0.875rem; }
[data-density="compact"] h3 { font-size: 1.125rem; margin-bottom: 0.5rem; }

/* ── Shimmer (dashboard panel loading) ────────── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.shimmer {
  border-radius: var(--radius);
  min-height: 200px;
  background: linear-gradient(
    90deg,
    var(--muted) 25%,
    var(--border) 50%,
    var(--muted) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ── Dashboard panels ──────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-panel-full {
    grid-column: 1 / -1;
  }
}
.dashboard-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  background: var(--card);
  box-shadow: 0 1px 3px color-mix(in oklch, var(--shadow-color) calc(var(--shadow-opacity) * 100%), transparent),
              0 1px 2px color-mix(in oklch, var(--shadow-color) calc(var(--shadow-opacity) * 80%), transparent);
}
.dashboard-panel h3 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin-bottom: 1rem;
}
.panel-error {
  color: var(--destructive);
  font-size: 0.875rem;
  padding: 1rem 0;
}

/* ── Expiry table row colors ───────────────────── */
tr.expiry-critical td { background-color: #fdf2f2; }
tr.expiry-warning td  { background-color: #fdf7ee; }

@media (prefers-color-scheme: dark) {
  tr.expiry-critical td { background-color: #3d1c1c; }
  tr.expiry-warning td  { background-color: #3d2e0d; }
}
[data-theme="dark"] tr.expiry-critical td { background-color: #3d1c1c; }
[data-theme="dark"] tr.expiry-warning td  { background-color: #3d2e0d; }
[data-theme="light"] tr.expiry-critical td { background-color: #fdf2f2; }
[data-theme="light"] tr.expiry-warning td  { background-color: #fdf7ee; }

/* ── Back link ─────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
  transition: color 0.15s;
}
.back-link:hover { color: var(--foreground); }

/* ── Search input ──────────────────────────────── */
.search-input {
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  background: var(--card);
  color: var(--foreground);
  outline: none;
  width: 16rem;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--ring); }

/* ── Split-view layout ─────────────────────────── */
.split-view {
    display: flex;
    flex-direction: column;
    flex: 1;       /* fill remaining space inside .site-main */
    min-height: 0; /* allow flex shrink below content height */
}
.split-list {
    flex: 0 0 55%;
    overflow-y: auto;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}
.split-divider-label {
    padding: 0.5rem 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
}
.split-detail {
    flex: 1;
    overflow-y: auto;
    padding-top: 0.75rem;
}
.split-detail-placeholder {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    padding: 1.5rem 0;
}
.split-list-header {
    position: sticky;
    top: 0;
    background: var(--background);
    z-index: 2;
    padding-bottom: 0.75rem;
}

/* Inside .split-list/.split-detail, the wrapper must not create its own scroll
   container — any non-visible overflow would intercept position:sticky on thead th.
   overflow:clip clips visually (preserving border-radius) without making a
   scroll container, so sticky anchors correctly to the panel scroller. */
.split-list .table-wrapper,
.split-detail .table-wrapper {
    overflow: clip;
}

/* ── Status filter chips (Licenses view) ──────────────── */
.chip {
    display: inline-flex;
    align-items: center;
    padding: .25rem .8rem;
    border-radius: 999px;
    font-size: .75rem;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    opacity: .45;
    transition: opacity .15s;
}
.chip.chip-on       { opacity: 1; }
.chip-active        { background: #e0f0e8; color: #1e6e3a; border-color: #a8d5ba; }
.chip-expiring      { background: #faecd4; color: #7a4a12; border-color: #e8c98a; }
.chip-expired       { background: #f5dada; color: #8a1a1a; border-color: #e0a0a0; }

@media (prefers-color-scheme: dark) {
  .chip-active        { background: #1a3a2a; color: #56d364; border-color: #2d5c40; }
  .chip-expiring      { background: #3a2f1a; color: #e3b341; border-color: #5c4a28; }
  .chip-expired       { background: #3a1a1a; color: #f85149; border-color: #5c2828; }
}
[data-theme="dark"] .chip-active        { background: #1a3a2a; color: #56d364; border-color: #2d5c40; }
[data-theme="dark"] .chip-expiring      { background: #3a2f1a; color: #e3b341; border-color: #5c4a28; }
[data-theme="dark"] .chip-expired       { background: #3a1a1a; color: #f85149; border-color: #5c2828; }
[data-theme="light"] .chip-active        { background: #e0f0e8; color: #1e6e3a; border-color: #a8d5ba; }
[data-theme="light"] .chip-expiring      { background: #faecd4; color: #7a4a12; border-color: #e8c98a; }
[data-theme="light"] .chip-expired       { background: #f5dada; color: #8a1a1a; border-color: #e0a0a0; }

/* ── Stat cards (org / user detail summary row) ── */
.stat-cards {
  display: flex;
  gap: .75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.stat-card {
  flex: 1;
  min-width: 80px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  text-align: center;
  background: var(--card);
  box-shadow: 0 1px 2px color-mix(in oklch, var(--shadow-color) calc(var(--shadow-opacity) * 80%), transparent);
}
.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--foreground);
}
.stat-card-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted-foreground);
  margin-top: .15rem;
}
.stat-card-warn   { background: oklch(0.98 0.03 70); border-color: oklch(0.85 0.08 70); }
.stat-card-warn   .stat-card-value { color: oklch(0.45 0.12 70); }
.stat-card-danger { background: color-mix(in oklch, var(--destructive) 8%, var(--background));
                    border-color: color-mix(in oklch, var(--destructive) 25%, var(--border)); }
.stat-card-danger .stat-card-value { color: var(--destructive); }

/* stat-card-warn has explicit light-mode colors; override for dark */
[data-theme="dark"] .stat-card-warn                  { background: #3a2f1a; border-color: #5c4a28; }
[data-theme="dark"] .stat-card-warn .stat-card-value { color: #e3b341; }
@media (prefers-color-scheme: dark) {
  .stat-card-warn                  { background: #3a2f1a; border-color: #5c4a28; }
  .stat-card-warn .stat-card-value { color: #e3b341; }
}

/* ── Dark mode elevation overrides ────────────── */
/* In dark mode black drop-shadows ARE visible because they deepen the already-
   dark background beneath the card, creating a visible halo of depth. */
[data-theme="dark"] .dashboard-panel,
[data-theme="dark"] .table-wrapper,
[data-theme="dark"] .stat-card {
  box-shadow: 0 8px 32px rgba(0,0,0,.65), 0 2px 8px rgba(0,0,0,.45);
}
@media (prefers-color-scheme: dark) {
  .dashboard-panel,
  .table-wrapper,
  .stat-card {
    box-shadow: 0 8px 32px rgba(0,0,0,.65), 0 2px 8px rgba(0,0,0,.45);
  }
}

/* ── Collapsible sections ─────────────────────── */
.section-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem .75rem;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: .25rem;
  text-align: left;
}
.section-toggle:hover { background: var(--accent); }
.section-toggle .toggle-icon { transition: transform .2s; font-style: normal; }
.section-toggle.open .toggle-icon { transform: rotate(90deg); }
.section-body { display: none; margin-bottom: 1rem; }
.section-body.open { display: block; }

/* ── Pill tabs ───────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: .3rem;
  background: var(--muted);
  border-radius: 6px;
  padding: .2rem;
  margin-bottom: .75rem;
  width: fit-content;
}
.tab-btn {
  padding: .28rem .75rem;
  font-size: .82rem;
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted-foreground);
  border: none;
  background: transparent;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.tab-btn.active {
  background: var(--card);
  color: var(--foreground);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Dark mode: --card and --muted are both #161b22, so active pill needs a border */
@media (prefers-color-scheme: dark) {
  .tab-btn.active { box-shadow: inset 0 0 0 1px var(--border); }
}
[data-theme="dark"] .tab-btn.active { box-shadow: inset 0 0 0 1px var(--border); }


/* ── Login page ───────────────────────────────── */
.login-bg {
  position: fixed;
  inset: 0;
  background: url('/images/login-bg.jpg') center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
}
.login-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
  padding: 3rem 3.5rem;
  background: rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  max-width: 420px;
  width: 90%;
}
[data-theme="dark"] .login-card {
  background: rgba(22, 27, 34, 0.38);
}
.login-btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem 1.5rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: 6px;
  font-weight: 500;
  text-decoration: none;
  font-size: .95rem;
  transition: opacity .15s;
}
.login-btn:hover { opacity: .85; }
/* Hide header/footer on login page */
body.login-page .site-header,
body.login-page .site-footer { display: none; }
body.login-page .site-main { padding: 0; max-width: none; }

/* Inline raw ID shown alongside resolved entity name in event detail panel */
.id-plain { font-size: .75rem; font-family: monospace; color: var(--muted-foreground); margin-left: .35rem; }
