/* ═══════════════════════════════════════════════════════════════════════════
   IT Inventory — Design System
   Dark glassmorphism theme with indigo/emerald accent palette
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Custom Properties ────────────────────────────────────────────────────── */
:root {
  /* REON Technologies Brand Palette */
  --brand-crimson: #B81D24;
  --brand-crimson-hover: #D32F2F;
  --brand-crimson-glow: rgba(184, 29, 36, 0.35);

  /* Base colors */
  --bg-primary: #0a0c10;
  --bg-secondary: #11141d;
  --bg-tertiary: #181d2a;
  --bg-card: rgba(255, 255, 255, 0.035);
  --bg-card-hover: rgba(255, 255, 255, 0.055);
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-input-focus: rgba(255, 255, 255, 0.08);

  /* Borders */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(184, 29, 36, 0.5);

  /* Accent colors */
  --accent-indigo: #B81D24;
  --accent-indigo-light: #e53935;
  --accent-indigo-dim: rgba(184, 29, 36, 0.18);
  --accent-emerald: #10b981;
  --accent-emerald-light: #34d399;
  --accent-emerald-dim: rgba(16, 185, 129, 0.15);
  --accent-amber: #f59e0b;
  --accent-amber-dim: rgba(245, 158, 11, 0.15);
  --accent-red: #ef4444;
  --accent-red-dim: rgba(239, 68, 68, 0.15);
  --accent-slate: #64748b;

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-link: var(--accent-indigo-light);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(184, 29, 36, 0.25);

  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 60px;
  --border-radius: 10px;
  --border-radius-sm: 6px;
  --border-radius-lg: 14px;

  /* Transitions */
  --transition: 0.2s ease;
  --transition-fast: 0.12s ease;
}

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

html { font-size: 15px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(184, 29, 36, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(16, 185, 129, 0.04), transparent);
  background-attachment: fixed;
}

h1, h2, h3, .card-title, .page-title, .auth-title, .asset-name {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
}

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

/* ── Layout: Sidebar + Main ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: rgba(10, 12, 16, 0.95);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  backdrop-filter: blur(20px);
}

.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Sidebar Header ───────────────────────────────────────────────────────── */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 24px;
  color: var(--brand-crimson);
  filter: drop-shadow(0 0 10px rgba(184, 29, 36, 0.6));
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* ── Sidebar Navigation ───────────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section {
  margin-bottom: 24px;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
  margin-bottom: 3px;
}

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

.nav-item.active {
  background: var(--accent-indigo-dim);
  color: #ff6b6b;
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3.5px;
  height: 65%;
  background: var(--brand-crimson);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px var(--brand-crimson);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

/* ── Sidebar Footer ───────────────────────────────────────────────────────── */
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-color);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-indigo-dim);
  border: 1px solid var(--brand-crimson);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #ff6b6b;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-email { font-size: 12px; font-weight: 500; truncate: ellipsis; overflow: hidden; white-space: nowrap; }

.sidebar-link {
  display: block;
  font-size: 12px;
  padding: 5px 8px;
  color: var(--text-muted);
  border-radius: 4px;
  margin-bottom: 4px;
  transition: color var(--transition-fast);
}
.sidebar-link:hover { color: var(--text-secondary); }

.btn-logout {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  text-align: left;
}
.btn-logout:hover { background: var(--accent-red-dim); color: var(--accent-red); border-color: rgba(239, 68, 68, 0.3); }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(10, 12, 16, 0.85);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-actions { display: flex; gap: 10px; }

/* ── Content ──────────────────────────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ── Glass Card ───────────────────────────────────────────────────────────── */
.card, .glass {
  background: rgba(17, 20, 29, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-lg);
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-action {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}
.card-action:hover { color: var(--text-link); }

.card-body {
  padding: 24px;
}

.card-danger {
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.04);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--border-radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--accent-indigo);
  color: #fff;
  border-color: var(--accent-indigo);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  background: var(--accent-indigo-light);
  border-color: var(--accent-indigo-light);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }

.btn-emerald {
  background: var(--accent-emerald);
  color: #fff;
  border-color: var(--accent-emerald);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
}
.btn-emerald:hover {
  background: var(--accent-emerald-light);
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.4);
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}
.btn-danger:hover { background: #f87171; transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-xs { padding: 4px 8px; font-size: 11.5px; }
.btn-block { width: 100%; justify-content: center; }

.btn-icon { width: 14px; height: 14px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  transition: all var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

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

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control {
  cursor: pointer;
  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='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; display: block; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; }

.select-sm { padding: 6px 28px 6px 10px; font-size: 12.5px; }
.select-xs { padding: 4px 24px 4px 8px; font-size: 11.5px; }
.input-sm  { padding: 6px 10px; font-size: 12.5px; }

.required-star { color: var(--accent-red); }

/* ── Search Box ───────────────────────────────────────────────────────────── */
.search-box {
  position: relative;
  flex: 1;
}

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

.search-input {
  padding-left: 34px;
}

/* ── Data Tables ──────────────────────────────────────────────────────────── */
.table-container { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.data-table.compact th, .data-table.compact td { padding: 7px 12px; font-size: 12.5px; }

.text-right { text-align: right; }

.table-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-color);
}

.row-low-stock td:first-child { border-left: 2px solid var(--accent-amber); }
.row-success  { background: rgba(16, 185, 129, 0.03); }
.row-failure  { background: rgba(239, 68, 68, 0.03); }
.row-positive { background: rgba(16, 185, 129, 0.03); }
.row-negative { background: rgba(239, 68, 68, 0.03); }
.row-damaged  { background: rgba(245, 158, 11, 0.04); }

/* Utility text colours */
.text-emerald { color: #34d399; }
.text-danger  { color: #f87171; }
.text-amber   { color: #fbbf24; }

/* ── Badges & Chips ───────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-in_stock  { background: var(--accent-emerald-dim); color: var(--accent-emerald-light); border: 1px solid rgba(16,185,129,0.25); }
.status-deployed  { background: var(--accent-indigo-dim);  color: var(--accent-indigo-light);  border: 1px solid rgba(99,102,241,0.25); }
.status-in_repair { background: var(--accent-amber-dim);   color: var(--accent-amber);         border: 1px solid rgba(245,158,11,0.25); }
.status-retired   { background: rgba(100,116,139,0.15);    color: var(--accent-slate);         border: 1px solid rgba(100,116,139,0.2); }
.status-lost      { background: var(--accent-red-dim);     color: #fca5a5;                      border: 1px solid rgba(239,68,68,0.25); }

.category-badge {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.role-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 4px;
}
.role-admin  { background: var(--accent-red-dim);    color: #fca5a5; }
.role-staff  { background: var(--accent-indigo-dim); color: var(--accent-indigo-light); }
.role-viewer { background: rgba(100,116,139,0.15);   color: var(--text-muted); }

.badge-success { background: var(--accent-emerald-dim); color: var(--accent-emerald-light); padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-danger  { background: var(--accent-red-dim); color: #fca5a5; padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-muted   { background: rgba(100,116,139,0.12); color: var(--text-muted); padding: 1px 7px; border-radius: 4px; font-size: 11px; }

.low-stock-tag { background: var(--accent-amber-dim); color: var(--accent-amber); font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; }

/* ── Asset Breakdown Rows ──────────────────────────────────────────────────── */
.breakdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 24px 10px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}
.breakdown-header span:first-child { flex: 1; }
.breakdown-header span:nth-child(2) { flex: 1; }
.breakdown-count-label { min-width: 40px; text-align: right; }

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background var(--transition-fast);
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-row:hover { background: var(--bg-card-hover); }
.breakdown-row .category-badge { flex: 1; }
.breakdown-row .status-badge   { flex: 1; }
.breakdown-count {
  min-width: 40px;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Dashboard ────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card-warning { border-color: rgba(245, 158, 11, 0.3); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }

.stat-icon-crimson { background: rgba(184, 29, 36, 0.18); color: #ff6b6b; border: 1px solid rgba(184, 29, 36, 0.3); }
.stat-icon-emerald { background: var(--accent-emerald-dim); color: var(--accent-emerald-light); border: 1px solid rgba(16, 185, 129, 0.3); }
.stat-icon-amber { background: var(--accent-amber-dim); color: var(--accent-amber); border: 1px solid rgba(245, 158, 11, 0.3); }

.stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 32px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.stat-label { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; font-weight: 500; }
.text-crimson { color: #ff6b6b; text-shadow: 0 0 12px rgba(184, 29, 36, 0.4); }

/* ── Running Totals Banner (Unboxed Stat Numerals) ────────────────────────── */
.totals-banner {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 8px 0 28px 0;
  margin-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.total-item {
  flex: 1;
}

.total-num {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.brand-total .total-num {
  color: var(--brand-crimson);
  text-shadow: 0 0 18px rgba(184, 29, 36, 0.4);
}

.warning-total .total-num {
  color: var(--accent-amber);
}

.total-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: 0.01em;
}

.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  margin-bottom: 20px;
}

.activity-feed { display: flex; flex-direction: column; gap: 1px; }

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  align-items: flex-start;
}

.activity-icon {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.activity-body { flex: 1; }
.activity-title { font-size: 13px; font-weight: 500; }
.activity-meta  { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.activity-notes { font-size: 12px; color: var(--text-secondary); margin-top: 4px; font-style: italic; }

/* ── Low Stock Widget ─────────────────────────────────────────────────────── */
.low-stock-list { display: flex; flex-direction: column; gap: 8px; }

.low-stock-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--accent-amber-dim);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--border-radius-sm);
}

.low-stock-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.low-stock-body { flex: 1; }

.low-stock-qty { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.qty-current { font-weight: 700; }
.qty-sep { opacity: 0.5; }
.qty-threshold { opacity: 0.7; }

/* ── Asset Detail ─────────────────────────────────────────────────────────── */
.asset-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px;
  margin-bottom: 20px;
  gap: 16px;
}

.asset-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.asset-name { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }

.asset-serial { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; }
.serial-number { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--accent-indigo-light); }
.serial-sm { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--text-muted); display: block; }

.immutable-tag { font-size: 11px; color: var(--text-muted); opacity: 0.7; }

.asset-meta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.meta-item { font-size: 12.5px; color: var(--text-secondary); }

.asset-header-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

.detail-columns {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: flex-start;
}

.detail-sidebar > * + * { margin-top: 16px; }
.detail-main > * + * { margin-top: 16px; }

/* ── Timeline ─────────────────────────────────────────────────────────────── */
.timeline { position: relative; }
.timeline::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--border-color);
}

.timeline-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  position: relative;
}

.timeline-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  z-index: 1;
}

.timeline-body { flex: 1; }

.timeline-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.event-label { font-weight: 600; font-size: 13px; }
.timeline-time { font-size: 11.5px; color: var(--text-muted); margin-left: auto; }
.timeline-actor { font-size: 12px; color: var(--text-muted); }
.timeline-notes { font-size: 12.5px; color: var(--text-secondary); margin-top: 6px; font-style: italic; }

.photo-pair { display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap; }

.photo-card {
  flex: 1;
  min-width: 140px;
  max-width: 200px;
}

.photo-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.event-photo {
  width: 100%;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  object-fit: cover;
  aspect-ratio: 4/3;
  transition: transform var(--transition-fast);
}
.event-photo:hover { transform: scale(1.02); }

.photo-stats { margin-top: 4px; }

/* ── Photo Upload ─────────────────────────────────────────────────────────── */
.photo-upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.photo-upload-zone:hover, .photo-upload-zone.has-file {
  border-color: var(--accent-indigo);
  background: var(--accent-indigo-dim);
}

.photo-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.photo-upload-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}

.photo-upload-icon { font-size: 28px; }

.photo-preview img {
  width: 100%;
  border-radius: var(--border-radius-sm);
  max-height: 200px;
  object-fit: cover;
}

.photo-size-stats {
  font-size: 12px;
  color: var(--accent-emerald);
  margin-top: 6px;
  font-weight: 500;
}

/* ── Asset Name cell ──────────────────────────────────────────────────────── */
.asset-name-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.asset-name-link {
  font-weight: 500;
  color: var(--text-primary);
  transition: color var(--transition-fast);
}
.asset-name-link:hover { color: var(--accent-indigo-light); }

.actions-cell { white-space: nowrap; }
.actions-cell .btn + .btn { margin-left: 4px; }

/* ── Stock Quantity ───────────────────────────────────────────────────────── */
.stock-qty-display {
  text-align: center;
  padding: 20px;
  border-radius: var(--border-radius);
  background: var(--bg-tertiary);
  margin-bottom: 16px;
}

.stock-qty-display.low-stock {
  background: var(--accent-amber-dim);
  border: 1px solid rgba(245,158,11,0.2);
}

.qty-value { font-size: 48px; font-weight: 700; letter-spacing: -0.04em; }
.qty-label { font-size: 12px; color: var(--text-muted); }
.low-stock-badge { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--accent-amber); }

/* ── Outcome Grid (check-in) ──────────────────────────────────────────────── */
.outcome-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}

.outcome-option { cursor: pointer; }
.outcome-option input { display: none; }

.outcome-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
  text-align: center;
}

.outcome-option input:checked + .outcome-card {
  border-color: var(--accent-indigo);
  background: var(--accent-indigo-dim);
}

.outcome-option:hover .outcome-card { border-color: rgba(99,102,241,0.4); }

.outcome-icon { font-size: 22px; }
.outcome-label { font-size: 12px; font-weight: 500; }

/* ── Track Type Toggle ────────────────────────────────────────────────────── */
.track-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }

.track-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  font-family: inherit;
  color: var(--text-secondary);
}

.track-btn:hover, .track-btn.active {
  border-color: var(--accent-indigo);
  background: var(--accent-indigo-dim);
  color: var(--text-primary);
}

.track-icon { font-size: 20px; }
.track-label { font-size: 13.5px; font-weight: 600; }
.track-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

/* ── Result List (search) ─────────────────────────────────────────────────── */
.result-list { display: flex; flex-direction: column; gap: 4px; }

.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.result-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(99,102,241,0.3);
  transform: translateX(2px);
}

.result-icon { font-size: 20px; flex-shrink: 0; }
.result-body { flex: 1; }
.result-name { font-size: 14px; font-weight: 500; }
.result-meta { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
.result-arrow { color: var(--text-muted); opacity: 0.5; }

/* ── Filter Bar ───────────────────────────────────────────────────────────── */
.filter-bar { padding: 14px 20px; margin-bottom: 20px; }
.filter-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.filter-row .search-box { flex: 1; min-width: 220px; }
.filter-row .form-control { width: auto; min-width: 140px; }
.filter-row .search-input { width: 100%; }
.filter-row #btn-new-asset { margin-left: auto; }

/* ── Auth Layout ──────────────────────────────────────────────────────────── */
.auth-page { background: var(--bg-primary); }

.auth-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99, 102, 241, 0.18), transparent),
    radial-gradient(ellipse 40% 40% at 90% 90%, rgba(16, 185, 129, 0.1), transparent);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 32px;
}

.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-logo { font-size: 36px; display: block; margin-bottom: 8px; filter: drop-shadow(0 0 12px rgba(99,102,241,0.5)); }
.auth-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.auth-subtitle { font-size: 13px; color: var(--text-muted); }

.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-muted); }

.totp-input { text-align: center; font-size: 24px; font-family: 'JetBrains Mono', monospace; letter-spacing: 0.3em; }

/* ── TOTP Setup ───────────────────────────────────────────────────────────── */
.totp-setup-card { padding: 0; }
.totp-qr-section { display: flex; flex-direction: column; align-items: center; padding: 24px; border-bottom: 1px solid var(--border-color); }
.totp-qr { border-radius: var(--border-radius-sm); }
.totp-secret-box { text-align: center; margin-top: 16px; }
.totp-secret {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  letter-spacing: 0.1em;
  margin-top: 6px;
  word-break: break-all;
}
.totp-verify-form { padding: 20px; }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.text-sm    { font-size: 12.5px; }
.text-xs    { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.text-emerald { color: var(--accent-emerald-light); }
.text-danger  { color: #fca5a5; }
.font-mono  { font-family: 'JetBrains Mono', monospace; }
.hidden     { display: none !important; }
.mb-4       { margin-bottom: 16px; }
.mt-4       { margin-top: 16px; }
.max-w-lg   { max-width: 600px; }
.truncate   { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.max-w-xs   { max-width: 200px; }
.link-muted { color: var(--text-muted); font-size: 13px; }
.link-muted:hover { color: var(--text-secondary); }
.inline-form { display: inline; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 12px; }
.empty-icon { width: 40px; height: 40px; margin: 0 auto 12px; opacity: 0.4; display: block; }
.empty-state-sm { text-align: center; padding: 16px; font-size: 13px; }

.page-section { max-width: 700px; }
.section-header { margin-bottom: 20px; }

.badge-user {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(184, 29, 36, 0.16);
  color: #ff6b6b;
  border: 1px solid rgba(184, 29, 36, 0.35);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  text-decoration: none !important;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.badge-user:hover {
  background: rgba(184, 29, 36, 0.4);
  color: #ffffff;
  border-color: #ff4d4d;
  box-shadow: 0 0 12px rgba(184, 29, 36, 0.5);
  transform: translateY(-1px);
}

.asset-summary-chip { display: flex; gap: 8px; align-items: center; margin-top: 6px; }

.sidebar-toggle { display: none; background: none; border: none; cursor: pointer; }

/* ── Menu Toggle (hamburger) ──────────────────────────────────────────────── */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.menu-toggle:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.menu-toggle svg { width: 18px; height: 18px; }

/* ── Sidebar Overlay ──────────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 98;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≤900px)
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* Sidebar slides off-screen; hamburger reveals it */
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-wrapper { margin-left: 0; }
  .menu-toggle  { display: flex; }

  /* Topbar tighten up */
  .topbar { padding: 0 16px; gap: 12px; }
  .page-title { font-size: 15px; }

  /* Content padding */
  .content { padding: 20px 20px; }

  /* Dashboard grid goes single column */
  .dashboard-row { grid-template-columns: 1fr; }

  /* Asset detail sidebar stacks */
  .detail-columns { grid-template-columns: 1fr; }

  /* Stats grid: 2 columns */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Totals banner: 2 across */
  .totals-banner {
    gap: 20px;
    flex-wrap: wrap;
  }
  .total-item { flex: 1 1 calc(50% - 10px); min-width: 120px; }
  .total-num  { font-size: 36px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (≤640px)
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Spacing */
  .content { padding: 14px; }
  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px; }
  .topbar { padding: 0 14px; height: 56px; gap: 10px; }

  /* Typography scale down */
  .page-title { font-size: 14px; }
  .total-num  { font-size: 30px; }
  .totals-banner { gap: 14px; padding-bottom: 20px; margin-bottom: 20px; }
  .total-item { flex: 1 1 calc(50% - 7px); }

  /* Stats: 2-up on phone */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 26px; }
  .stat-card  { padding: 14px; gap: 10px; }
  .stat-icon  { width: 38px; height: 38px; }

  /* Filter bar stacks */
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-row .search-box { min-width: unset; }
  .filter-row .form-control { width: 100%; min-width: unset; }
  .filter-row #btn-new-asset { margin-left: 0; }
  .filter-row .btn { width: 100%; justify-content: center; }

  /* Forms */
  .form-row    { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions .btn { width: 100%; justify-content: center; }

  /* Asset header */
  .asset-header { flex-direction: column; }
  .asset-header-actions { flex-wrap: wrap; }
  .asset-header-actions .btn { flex: 1 1 auto; justify-content: center; }
  .asset-name { font-size: 18px; }

  /* Toggles */
  .track-toggle  { grid-template-columns: 1fr; }
  .outcome-grid  { grid-template-columns: 1fr 1fr; }

  /* Tables → mobile cards */
  .data-table thead { display: none; }
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td { display: block; width: 100%; }
  .data-table tr {
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-card);
    overflow: hidden;
  }
  .data-table tr:hover { background: var(--bg-card-hover); }
  .data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
  }
  .data-table td:last-child { border-bottom: none; }
  .data-table td::before {
    content: attr(data-label);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    min-width: 80px;
    flex-shrink: 0;
  }
  /* Cells that shouldn't show a label (actions, image cells) */
  .data-table td.no-label::before { display: none; }
  .data-table td.no-label { justify-content: flex-end; }

  /* Topbar action: hide text, keep icon feel */
  .topbar-actions .btn { padding: 6px 10px; font-size: 12px; }

  /* Photo upload zone */
  .photo-upload-zone { padding: 14px; }

  /* Auth card full width */
  .auth-card { padding: 24px 18px; }

  /* Timeline tighten */
  .timeline-time { margin-left: 0; display: block; margin-top: 2px; }

  /* Page section */
  .page-section { max-width: 100%; }
}

/* ── Htmx Loading Indicator ───────────────────────────────────────────────── */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-settling { transition: all 200ms ease; }

/* ── Flash Toast Notification ─────────────────────────────────────────────── */
.flash-toast-container {
  padding: 16px 28px 0 28px;
  display: flex;
  justify-content: center;
  z-index: 100;
}

.flash-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  max-width: 600px;
  padding: 12px 18px;
  border-radius: var(--border-radius-md);
  background: rgba(18, 20, 26, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  animation: toastSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

@keyframes toastSlideDown {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.flash-toast-error {
  border-left: 4px solid var(--brand-crimson);
  background: linear-gradient(90deg, rgba(184, 29, 36, 0.16) 0%, rgba(18, 20, 26, 0.95) 100%);
}

.flash-toast-success {
  border-left: 4px solid #10b981;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.16) 0%, rgba(18, 20, 26, 0.95) 100%);
}

.flash-toast-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flash-toast-error .flash-toast-icon {
  color: #ff4d4d;
}

.flash-toast-success .flash-toast-icon {
  color: #10b981;
}

.flash-toast-icon svg {
  width: 20px;
  height: 20px;
}

.flash-toast-content {
  flex: 1;
}

.flash-toast-message {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.flash-toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  margin-left: 8px;
}

.flash-toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.flash-toast-close svg {
  width: 14px;
  height: 14px;
}

/* ── Print ────────────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .flash, .btn-logout, .nav-item { display: none !important; }
  .main-wrapper { margin-left: 0; }
  body { background: #fff; color: #000; }
}
