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

:root {
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --color-bg: #f1f5f9;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-text-subtle: #94a3b8;
  --color-primary: #1e40af;
  --color-primary-hover: #1e3a8a;
  --color-primary-light: #eff6ff;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-purple: #7c3aed;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 5px;
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 24px rgba(15,23,42,.10), 0 4px 8px rgba(15,23,42,.06);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

html { font-size: 14px; }
body { font-family: var(--font); background: var(--color-bg); color: var(--color-text); display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #1e293b;
  border-right: none;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.logo { display: flex; align-items: center; }
.logo-wordmark { display: flex; flex-direction: column; gap: 2px; }
.logo-main {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #e2e8f0;
}
.logo-amp {
  font-style: italic;
  letter-spacing: 0;
  color: #64748b;
}
.logo-sub {
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #475569;
  font-family: inherit;
}
.sidebar-toggle { display: none; background: none; border: none; cursor: pointer; color: #64748b; font-size: 18px; }

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: #94a3b8; text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.nav-item.active { background: rgba(255,255,255,.10); color: #fff; }
.nav-badge {
  margin-left: auto;
  background: var(--color-primary); color: #fff;
  border-radius: 999px; padding: 1px 7px;
  font-size: 11px; font-weight: 600;
  min-width: 20px; text-align: center;
}
.nav-badge { background: #3b82f6 !important; }
.nav-badge[data-count="0"], .nav-badge:empty { display: none; }

.sidebar-footer { padding: 12px 12px 16px; border-top: 1px solid rgba(255,255,255,.07); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #e2e8f0;
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name { font-weight: 600; font-size: 13px; display: block; color: #e2e8f0; }
.user-role { font-size: 11.5px; color: #64748b; }

/* ===== Main ===== */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== Topbar ===== */
.topbar {
  height: var(--topbar-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(15,23,42,.05);
}
.page-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.clock { font-size: 12.5px; color: var(--color-text-muted); font-weight: 500; white-space: nowrap; letter-spacing: .01em; }

/* ===== Pages ===== */
.page { display: none; padding: 28px 32px; flex-direction: column; gap: 24px; animation: fadeIn .2s ease; }
.page.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Stats ===== */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
  width: 50px; height: 50px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; fill: currentColor; }
.stat-icon--blue { background: #eff6ff; color: #1e40af; }
.stat-icon--green { background: #f0fdf4; color: #16a34a; }
.stat-icon--orange { background: #fff7ed; color: #ea580c; }
.stat-icon--purple { background: #f5f3ff; color: #7c3aed; }
.stat-value { font-size: 30px; font-weight: 800; line-height: 1; display: block; letter-spacing: -.02em; }
.stat-label { font-size: 11.5px; color: var(--color-text-muted); margin-top: 5px; font-weight: 500; letter-spacing: .01em; }

/* ===== Dashboard Grid ===== */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Badge tile grid (dashboard widget) */
.badge-tile-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}
.badge-tile-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.badge-tile-name {
  font-size: 9.5px; font-weight: 600; color: var(--color-text-muted);
  max-width: 44px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1;
}
.badge-tile {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  color: var(--color-text-muted);
  transition: transform .12s, box-shadow .12s;
  user-select: none;
}
.badge-tile--available {
  background: var(--color-bg);
  border-color: var(--color-border);
  color: var(--color-text-muted);
}
.badge-tile--available:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.badge-tile--recent {
  background: #dcfce7;
  border-color: #16a34a;
  color: #15803d;
}
.badge-tile--overdue {
  background: #fee2e2;
  border-color: #dc2626;
  color: #b91c1c;
}
.badge-tile--blocked {
  background: #fef9c3;
  border-color: #ca8a04;
  color: #854d0e;
}

/* ===== Parking dashboard widget ===== */
.parking-widget-summary {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.parking-summary-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
}
.parking-summary-pill span {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}
.parking-summary-free { background: #f0fdf4; color: #15803d; border: 1.5px solid #86efac; }
.parking-summary-occ  { background: #fef2f2; color: #b91c1c; border: 1.5px solid #fca5a5; }
.parking-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
}

/* ===== Cards ===== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.card-header h2 { font-size: 14px; font-weight: 600; letter-spacing: .01em; color: var(--color-text); }
.card-link { font-size: 12px; color: var(--color-primary); text-decoration: none; font-weight: 500; opacity: .8; }
.card-link:hover { opacity: 1; text-decoration: underline; }
.card-body { padding: 24px; }
.card-actions { display: flex; align-items: center; gap: 10px; }

/* ===== Form ===== */
.form-card { max-width: 860px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.form-row--full { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group label { font-size: 11.5px; font-weight: 600; color: var(--color-text-muted); letter-spacing: .04em; text-transform: uppercase; }
.field-required { color: var(--color-danger); }
input[type="text"], input[type="email"], input[type="tel"], input[type="search"],
input[type="date"], input[type="datetime-local"], select, textarea {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
  outline: none;
  line-height: 1.4;
}
input[type="text"]::placeholder, input[type="search"]::placeholder, textarea::placeholder { color: var(--color-text-subtle); }
input:focus, select:focus, textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,.1);
}
input.error, select.error { border-color: var(--color-danger); box-shadow: 0 0 0 3px rgba(239,68,68,.1); }
textarea { resize: vertical; min-height: 72px; }
.search-input { width: 220px; }
.color-input { height: 40px; padding: 4px 8px; cursor: pointer; }

.checkbox-group { margin-top: 4px; }
.checkbox-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.checkbox-label input { display: none; }
.checkbox-custom {
  width: 18px; height: 18px; border: 2px solid var(--color-border);
  border-radius: 4px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.checkbox-label input:checked + .checkbox-custom {
  background: var(--color-primary); border-color: var(--color-primary);
}
.checkbox-label input:checked + .checkbox-custom::after {
  content: '✓'; color: #fff; font-size: 12px; line-height: 1;
}
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; padding-top: 20px; border-top: 1px solid var(--color-border); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; transition: background .15s, box-shadow .15s, transform .1s;
  text-decoration: none; white-space: nowrap; letter-spacing: .01em;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 15px; height: 15px; fill: currentColor; }
.btn-primary { background: var(--color-primary); color: #fff; box-shadow: 0 1px 3px rgba(30,64,175,.3); }
.btn-primary:hover { background: var(--color-primary-hover); box-shadow: 0 2px 6px rgba(30,64,175,.35); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border: 1.5px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-bg); border-color: #cbd5e1; }
.btn-danger { background: #fef2f2; color: #dc2626; border: 1.5px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-ghost { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-bg); color: var(--color-text); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 11px 26px; font-size: 14px; font-weight: 600; }
.btn-full { width: 100%; justify-content: center; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 11px 16px;
  font-size: 10.5px; font-weight: 700; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1.5px solid var(--color-border);
  background: var(--color-bg);
}
tbody tr { border-bottom: 1px solid var(--color-border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
td { padding: 13px 16px; vertical-align: middle; }

/* ===== Status Badges ===== */
.status-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
}
.status-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-active { background: #f0fdf4; color: #16a34a; }
.chip-out { background: #f8fafc; color: var(--color-text-muted); }
.badge-chip {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; color: #fff;
}

/* ===== Empty State ===== */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 40px 20px; color: var(--color-text-muted);
  text-align: center;
}
.empty-state svg { width: 40px; height: 40px; fill: currentColor; opacity: .35; }
.empty-state p { font-size: 13.5px; }

/* ===== Visitor Cards (small) ===== */
.visitor-mini {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--color-border);
}
.visitor-mini:last-child { border-bottom: none; }
.visitor-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
  color: #fff;
}
.visitor-mini-info { flex: 1; min-width: 0; }
.visitor-mini-name { font-weight: 600; font-size: 13.5px; }
.visitor-mini-sub { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visitor-mini-time { font-size: 11.5px; color: var(--color-text-muted); white-space: nowrap; }

/* ===== Badge Styles ===== */
.badges-layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; }
.badge-preview-body { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.badge-container { display: flex; justify-content: center; }

.badge {
  width: 260px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15), 0 0 0 1px rgba(0,0,0,.08);
  overflow: hidden;
  text-align: center;
  font-family: var(--font);
  user-select: none;
}
.badge-header-strip {
  padding: 10px 16px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .12em;
  color: #fff;
  background: var(--color-primary);
}
.badge-logo-area { padding: 16px 16px 8px; }
.badge-company-logo {
  width: 52px; height: 52px; border-radius: 12px;
  background: var(--color-primary); color: #fff;
  font-weight: 800; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}
.badge-name { font-size: 17px; font-weight: 700; padding: 4px 12px 2px; color: #1e293b; }
.badge-company { font-size: 12px; color: #64748b; padding: 0 12px 8px; }
.badge-host { font-size: 11.5px; color: #475569; padding: 0 12px; }
.badge-host span { font-weight: 600; }
.badge-date { font-size: 11px; color: #94a3b8; padding: 6px 12px 4px; }
.badge-number { font-size: 11px; font-weight: 700; color: #cbd5e1; letter-spacing: .06em; padding: 0 12px 12px; }

/* ===== Filters ===== */
.filter-row {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 16px; margin-bottom: 4px;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.filter-row label { font-size: 13px; font-weight: 500; color: var(--color-text-muted); }
.filter-row input[type="date"] { width: auto; }

/* ===== Settings ===== */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-save-row { margin-top: 4px; display: flex; justify-content: flex-end; }
.help-text { font-size: 13px; color: var(--color-text-muted); margin-bottom: 16px; }

/* ===== Modal ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.5); backdrop-filter: blur(2px);
  z-index: 200; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }
.modal {
  background: var(--color-surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 440px;
  max-height: 90vh; overflow-y: auto;
}
.modal-sm { max-width: 340px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--color-border);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 22px; color: var(--color-text-muted); line-height: 1;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
}
.modal-close:hover { background: var(--color-bg); }
.modal-body { padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: 10px; }
.success-icon svg { width: 48px; height: 48px; fill: var(--color-success); }
.modal-badge .badge { width: 220px; }

/* ===== Toast ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1e293b; color: #fff;
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .25s ease;
  max-width: 320px;
}
.toast.success { background: #065f46; }
.toast.error { background: #7f1d1d; }
.toast svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }
.toast-undo { max-width: 360px; }
.toast-undo-btn {
  margin-left: auto;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.toast-undo-btn:hover { background: rgba(255,255,255,.28); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ===== Print Styles ===== */
@media print {
  .sidebar, .topbar, .modal-footer, .btn { display: none !important; }
  .main { margin-left: 0; }
  .badge { box-shadow: none; border: 2px solid #000; }
}

/* ===== Purpose Pills ===== */
.purpose-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.purpose-pill {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, transform .08s;
  user-select: none;
}
.purpose-pill:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}
.purpose-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.purpose-pill:active { transform: scale(.96); }
.pills-error .purpose-pill {
  border-color: var(--color-danger);
}

/* centre the NDA checkbox vertically in its cell */
.form-group--center {
  justify-content: center;
  padding-top: 24px;
}
.nda-label { font-size: 13px; }

/* ===== Field hints ===== */
.field-hint { font-size: 12px; margin-top: 4px; display: block; }
.field-hint--warn { color: var(--color-warning); }
.field-hint--ok   { color: var(--color-success); }

/* ===== Host Picker ===== */
.host-picker { position: relative; }
.host-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 60;
  max-height: 200px;
  overflow-y: auto;
}
.host-option {
  padding: 9px 12px;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .1s;
}
.host-option:hover, .host-option.selected { background: var(--color-primary-light); color: var(--color-primary); }
.host-option--new { color: var(--color-text-muted); font-style: italic; }
.host-option--new:hover { background: var(--color-bg); color: var(--color-text); }

/* ===== Settings Items (categories & inventory) ===== */
.settings-card-tall .card-body { display: flex; flex-direction: column; gap: 12px; }
.item-list { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.item-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}
.item-color-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
}
.item-label { font-size: 13.5px; font-weight: 500; flex: 1; }
.item-label--muted { color: var(--color-text-muted); font-size: 12.5px; }
.item-delete { padding: 2px 6px; color: var(--color-text-muted); flex-shrink: 0; }
.item-delete:hover { color: var(--color-danger); }
.item-delete:disabled { opacity: .3; cursor: not-allowed; }
.drag-handle { font-size: 16px; color: var(--color-text-muted); cursor: grab; flex-shrink: 0; line-height: 1; padding: 0 2px; }
.drag-handle:active { cursor: grabbing; }
.item-row.dragging { opacity: .4; }
.item-row.drag-over { border-color: var(--color-primary); background: #eff6ff; }

.add-item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid var(--color-border);
}
.add-item-row--3 {
  grid-template-columns: 1fr 1fr auto;
}
.add-item-row--3col {
  grid-template-columns: 1fr auto auto;
}
.color-input-sm { height: 36px; width: 36px; padding: 2px 4px; }

/* ===== Check-in success badge display ===== */
.assigned-badge-display { display: flex; justify-content: center; margin-top: 4px; }
.badge-assigned-info { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.badge-cat-label { font-size: 12px; color: var(--color-text-muted); font-weight: 500; }

/* ===== Modal sub text ===== */
.modal-sub { font-size: 12.5px; color: var(--color-text-muted); margin-top: 4px; }

/* ===== Deliveries layout ===== */
.deliveries-layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  gap: 24px;
  align-items: start;
}
.expected-layout {
  display: grid;
  grid-template-columns: minmax(380px, 480px) 1fr;
  gap: 24px;
  align-items: start;
}
.delivery-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
}
.delivery-filter-pill {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
}
.delivery-filter-pill:hover { border-color: var(--color-primary); color: var(--color-primary); }
.delivery-filter-pill.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.delivery-sort-select {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 12px;
  cursor: pointer;
}
.delivery-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.delivery-row:last-child { border-bottom: none; }
.delivery-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
}
.delivery-row-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.delivery-row-recipient {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.delivery-row-sender {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.delivery-row-time {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.delivery-row-notes {
  font-size: 12px;
  color: var(--color-text-muted);
  padding-left: 2px;
  font-style: italic;
}
.delivery-row-actions {
  display: flex;
  gap: 6px;
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .badges-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .page { padding: 16px; }
  .search-input { width: 160px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-right .clock { display: none; }
}

/* ===== Notes ===== */
.notes-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.note-colors { display: flex; gap: 8px; align-items: center; }
.note-color-btn {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.note-color-btn:hover { transform: scale(1.2); }
.note-color-btn.active { border-color: var(--color-text); transform: scale(1.15); }

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
}
.sticky-note {
  border-radius: 4px;
  padding: 14px 14px 40px;
  position: relative;
  box-shadow: 2px 3px 8px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  min-height: 160px;
  height: 160px;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, transform .15s;
}
.sticky-note:hover { box-shadow: 4px 6px 16px rgba(0,0,0,.18); transform: translateY(-2px); }
.sticky-note-text {
  flex: 1;
  overflow-y: auto;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.55;
  color: #1e293b;
  width: 100%;
  min-height: 80px;
}
.sticky-note-text::placeholder { color: #94a3b8; }
.sticky-note-footer {
  position: absolute; bottom: 8px; left: 14px; right: 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.sticky-note-date { font-size: 10.5px; color: rgba(0,0,0,.35); }
.sticky-note-delete {
  background: none; border: none; cursor: pointer;
  color: rgba(0,0,0,.25); font-size: 16px; line-height: 1; padding: 2px 4px;
  border-radius: 4px; transition: color .12s, background .12s;
}
.sticky-note-delete:hover { color: var(--color-danger); background: rgba(239,68,68,.1); }

/* Note sizes */
.sticky-note--sm { height: 160px; }
.sticky-note--md { height: 240px; grid-column: span 2; }
.sticky-note--lg { height: 320px; grid-column: span 3; }

.sticky-note-size {
  background: none; border: none; cursor: pointer;
  color: rgba(0,0,0,.3); font-size: 11px; font-weight: 700;
  padding: 2px 5px; border-radius: 4px;
  transition: color .12s, background .12s;
  letter-spacing: .02em;
}
.sticky-note-size:hover { color: rgba(0,0,0,.6); background: rgba(0,0,0,.08); }

/* ===== Parking ===== */
.parking-header { margin-bottom: 4px; }
.parking-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
}
.parking-spot {
  border-radius: var(--radius);
  padding: 18px 14px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 2px solid var(--color-border);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  text-align: center;
  user-select: none;
}
.parking-spot:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.parking-spot-num  { font-size: 28px; font-weight: 800; line-height: 1; }
.parking-spot-name { font-size: 12px; font-weight: 600; word-break: break-word; margin-top: 2px; }
.parking-spot-label{ font-size: 11px; color: inherit; opacity: .7; }
.parking-spot--free {
  background: var(--color-bg); border-color: var(--color-border); color: var(--color-text-muted);
}
.parking-spot--free:hover { border-color: var(--color-primary); color: var(--color-primary); }
.parking-spot--recent  { background: #dcfce7; border-color: #16a34a; color: #15803d; }
.parking-spot--overdue { background: #fee2e2; border-color: #dc2626; color: #b91c1c; }
.parking-spot--preassigned { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }
.parking-spot--preassigned:hover { border-color: #1e40af; }
.parking-spot-expected { font-size: 11px; font-weight: 600; color: #1e40af; opacity: 1; }
.parking-spot-timeslot { font-size: 10px; color: var(--color-text-muted); margin-top: 2px; }
/* Services widget */
.service-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.service-row:last-child { border-bottom: none; }
.service-row-name { font-size: 13px; font-weight: 600; flex: 1; }
.service-row-done { font-size: 12px; color: #16a34a; font-weight: 600; background: #dcfce7; border-radius: 6px; padding: 4px 10px; }
.service-row-actions { display: flex; align-items: center; gap: 8px; }
.service-time-input { font-size: 12px; padding: 5px 8px; border: 1.5px solid var(--color-border); border-radius: 8px; background: var(--color-bg); color: var(--color-text); width: 96px; }

.parking-spot-nextup { font-size: 10px; font-weight: 600; color: #7c3aed; margin-top: 3px; border-top: 1px dashed #ddd6fe; padding-top: 3px; }
.parking-spot-nextup-pill {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 8px; padding: 6px 8px;
  background: #eff6ff; border: 1.5px solid #bfdbfe;
  border-radius: 8px; width: 100%; box-sizing: border-box;
  text-align: left; overflow: hidden;
}
.parking-spot-nextup-pill-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #3b82f6; flex-shrink: 0; margin-top: 3px;
}
.parking-spot-nextup-pill-text {
  font-size: 10px; font-weight: 600; color: #1e40af;
  line-height: 1.35; min-width: 0; flex: 1;
  overflow: hidden; word-break: break-word;
}
.parking-spot-nextup-pill-sub {
  font-size: 9px; font-weight: 500; color: #60a5fa; margin-top: 1px;
}

/* Timeslot picker */
.timeslot-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.timeslot-btn {
  padding: 4px 8px; border-radius: 6px; border: 1.5px solid var(--color-border);
  background: var(--color-bg-secondary); color: var(--color-text-muted);
  font-size: 12px; font-weight: 500; cursor: pointer; transition: all .12s;
  font-family: inherit;
}
.timeslot-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* ===== To-Do ===== */
.todo-list { display: flex; flex-direction: column; gap: 6px; }
.todo-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.todo-check {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-muted); flex-shrink: 0;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  transition: color .12s;
}
.todo-check svg { width: 20px; height: 20px; }
.todo-check:hover { color: var(--color-success); }
.todo-check--done { color: var(--color-success); }
.todo-text { flex: 1; font-size: 13.5px; }
.todo-text--done { text-decoration: line-through; color: var(--color-text-muted); }
.todo-delete {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-muted); font-size: 14px; padding: 2px 5px;
  border-radius: 4px; transition: color .12s;
}
.todo-delete:hover { color: var(--color-danger); }
.todo-done-date { font-size: 11px; color: var(--color-text-muted); white-space: nowrap; }

.todo-archive-section { margin-top: 4px; }
.todo-archive-toggle {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--color-text-muted);
  padding: 6px 2px;
}
.todo-archive-toggle svg { width: 18px; height: 18px; fill: currentColor; transition: transform .2s; }
.todo-archive-toggle:hover { color: var(--color-text); }
.todo-archive-count {
  background: var(--color-border); color: var(--color-text-muted);
  border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 600;
}
.todo-archive-list { margin-top: 8px; }
.todo-list--archived .todo-item { opacity: .75; }

/* Parking plate chip */
.parking-spot-plate {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  background: rgba(0,0,0,.1); border-radius: 3px; padding: 1px 5px;
  margin-top: 2px;
}

/* ===== PIN Lock Screen ===== */
.pin-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: #0f172a;
  display: flex; align-items: center; justify-content: center;
}
.pin-overlay.hidden { display: none; }

.pin-box {
  display: flex; flex-direction: column; align-items: center;
  gap: 20px; width: 320px;
}

.pin-logo {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin-bottom: 4px;
}
.pin-logo .logo-main  { font-size: 20px; font-weight: 700; color: #e2e8f0; letter-spacing: -.02em; }
.pin-logo .logo-amp   { color: #64748b; }
.pin-logo .logo-sub   { font-size: 11px; font-weight: 500; color: #64748b; letter-spacing: .06em; text-transform: uppercase; }

.pin-title {
  font-size: 15px; font-weight: 600; color: #94a3b8; letter-spacing: .04em; text-transform: uppercase;
}

.pin-dots {
  display: flex; gap: 16px;
}
.pin-dots span {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #334155;
  background: transparent;
  transition: background .15s, border-color .15s;
}
.pin-dots span.filled {
  background: #1e40af; border-color: #1e40af;
}

.pin-error {
  height: 18px; font-size: 13px; color: #f87171; font-weight: 500; text-align: center;
}
.pin-error.shake {
  animation: pin-shake .35s ease;
}
@keyframes pin-shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  60%      { transform: translateX(6px); }
}

.pin-pad {
  display: grid; grid-template-columns: repeat(3, 72px); gap: 10px;
}
.pin-key {
  height: 72px; border-radius: 50%; border: none;
  background: #1e293b; color: #e2e8f0;
  font-size: 22px; font-weight: 600; cursor: pointer;
  transition: background .12s, transform .08s;
  display: flex; align-items: center; justify-content: center;
}
.pin-key:hover  { background: #334155; }
.pin-key:active { background: #1e40af; transform: scale(.93); }
.pin-key--clear { font-size: 16px; color: #f87171; }
.pin-key--back  { font-size: 18px; color: #94a3b8; }

/* ===== Scan Modal ===== */
.scan-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Delivery Category Boxes ===== */
.delivery-categories {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}
.delivery-empty-all { grid-column: 1 / -1; }

.delivery-cat-box {
  background: var(--cat-bg);
  border: 1.5px solid var(--cat-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.delivery-cat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1.5px solid var(--cat-border);
  background: var(--cat-bg);
}
.delivery-cat-icon  { font-size: 20px; line-height: 1; }
.delivery-cat-title { font-size: 14px; font-weight: 700; color: var(--cat-color); flex: 1; }
.delivery-cat-count {
  background: var(--cat-color); color: #fff;
  border-radius: 999px; padding: 1px 8px;
  font-size: 12px; font-weight: 700;
  min-width: 22px; text-align: center;
}
.delivery-cat-list { padding: 8px 0; }
.delivery-cat-empty {
  padding: 16px; text-align: center;
  font-size: 13px; color: var(--color-text-muted);
}
.delivery-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--cat-border);
}
.delivery-item:last-child { border-bottom: none; }
.delivery-item-main {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  margin-bottom: 8px;
}
.delivery-item-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.delivery-item-recipient { font-size: 14px; font-weight: 700; color: var(--color-text); }
.delivery-item-sender    { font-size: 12px; color: var(--color-text-muted); }
.delivery-item-notes     { font-size: 12px; color: var(--color-text-muted); font-style: italic; }
.delivery-item-time      { font-size: 11px; color: var(--color-text-muted); white-space: nowrap; flex-shrink: 0; }
.delivery-item-actions   { display: flex; gap: 6px; }

/* ===== Active Visitor Cards ===== */
.visitor-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.visitor-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px 20px 18px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
  text-align: center;
  min-height: 340px;
}
.visitor-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.visitor-card-avatar-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.visitor-card-avatar {
  width: 64px; height: 64px; border-radius: 16px;
  font-size: 20px; font-weight: 700;
}
.visitor-card-checkin {
  font-size: 11px; font-weight: 600; color: var(--color-text-muted);
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: 20px; padding: 2px 10px;
}
.visitor-card-name    { font-size: 17px; font-weight: 700; color: var(--color-text); }
.visitor-card-company  { font-size: 12px; color: var(--color-text-muted); margin-bottom: 2px; }
.visitor-card-duration { font-size: 11px; font-weight: 600; color: #0369a1; background: #e0f2fe; border-radius: 999px; padding: 2px 9px; display: inline-block; margin-bottom: 4px; }
.host-link { color: inherit; text-decoration: underline dotted; text-underline-offset: 2px; cursor: pointer; }
.host-link:hover { color: var(--color-primary); }
.checkout-returns { font-size: 12px; color: #0369a1; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 8px 12px; margin-top: 8px; }

/* ── Calendar view ─────────────────────────────────────────────────── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-day { background: var(--color-bg-secondary); border: 1.5px solid var(--color-border); border-radius: 10px; padding: 8px; min-height: 90px; }
.cal-day--today { border-color: var(--color-primary); background: #eff6ff; }
.cal-day--past { opacity: .55; }
.cal-day-label { font-size: 11px; font-weight: 700; color: var(--color-text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em; }
.cal-day--today .cal-day-label { color: var(--color-primary); }
.cal-empty { font-size: 11px; color: var(--color-text-muted); text-align: center; padding-top: 8px; }
.cal-event { background: #fff; border: 1.5px solid #bfdbfe; border-radius: 7px; padding: 5px 7px; margin-bottom: 4px; cursor: pointer; transition: border-color .12s; }
.cal-event:hover { border-color: var(--color-primary); }
.cal-event-time { font-size: 10px; font-weight: 700; color: #1e40af; }
.cal-event-name { font-size: 11px; font-weight: 600; color: var(--color-text); }
.cal-event-sub  { font-size: 10px; color: var(--color-text-muted); margin-top: 1px; }

.visitor-card-divider { height: 1px; background: var(--color-border); margin: 8px 0; }

.visitor-card-detail  { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.visitor-card-detail-row {
  display: flex; align-items: baseline; gap: 8px;
}
.vcd-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--color-text-muted); white-space: nowrap; min-width: 36px;
}
.vcd-label--parking { color: #15803d; }
.vcd-label--badge   { color: #7c3aed; }
.vcd-value { font-size: 13px; font-weight: 500; color: var(--color-text); }

.visitor-card-actions {
  display: flex; gap: 6px; margin-top: auto; padding-top: 14px;
  border-top: 1px solid var(--color-border);
}
.visitor-card-actions .btn { flex: 1; }

/* ===== Day Recap Widget ===== */
.recap-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.recap-event {
  display: grid;
  grid-template-columns: 52px 22px 110px 1fr auto;
  align-items: center;
  gap: 0 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--color-border-light);
}
.recap-event:last-child { border-bottom: none; }
.recap-event-time  { font-size: 12px; font-weight: 600; color: var(--color-text-muted); white-space: nowrap; }
.recap-event-icon  { font-size: 15px; text-align: center; }
.recap-event-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.recap-event-name  { font-size: 13px; font-weight: 600; color: var(--color-text); }
.recap-event-sub   { font-size: 11px; color: var(--color-text-muted); text-align: right; white-space: nowrap; }

.recap-show-more {
  background: none; border: none; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--color-primary);
  padding: 8px 0 2px; width: 100%; text-align: left;
  transition: opacity .15s;
}
.recap-show-more:hover { opacity: .7; }

/* ===== Recap section headers ===== */
.recap-section { margin-bottom: 10px; }
.recap-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--color-text-muted); padding: 6px 0 4px; margin-top: 4px;
  border-bottom: 1.5px solid var(--color-border);
  margin-bottom: 2px;
}
.recap-section:first-child .recap-section-label { margin-top: 0; }

/* ===== Recap Row (paired format) ===== */
.recap-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--color-border); font-size: 13px; }
.recap-row:last-child { border-bottom: none; }
.recap-row-icon { font-size: 15px; flex-shrink: 0; width: 22px; text-align: center; }
.recap-row-name { font-weight: 600; color: var(--color-text); min-width: 130px; flex-shrink: 0; }
.recap-row-events { color: var(--color-text-muted); font-size: 12px; flex: 1; }
.recap-row-events strong { color: var(--color-text); font-weight: 500; }
