/* IT Asset Inventory — styles */

:root {
  --bg:        #f5f6f8;
  --surface:   #ffffff;
  --ink:       #1a1d23;
  --ink-soft:  #4a5160;
  --muted:     #7b8494;
  --line:      #e3e6ec;
  --line-2:    #d7dbe3;
  --primary:   #2b5fd9;
  --primary-h: #214cae;
  --danger:    #c0392b;
  --danger-h:  #9a2d22;
  --ok:        #1d8a5f;
  --warn:      #c98200;
  --radius:    6px;
  --shadow-sm: 0 1px 2px rgba(12,18,32,0.05);
  --shadow:    0 2px 6px rgba(12,18,32,0.07), 0 1px 2px rgba(12,18,32,0.05);
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--font-mono); font-size: 0.92em; }

/* ══════════════════════════════════════════════════════════════════════
   Sidebar navigation (always visible, collapsible)
   ══════════════════════════════════════════════════════════════════════ */

:root {
  --sb-width: 240px;
  --sb-collapsed-width: 60px;
  --sb-bg: #14181f;
  --sb-bg-dark: #0f1319;
  --sb-fg: #c9d0db;
  --sb-fg-dim: #8892a2;
  --sb-fg-strong: #ffffff;
  --sb-border: #0a0d12;
  --sb-hover: #222733;
  --sb-active-bg: rgba(59, 130, 246, 0.15);
  --sb-active-border: #3b82f6;
  --sb-accent: #3b82f6;
  --sb-transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sb-width);
  background: var(--sb-bg);
  color: var(--sb-fg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sb-border);
  z-index: 50;
  transition: width var(--sb-transition);
  overflow: hidden;
}
html.sb-collapsed .sidebar { width: var(--sb-collapsed-width); }

/* Header (brand + toggle) */
.sb-header {
  padding: 12px 12px 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--sb-border);
  min-height: 62px;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  color: var(--sb-fg-strong);
  text-decoration: none;
  font-weight: 600;
}
.sb-brand:hover { text-decoration: none; }
.sb-logo {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.sb-logo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.sb-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
  transition: opacity var(--sb-transition);
}
.sb-brand-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.sb-brand-subtitle {
  font-size: 11px;
  color: var(--sb-fg-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-toggle {
  background: transparent;
  border: 1px solid transparent;
  color: var(--sb-fg);
  cursor: pointer;
  padding: 6px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform var(--sb-transition);
  position: relative;
  z-index: 2;
}
.sb-toggle:hover {
  background: var(--sb-hover);
  color: var(--sb-fg-strong);
}
html.sb-collapsed .sb-toggle-icon {
  transform: rotate(180deg);
}
.sb-toggle-icon {
  transition: transform var(--sb-transition);
}

/* Nav body */
.sb-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0 16px;
  /* thin scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #2a313d transparent;
}
.sb-nav::-webkit-scrollbar { width: 6px; }
.sb-nav::-webkit-scrollbar-thumb { background: #2a313d; border-radius: 3px; }
.sb-nav::-webkit-scrollbar-track { background: transparent; }

.sb-section-head {
  padding: 14px 20px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--sb-fg-dim);
  white-space: nowrap;
  overflow: hidden;
}
.sb-section-head span {
  transition: opacity var(--sb-transition);
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px;
  color: var(--sb-fg);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.12s ease;
}
.sb-item:hover {
  background: var(--sb-hover);
  color: var(--sb-fg-strong);
  text-decoration: none;
}
.sb-item.active {
  background: var(--sb-active-bg);
  border-left-color: var(--sb-active-border);
  color: var(--sb-fg-strong);
  font-weight: 500;
}
.sb-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 2;
}
.sb-label {
  transition: opacity var(--sb-transition);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Footer (user + signout) */
.sb-footer {
  border-top: 1px solid var(--sb-border);
  padding: 8px 0;
  background: var(--sb-bg-dark);
}
.sb-user, .sb-signout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sb-fg);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
}
.sb-user:hover, .sb-signout:hover {
  background: var(--sb-hover);
  color: var(--sb-fg-strong);
  text-decoration: none;
}
.sb-user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
  transition: opacity var(--sb-transition);
}
.sb-user-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--sb-fg-strong);
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-user-role {
  font-size: 10px;
  color: var(--sb-fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Collapsed state — hide text, keep icons */
html.sb-collapsed .sb-brand-text,
html.sb-collapsed .sb-section-head span,
html.sb-collapsed .sb-label,
html.sb-collapsed .sb-user-text {
  opacity: 0;
  pointer-events: none;
}
html.sb-collapsed .sb-section-head {
  padding: 10px 0 4px;
  text-align: center;
}
html.sb-collapsed .sb-section-head::after {
  content: "";
  display: block;
  width: 24px;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 auto;
}
html.sb-collapsed .sb-item,
html.sb-collapsed .sb-user,
html.sb-collapsed .sb-signout {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
html.sb-collapsed .sb-header {
  padding: 12px 6px;
  justify-content: center;
}
html.sb-collapsed .sb-brand {
  display: none;
}
html.sb-collapsed .sb-toggle {
  margin: 0 auto;
}

/* App shell — everything non-sidebar lives here */
.app-shell {
  margin-left: var(--sb-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--sb-transition);
}
html.sb-collapsed .app-shell {
  margin-left: var(--sb-collapsed-width);
}
.app-shell > main.container {
  flex: 1;
}

/* Footer row: prefs button + signout button side-by-side */
.sb-footer-row {
  display: flex;
  gap: 0;
}
.sb-footer-row > * { flex: 1; min-width: 0; }
.sb-prefs-btn {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sb-fg);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  font-family: inherit;
}
.sb-prefs-btn:hover {
  background: var(--sb-hover);
  color: var(--sb-fg-strong);
}

/* When collapsed, stack the prefs button over signout (they don't fit side-by-side) */
html.sb-collapsed .sb-footer-row {
  flex-direction: column;
}

/* Preferences popup */
.sb-prefs-popup {
  position: absolute;
  bottom: 100%;
  left: 10px;
  right: 10px;
  margin-bottom: 6px;
  background: #1a1f2a;
  border: 1px solid #2a313d;
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  z-index: 60;
}
.sb-prefs-popup[hidden] { display: none; }
.sb-prefs-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--sb-fg-dim);
  margin-bottom: 10px;
}
.sb-prefs-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--sb-fg);
  font-size: 13px;
  cursor: pointer;
  line-height: 1.4;
}
.sb-prefs-row input[type="checkbox"] {
  margin-top: 3px;
  cursor: pointer;
  flex-shrink: 0;
}
.sb-prefs-text { display: flex; flex-direction: column; gap: 2px; }
.sb-prefs-label {
  color: var(--sb-fg-strong);
  font-weight: 500;
}
.sb-prefs-hint {
  color: var(--sb-fg-dim);
  font-size: 11px;
}
.sb-footer { position: relative; } /* anchor for popup positioning */

/* Hover-expand: only active when both collapsed AND preference enabled */
html.sb-collapsed.sb-hover-expand .sidebar:hover {
  width: var(--sb-width);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
}
/* Re-enable all labels during hover-expand */
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-brand-text,
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-section-head span,
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-label,
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-user-text {
  opacity: 1;
  pointer-events: auto;
}
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-brand {
  display: flex;
}
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-header {
  padding: 12px 12px 12px 16px;
  justify-content: flex-start;
}
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-toggle {
  margin: 0;
}
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-section-head {
  padding: 14px 20px 6px;
  text-align: left;
}
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-section-head::after {
  display: none;
}
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-item,
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-user,
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-signout,
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-prefs-btn {
  justify-content: flex-start;
  padding-left: 20px;
  padding-right: 20px;
}
html.sb-collapsed.sb-hover-expand .sidebar:hover .sb-footer-row {
  flex-direction: row;
}
/* Content area doesn't shift during hover-expand — sidebar overlays on top */
html.sb-collapsed.sb-hover-expand .app-shell {
  margin-left: var(--sb-collapsed-width);
}

/* Mobile: sidebar becomes slide-in overlay */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--sb-transition);
    width: var(--sb-width) !important;
  }
  html.sb-mobile-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  html.sb-mobile-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 49;
  }
  .app-shell {
    margin-left: 0 !important;
  }
}

/* ── Flash ──────────────────────────────────────────────────────────── */
.flash {
  padding: 10px 16px; margin: 0;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
}
.flash-success { background: #e7f5ee; color: #0d6e47; border-color: #bde4cf; }
.flash-error   { background: #fbe8e6; color: #8a2318; border-color: #f0c2bc; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 16px;
}
.page-head h1 { margin: 0; font-size: 22px; }
.page-head .crumb {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.page-head .crumb a,
.page-head .crumb a:link,
.page-head .crumb a:visited {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #475569;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  padding: 3px 10px 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.08s;
}
.page-head .crumb a:hover {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
  color: #0f172a;
  text-decoration: none;
}
.page-actions { display: flex; gap: 8px; }

.foot {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 24px 0 32px;
}

/* ── Cards & grid ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0 0 12px 0; font-size: 15px; letter-spacing: 0.2px; }

.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 16px; }
.stat .stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
.stat .stat-value { font-size: 28px; font-weight: 700; margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── Tables ─────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.table th {
  font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--ink-soft); background: #fafbfc;
}
.table tbody tr:hover { background: #f8f9fb; }
.table td.right, .table th.right { text-align: right; }
.muted { color: var(--muted); }

/* Empty-state action links (e.g. "No X yet. Add one.") — styled as subtle
   buttons so they don't look like raw hyperlinks. */
td.muted a,
td.muted a:link,
td.muted a:visited {
  display: inline-block;
  padding: 2px 10px;
  margin-left: 4px;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  color: #1e40af;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.08s;
}
td.muted a:hover {
  background-color: #dbeafe;
  border-color: #93c5fd;
  text-decoration: none;
}

/* ── Status chips ───────────────────────────────────────────────────── */
.status {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
  border: 1px solid transparent;
}
.status.st-active     { background: #e7f5ee; color: #0d6e47; border-color: #bde4cf; }
.status.st-in-storage { background: #fff6dc; color: #7a5900; border-color: #f0df9e; }
.status.st-retired    { background: #eef0f4; color: #4a5160; border-color: #d7dbe3; }
.status.st-disposed   { background: #fbe8e6; color: #8a2318; border-color: #f0c2bc; }
.status.st-needs-verification { background: #e8effd; color: #1e40af; border-color: #bed0f5; }
.status.st-missing    { background: #fbe8e6; color: #8a2318; border-color: #f0c2bc; font-weight: 700; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.form-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(2, 1fr);
}
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
}
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-soft); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=file],
select, textarea {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43,95,217,0.15);
}
textarea { resize: vertical; font-family: var(--font-sans); }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; }

/* Subtle inline link inside hint text — matches hint color, no chip.
   Underlines on hover to signal clickability without shouting. */
.hint a,
.hint a:link,
.hint a:visited {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #cbd5e1;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.hint a:hover {
  color: var(--text, #0f172a);
  text-decoration-color: currentColor;
}

.filters {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 12px 16px;
}
.filters input[type=text] { flex: 1 1 260px; }
.filters select { flex: 0 0 auto; }

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

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 7px 14px;
  font: inherit; font-weight: 500;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: #f1f3f7; text-decoration: none; }
.btn-primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-h); border-color: var(--primary-h); color: #fff; }
.btn-danger {
  background: var(--danger); color: #fff; border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger-h); border-color: var(--danger-h); color: #fff; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }

/* ── Detail grid ────────────────────────────────────────────────────── */
.detail-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 24px;
}
.detail-grid .span-2 { grid-column: span 2; }
.detail-grid dt {
  color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  margin: 0 0 2px 0;
}
.detail-grid dd { margin: 0; font-size: 14px; }

/* ── Auth ───────────────────────────────────────────────────────────── */
.auth-wrap {
  padding: 60px 20px 20px;
  display: flex; align-items: flex-start; justify-content: center;
}
.auth-card {
  width: 100%; max-width: 360px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-card h1 { margin: 0 0 2px; font-size: 22px; }
.auth-card p.muted { margin: 0 0 18px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; text-align: left; margin-top: 6px; }
.auth-card .org-subtitle { font-size: 14px; margin: 0 0 18px; font-weight: 500; color: var(--muted); }

/* Logged-out pages (login, etc.) have no sidebar — don't reserve space for one.
   Also remove the flex-stretch so the footer sits naturally below the login
   card instead of being pinned to the viewport bottom with a huge empty gap. */
body.no-sidebar .app-shell {
  margin-left: 0 !important;
  min-height: 0;
}
body.no-sidebar .app-shell > main.container {
  flex: 0 0 auto;
}
body.no-sidebar .foot {
  padding: 16px 0;
}

/* ── Misc ───────────────────────────────────────────────────────────── */
.chips { list-style: none; padding: 0; margin: 8px 0 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.chips li code {
  display: inline-block; padding: 3px 8px; background: #f1f3f7;
  border: 1px solid var(--line-2); border-radius: 4px;
}
.err-list { color: var(--danger); font-family: var(--font-mono); font-size: 12px; }

/* ── Phase 2 additions ─────────────────────────────────────────────── */
.u-link {
  font-weight: 600; color: #fff; text-decoration: none;
  padding: 4px 8px; border-radius: 4px;
}
.u-link:hover { background: #222733; text-decoration: none; }

/* Generic pager (used on audit page etc.) */
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 12px 0 4px;
}

/* Pager bar — wraps the per-page dropdown + hybrid pagination on the assets list */
.pager-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 14px 0 4px;
  flex-wrap: wrap;
}
.pager-bar .pager {
  /* Override generic .pager: right-aligned, tight spacing for numbered pager */
  justify-content: flex-end;
  gap: 2px;
  margin: 0;
}
.pager-perpage {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.pager-perpage select {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 4px;
  background: #fff;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink, #0f172a);
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 4px;
  text-decoration: none;
  transition: background-color 0.08s, border-color 0.08s;
}
.page-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  text-decoration: none;
}
.page-btn.page-current {
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  color: #fff;
  cursor: default;
}
.page-btn.page-current:hover {
  background: var(--primary, #2563eb);
}
.page-btn.disabled {
  color: #cbd5e1;
  background: #f8fafc;
  cursor: not-allowed;
  pointer-events: none;
}
.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  color: #94a3b8;
  user-select: none;
}

/* Keyboard shortcut hint below the pager */
.pager-hint {
  margin: 8px 0 0 0;
  text-align: right;
  font-size: 11px;
}
.pager-hint kbd {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 1px;
  font-family: var(--mono, ui-monospace, "SF Mono", Consolas, monospace);
  font-size: 11px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 3px;
  line-height: 1;
}

/* ── Overview dashboard (reports/overview) ─────────────────────────── */

.overview-header {
  background: linear-gradient(135deg, #4c1d95, #6d28d9);
  color: #fff;
  padding: 16px 20px;
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}
.overview-title h1 {
  color: #fff;
  margin: 0;
  font-size: 22px;
}
.overview-title .crumb {
  font-size: 12px;
  margin-bottom: 6px;
}
.overview-title .crumb a,
.overview-title .crumb a:link,
.overview-title .crumb a:visited {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #f5f3ff;
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  text-decoration: none;
  padding: 3px 10px 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.08s;
}
.overview-title .crumb a:hover {
  background-color: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.32);
  color: #ffffff;
  text-decoration: none;
}

.overview-slicers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.slicer {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.slicer span {
  font-size: 11px;
  color: #ddd6fe;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.slicer select {
  padding: 6px 10px;
  font-size: 13px;
  min-width: 160px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  background: rgba(255,255,255,0.95);
  color: #0f172a;
}
.overview-header .btn-ghost {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
}
.overview-header .btn-ghost:hover {
  background: rgba(255,255,255,0.25);
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px;
  padding: 12px 14px;
}
/* Clickable KPI tile — used when the KPI can drill into a filtered list.
   Keeps the same visual resting state as a regular .kpi-card but adds a
   hover affordance: border tints, shadow lifts, and the KPI label briefly
   gains an arrow glyph. Uses <a> as the root so the whole tile is a
   single tap/click target (better than just linking the number). */
.kpi-card-clickable {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
  position: relative;
}
.kpi-card-clickable:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
  text-decoration: none;
}
.kpi-card-clickable::after {
  content: "→";
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--muted, #94a3b8);
  font-size: 14px;
  font-weight: 400;
  opacity: 0.5;
  transition: opacity 0.12s, transform 0.12s;
}
.kpi-card-clickable:hover::after {
  opacity: 1;
  color: #2563eb;
  transform: translateX(2px);
}
.kpi-label {
  font-size: 11px;
  color: var(--muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
}
.kpi-sub {
  font-size: 11px;
  color: var(--muted, #64748b);
  margin-top: 4px;
}

@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

.chart-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.chart-card { padding: 14px; }
.chart-card h3 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}
.chart-wrap {
  position: relative;
  height: 260px;
}

@media (max-width: 900px) {
  .chart-row { grid-template-columns: 1fr; }
  .chart-wrap { height: 240px; }
}

/* Featured report card — slightly more prominent */
.report-card-featured {
  border: 2px solid #6d28d9;
  background: linear-gradient(135deg, #faf5ff, #f5f3ff);
}
.report-card-featured h2 { color: #6d28d9; }

.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=password] {
  padding: 4px 8px !important;
  font-size: 12px;
}

.inline-check {
  display: inline-flex; flex-direction: row !important; align-items: center;
  gap: 4px; font-size: 11px; color: var(--ink-soft); font-weight: 500;
  white-space: nowrap;
}
.inline-check input[type=checkbox] { margin: 0; }

.checkbox-row {
  flex-direction: row !important; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.checkbox-row input[type=checkbox] {
  width: auto; margin: 0;
}
.checkbox-row > span {
  font-weight: 500; color: var(--ink);
}
.checkbox-row .hint { flex-basis: 100%; }

/* ── Tabs (vendors page) ───────────────────────────────────────────── */
.tabs {
  display: flex; gap: 2px; margin-bottom: 12px;
  border-bottom: 1px solid var(--line-2);
}
.tabs .tab {
  padding: 8px 14px;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  font-weight: 500; font-size: 13px;
  margin-bottom: -1px;
}
.tabs .tab:hover { color: var(--ink); text-decoration: none; }
.tabs .tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Dashboard sections ────────────────────────────────────────────── */
.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin: 24px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-2);
}
.section-title:first-of-type { margin-top: 8px; }

.stat-sub { font-size: 14px; color: var(--muted); font-weight: 500; }
.stat-warn { color: var(--warn); }

/* Stat card tints — applied to the whole card to draw attention when
   there's something worth attending to. Subtle, not alarming. */
.stat.stat-tint-warn {
  background: #fffbeb;
  border-color: #fde68a;
}
.stat.stat-tint-warn .stat-value { color: #b45309; }

.stat.stat-tint-danger {
  background: #fef2f2;
  border-color: #fecaca;
}
.stat.stat-tint-danger .stat-value { color: #b91c1c; }

.stat.stat-tint-ok {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.stat.stat-tint-ok .stat-value { color: #15803d; }

.seat-bar {
  margin-top: 8px;
  height: 6px;
  background: #eef0f4;
  border-radius: 999px;
  overflow: hidden;
}
.seat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #5a8ef0);
  transition: width 0.3s, background 0.3s;
}
/* Conditional colour based on utilisation — green < 80, amber 80-95, red >= 95 */
.seat-bar-fill.seat-warn {
  background: linear-gradient(90deg, #d97706, #f59e0b);
}
.seat-bar-fill.seat-danger {
  background: linear-gradient(90deg, #b91c1c, #ef4444);
}
.seat-bar-fill.seat-ok {
  background: linear-gradient(90deg, #15803d, #22c55e);
}

/* ── Phase 4 additions ─────────────────────────────────────────────── */

/* Stat card color tints for each status */
.stat.stat-needs-verification {
  background: #e8effd; border-color: #bed0f5;
}
.stat.stat-needs-verification .stat-label { color: #1e40af; }
.stat.stat-needs-verification .stat-value { color: #1e40af; }

.stat.stat-missing {
  background: #fbe8e6; border-color: #f0c2bc;
}
.stat.stat-missing .stat-label { color: #8a2318; }
.stat.stat-missing .stat-value { color: #8a2318; }

.stat.stat-in-storage {
  background: #fff6dc; border-color: #f0df9e;
}
.stat.stat-in-storage .stat-label { color: #7a5900; }

.stat.stat-active {
  background: #e7f5ee; border-color: #bde4cf;
}
.stat.stat-active .stat-label { color: #0d6e47; }

/* Verification progress card */
.progress-card { padding: 14px 18px; margin-bottom: 16px; }
.progress-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.progress-stats { color: var(--ink-soft); font-size: 13px; }
.progress-stats strong { color: var(--ink); }
.progress-bar {
  height: 10px; background: #eef0f4; border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  transition: width 0.4s;
}
.progress-hint { margin-top: 8px; font-size: 13px; }

/* Total row in entity value table */
.total-row td {
  border-top: 2px solid var(--line-2);
  background: #fafbfc;
}

/* Asset list — sort links */
.sort-link {
  color: inherit; text-decoration: none;
  display: inline-block; white-space: nowrap;
}
.sort-link:hover { color: var(--primary); text-decoration: none; }
.sort-link.active { color: var(--primary); }
.sort-arrow { font-size: 10px; margin-left: 2px; }

/* Bulk toolbar */
.bulk-toolbar {
  background: #1e40af;
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.bulk-toolbar .bulk-count { flex-shrink: 0; }
.bulk-toolbar .bulk-actions {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.bulk-toolbar select, .bulk-toolbar input[type=text] {
  padding: 4px 8px; font-size: 13px;
}
.bulk-toolbar .divider {
  width: 1px; height: 24px; background: rgba(255,255,255,0.3);
  margin: 0 4px;
}

/* Quick action bar on asset detail */
.quick-action-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.quick-action-form {
  padding: 16px;
  border-left: 3px solid var(--primary);
  margin-bottom: 16px;
}
.quick-action-form h3 { margin: 0 0 12px; font-size: 14px; }

/* Section head (between card h2 and add-note button) */
.section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}

/* History timeline — scrollable when it gets long */
.timeline-scroll {
  max-height: 480px;
  overflow-y: auto;
  padding-right: 8px;
  /* Subtle visual cue that content is scrollable */
  background:
    linear-gradient(to bottom, #fff, transparent 4%),
    linear-gradient(to top, #fff, transparent 4%);
  background-attachment: local, local;
}
.timeline-scroll::-webkit-scrollbar        { width: 8px; }
.timeline-scroll::-webkit-scrollbar-track  { background: transparent; }
.timeline-scroll::-webkit-scrollbar-thumb  { background: var(--line-2); border-radius: 4px; }
.timeline-scroll::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.timeline {
  list-style: none; padding: 0; margin: 0;
  border-left: 2px solid var(--line-2);
  margin-left: 6px;
}
.timeline-item {
  position: relative;
  padding: 14px 0 14px 20px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -6px; top: 20px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--muted);
  border: 2px solid #fff;
}
.timeline-verification::before { background: var(--ok); }
.timeline-status_change::before { background: var(--primary); }
.timeline-assignment_change::before { background: #b45309; }
.timeline-movement::before { background: #6b21a8; }
.timeline-note::before { background: var(--muted); }

/* The event date becomes the visual anchor — left column, big, bold */
.timeline-event-date {
  flex: 0 0 110px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding-top: 1px;
  letter-spacing: 0.3px;
}

.timeline-body {
  flex: 1;
  min-width: 0;
}
.timeline-head {
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
  margin-bottom: 4px;
}
.timeline-type {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  background: #eef0f4; color: var(--ink-soft);
  padding: 2px 7px; border-radius: 4px; font-weight: 600;
}
.timeline-verification .timeline-type { background: #e7f5ee; color: #0d6e47; }
.timeline-status_change .timeline-type { background: #e8effd; color: #1e40af; }
.timeline-assignment_change .timeline-type { background: #fef3c7; color: #92400e; }
.timeline-movement .timeline-type { background: #f3e8ff; color: #6b21a8; }
.timeline-transition { font-size: 14px; color: var(--ink); }
.timeline-desc { margin-top: 4px; font-size: 13px; color: var(--ink); }
.timeline-meta { margin-top: 6px; font-size: 11px; }
.timeline-meta .logged-at { color: var(--muted); opacity: 0.75; }

.tiny { font-size: 11px; }

/* ── Phase 5 additions ─────────────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 6px;
}
.pill-cross   { background: #f3e8ff; color: #6b21a8; }
.pill-inactive { background: #eef0f4; color: var(--muted); }
.pill-primary { background: #dbeafe; color: #1e40af; }

/* Alias list on person detail page */
.alias-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}
.alias-list li {
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.alias-list li:first-child { border-top: none; }
.alias-list code {
  background: #f8fafc;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

/* Small button variant for inline actions */
.btn-small {
  padding: 3px 10px;
  font-size: 12px;
}

.muted-row td { color: var(--muted); }
.req { color: var(--danger); }
.inline-check { display: flex; align-items: center; gap: 8px; }
.inline-check input { width: auto; margin: 0; }

/* Phase 7: compact multi-column filter grid */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  align-items: start;
}
.filters-grid .span-2 { grid-column: span 2; }
.filters-grid input,
.filters-grid select {
  width: 100%;
  margin: 0;
}
.filters-grid .filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  grid-column: span 4;
}
@media (max-width: 900px) {
  .filters-grid { grid-template-columns: repeat(2, 1fr); }
  .filters-grid .span-2 { grid-column: span 2; }
  .filters-grid .filter-actions { grid-column: span 2; }
}

.dupe-group {
  border-left: 3px solid var(--warn, #d97706);
  padding: 10px 14px;
  margin: 14px 0;
  background: #fffbeb;
  border-radius: 6px;
}
.dupe-group h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
}
.btn.tiny {
  padding: 3px 8px;
  font-size: 11px;
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.report-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.08s, box-shadow 0.08s;
}
.report-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  text-decoration: none;
}
.report-card h2 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 16px;
}
.report-card p { margin: 0; font-size: 13px; }

/* Clickable table rows (dashboard drill-downs) */
.table-clickable tbody tr[onclick] {
  cursor: pointer;
  transition: background-color 0.08s;
}
.table-clickable tbody tr[onclick]:hover {
  background-color: #f1f5f9;
}
.table-clickable tbody tr[onclick]:active {
  background-color: #e2e8f0;
}
.table-clickable tbody tr.total-row {
  cursor: default;
}
.table-clickable tbody tr.total-row:hover {
  background: inherit;
}

/* Clickable stat cards */
.stat-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.08s, box-shadow 0.08s;
}
.stat-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  text-decoration: none;
}

/* Scrollable table container — sticks the header while scrolling the rows */
.table-scroll {
  max-height: 60vh;
  overflow-y: auto;
  border-radius: 6px;
}
.table-scroll table { margin: 0; }
.table-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--panel-bg, #f8fafc);
  z-index: 1;
  box-shadow: inset 0 -1px 0 var(--line, #e5e7eb);
}
/* Taller variant for list/working views like Assets where you want to see
   many rows at once. Keeps filters + bulk toolbar + pagination visible. */
.table-scroll.table-scroll-tall {
  max-height: 65vh;
}

/* Count pill — button-styled badge for asset counts on the right */
.count-pill {
  display: inline-block;
  min-width: 2.5em;
  padding: 3px 10px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.count-pill.count-zero {
  color: var(--muted, #94a3b8);
  background: transparent;
  border: 1px dashed var(--line, #e5e7eb);
  border-radius: 4px;
}

/* Bolder table headers for clearer visual hierarchy */
.table thead th {
  font-weight: 700;
  color: #0f172a;
}

/* Entity pill — consistent coloured badge for entity codes.
   Colour is deterministic based on the code, so BBTC always looks
   the same everywhere it appears. */
.entity-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono, ui-monospace, "SF Mono", Consolas, monospace);
  letter-spacing: 0.02em;
  line-height: 1.6;
  vertical-align: middle;
  white-space: nowrap;
  border: 1px solid transparent;
}
/* Ten distinct, readable hues. Each has a light background + dark text
   + subtle border. Assignment is by hash(code) % 10. */
.entity-pill.epc-0 { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.entity-pill.epc-1 { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.entity-pill.epc-2 { background: #fef3c7; color: #854d0e; border-color: #fde68a; }
.entity-pill.epc-3 { background: #f3e8ff; color: #6b21a8; border-color: #e9d5ff; }
.entity-pill.epc-4 { background: #ffe4e6; color: #9f1239; border-color: #fecdd3; }
.entity-pill.epc-5 { background: #cffafe; color: #155e75; border-color: #a5f3fc; }
.entity-pill.epc-6 { background: #ecfccb; color: #3f6212; border-color: #d9f99d; }
.entity-pill.epc-7 { background: #fed7aa; color: #9a3412; border-color: #fdba74; }
.entity-pill.epc-8 { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.entity-pill.epc-9 { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }
.entity-pill.epc-unknown { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

/* Tag link — for asset tags / software tags / identifiers in lists.
   Rendered as a dark monospace identifier, NOT as a blue hyperlink.
   The hover state reveals it's clickable (background + subtle colour shift). */
a.tag-link,
a.tag-link:link,
a.tag-link:visited {
  text-decoration: none;
  color: #334155;                 /* slate-700 — dark, reads as data not link */
  font-family: var(--mono, ui-monospace, "SF Mono", Consolas, monospace);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background-color: #f1f5f9;       /* slate-100 — subtle chip background */
  border: 1px solid transparent;
  transition: all 0.08s;
  white-space: nowrap;
}
a.tag-link:hover {
  color: #1e40af;                  /* blue-800 — shifts on hover to signal link */
  background-color: #eff6ff;       /* blue-50 */
  border-color: #bfdbfe;           /* blue-200 */
  text-decoration: none;
}

/* Name link — for human names (people, etc.) in lists.
   Same chip-style affordance as tag-link but without monospace. */
a.name-link,
a.name-link:link,
a.name-link:visited {
  text-decoration: none;
  color: #334155;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background-color: #f1f5f9;
  border: 1px solid transparent;
  transition: all 0.08s;
  display: inline-block;
}
a.name-link:hover {
  color: #1e40af;
  background-color: #eff6ff;
  border-color: #bfdbfe;
  text-decoration: none;
}

/* Card footer — for "See all X →" links at the bottom of dashboard widgets. */
.card-footer-link {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line, #e5e7eb);
}
.card-footer-link a,
.card-footer-link a:link,
.card-footer-link a:visited {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent, #2563eb);
  padding: 6px 12px;
  border-radius: 6px;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  transition: all 0.1s;
}
.card-footer-link a:hover {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
  text-decoration: none;
}
.card-footer-link a::after {
  content: "→";
  transition: transform 0.1s;
}
.card-footer-link a:hover::after {
  transform: translateX(2px);
}

/* Category icon — small emoji prefix, consistent spacing */
.category-icon {
  display: inline-block;
  margin-right: 6px;
  font-size: 14px;
  width: 1.2em;
  text-align: center;
  opacity: 0.9;
}

/* Icon picker for category form */
.icon-picker {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 12px 14px 14px;
  margin: 0;
  background: #fafbfc;
}
.icon-picker legend {
  padding: 0 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text, #111);
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
  margin: 8px 0;
}
.icon-chip {
  appearance: none;
  border: 1px solid var(--border, #d1d5db);
  background: #fff;
  border-radius: 6px;
  height: 44px;
  font-size: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 100ms ease, background 100ms ease, transform 100ms ease;
}
.icon-chip:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
}
.icon-chip.selected {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: 0 0 0 1px #2563eb inset;
}
.icon-auto-label {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  letter-spacing: 0.02em;
}
.icon-chip.selected .icon-auto-label {
  color: #1d4ed8;
}

/* Duplicates page — sticky jump nav + collapsible section heads */
.dupe-jump-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  margin: 12px 0;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  flex-wrap: wrap;
  align-items: center;
}
.dupe-jump-nav a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 100ms ease, border-color 100ms ease;
}
.dupe-jump-nav a:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.dupe-jump-nav a .count {
  color: #64748b;
  font-weight: 400;
  font-size: 12px;
}
.dupe-section-head {
  display: flex;
  align-items: center;
  margin: 0;
}
.dupe-section-head h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.dupe-toggle {
  background: transparent;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  color: #475569;
  line-height: 1;
  flex-shrink: 0;
  transition: background 100ms ease;
}
.dupe-toggle:hover {
  background: #f1f5f9;
}
.dupe-section-body {
  margin-top: 10px;
}


/* ── Branding: login page logo + settings-page logo preview ──────── */
.auth-logo {
  display: block;
  margin: 0 auto 12px;
  max-height: 64px;
  max-width: 200px;
  object-fit: contain;
}
.org-subtitle {
  font-size: 14px;
  margin: -8px 0 12px;
  font-weight: 500;
}
.logo-preview {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  margin-bottom: 8px;
}
.logo-preview img {
  max-height: 40px;
  max-width: 120px;
  object-fit: contain;
}

/* Overview dashboard: supplementary panels */
.card-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.card-head-row h3 {
  margin: 0;
}
.chart-card-wide {
  width: 100%;
}
.table-compact th, .table-compact td {
  padding: 6px 10px;
  font-size: 13px;
}
.table-compact td.num, .table-compact th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Filter banner — shown when a list is filtered via deep-link from elsewhere */
.filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #1e3a8a;
}
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* table.td.num — right-aligned numeric cell (we prefer this name over .right
   for numeric data since it also enables tabular numerals via typography) */
.table td.num, .table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Days-left urgency badges (overview warranty panel) */
.days-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: center;
}
.days-badge.badge-red   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.days-badge.badge-amber { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.days-badge.badge-green { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* Location panel: highlight unassigned+unlocated as an audit-hygiene gap */
.loc-warn { color: #b45309; font-weight: 600; }

/* ══════════════════════════════════════════════════════════════════════════
   Mobile polish (added in v0.10.0 — mobile responsiveness audit)
   ──────────────────────────────────────────────────────────────────────────
   Philosophy: the app is a desktop-first admin tool, but occasionally gets
   used on a phone for spot-checks and quick edits. These rules keep the
   core workflows usable on narrow viewports without redesigning the UI.

   Hamburger top bar: The left-hand sidebar is hidden off-canvas on mobile
   (see existing rule at max-width: 768px further up this file). A dedicated
   `.mobile-topbar` shows only on mobile and contains a hamburger that opens
   the sidebar as a drawer.

   Tables: `.table-scroll` was vertical-only. On mobile we need horizontal
   scrolling too, with a subtle shadow to hint more content exists.

   Breakpoints used (consistent with rest of file):
     - 768px: mobile (phone, portrait tablet)
     - 640px: small mobile (single-column KPIs etc., already defined above)
   ────────────────────────────────────────────────────────────────────── */

/* Mobile topbar — hidden by default (desktop), shown at the mobile breakpoint */
.mobile-topbar {
  display: none;
}

.mt-hamburger {
  background: transparent;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 6px;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #1f2937;
  cursor: pointer;
  flex-shrink: 0;
}
.mt-hamburger:hover, .mt-hamburger:focus {
  background: #f1f5f9;
  outline: none;
}
.mt-brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: #0f172a; text-decoration: none;
  min-width: 0;                /* allow text ellipsis inside */
  flex: 1 1 auto;
}
.mt-brand:hover { text-decoration: none; }
.mt-logo {
  width: 30px; height: 30px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
}
.mt-logo-placeholder {
  background: var(--primary, #2b5fd9);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.mt-brand-text {
  display: flex; flex-direction: column;
  min-width: 0; line-height: 1.15;
}
.mt-brand-org {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mt-brand-app {
  font-size: 11px; color: #64748b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Horizontal scroll for wide tables on narrow screens. We apply it to the
   existing `.table-scroll` wrapper so list pages automatically benefit.
   `-webkit-overflow-scrolling: touch` keeps iOS momentum scrolling.
   The thin shadow on the right edge hints that more content exists. */
.table-scroll {
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  /* Show the mobile topbar */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #fff;
    border-bottom: 1px solid var(--line, #e5e7eb);
    position: sticky; top: 0;
    z-index: 40;                /* below the open sidebar (50) + scrim (49) */
  }

  /* Hide the desktop-only sidebar toggle button (the `‹` chevron). On mobile
     the hamburger on the topbar is the control; tapping outside the drawer
     or a nav link also closes it. */
  .sidebar .sb-toggle { display: none; }

  /* Mobile sidebar layering — existing rule already flips transform on
     .sb-mobile-open; bump z-index so it sits above the topbar. */
  .sidebar { z-index: 50; }

  /* Container padding — 24px wastes ~12% of viewport on narrow phones */
  .container { padding: 14px; }

  /* Page head — stack h1 above actions, let long titles wrap */
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .page-head h1 { font-size: 19px; word-break: break-word; }
  .page-actions { flex-wrap: wrap; }

  /* Horizontal scroll for tables; keep the existing vertical limit but
     let the thead remain sticky as rows scroll up. */
  .table-scroll {
    overflow-x: auto;
    max-height: none;            /* let the whole page scroll on mobile */
  }
  .table-scroll.table-scroll-tall {
    max-height: none;
  }
  .table { min-width: 600px; }   /* force horizontal scroll rather than cramped columns */
  .table th, .table td {
    padding: 8px 8px;
    font-size: 13px;
  }

  /* Filters bar — let inputs grow to full width one per row when needed */
  .filters { padding: 10px 12px; }
  .filters input[type=text],
  .filters select {
    flex: 1 1 100%;
    min-width: 0;
  }

  /* Flash — don't overrun the edges */
  .flash { padding: 10px 14px; font-size: 14px; }

  /* Cards — drop the per-card min width so the grid doesn't overflow */
  .cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

  /* Buttons inside page-actions — ensure tap targets are >= 40px */
  .page-actions .btn { min-height: 40px; }
}

/* Very narrow screens — stack filter selects one per row cleanly */
@media (max-width: 480px) {
  .container { padding: 10px; }
  .page-head h1 { font-size: 17px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .stat .stat-value { font-size: 22px; }
}

/* ── Data completeness wizard (/reports/completeness, v0.11.0) ───────── */
.gap {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 6px;
  margin-bottom: 8px;
  background: #fff;
}
.gap > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  font-weight: 500;
}
.gap > summary::-webkit-details-marker { display: none; }
.gap > summary::before {
  content: "▸";
  font-size: 10px;
  color: #94a3b8;
  margin-right: 6px;
  transition: transform 0.08s;
  display: inline-block;
}
.gap[open] > summary::before { transform: rotate(90deg); }
.gap:hover { border-color: #d1d5db; }
.gap-label { flex: 1 1 auto; }
.gap-count {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  flex-shrink: 0;
}
.gap-body {
  padding: 0 14px 12px 14px;
  border-top: 1px solid var(--line, #e5e7eb);
}
.gap-clean {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line, #e5e7eb);
  font-size: 13px;
  color: #475569;
}
.clean-pill {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 8px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  font-size: 12px;
}
.ent-tag {
  display: inline-block;
  padding: 2px 7px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.col-actions { white-space: nowrap; text-align: right; }

/* Tiny info text in stat tiles */
.stat .tiny { font-size: 11px; margin-top: 2px; }

/* ── Asset photos gallery (v0.12.0) ────────────────────────────────────── */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.photo-tile {
  position: relative;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 6px;
  overflow: hidden;
  background: #f8fafc;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
}
.photo-tile > a {
  flex: 1 1 auto;
  display: block;
  overflow: hidden;
}
.photo-tile img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.12s;
}
.photo-tile:hover img { transform: scale(1.03); }
.photo-tile-meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 4px 6px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.photo-tile-delete {
  position: absolute;
  top: 4px; right: 4px;
  margin: 0;
}
.btn-x {
  width: 24px; height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.btn-x:hover { background: #b91c1c; }

@media (max-width: 480px) {
  .photo-gallery { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
