@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

/* ─── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --navy:       #0F172A;
  --navy-mid:   #1e3a5f;
  --navy-dark:  #0d1f35;
  --slate:      #334155;
  --blue:       #0369A1;
  --blue-light: #0ea5e9;
  --amber:      #f59e0b;
  --amber-light:#fbbf24;
  --green:      #10b981;
  --red:        #ef4444;
  --bg:         #F8FAFC;
  --card:       #ffffff;
  --border:     #e2e8f0;
  --border-lt:  #f1f5f9;
  --text:       #020617;
  --text-sec:   #475569;
  --muted:      #64748b;
  --subtle:     #f1f5f9;

  --sidebar-w:          240px;
  --sidebar-w-collapsed: 64px;
  --topbar-h:   60px;
  --radius:     10px;
  --radius-sm:  7px;
  --radius-lg:  14px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06);
  --shadow:     0 4px 14px rgba(0,0,0,.08);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.14);

  --font-head:  'Lexend', sans-serif;
  --font-body:  'Source Sans 3', sans-serif;
  --ease:       150ms ease;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: var(--font-body); font-size: 14px; }

/* ─── App Shell ──────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--navy);
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 220ms ease;
}

/* Scrollbar styling for sidebar — Firefox uses scrollbar-width; Chrome/Safari use ::-webkit-scrollbar */
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* ── Collapsed sidebar ─────────────────────────────────────────────────── */
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }

/* Hide text-only elements when collapsed */
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed #logout-btn span,
.sidebar.collapsed #profile-gear-btn { display: none; }

/* Centre icon-only items */
.sidebar.collapsed .sidebar-logo  { justify-content: center; padding: 20px 0 16px; }
.sidebar.collapsed .nav-item      { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .sidebar-user  { justify-content: center; padding: 8px 0; }
.sidebar.collapsed #logout-btn    { justify-content: center; padding: 10px 0; }

/* Tooltip on hover when collapsed */
.sidebar.collapsed .nav-item { position: relative; }
.sidebar.collapsed .nav-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(var(--sidebar-w-collapsed) + 8px);
  top: 50%; transform: translateY(-50%);
  background: var(--navy-dark);
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 200;
}
.sidebar.collapsed .nav-item:hover::after { opacity: 1; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: var(--amber);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(245,158,11,.3);
}
.sidebar-logo-icon svg { width: 20px; height: 20px; color: #1a1a1a; }

.sidebar-logo-text { line-height: 1.2; }
.sidebar-logo-name {
  font-family: var(--font-head);
  font-size: 15px; font-weight: 700;
  color: #fff; letter-spacing: -.2px;
}
.sidebar-logo-sub {
  font-size: 10px; color: rgba(255,255,255,.35);
  text-transform: uppercase; letter-spacing: .8px;
}

.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-section { padding: 0 10px; margin-bottom: 4px; }
.nav-section-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.1px;
  color: rgba(255,255,255,.28);
  padding: 8px 8px 4px; display: block;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  color: rgba(255,255,255,.55);
  font-size: 13.5px; font-weight: 500;
  text-decoration: none;
  transition: background var(--ease), color var(--ease);
  cursor: pointer; margin-bottom: 1px;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--amber); color: #1a1a1a; }
.nav-item.active:hover { background: var(--amber-light); }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto; padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--slate);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  font-family: var(--font-head);
  color: var(--amber); flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,.38); text-transform: capitalize; }

/* Gear / profile button */
#profile-gear-btn {
  background: none; border: none;
  color: rgba(255,255,255,.35); cursor: pointer;
  padding: 4px 5px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, background .15s;
}
#profile-gear-btn:hover { color: rgba(255,255,255,.8); background: rgba(255,255,255,.08); }

/* Avatar image (when photo is set) */
.sidebar-avatar-img {
  width: 32px; height: 32px; border-radius: 50%;
  object-fit: cover; display: block;
}
.sidebar-avatar { cursor: pointer; }

/* Profile dialog avatar preview */
.profile-avatar-preview {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--slate, #334155);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
  font-family: var(--font-head); color: var(--amber);
  overflow: hidden; margin: 0 auto;
}
.profile-avatar-preview img {
  width: 100%; height: 100%; object-fit: cover;
}

#logout-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px;
  border-radius: 7px; background: none; border: none;
  color: rgba(255,255,255,.45); font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer; transition: background var(--ease), color var(--ease);
  margin-top: 4px;
}
#logout-btn:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.75); }
#logout-btn svg { width: 16px; height: 16px; }

/* Content wrapper — gets transition class added by JS */
.content-wrap { transition: margin-left 220ms ease; }

/* ─── Sidebar toggle button ───────────────────────────────────────────────── */
#sidebar-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted); cursor: pointer;
  flex-shrink: 0;
  transition: background var(--ease), color var(--ease);
}
#sidebar-toggle:hover { background: var(--subtle); color: var(--text); }
#sidebar-toggle svg { width: 18px; height: 18px; }

/* ─── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
  position: -webkit-sticky; position: sticky; top: 0; z-index: 50;
}
.topbar-title {
  font-family: var(--font-head);
  font-size: 17px; font-weight: 700;
  color: var(--text); letter-spacing: -.3px;
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ─── Main content ────────────────────────────────────────────────────────── */
.main-content { padding: 26px; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border-lt);
  display: flex; align-items: center; gap: 10px;
}
.card-header-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: #dbeafe;
}
.card-header-icon svg { width: 16px; height: 16px; color: var(--blue); }
.card-header-icon.amber { background: #fef3c7; }
.card-header-icon.amber svg { color: var(--amber); }
.card-header-icon.green { background: #d1fae5; }
.card-header-icon.green svg { color: var(--green); }
.card-header-icon.slate { background: var(--subtle); }
.card-header-icon.slate svg { color: var(--slate); }

.card-title {
  font-family: var(--font-head);
  font-size: 14.5px; font-weight: 700;
  color: var(--text); flex: 1;
}
.card-body { padding: 22px; }

/* ─── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}
.page-header h1 {
  font-family: var(--font-head);
  font-size: 22px; font-weight: 700;
  color: var(--text); letter-spacing: -.4px;
}
.page-header .page-sub {
  font-size: 13px; color: var(--muted); margin-top: 3px;
}
.page-header-actions { display: flex; gap: 8px; align-items: center; }

/* ─── Stats ───────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative; overflow: hidden;
  transition: box-shadow var(--ease), transform var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card::after {
  content: ''; position: absolute;
  bottom: 0; left: 0; right: 0; height: 3px;
}
.stat-card.pending::after { background: var(--amber); }
.stat-card.approved::after { background: var(--green); }
.stat-card.denied::after { background: var(--red); }
.stat-card.total::after { background: var(--blue); }

.stat-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.stat-icon svg { width: 17px; height: 17px; }
.stat-card.pending .stat-icon { background: #fef3c7; }
.stat-card.pending .stat-icon svg { color: var(--amber); }
.stat-card.approved .stat-icon { background: #d1fae5; }
.stat-card.approved .stat-icon svg { color: var(--green); }
.stat-card.denied .stat-icon { background: #fee2e2; }
.stat-card.denied .stat-icon svg { color: var(--red); }
.stat-card.total .stat-icon { background: #dbeafe; }
.stat-card.total .stat-icon svg { color: var(--blue); }

.stat-value {
  font-family: var(--font-head);
  font-size: 30px; font-weight: 700;
  color: var(--text); line-height: 1; margin-bottom: 3px;
}
.stat-label {
  font-size: 11.5px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600;
  font-family: var(--font-body);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), box-shadow var(--ease), transform 80ms;
  text-decoration: none; white-space: nowrap; -webkit-user-select: none; -moz-user-select: none; user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 15px; height: 15px; }

.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1e293b; color: #fff; }

.btn-amber { background: var(--amber); color: #1a1a1a; border-color: var(--amber); }
.btn-amber:hover:not(:disabled) { background: var(--amber-light); color: #1a1a1a; }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(1.08); color: #fff; }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); color: #fff; }

.btn-outline {
  background: transparent;
  border-color: var(--border); color: var(--slate);
}
.btn-outline:hover:not(:disabled) { background: var(--subtle); border-color: #94a3b8; color: var(--text); }

.btn-ghost {
  background: transparent; border-color: transparent; color: var(--muted);
}
.btn-ghost:hover:not(:disabled) { background: var(--subtle); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.w-full { width: 100%; }
.btn.w-full { justify-content: center; }

/* ─── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 700;
  text-transform: capitalize;
}
.badge::before {
  content: ''; width: 5px; height: 5px;
  border-radius: 50%; flex-shrink: 0;
}
.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-pending::before   { background: var(--amber); }
.badge-approved  { background: #d1fae5; color: #065f46; }
.badge-approved::before  { background: var(--green); }
.badge-denied    { background: #fee2e2; color: #991b1b; }
.badge-denied::before    { background: var(--red); }
.badge-cancelled { background: var(--subtle); color: #475569; }
.badge-cancelled::before { background: #94a3b8; }
.badge-rep     { background: #dbeafe; color: #1e40af; }
.badge-manager { background: #ede9fe; color: #4c1d95; }
.badge-admin   { background: #fce7f3; color: #9d174d; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text); margin-bottom: 5px; letter-spacing: .1px;
}
.form-label .req { color: var(--red); margin-left: 2px; }
.form-control {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--font-body);
  color: var(--text); background: var(--bg);
  transition: border-color var(--ease), box-shadow var(--ease);
  outline: none; -webkit-appearance: none; -moz-appearance: none; appearance: none;
}
.form-control:focus {
  border-color: var(--blue); background: #fff;
  box-shadow: 0 0 0 3px rgba(3,105,161,.1);
}
.form-control::placeholder { color: #94a3b8; }
select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px; padding-right: 34px;
}
textarea.form-control { resize: vertical; min-height: 88px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ─── File drop zone ──────────────────────────────────────────────────────── */
.file-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px; text-align: center;
  cursor: pointer; background: var(--subtle);
  transition: border-color var(--ease), background var(--ease);
  position: relative;
}
.file-drop-zone:hover, .file-drop-zone.dragover { border-color: var(--blue); background: #eff8ff; }
.file-drop-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0;
  cursor: pointer; width: 100%; height: 100%;
}
.file-drop-zone svg { width: 26px; height: 26px; color: #94a3b8; margin: 0 auto 6px; display: block; }
.file-drop-text { font-size: 13.5px; color: var(--muted); }
.file-drop-text strong { color: var(--blue); }
.file-drop-hint { font-size: 12px; color: #94a3b8; margin-top: 3px; }

.file-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px;
}
.file-item svg { width: 16px; height: 16px; color: var(--blue); flex-shrink: 0; }
.file-item-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item-size { font-size: 11.5px; color: var(--muted); }
.file-item-remove {
  background: none; border: none; color: #94a3b8;
  cursor: pointer; padding: 0 3px; line-height: 1;
  transition: color 100ms; display: flex;
}
.file-item-remove:hover { color: var(--red); }
.file-item-remove svg { width: 14px; height: 14px; }

/* ─── Tables ──────────────────────────────────────────────────────────────── */
.table-container {
  overflow-x: auto; border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card); box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--subtle); padding: 11px 16px;
  text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .7px;
  color: var(--slate); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px; font-size: 13.5px;
  color: var(--text); border-bottom: 1px solid var(--border-lt);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 100ms; }
tbody tr:hover { background: var(--subtle); }
tbody tr.clickable { cursor: pointer; }
.table-empty { text-align: center; padding: 44px 24px; color: var(--muted); }
.table-empty svg { width: 32px; height: 32px; color: #cbd5e1; margin: 0 auto 10px; display: block; }
.table-empty p { font-size: 13.5px; }

/* ─── Filters bar ─────────────────────────────────────────────────────────── */
.filters-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filters-bar .form-control { width: auto; padding: 7px 12px; }
.filters-bar select.form-control { padding-right: 32px; }

/* ─── Detail layout ───────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 18px; }
.detail-field { margin-bottom: 14px; }
.detail-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin-bottom: 3px;
}
.detail-value { font-size: 14px; color: var(--text); font-weight: 500; }
.detail-divider { border: none; border-top: 1px solid var(--border-lt); margin: 16px 0; }

/* ─── Dialog ──────────────────────────────────────────────────────────────── */
dialog {
  border: none; border-radius: var(--radius-lg); padding: 0;
  box-shadow: var(--shadow-lg); max-width: 480px; width: 90%;
  animation: dial-in 180ms ease;
}
dialog::backdrop { background: rgba(15,23,42,.5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@keyframes dial-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } to { opacity: 1; transform: none; } }

.dialog-header {
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.dialog-title { font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--text); }
.dialog-close {
  background: none; border: none; color: #94a3b8;
  cursor: pointer; padding: 4px; border-radius: 6px;
  transition: color 100ms; display: flex;
}
.dialog-close:hover { color: var(--text); }
.dialog-close svg { width: 18px; height: 18px; }
.dialog-body { padding: 22px; }
.dialog-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ─── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 13.5px; margin-bottom: 16px;
  border-left: 3px solid transparent;
}
.alert-error   { background: #fee2e2; color: #991b1b; border-left-color: var(--red); }
.alert-success { background: #d1fae5; color: #065f46; border-left-color: var(--green); }
.alert-warning { background: #fef3c7; color: #92400e; border-left-color: var(--amber); }

/* ─── Doc list ────────────────────────────────────────────────────────────── */
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--card);
}
.doc-item svg { width: 18px; height: 18px; color: var(--blue); flex-shrink: 0; }
.doc-name { flex: 1; font-size: 13px; font-weight: 500; }
.doc-size { font-size: 11.5px; color: var(--muted); }

/* ─── Toast ───────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 22px; right: 22px;
  z-index: 9999; display: flex; flex-direction: column;
  gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 16px; border-radius: 10px;
  background: var(--navy); color: #fff;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg); pointer-events: all;
  min-width: 220px; max-width: 340px;
  animation: t-in 220ms ease;
  border-left: 3px solid var(--amber);
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast svg { width: 15px; height: 15px; flex-shrink: 0; }
@keyframes t-in  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes t-out { to   { opacity: 0; transform: translateX(16px); } }

/* ─── Password strength ────────────────────────────────────────────────────── */
.strength-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.strength-fill { height: 100%; border-radius: 2px; transition: width 250ms ease, background 250ms ease; width: 0; }
.strength-fill.weak   { width: 33%; background: var(--red); }
.strength-fill.medium { width: 66%; background: var(--amber); }
.strength-fill.strong { width: 100%; background: var(--green); }
.strength-text { font-size: 11.5px; margin-top: 3px; }

/* ─── Login page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--card);
}
.login-brand {
  background: var(--navy);
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 60px; position: relative; overflow: hidden;
}
.login-brand::before {
  content: ''; position: absolute;
  top: -100px; right: -100px;
  width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(245,158,11,.12) 0%, transparent 70%);
  border-radius: 50%;
}
.login-brand-mark {
  width: 52px; height: 52px;
  background: var(--amber); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(245,158,11,.35);
  margin-bottom: 16px;
}
.login-brand-mark svg { width: 26px; height: 26px; color: #1a1a1a; }
.login-brand h1 {
  font-family: var(--font-head); font-size: 28px; font-weight: 700;
  color: #fff; letter-spacing: -.4px; margin-bottom: 12px;
  position: relative; z-index: 1;
}
.login-brand p { color: rgba(255,255,255,.5); font-size: 15px; text-align: center; max-width: 300px; line-height: 1.7; position: relative; z-index: 1; }
.login-brand-features { margin-top: 36px; display: flex; flex-direction: column; gap: 11px; position: relative; z-index: 1; }
.login-brand-feature { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.6); font-size: 13.5px; }
.login-brand-dot { width: 7px; height: 7px; background: var(--amber); border-radius: 50%; flex-shrink: 0; }

.login-form-side {
  display: flex; flex-direction: column;
  justify-content: center; align-items: center; padding: 60px;
}
.login-card { width: 100%; max-width: 400px; }
.login-card h2 {
  font-family: var(--font-head); font-size: 24px; font-weight: 700;
  color: var(--text); margin-bottom: 6px; letter-spacing: -.4px;
}
.login-card .subtitle { color: var(--muted); font-size: 14px; margin-bottom: 32px; }

/* ─── Misc utils ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.text-muted  { color: var(--muted); }
.text-sm     { font-size: 12.5px; }
.text-right  { text-align: right; }
.font-bold   { font-weight: 700; }
.flex        { display: flex; }
.items-center{ align-items: center; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }

/* ─── Hamburger button (hidden on desktop) ────────────────────────────────── */
.topbar-hamburger {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--text);
  border-radius: var(--radius-sm);
  margin-right: 4px;
  flex-shrink: 0;
}
.topbar-hamburger:hover { background: var(--bg); }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ─── Mobile / Tablet breakpoint ─────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    position: fixed;
    left: -260px;
    width: 260px;
    top: 0; bottom: 0;
    z-index: 1000;
    transition: left 220ms ease;
    box-shadow: none;
  }

  body.sidebar-open .sidebar {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 999;
  }
  body.sidebar-open .sidebar-backdrop { display: block; }

  .topbar { left: 0 !important; padding-left: 12px; }
  .topbar-hamburger { display: flex !important; }

  /* Sidebar toggle button hidden on mobile — hamburger takes over */
  #sidebar-toggle { display: none !important; }

  /* Main content full width */
  [style*="margin-left:var(--sidebar-w)"],
  [style*="margin-left: var(--sidebar-w)"] {
    margin-left: 0 !important;
  }
  /* Also catch JS-applied inline margin-left values */
  .content-wrap {
    margin-left: 0 !important;
  }

  .main-content { padding: 16px; }

  /* Tables: horizontal scroll on small screens */
  .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Form layouts: stack columns */
  .form-row { flex-direction: column !important; }
  .form-row .form-group { width: 100% !important; }

  /* Cards/grids */
  .rep-grid { grid-template-columns: 1fr !important; }
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Dialogs: full-screen on mobile */
  dialog {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 90vh !important;
    margin: auto !important;
    padding: 0 !important;
    overflow-y: auto;
  }

  /* Page header */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr !important; }
  .btn-group { flex-wrap: wrap; }
  thead th, tbody td { font-size: 12px; padding: 8px 10px; }
  .topbar-title { font-size: 15px; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .filters-bar .form-control { width: 100%; }
}

/* ─── Legacy compat ─────────────────────────────────────────────────────────── */
.page-sub, .page-subtitle { font-size: 13px; color: var(--muted); margin-top: 3px; }
.page-header-left { flex: 1; }
.page-header-left h1 { font-family: var(--font-head); font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -.4px; }
.card-body { padding: 22px; }
