/* === THEME SYSTEM — revert: remove this block, theme toggle in index.html, initTheme() in app.js === */

:root {
  --accent: #a3e635;
  --accent-hover: #84cc16;
  --success: #a3e635;
  --warning: #f59e0b;
  --error: #ef4444;
  --skipped: #6b7280;
  --primary-btn-text: #000000;
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-width: 260px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg-base: #000000;
  --bg-surface: #0a0a0a;
  --bg-elevated: #111111;
  --bg-hover: #1a1a1a;
  --border: #222222;
  --border-subtle: #181818;
  --text: #f0f0f0;
  --text-muted: #a0a0a0;
  --text-dim: #707070;
  --accent-glow: rgba(163, 230, 53, 0.15);
  --body-gradient-1: rgba(163, 230, 53, 0.08);
  --body-gradient-2: rgba(163, 230, 53, 0.04);
  --bg-animation-opacity: 0.75;
  --bg-blob-1: rgba(0, 255, 10, 0.4);
  --bg-blob-2: rgba(0, 156, 6, 0.35);
  --bg-blob-3: rgba(0, 102, 22, 0.3);
  --panel-shadow: none;
  --toast-bg: var(--bg-elevated);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg-base: #eef2e6;
  --bg-surface: #ffffff;
  --bg-elevated: #f7faf2;
  --bg-hover: #e8efd9;
  --border: #c8d4b8;
  --border-subtle: #dce5d0;
  --text: #16210f;
  --text-muted: #4a5a3d;
  --text-dim: #6a7a5d;
  --accent-glow: rgba(101, 163, 13, 0.38);
  --body-gradient-1: rgba(132, 204, 22, 0.32);
  --body-gradient-2: rgba(101, 163, 13, 0.22);
  --bg-animation-opacity: 1;
  --bg-blob-1: rgba(101, 163, 13, 0.82);
  --bg-blob-2: rgba(77, 124, 15, 0.74);
  --bg-blob-3: rgba(54, 94, 11, 0.66);
  --panel-shadow: 0 1px 3px rgba(22, 33, 15, 0.06);
  --toast-bg: #ffffff;
}

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

img {
  -webkit-user-drag: none;
  user-drag: none;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--body-gradient-1), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, var(--body-gradient-2), transparent);
}

.bg-animation {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-animation-square {
  position: absolute;
  top: 50%;
  left: calc(50vw + var(--sidebar-width) / 2);
  transform: translate(-50%, -50%);
  width: min(86vmin, 780px);
  height: min(86vmin, 780px);
  opacity: var(--bg-animation-opacity);
}

.bg-animation-square i {
  position: absolute;
  inset: 0;
  border: 6px solid rgba(163, 230, 53, 0.45);
}

.bg-animation-square i:nth-child(1) {
  border-color: var(--bg-blob-1);
  border-radius: 38% 62% 63% 37% / 41% 44% 56% 59%;
  animation: animate 14s linear infinite;
}

.bg-animation-square i:nth-child(2) {
  border-color: var(--bg-blob-2);
  border-radius: 41% 44% 56% 59% / 38% 62% 63% 37%;
  animation: animate 10s linear infinite;
}

.bg-animation-square i:nth-child(3) {
  border-color: var(--bg-blob-3);
  border-radius: 41% 44% 56% 59% / 38% 62% 63% 37%;
  animation: animate2 22s linear infinite;
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

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

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

.brand-logo {
  height: 48px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

.brand-logo-light {
  display: none;
}

html[data-theme="light"] .brand-logo-dark {
  display: none;
}

html[data-theme="light"] .brand-logo-light {
  display: block;
}

.nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: visible;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: left;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.nav-powered-badge {
  flex-shrink: 0;
  pointer-events: none;
}

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

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.nav-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: visible;
}

.nav-group .nav-group-toggle .nav-item-label,
.nav-group .nav-group-toggle .sidebar-footer-btn-label {
  justify-content: space-between;
}

.nav-chevron-flyout {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.nav-group.expanded .nav-chevron-flyout {
  transform: translateX(2px);
}

.nav-flyout-menu {
  display: none;
  position: fixed;
  z-index: 10010;
  pointer-events: auto;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  min-width: 240px;
  max-width: min(320px, calc(100vw - 24px));
}

.nav-flyout-menu.open {
  display: flex;
}

.nav-flyout-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

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

.nav-flyout-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.nav-flyout-item--with-badge {
  justify-content: space-between;
  gap: 10px;
}

.nav-flyout-item-label {
  flex: 1;
  min-width: 0;
}

.sidebar-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border-subtle);
  overflow: visible;
}

.sidebar-footer-btn {
  margin-top: 8px;
  width: 100%;
  justify-content: flex-start;
}

.sidebar-footer-group {
  margin-top: 8px;
  overflow: visible;
}

.sidebar-footer-group .nav-group-toggle {
  margin-top: 0;
}

.sidebar-footer-btn-label {
  flex: 1;
  text-align: left;
}

.sidebar-footer-group .nav-group-toggle.active,
.sidebar-footer [data-view].active {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: transparent;
}

.theme-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

html[data-theme="dark"] .theme-icon-moon,
html[data-theme="light"] .theme-icon-sun {
  display: none;
}

html[data-theme="light"] .status-pill.success {
  background: rgba(26, 77, 46, 0.2);
  color: #14532d;
  border: 1px solid rgba(26, 77, 46, 0.35);
}

html[data-theme="light"] .badge {
  background: rgba(26, 77, 46, 0.18);
  color: #14532d;
  border: 1px solid rgba(26, 77, 46, 0.32);
  font-weight: 600;
}

html[data-theme="light"] .src-badge.online {
  color: #1a4d2e;
  background: rgba(26, 77, 46, 0.14);
  border-color: rgba(26, 77, 46, 0.7);
  box-shadow: 0 0 14px rgba(26, 77, 46, 0.38);
}

html[data-theme="light"] .src-badge.offline {
  color: #7f1d1d;
  background: rgba(127, 29, 29, 0.12);
  border-color: rgba(127, 29, 29, 0.7);
  box-shadow: 0 0 14px rgba(127, 29, 29, 0.38);
}

html[data-theme="light"] .nav-item.active,
html[data-theme="light"] .nav-flyout-item.active,
html[data-theme="light"] .sidebar-footer [data-view].active,
html[data-theme="light"] .sidebar-footer-group .nav-group-toggle.active,
html[data-theme="light"] .nav-osint-group .nav-group-toggle.active,
html[data-theme="light"] .nav-officer-group .nav-group-toggle.active {
  background: #1a4d2e;
  color: #ffffff;
  font-weight: 600;
}

html[data-theme="light"] .nav-item.active .nav-powered-badge,
html[data-theme="light"] .nav-item.active .nav-online-badge,
html[data-theme="light"] .nav-flyout-item.active .nav-powered-badge,
html[data-theme="light"] .nav-flyout-item.active .nav-online-badge {
  color: #000000;
  background: #a3e635;
  border-color: #84cc16;
  box-shadow: 0 0 14px rgba(163, 230, 53, 0.65);
}

.nav-item.active .nav-online-badge {
  color: var(--accent);
  background: rgba(163, 230, 53, 0.18);
  border-color: rgba(163, 230, 53, 0.65);
  box-shadow: 0 0 14px rgba(163, 230, 53, 0.45);
}

html[data-theme="light"] .nav-item.active .nav-offline-badge.offline,
html[data-theme="light"] .nav-flyout-item.active .nav-offline-badge.offline {
  color: #ffffff;
  background: #dc2626;
  border-color: #ef4444;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.65);
}

html[data-theme="light"] .warning-notice {
  background: rgba(245, 158, 11, 0.14);
}

/* Main */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px 40px;
  max-width: 1400px;
}

.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.view-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.view-title-with-icon {
  display: flex;
  align-items: center;
  gap: 0.45em;
  flex-wrap: wrap;
}

.view-title-label {
  display: flex;
  align-items: center;
  gap: 0.5em;
  min-width: 0;
}

.view-title-icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  color: #b8f055;
  filter: drop-shadow(0 0 8px rgba(184, 240, 85, 0.45));
}

html[data-theme="light"] .view-title-icon {
  color: #1a4d2e;
  filter: drop-shadow(0 0 8px rgba(26, 77, 46, 0.35));
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.source-badges {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.src-badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: box-shadow 0.25s ease, border-color 0.25s ease, color 0.25s ease, background 0.25s ease;
}

.src-badge.online {
  color: var(--success);
  border-color: rgba(163, 230, 53, 0.55);
  background: rgba(163, 230, 53, 0.1);
  box-shadow: 0 0 12px rgba(163, 230, 53, 0.4);
}

.src-badge.offline {
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.1);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.view-title-badges {
  display: flex;
  align-items: center;
  gap: 0.35em;
  flex-shrink: 0;
}

.view-title-badge {
  flex-shrink: 0;
  font-size: 0.36em;
  padding: 0.15em 0.5em;
  pointer-events: none;
}

.view-title-experimental-badge {
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.65);
  background: rgba(239, 68, 68, 0.14);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.55);
}

html[data-theme="light"] .view-title-experimental-badge {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(220, 38, 38, 0.75);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.48);
}

/* Panels */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
  overflow: hidden;
}

.search-layout {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1100px) {
  .search-layout { grid-template-columns: 1fr; }
}

.search-panel { padding: 0; }

.search-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
}

.tab {
  flex: 1;
  padding: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

html[data-theme="light"] .search-tabs .tab.active {
  color: #1a4d2e;
  border-bottom-color: #1a4d2e;
}

.search-form { padding: 24px; }

.search-form select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 2rem 10px 12px;
  background-color: var(--bg-elevated);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23707070' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 0.75rem;
}

html[data-theme="light"] .search-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a5a3d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .search-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.req { color: var(--error); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
select {
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 22px;
  cursor: pointer;
}

.checkbox-label input { width: auto; accent-color: var(--accent); }

.hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: -8px;
}

.captcha-section .label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.captcha-section {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--warning);
}

.warning-notice {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.5;
}

.warning-notice strong {
  color: var(--warning);
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

#captcha-image {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
}

.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--primary-btn-text);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: var(--primary-btn-text);
}
.btn-primary svg {
  stroke: currentColor;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

button[type="reset"].btn-ghost:hover:not(:disabled),
#logout-btn:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.5);
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

.btn-danger {
  background: var(--error);
  color: #ffffff;
  border: 1px solid var(--error);
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

/* Results */
.results-panel {
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

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

.results-header h3 { font-size: 1rem; font-weight: 600; }

.results-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 999px;
}

.empty-state, .loading-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--text-dim);
  text-align: center;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

.results-content {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  padding: 16px;
}

.source-group {
  margin-bottom: 20px;
}

.source-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.source-group-header h4 {
  font-size: 0.85rem;
  font-weight: 600;
}

.status-pill {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
}

.status-pill.success { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.status-pill.partial { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-pill.error { background: rgba(239, 68, 68, 0.15); color: var(--error); }
.status-pill.skipped { background: rgba(107, 114, 128, 0.15); color: var(--skipped); }

.duration {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-left: auto;
}

.record-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}

.record-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.record-card-header:hover { background: var(--bg-hover); }

.record-photo {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-base);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.record-photo-placeholder {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 1.1rem;
  font-weight: 600;
  flex-shrink: 0;
}

.record-summary { flex: 1; min-width: 0; }
.record-name {
  font-weight: 600;
  font-size: 0.95rem;
}
.record-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.record-charge {
  font-size: 0.72rem;
  color: var(--warning);
  margin-top: 3px;
  line-height: 1.2;
  font-family: var(--mono);
}

.record-expand {
  color: var(--text-dim);
  transition: transform 0.2s;
}
.record-card.open .record-expand { transform: rotate(180deg); }

.record-details {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--border-subtle);
}

.record-card.open .record-details { display: block; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding-top: 14px;
}

.detail-item label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.detail-item p {
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 2px;
}

.offense-list {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.offense-list h5 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.offense-item {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.offense-item:last-child { border-bottom: none; }

.record-links {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.record-links a {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
}
.record-links a:hover { text-decoration: underline; }

.record-links .copy-btn {
  font-size: 0.7rem;
  padding: 4px 9px;
  border-radius: 999px;
}
.record-links .copy-btn:hover {
  background: var(--bg-hover);
}

.record-wanted {
  border-color: var(--error);
}

.record-wanted .record-card-header {
  background: rgba(239, 68, 68, 0.035);
}

.record-wanted .record-card-header:hover {
  background: rgba(239, 68, 68, 0.08);
}

.wanted-label {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 3px;
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
  vertical-align: middle;
}

.source-message {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

/* Profile */
.profile-panel {
  padding: 24px;
}

.profile-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}

.profile-photo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.profile-photo-frame {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--bg-base);
}

.profile-upload-btn {
  width: 100%;
  justify-content: center;
  cursor: pointer;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-license-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.profile-license-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-license-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #a3e635;
}

html[data-theme="light"] .profile-license-icon {
  color: #1a4d2e;
}

.profile-license-label {
  font-size: 0.9rem;
  color: var(--text);
}

#profile-license-badge.leo-license {
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(125, 211, 252, 0.7);
  animation: leo-license-pulse 2s ease-in-out infinite;
}

html[data-theme="light"] #profile-license-badge.leo-license {
  color: #0055ff;
  background: rgba(0, 102, 255, 0.12);
  border-color: rgba(0, 85, 255, 0.75);
  animation: leo-license-pulse-light 2s ease-in-out infinite;
}

@keyframes leo-license-pulse {
  0%, 100% {
    box-shadow:
      0 0 10px rgba(56, 189, 248, 0.45),
      0 0 22px rgba(56, 189, 248, 0.28);
    filter: brightness(1);
  }
  50% {
    box-shadow:
      0 0 16px rgba(56, 189, 248, 0.8),
      0 0 34px rgba(56, 189, 248, 0.5);
    filter: brightness(1.08);
  }
}

@keyframes leo-license-pulse-light {
  0%, 100% {
    box-shadow:
      0 0 10px rgba(0, 102, 255, 0.5),
      0 0 24px rgba(0, 102, 255, 0.32);
    filter: brightness(1);
  }
  50% {
    box-shadow:
      0 0 18px rgba(0, 102, 255, 0.92),
      0 0 38px rgba(0, 102, 255, 0.58);
    filter: brightness(1.06);
  }
}

#profile-license-badge.klyde-ai-license {
  color: #b8f055;
  background: rgba(163, 230, 53, 0.14);
  border-color: rgba(184, 240, 85, 0.7);
  animation: klyde-ai-license-pulse 2s ease-in-out infinite;
}

html[data-theme="light"] #profile-license-badge.klyde-ai-license {
  color: #1a4d2e;
  background: rgba(26, 77, 46, 0.14);
  border-color: rgba(26, 77, 46, 0.75);
  animation: klyde-ai-license-pulse-light 2s ease-in-out infinite;
}

@keyframes klyde-ai-license-pulse {
  0%, 100% {
    box-shadow:
      0 0 10px rgba(163, 230, 53, 0.45),
      0 0 22px rgba(163, 230, 53, 0.28);
    filter: brightness(1);
  }
  50% {
    box-shadow:
      0 0 16px rgba(184, 240, 85, 0.8),
      0 0 34px rgba(163, 230, 53, 0.5);
    filter: brightness(1.08);
  }
}

@keyframes klyde-ai-license-pulse-light {
  0%, 100% {
    box-shadow:
      0 0 10px rgba(26, 77, 46, 0.45),
      0 0 24px rgba(26, 77, 46, 0.3);
    filter: brightness(1);
  }
  50% {
    box-shadow:
      0 0 18px rgba(26, 77, 46, 0.85),
      0 0 38px rgba(26, 77, 46, 0.55);
    filter: brightness(1.06);
  }
}

#profile-license-badge.staff-license {
  color: #f87171;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.7);
  animation: staff-license-pulse 2s ease-in-out infinite;
}

html[data-theme="light"] #profile-license-badge.staff-license {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(220, 38, 38, 0.75);
}

@keyframes staff-license-pulse {
  0%, 100% {
    box-shadow:
      0 0 10px rgba(239, 68, 68, 0.5),
      0 0 22px rgba(239, 68, 68, 0.3);
    filter: brightness(1);
  }
  50% {
    box-shadow:
      0 0 18px rgba(239, 68, 68, 0.92),
      0 0 38px rgba(239, 68, 68, 0.58);
    filter: brightness(1.08);
  }
}

.profile-form input[type="text"],
.profile-form input[type="email"],
.profile-form input[type="tel"],
.profile-form input[type="number"] {
  background: var(--bg-base);
}

.equipment-rental-form input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.equipment-rental-form input[type="number"]::-webkit-outer-spin-button,
.equipment-rental-form input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.profile-form input[readonly] {
  color: var(--text-muted);
  cursor: default;
}

#current-user {
  margin: 4px 0 12px;
}

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

.current-user-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  border: 2px solid var(--border-subtle);
}

.current-user-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--primary-btn-text);
  border-color: var(--accent);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

html[data-theme="light"] .current-user-avatar-placeholder {
  background: #1a4d2e;
  color: #ffffff;
  border-color: #1a4d2e;
}

.current-user-text {
  min-width: 0;
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.4;
}

#current-user strong {
  color: var(--text);
  font-weight: 700;
}

.current-user-agency {
  margin-top: 2px;
  font-size: 0.7rem;
}

.current-user-rank {
  margin-top: 1px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.current-user-rank-admin {
  color: #ef4444;
  font-weight: 700;
}

html[data-theme="light"] .current-user-rank-admin {
  color: #dc2626;
}

.profile-status {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--success);
}

.profile-status.error {
  color: var(--error);
}

/* Klyde AI chat */
.ai-chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 560px;
  max-height: calc(100vh - 180px);
}

.ncic-access-denied {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  padding: 60px 24px;
  text-align: center;
}

.ncic-access-denied p {
  max-width: 520px;
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.critical-notice,
.ncic-confidential-notice {
  margin-bottom: 16px;
  padding: 14px 20px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.5;
}

.critical-notice strong,
.ncic-confidential-notice strong {
  color: var(--error);
}

.ai-experimental-notice {
  flex-shrink: 0;
  padding: 14px 20px;
  background: rgba(239, 68, 68, 0.12);
  border-bottom: 1px solid rgba(239, 68, 68, 0.45);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.5;
}

.ai-experimental-notice strong {
  color: var(--error);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-chat-empty {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.ai-suggestion {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ai-suggestion:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.ai-chat-bubble {
  max-width: min(760px, 92%);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-chat-bubble.user {
  align-self: flex-end;
  background: var(--accent-glow);
  color: var(--text);
  border: 1px solid rgba(163, 230, 53, 0.25);
}

.ai-chat-bubble.assistant {
  align-self: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.ai-chat-tools {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-tool-pill {
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(163, 230, 53, 0.12);
  color: var(--accent);
  border: 1px solid rgba(163, 230, 53, 0.25);
}

.ai-result-cards {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-result-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.ai-result-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.ai-result-card p {
  margin: 0;
  color: var(--text-muted);
}

.ai-chat-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
}

.ai-chat-form textarea {
  flex: 1;
  resize: vertical;
  min-height: 44px;
  max-height: 160px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.ai-chat-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.ai-chat-status {
  padding: 0 20px 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ai-chat-status.error {
  color: var(--error);
}

.ai-chat-typing {
  align-self: flex-start;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-style: italic;
}

html[data-theme="light"] .ai-chat-bubble.user {
  background: rgba(101, 163, 13, 0.18);
  border-color: rgba(101, 163, 13, 0.35);
}

html[data-theme="light"] .ai-tool-pill {
  background: rgba(26, 77, 46, 0.12);
  color: #1a4d2e;
  border-color: rgba(26, 77, 46, 0.25);
}

@media (max-width: 768px) {
  .profile-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .profile-photo-section {
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
  }

  .ai-chat-panel {
    min-height: 420px;
    max-height: none;
  }

  .ai-chat-form {
    flex-direction: column;
    align-items: stretch;
  }

  .ai-chat-form .btn {
    width: 100%;
  }
}

/* Equipment rental */
.my-active-rentals-btn {
  padding: 9px 18px;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.my-active-rentals-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #000000;
  border-color: var(--accent);
}

html[data-theme="light"] .my-active-rentals-btn:hover:not(:disabled) {
  background: #1a4d2e;
  color: #ffffff;
  border-color: #1a4d2e;
}

.equipment-rental-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.equipment-rental-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
  overflow: visible;
}

.equipment-rental-card-media {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
  border-bottom: 1px solid var(--border-subtle);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  overflow: visible;
}

html[data-theme="light"] .equipment-rental-card-media {
  background: linear-gradient(180deg, rgba(22, 33, 15, 0.03), transparent);
}

.equipment-rental-card-media img {
  display: block;
  width: auto;
  height: 220px;
  max-width: 100%;
  object-fit: contain;
  object-position: center;
  animation: equipment-product-glow 3.2s ease-in-out infinite;
}

html[data-theme="light"] .equipment-rental-card-media img {
  animation: equipment-product-glow-light 3.2s ease-in-out infinite;
}

.equipment-rental-card-tac-patrol .equipment-rental-card-media {
  min-height: 300px;
}

.equipment-rental-card-tac-patrol .equipment-rental-card-media img {
  height: 260px;
}

@keyframes equipment-product-glow {
  0%, 100% {
    filter:
      drop-shadow(0 0 10px rgba(163, 230, 53, 0.62))
      drop-shadow(0 0 20px rgba(163, 230, 53, 0.44))
      drop-shadow(0 0 36px rgba(163, 230, 53, 0.3));
  }
  50% {
    filter:
      drop-shadow(0 0 12px rgba(163, 230, 53, 0.74))
      drop-shadow(0 0 24px rgba(163, 230, 53, 0.52))
      drop-shadow(0 0 40px rgba(163, 230, 53, 0.36));
  }
}

@keyframes equipment-product-glow-light {
  0%, 100% {
    filter:
      drop-shadow(0 0 10px rgba(26, 77, 46, 0.48))
      drop-shadow(0 0 20px rgba(26, 77, 46, 0.32))
      drop-shadow(0 0 36px rgba(26, 77, 46, 0.2));
  }
  50% {
    filter:
      drop-shadow(0 0 12px rgba(26, 77, 46, 0.58))
      drop-shadow(0 0 24px rgba(26, 77, 46, 0.4))
      drop-shadow(0 0 40px rgba(26, 77, 46, 0.26));
  }
}

.equipment-rental-card-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.equipment-rental-card-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.equipment-rental-card-logo {
  width: auto;
  max-width: 120px;
  height: auto;
  object-fit: contain;
}

.equipment-rental-card-logo-wide {
  max-width: 150px;
}

.equipment-rental-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.equipment-rental-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.equipment-availability-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--warning);
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.55);
}

html[data-theme="light"] .equipment-availability-badge {
  color: #b45309;
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(217, 119, 6, 0.65);
}

.equipment-in-stock-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--success);
  background: rgba(163, 230, 53, 0.14);
  border: 1px solid rgba(163, 230, 53, 0.55);
}

html[data-theme="light"] .equipment-in-stock-badge {
  color: #1a4d2e;
  background: rgba(26, 77, 46, 0.14);
  border-color: rgba(26, 77, 46, 0.65);
}

.equipment-out-of-stock-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--error);
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.55);
}

html[data-theme="light"] .equipment-out-of-stock-badge {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(220, 38, 38, 0.65);
}

.equipment-rental-price-na {
  color: var(--text-muted);
}

html[data-theme="light"] .equipment-rental-price-na {
  color: var(--text-dim);
}

.equipment-rental-card-unavailable .equipment-rental-start-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.equipment-rental-price {
  text-align: right;
  flex-shrink: 0;
  line-height: 1.2;
}

.equipment-rental-price-amount {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--success);
}

html[data-theme="light"] .equipment-rental-price-amount {
  color: #1a4d2e;
}

.equipment-rental-price-period {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  line-height: 1.05;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.equipment-rental-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: center;
}

.equipment-rental-start-btn {
  align-self: center;
  margin-top: 4px;
}

body.modal-open {
  overflow: hidden;
}

.equipment-rental-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.78);
  background-image: radial-gradient(ellipse 80% 55% at 50% 45%, rgba(163, 230, 53, 0.1), transparent 70%);
}

.equipment-rental-modal-card {
  width: min(92vw, 560px);
  padding: 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.equipment-rental-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.equipment-rental-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.equipment-rental-modal-subtitle {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.equipment-rental-form .field-row {
  margin-bottom: 14px;
}

.equipment-rental-units-hint {
  margin: -4px 0 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.equipment-rental-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.search-reason-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.78);
  background-image: radial-gradient(ellipse 80% 55% at 50% 45%, rgba(163, 230, 53, 0.1), transparent 70%);
  z-index: 10000;
}

.search-reason-modal-card {
  width: min(92vw, 520px);
  padding: 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.search-reason-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.search-reason-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.search-reason-modal-subtitle {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.search-reason-warning {
  margin-bottom: 20px;
  padding: 14px 16px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.5;
}

.search-reason-warning strong {
  color: var(--error);
}

html[data-theme="light"] .search-reason-warning {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(220, 38, 38, 0.55);
}

html[data-theme="light"] .search-reason-warning strong {
  color: #b91c1c;
}

.search-reason-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.search-reason-form select {
  width: 100%;
}

.search-reason-form textarea {
  width: 100%;
  min-height: 110px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-reason-form textarea::placeholder {
  color: var(--text-dim);
}

.search-reason-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-reason-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.admin-equipment-rental-panel {
  display: flex;
  flex-direction: column;
}

/* Sources grid */
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.source-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px;
}

.source-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.source-card h3 {
  font-size: 1rem;
  font-weight: 600;
}

.source-card .agency {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.health-dot.ok { background: var(--success); box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
.health-dot.down { background: var(--error); }
.health-dot.unknown { background: var(--text-dim); }

.source-card p.desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.capability-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cap-tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 3px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-dim);
}

.source-card-footer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.source-card-footer a {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
}

/* Generic table used for results / lists */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.audit-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.audit-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
  vertical-align: top;
}

.audit-table td.mono {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.audit-table tr:hover td { background: var(--bg-hover); }

.deactivated-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #000000;
  background-image: radial-gradient(ellipse 80% 55% at 50% 45%, rgba(239, 68, 68, 0.1), transparent 70%);
}

.deactivated-overlay .square {
  position: relative;
  width: 500px;
  height: 500px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.deactivated-overlay .square i {
  position: absolute;
  inset: 0;
  border: 4px solid var(--clr);
  filter: drop-shadow(0 0 18px var(--clr));
  opacity: 0.92;
}

.deactivated-overlay .square i:nth-child(1) {
  border-radius: 38% 62% 63% 37% / 41% 44% 56% 59%;
  animation:
    animate 6s linear infinite,
    splash-blob-glow 2.6s ease-in-out infinite;
}

.deactivated-overlay .square i:nth-child(2) {
  border-radius: 41% 44% 56% 59% / 38% 62% 63% 37%;
  animation:
    animate 4s linear infinite,
    splash-blob-glow 3.1s ease-in-out infinite 0.45s;
}

.deactivated-overlay .square i:nth-child(3) {
  border-radius: 41% 44% 56% 59% / 38% 62% 63% 37%;
  animation:
    animate2 10s linear infinite,
    splash-blob-glow 3.6s ease-in-out infinite 0.9s;
}

.deactivated-content {
  position: absolute;
  z-index: 1;
  width: min(100%, 560px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 16px;
}

.deactivated-panel {
  width: 100%;
  padding: 32px 28px;
  text-align: center;
  background: rgba(6, 2, 2, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 2px solid rgba(239, 68, 68, 0.55);
  border-radius: var(--radius);
  box-shadow:
    0 0 18px rgba(239, 68, 68, 0.45),
    0 0 42px rgba(239, 68, 68, 0.25);
  animation: deactivated-panel-pulse 2s ease-in-out infinite;
}

.deactivated-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  color: #ffffff;
}

.deactivated-icon svg {
  width: 44px;
  height: 44px;
}

.deactivated-title {
  margin: 0 0 14px;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  animation: deactivated-title-pulse 2s ease-in-out infinite;
}

.deactivated-message {
  margin: 0 0 24px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.92);
  white-space: pre-line;
}

.deactivated-panel .btn-ghost {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(0, 0, 0, 0.32);
}

.deactivated-panel .btn-ghost:hover:not(:disabled) {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.1);
}

html[data-theme="light"] .deactivated-panel {
  background: rgba(255, 252, 252, 0.96);
  border-color: rgba(220, 38, 38, 0.75);
}

html[data-theme="light"] .deactivated-icon {
  background: rgba(239, 68, 68, 0.14);
  color: #991b1b;
}

html[data-theme="light"] .deactivated-title {
  color: #7f1d1d;
  animation: deactivated-title-pulse-light 2s ease-in-out infinite;
}

html[data-theme="light"] .deactivated-message {
  color: #450a0a;
}

html[data-theme="light"] .deactivated-panel .btn-ghost {
  color: #7f1d1d;
  border-color: rgba(127, 29, 29, 0.35);
  background: rgba(255, 255, 255, 0.72);
}

html[data-theme="light"] .deactivated-panel .btn-ghost:hover:not(:disabled) {
  color: #450a0a;
  border-color: rgba(127, 29, 29, 0.55);
  background: rgba(254, 242, 242, 0.95);
}

@keyframes deactivated-panel-pulse {
  0%, 100% {
    box-shadow:
      0 0 14px rgba(239, 68, 68, 0.45),
      0 0 30px rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.55);
  }
  50% {
    box-shadow:
      0 0 24px rgba(239, 68, 68, 0.92),
      0 0 52px rgba(239, 68, 68, 0.55);
    border-color: rgba(248, 113, 113, 0.95);
  }
}

@keyframes deactivated-title-pulse {
  0%, 100% {
    text-shadow:
      0 1px 2px rgba(0, 0, 0, 0.65),
      0 0 10px rgba(255, 255, 255, 0.18);
    filter: brightness(1);
  }
  50% {
    text-shadow:
      0 1px 3px rgba(0, 0, 0, 0.75),
      0 0 18px rgba(255, 255, 255, 0.42);
    filter: brightness(1.04);
  }
}

@keyframes deactivated-title-pulse-light {
  0%, 100% {
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.55);
    filter: brightness(1);
  }
  50% {
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.85);
    filter: brightness(1.02);
  }
}

body.deactivated-active .app {
  pointer-events: none;
  user-select: none;
}

.admin-staff-notice {
  margin-bottom: 24px;
  padding: 14px 20px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.5;
}

.admin-staff-notice strong {
  color: var(--error);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.admin-users-panel {
  display: flex;
  flex-direction: column;
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.admin-panel-header h3,
.admin-form-panel h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.admin-panel-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.admin-users-table-wrap {
  overflow-x: auto;
}

.admin-users-table-wrap .loading-text {
  margin: 0;
  padding: 48px 24px;
  text-align: center;
}

.admin-users-table-wrap .audit-table th:first-child,
.admin-users-table-wrap .audit-table td:first-child {
  padding-left: 20px;
}

.admin-users-table-wrap .audit-table th:last-child,
.admin-users-table-wrap .audit-table td:last-child {
  padding-right: 20px;
  white-space: nowrap;
}

.admin-users-table-wrap .audit-table tr:last-child td {
  border-bottom: none;
}

.admin-form-panel {
  padding: 24px;
}

.admin-form-panel h3 {
  margin-bottom: 20px;
}

.admin-user-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.admin-user-form .field-row {
  margin-bottom: 16px;
}

.admin-user-form .field-row:last-of-type {
  margin-bottom: 0;
}

.admin-user-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  color: var(--text);
  font: inherit;
}

.admin-license-field-row {
  margin-bottom: 16px;
}

.admin-license-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
}

.admin-license-picker-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
}

.admin-license-picker-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
}

.admin-license-picker-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.admin-license-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(163, 230, 53, 0.35);
  background: var(--accent-glow);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}

html[data-theme="light"] .admin-license-tag {
  border-color: rgba(101, 163, 13, 0.35);
}

.admin-license-picker-btn {
  align-self: flex-start;
}

#admin-license-modal.admin-license-overlay,
.admin-license-overlay {
  position: fixed !important;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.82);
  background-image: radial-gradient(ellipse 80% 55% at 50% 45%, rgba(163, 230, 53, 0.08), transparent 70%);
  z-index: 10001;
}

body.admin-license-modal-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

.admin-license-modal-card {
  width: min(92vw, 480px);
  max-height: min(90vh, 640px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55);
  opacity: 1;
}

html[data-theme="dark"] .admin-license-modal-card {
  background: #111111;
  border-color: #2a2a2a;
}

html[data-theme="light"] .admin-license-modal-card {
  background: #ffffff;
  border-color: #c8d4b8;
}

.admin-license-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.admin-license-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.admin-license-modal-subtitle {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.admin-license-modal-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding: 2px;
  margin-bottom: 16px;
  flex: 1 1 auto;
}

.admin-license-option-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

html[data-theme="dark"] .admin-license-option-card {
  background: #1a1a1a;
  border-color: #333333;
}

html[data-theme="light"] .admin-license-option-card {
  background: #f7faf2;
  border-color: #d5dfc8;
}

.admin-license-option-card:hover {
  border-color: rgba(163, 230, 53, 0.55);
  background: var(--bg-hover);
}

.admin-license-option-card.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: inset 0 0 0 1px rgba(163, 230, 53, 0.35);
}

.admin-license-option-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.admin-license-option-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.admin-license-option-check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: transparent;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.admin-license-option-card.selected .admin-license-option-check {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--primary-btn-text);
}

.admin-license-option-card.admin-license-option-wide {
  grid-column: 1 / -1;
}

.admin-license-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  margin-top: 0;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
}

.admin-license-option-ncic-badge {
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.45);
  background: rgba(96, 165, 250, 0.12);
  color: #93c5fd;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

html[data-theme="light"] .admin-license-option-ncic-badge {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

.admin-ncic-password-overlay {
  z-index: 10002;
}

.admin-ncic-password-modal-card {
  width: min(92vw, 420px);
  padding: 22px;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55);
}

.admin-ncic-password-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-ncic-password-modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.admin-ncic-password-modal-subtitle {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.admin-ncic-password-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-ncic-password-field span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
}

.admin-ncic-password-field input,
.admin-ncic-password-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-ncic-password-field textarea {
  resize: vertical;
  min-height: 110px;
}

.admin-ncic-password-field input::placeholder,
.admin-ncic-password-field textarea::placeholder {
  color: var(--text-dim);
}

.admin-ncic-password-field input:focus,
.admin-ncic-password-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.admin-ncic-password-error {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--danger);
}

.admin-ncic-password-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.admin-users-table .license-cell {
  max-width: 220px;
  white-space: normal;
  line-height: 1.35;
}

.admin-password-hint {
  margin: 8px 0 20px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
  padding-top: 4px;
}

.admin-form-status {
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--success);
}

.admin-form-status.error {
  color: var(--error);
}

.admin-audit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.admin-audit-panel {
  display: flex;
  flex-direction: column;
}

.admin-audit-form-panel {
  padding: 24px;
}

.admin-audit-form-panel h3 {
  margin: 0 0 20px;
  font-size: 1rem;
  font-weight: 700;
}

.admin-audit-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.admin-audit-form .field-row {
  margin-bottom: 16px;
}

.admin-audit-form textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
}

.admin-audit-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.admin-audit-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  color: var(--text);
  font: inherit;
}

.admin-audit-row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-audit-panel .admin-panel-actions {
  align-items: center;
}

.admin-audit-panel .admin-panel-actions > .btn-sm {
  justify-content: center;
  white-space: nowrap;
}

.admin-audit-limit.btn {
  gap: 0;
  padding: 6px 10px;
  cursor: default;
}

.admin-audit-limit select {
  appearance: none;
  -webkit-appearance: none;
  width: 3.4rem;
  margin: 0;
  padding: 0 14px 0 2px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 10px 10px;
}

.admin-audit-limit select:focus {
  outline: none;
}

.admin-audit-search {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-audit-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-audit-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.admin-audit-search-input::placeholder {
  color: var(--text-dim);
}

.admin-audit-table-wrap {
  overflow-x: auto;
}

.admin-audit-table-wrap .loading-text {
  margin: 0;
  padding: 48px 24px;
  text-align: center;
}

.admin-audit-table-wrap .audit-table th:first-child,
.admin-audit-table-wrap .audit-table td:first-child {
  padding-left: 20px;
  white-space: nowrap;
}

.admin-audit-table-wrap .audit-table th:last-child,
.admin-audit-table-wrap .audit-table td:last-child {
  padding-right: 20px;
}

.admin-audit-table-wrap .audit-table tr:last-child td {
  border-bottom: none;
}

.admin-audit-action {
  font-weight: 600;
  color: var(--text);
}

.admin-audit-details {
  max-width: 420px;
  word-break: break-word;
}

.loading-text {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 24px;
}

.hidden { display: none !important; }

.login-overlay {
  position: fixed;
  inset: 0;
  background: #000000;
  background-image: radial-gradient(ellipse 80% 55% at 50% 45%, rgba(0, 255, 10, 0.07), transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}

#post-login-splash {
  z-index: 10002;
}

#toast,
#logout-confirm-modal,
#equipment-rental-modal,
#equipment-rental-success-modal,
#barcode-modal,
.photo-lightbox {
  z-index: 10000;
}

.equipment-rental-success-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
  background-image: radial-gradient(ellipse 80% 55% at 50% 45%, rgba(163, 230, 53, 0.08), transparent 70%);
}

.equipment-rental-success-panel {
  width: min(92vw, 420px);
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid rgba(163, 230, 53, 0.55);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(163, 230, 53, 0.15);
  text-align: center;
}

.equipment-rental-success-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(163, 230, 53, 0.15);
  color: var(--success);
}

.equipment-rental-success-icon svg {
  width: 28px;
  height: 28px;
}

.equipment-rental-success-panel h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  color: var(--success);
}

html[data-theme="light"] .equipment-rental-success-panel h3 {
  color: #1a4d2e;
}

html[data-theme="light"] .equipment-rental-success-panel {
  border-color: rgba(26, 77, 46, 0.45);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(26, 77, 46, 0.12);
}

html[data-theme="light"] .equipment-rental-success-icon {
  background: rgba(26, 77, 46, 0.12);
  color: #1a4d2e;
}

.equipment-rental-success-panel p {
  margin: 0 0 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.equipment-rental-success-actions {
  display: flex;
  justify-content: center;
}

.logout-confirm-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
}

.logout-confirm-panel {
  width: min(92vw, 380px);
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid rgba(239, 68, 68, 0.55);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(239, 68, 68, 0.15);
  text-align: center;
}

.logout-confirm-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.logout-confirm-icon svg {
  width: 28px;
  height: 28px;
}

.logout-confirm-panel h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: var(--error);
}

.logout-confirm-panel p {
  margin: 0 0 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.logout-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.logout-confirm-actions .btn {
  min-width: 108px;
  justify-content: center;
  text-align: center;
}

#logout-confirm-yes {
  animation: logout-danger-pulse 1.8s ease-in-out infinite;
}

#logout-confirm-yes:hover:not(:disabled) {
  animation: logout-danger-pulse 1.2s ease-in-out infinite;
}

@keyframes logout-danger-pulse {
  0%, 100% {
    box-shadow:
      0 0 8px rgba(239, 68, 68, 0.5),
      0 0 18px rgba(239, 68, 68, 0.28);
    filter: brightness(1);
  }
  50% {
    box-shadow:
      0 0 14px rgba(239, 68, 68, 0.85),
      0 0 28px rgba(239, 68, 68, 0.55),
      0 0 42px rgba(239, 68, 68, 0.3);
    filter: brightness(1.08);
  }
}

/* POST-LOGIN SPLASH — revert: remove this block, splash HTML in index.html, showPostLoginSplash() in app.js */

body.splash-active {
  overflow: hidden;
}

.post-login-splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  background-image: radial-gradient(ellipse 80% 55% at 50% 45%, rgba(0, 255, 10, 0.08), transparent 70%);
  padding: 24px;
}

.splash-square {
  position: relative;
  width: min(92vw, 520px);
  height: min(92vw, 520px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-square i {
  position: absolute;
  inset: 0;
  border-style: solid;
  border-color: #ffffff;
  border-width: 2px;
  opacity: 0.92;
}

.splash-square i:nth-child(1) {
  border-radius: 38% 62% 63% 37% / 41% 44% 56% 59%;
  animation: animate 6s linear infinite;
}

.splash-square i:nth-child(2) {
  border-radius: 41% 44% 56% 59% / 38% 62% 63% 37%;
  animation: animate 4s linear infinite;
}

.splash-square i:nth-child(3) {
  border-radius: 41% 44% 56% 59% / 38% 62% 63% 37%;
  animation: animate2 10s linear infinite;
}

.splash-square.splash-rings-expand i:nth-child(1) {
  animation:
    animate 6s linear infinite,
    splash-blob-glow 2.6s ease-in-out infinite,
    splash-ring-thicken 0.9s ease-out forwards;
}

.splash-square.splash-rings-expand i:nth-child(2) {
  animation:
    animate 4s linear infinite,
    splash-blob-glow 3.1s ease-in-out infinite 0.45s,
    splash-ring-thicken 0.9s ease-out forwards;
}

.splash-square.splash-rings-expand i:nth-child(3) {
  animation:
    animate2 10s linear infinite,
    splash-blob-glow 3.6s ease-in-out infinite 0.9s,
    splash-ring-thicken 0.9s ease-out forwards;
}

@keyframes splash-ring-thicken {
  from {
    border-width: 2px;
    border-color: #ffffff;
  }
  to {
    border-width: 12px;
    border-color: var(--clr);
  }
}

@keyframes splash-blob-glow {
  0%, 100% {
    filter: drop-shadow(0 0 10px var(--clr));
    box-shadow:
      0 0 18px color-mix(in srgb, var(--clr) 40%, transparent),
      inset 0 0 14px color-mix(in srgb, var(--clr) 18%, transparent);
    opacity: 0.82;
  }
  50% {
    filter: drop-shadow(0 0 26px var(--clr));
    box-shadow:
      0 0 44px color-mix(in srgb, var(--clr) 72%, transparent),
      inset 0 0 26px color-mix(in srgb, var(--clr) 34%, transparent);
    opacity: 1;
  }
}

.splash-core {
  position: absolute;
  z-index: 1;
  width: min(85%, 320px);
  text-align: center;
  padding: 0 16px;
}

.splash-logo {
  width: min(210px, 64vw);
  height: auto;
  display: block;
  margin: 0 auto 22px;
  animation: splash-logo-pulse 2.6s ease-in-out infinite;
}

@keyframes splash-logo-pulse {
  0%, 100% {
    transform: scale(0.96);
    filter: drop-shadow(0 0 10px rgba(163, 230, 53, 0.35));
    opacity: 0.86;
  }
  50% {
    transform: scale(1.04);
    filter: drop-shadow(0 0 26px rgba(163, 230, 53, 0.8));
    opacity: 1;
  }
}

.splash-status {
  margin: 0 0 18px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: #a3e635;
  text-shadow:
    0 0 12px rgba(163, 230, 53, 0.45),
    0 0 24px rgba(163, 230, 53, 0.2);
  min-height: 3em;
}

.splash-status.splash-status-update {
  animation: splash-status-change 0.5s ease;
}

.splash-progress {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.splash-progress-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #1a4d2e, #84cc16, #bef264);
  box-shadow: 0 0 12px rgba(163, 230, 53, 0.55);
  animation: splash-progress 7s linear forwards;
}

@keyframes splash-status-change {
  0% { opacity: 0.35; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes splash-progress {
  to { width: 100%; }
}

.login-overlay .square {
  position: relative;
  width: 500px;
  height: 500px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-overlay .square i {
  position: absolute;
  inset: 0;
  border: 2px solid #fff;
  transition: 0.5s;
}

.login-overlay .square i:nth-child(1) {
  border-radius: 38% 62% 63% 37% / 41% 44% 56% 59%;
  animation: animate 6s linear infinite;
}

.login-overlay .square i:nth-child(2) {
  border-radius: 41% 44% 56% 59% / 38% 62% 63% 37%;
  animation: animate 4s linear infinite;
}

.login-overlay .square i:nth-child(3) {
  border-radius: 41% 44% 56% 59% / 38% 62% 63% 37%;
  animation: animate2 10s linear infinite;
}

.login-overlay .square:hover i {
  border: 6px solid var(--clr);
  filter: drop-shadow(0 0 20px var(--clr));
}

@keyframes animate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes animate2 {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

.login-overlay .login {
  position: absolute;
  width: min(100%, 340px);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  font-family: var(--font);
  z-index: 1;
}

.login-card {
  width: 100%;
  padding: 28px 24px 24px;
  background: rgba(6, 10, 6, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(163, 230, 53, 0.22);
  border-radius: 16px;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: opacity 0.45s ease, transform 0.45s ease, filter 0.45s ease;
}

.login-card.login-card-exit {
  opacity: 0;
  transform: scale(0.94) translateY(-14px);
  filter: blur(8px);
  pointer-events: none;
}

.login-overlay.login-transitioning {
  z-index: 10003;
}

.login-overlay.login-overlay-exit {
  opacity: 0;
  transition: opacity 0.42s ease;
  pointer-events: none;
}

.post-login-splash .splash-core.splash-core-enter {
  animation: splash-core-enter 0.55s ease forwards;
}

@keyframes splash-core-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo {
  width: min(200px, 72vw);
  height: auto;
  display: block;
  margin: 0 auto 12px;
}

.login-tagline {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.62);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.login-field input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  color: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.login-field input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.login-field input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(163, 230, 53, 0.55);
  box-shadow: 0 0 0 3px rgba(163, 230, 53, 0.14);
}

.login-submit {
  width: 100%;
  margin-top: 6px;
  padding: 13px 18px;
  border: 1px solid rgba(190, 242, 100, 0.35);
  border-radius: 10px;
  background: linear-gradient(
    120deg,
    #1a4d2e 0%,
    #2f6b3a 32%,
    #4d7c0f 58%,
    #84cc16 82%,
    #bef264 100%
  );
  color: #000000;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow:
    0 0 4px rgba(255, 255, 255, 1),
    0 0 14px rgba(255, 255, 255, 0.9),
    0 0 24px rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease, box-shadow 0.15s ease;
  box-shadow:
    0 4px 20px rgba(26, 77, 46, 0.45),
    0 2px 10px rgba(163, 230, 53, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.login-submit:hover {
  filter: brightness(1.08) saturate(1.05);
  box-shadow:
    0 6px 26px rgba(26, 77, 46, 0.5),
    0 3px 14px rgba(163, 230, 53, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.login-submit:active {
  transform: scale(0.98);
}

.login-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 68, 68, 0.12);
  border: 1px solid rgba(255, 68, 68, 0.35);
  color: #ff6b6b;
  font-size: 0.82rem;
  line-height: 1.4;
  text-align: center;
}

/* Barcode scanner modal */
#barcode-modal .modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}
#qr-reader {
  background: #000;
}
#qr-reader video {
  width: 100% !important;
  height: auto !important;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--toast-bg);
  border: 1px solid var(--border);
  box-shadow: var(--panel-shadow);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  animation: slideIn 0.25s ease;
}

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

@keyframes slideIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* FOIL mugshot expandable */
.record-photo {
  cursor: zoom-in;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}
.record-photo:hover {
  box-shadow: 0 0 0 3px var(--accent);
  transform: scale(1.03);
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}
.photo-lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border);
  background: #0a0c10;
  object-fit: contain;
}
.photo-lightbox .close {
  position: absolute;
  top: 16px;
  right: 24px;
  font-size: 32px;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  opacity: 0.85;
  user-select: none;
}
.photo-lightbox .close:hover {
  opacity: 1;
}

/* === MOBILE RESPONSIVE — revert: remove this block, mobile-topbar/backdrop in index.html, initMobileNav() in app.js === */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.mobile-topbar,
.sidebar-backdrop {
  display: none;
}

.mobile-topbar-logo-light {
  display: none;
}

html[data-theme="light"] .mobile-topbar-logo-dark {
  display: none;
}

html[data-theme="light"] .mobile-topbar-logo-light {
  display: block;
}

@media (max-width: 1024px) {
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 180;
    height: calc(52px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
  }

  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-menu-toggle svg {
    width: 22px;
    height: 22px;
  }

  .mobile-topbar-logo {
    height: 32px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  body.mobile-nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 200;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    padding: calc(68px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    max-width: none;
  }

  .bg-animation-square {
    left: 50%;
    width: min(92vmin, 560px);
    height: min(92vmin, 560px);
  }

  .view-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 20px;
  }

  .view-header h2 {
    font-size: 1.45rem;
  }

  .results-header {
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
  }

  .results-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .results-panel {
    min-height: 360px;
  }

  .results-content {
    max-height: none;
    padding: 12px;
  }

  .search-form {
    padding: 18px 16px;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

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

  .admin-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .admin-panel-header {
    flex-wrap: wrap;
    padding: 14px 16px;
  }

  .admin-panel-actions {
    width: 100%;
  }

  .admin-form-panel {
    padding: 20px 16px;
  }

  .admin-license-modal-options {
    grid-template-columns: 1fr;
  }

  .admin-users-table-wrap .audit-table th:first-child,
  .admin-users-table-wrap .audit-table td:first-child {
    padding-left: 16px;
  }

  .admin-users-table-wrap .audit-table th:last-child,
  .admin-users-table-wrap .audit-table td:last-child {
    padding-right: 16px;
  }

  .admin-audit-table-wrap .audit-table th:first-child,
  .admin-audit-table-wrap .audit-table td:first-child {
    padding-left: 16px;
  }

  .admin-audit-table-wrap .audit-table th:last-child,
  .admin-audit-table-wrap .audit-table td:last-child {
    padding-right: 16px;
  }

  .admin-audit-panel .admin-panel-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .admin-audit-panel .admin-panel-actions > .btn-sm {
    width: 100%;
    justify-content: center;
  }

  .admin-audit-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .admin-audit-form-panel {
    padding: 20px 16px;
  }

  .admin-audit-search {
    padding: 14px 16px 12px;
  }

  .source-group-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .source-group-header .duration {
    margin-left: 0;
    width: 100%;
  }

  .captcha-row {
    flex-wrap: wrap;
  }

  #captcha-image {
    max-width: 100%;
    height: auto;
  }

  .toast {
    left: max(16px, env(safe-area-inset-left, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }

  .photo-lightbox .close {
    top: max(16px, env(safe-area-inset-top, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  input[type="submit"],
  select,
  textarea {
    font-size: 16px;
  }
}

@media (max-width: 768px) {
  .main {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }

  .view-header h2 {
    font-size: 1.3rem;
  }

  .subtitle {
    font-size: 0.88rem;
  }

  .tab {
    padding: 12px 8px;
    font-size: 0.8rem;
    min-height: 44px;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .checkbox-label {
    padding-top: 0;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    min-height: 44px;
  }

  .nav-item {
    min-height: 44px;
    padding: 12px 14px;
  }

  .btn-sm {
    min-height: 40px;
    padding: 8px 14px;
  }

  .record-card-header {
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }

  .record-photo,
  .record-photo-placeholder {
    width: 52px;
    height: 52px;
    font-size: 0.95rem;
  }

  .record-name {
    font-size: 0.9rem;
    line-height: 1.35;
  }

  .wanted-label {
    display: inline;
    margin-left: 0;
    margin-top: 4px;
  }

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

  .record-links {
    flex-direction: column;
    align-items: flex-start;
  }

  .record-links .copy-btn {
    min-height: 36px;
    padding: 8px 12px;
  }

  .empty-state,
  .loading-state {
    padding: 40px 16px;
  }

  .login-overlay {
    padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  }

  .login-overlay .square,
  .deactivated-overlay .square {
    width: min(94vw, 400px);
    height: min(94vw, 400px);
  }

  .deactivated-overlay {
    padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  }

  .deactivated-panel {
    padding: 24px 20px;
  }

  .login-card {
    padding: 22px 18px 18px;
  }

  .login-field input {
    font-size: 16px;
    min-height: 44px;
  }

  .login-submit {
    min-height: 44px;
  }

  .bg-animation-square {
    width: min(100vmin, 420px);
    height: min(100vmin, 420px);
    opacity: calc(var(--bg-animation-opacity) * 0.65);
  }

  .audit-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 390px) {
  .mobile-topbar-logo {
    max-width: 110px;
  }

  .source-badges {
    gap: 6px;
  }

  .src-badge {
    font-size: 0.6rem;
    padding: 3px 7px;
  }
}


