/* ==========================================================
   VISITOR MANAGER — Office 2024 / Fluent Design
   ========================================================== */
:root {
  /* Office signature colors */
  --office-blue: #0F6CBD;
  --office-blue-hover: #115EA3;
  --office-blue-pressed: #0F548C;
  --office-blue-light: #EBF3FC;
  --office-blue-tint: #F6FAFD;

  /* Surfaces (Mica-inspired) */
  --surface-canvas: #F3F3F3;
  --surface-card: #FFFFFF;
  --surface-secondary: #FAFAFA;
  --surface-tertiary: #F5F5F5;
  --surface-hover: #F5F5F5;
  --surface-pressed: #EBEBEB;

  /* Strokes */
  --stroke-default: #E1DFDD;
  --stroke-soft: #EDEBE9;
  --stroke-strong: #C8C6C4;
  --stroke-divider: #F3F2F1;

  /* Text */
  --text-primary: #242424;
  --text-secondary: #424242;
  --text-tertiary: #616161;
  --text-disabled: #BDBDBD;
  --text-onaccent: #FFFFFF;

  /* Status (Fluent) */
  --success: #107C10;
  --success-bg: #DFF6DD;
  --warning: #F7B500;
  --warning-bg: #FFF4CE;
  --danger: #C42B1C;
  --danger-bg: #FDE7E9;
  --info: #0F6CBD;

  /* Shadows (Fluent depth) */
  --shadow-2: 0 1px 2px rgba(0,0,0,.07), 0 0 2px rgba(0,0,0,.06);
  --shadow-4: 0 2px 4px rgba(0,0,0,.10), 0 0 2px rgba(0,0,0,.06);
  --shadow-8: 0 4px 8px rgba(0,0,0,.10), 0 0 2px rgba(0,0,0,.05);
  --shadow-16: 0 8px 16px rgba(0,0,0,.10), 0 0 2px rgba(0,0,0,.05);
  --shadow-28: 0 14px 28px rgba(0,0,0,.12), 0 0 8px rgba(0,0,0,.06);

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--surface-canvas);
  color: var(--text-primary);
  font-family: "Segoe UI", "Segoe UI Variable", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--office-blue-light); color: var(--text-primary); }
a { color: var(--office-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==========================================================
   APP SHELL
   ========================================================== */
.app-shell { display: flex; flex-direction: column; height: 100vh; }
.app-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1;
  overflow: hidden;
}

/* ==========================================================
   SIDEBAR
   ========================================================== */
.sidebar {
  background: var(--surface-secondary);
  border-right: 1px solid var(--stroke-soft);
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--stroke-soft);
  margin-bottom: 4px;
}
.app-icon {
  width: 28px; height: 28px;
  background: var(--office-blue);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}
.sidebar-brand-title { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.sidebar-brand-sub { font-size: 11px; color: var(--text-tertiary); line-height: 1.2; }
.sidebar-section {
  padding: 10px 16px 6px;
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  border-left: 3px solid transparent;
  user-select: none;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface-hover); text-decoration: none; }
.nav-item.active {
  background: var(--office-blue-light);
  border-left-color: var(--office-blue);
  color: var(--office-blue);
  font-weight: 600;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--surface-pressed);
  color: var(--text-secondary);
  font-size: 11px; padding: 1px 7px; border-radius: 9px;
  font-weight: 600;
}
.nav-item.active .nav-badge { background: var(--office-blue); color: white; }
.sidebar-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--stroke-soft);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--office-blue);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.avatar.super-admin { background: linear-gradient(135deg, var(--warning) 0%, #E89B00 100%); }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-tertiary); }
.icon-btn-bare {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-secondary);
  padding: 0;
}
.icon-btn-bare:hover { background: var(--surface-hover); }
.icon-btn-bare svg { width: 14px; height: 14px; }

/* ==========================================================
   MAIN CONTENT
   ========================================================== */
.main { display: flex; flex-direction: column; overflow: hidden; }
.breadcrumb-bar {
  height: 48px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--stroke-soft);
  display: flex; align-items: center;
  padding: 0 24px; gap: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.breadcrumb-bar .crumb-current { color: var(--text-primary); font-weight: 600; }
.breadcrumb-spacer { flex: 1; }
.live-clock {
  font-size: 12px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  animation: pulse 1.8s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.content {
  flex: 1; overflow-y: auto;
  padding: 24px;
  background: var(--surface-canvas);
}
.content::-webkit-scrollbar { width: 14px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb {
  background: #C8C8C8; border-radius: 7px;
  border: 4px solid var(--surface-canvas);
}
.content::-webkit-scrollbar-thumb:hover { background: #A8A8A8; }

/* ==========================================================
   PAGE HEADER
   ========================================================== */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; gap: 20px;
}
.page-title {
  font-size: 28px; font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -.01em;
}
.page-subtitle { color: var(--text-tertiary); font-size: 13px; }

/* ==========================================================
   KPI CARDS
   ========================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--surface-card);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-2);
  position: relative;
  overflow: hidden;
}
.kpi-label {
  font-size: 12px; color: var(--text-tertiary);
  margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.kpi-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.kpi-icon svg { width: 16px; height: 16px; }
.kpi-value {
  font-size: 30px; font-weight: 600;
  line-height: 1; letter-spacing: -.01em;
}
.kpi-trend {
  margin-top: 6px;
  font-size: 12px; color: var(--success);
  display: flex; align-items: center; gap: 4px;
}
.kpi-trend.down { color: var(--danger); }
.kpi.alert {
  background: linear-gradient(135deg, #FFF8E0 0%, var(--surface-card) 100%);
  border-color: rgba(247,181,0,.3);
}
.kpi.alert .kpi-icon { background: var(--warning-bg); color: #8A6A00; }
.kpi.success .kpi-icon { background: var(--success-bg); color: var(--success); }
.kpi.info .kpi-icon { background: var(--office-blue-light); color: var(--office-blue); }
.kpi.neutral .kpi-icon { background: var(--surface-tertiary); color: var(--text-secondary); }

/* ==========================================================
   CARDS
   ========================================================== */
.card {
  background: var(--surface-card);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--stroke-divider);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-title-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.dash-row { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 12px; }
.two-col { display: grid; grid-template-columns: 1.1fr 1fr; gap: 12px; }

/* ==========================================================
   TABLES
   ========================================================== */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px; font-weight: 600;
  color: var(--text-tertiary);
  background: var(--surface-secondary);
  border-bottom: 1px solid var(--stroke-default);
}
td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--stroke-divider);
  font-size: 13px;
  vertical-align: middle;
}
tr:hover td { background: var(--office-blue-tint); }
td.muted, .muted { color: var(--text-tertiary); }
.name-cell { display: flex; align-items: center; gap: 10px; }
.mini-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 11px; color: white;
  flex-shrink: 0;
}

/* ==========================================================
   STATUS PILLS
   ========================================================== */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 12px;
  font-size: 12px; font-weight: 600;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.pill.in { background: var(--success-bg); color: var(--success); }
.pill.in::before { background: var(--success); }
.pill.out { background: var(--surface-tertiary); color: var(--text-secondary); }
.pill.out::before { background: var(--text-tertiary); }
.pill.expected { background: var(--office-blue-light); color: var(--office-blue); }
.pill.expected::before { background: var(--office-blue); }
.pill.alert { background: var(--danger-bg); color: var(--danger); }
.pill.alert::before { background: var(--danger); animation: pulse 1s infinite; }
.pill.vip { background: var(--warning-bg); color: #8A6A00; }
.pill.vip::before { background: var(--warning); }

/* ==========================================================
   BUTTONS
   ========================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--stroke-default);
  background: var(--surface-card);
  color: var(--text-primary);
  font-family: inherit;
  transition: background .1s;
  text-decoration: none;
}
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:active { background: var(--surface-pressed); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--office-blue); border-color: var(--office-blue); color: white; }
.btn-primary:hover { background: var(--office-blue-hover); border-color: var(--office-blue-hover); color: white; }
.btn-primary:active { background: var(--office-blue-pressed); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: white; }
.btn-warning:hover { background: #E89B00; border-color: #E89B00; color: white; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }
.btn-danger:hover { background: #A92218; border-color: #A92218; color: white; }
.btn-subtle { background: transparent; border-color: transparent; color: var(--text-primary); }
.btn-subtle:hover { background: var(--surface-hover); }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.icon-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer;
  background: transparent; border: 1px solid transparent;
  padding: 0;
}
.icon-btn:hover { background: var(--surface-hover); border-color: var(--stroke-default); }
.icon-btn svg { width: 14px; height: 14px; }
.row-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ==========================================================
   FORMS
   ========================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 16px;
}
.form-grid.full { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.col-span-2 { grid-column: span 2; }
.field label {
  font-size: 12px; color: var(--text-secondary);
  font-weight: 600;
}
.field label.req::after { content: "*"; color: var(--danger); margin-left: 2px; }
.field input, .field select, .field textarea {
  background: var(--surface-card);
  border: 1px solid var(--stroke-default);
  border-bottom: 1px solid var(--text-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 7px 11px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--text-secondary); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--office-blue);
  border-bottom-width: 2px;
  padding-bottom: 6px;
}
.field textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.field input::placeholder { color: var(--text-disabled); }

.photo-upload {
  border: 1.5px dashed var(--stroke-strong);
  border-radius: var(--radius-md);
  aspect-ratio: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-tertiary); font-size: 12px;
  cursor: pointer;
  background: var(--surface-secondary);
  text-align: center;
}
.photo-upload:hover { border-color: var(--office-blue); color: var(--office-blue); background: var(--office-blue-tint); }
.photo-upload svg { width: 28px; height: 28px; margin-bottom: 8px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 12px;
  border: 1px solid var(--stroke-default);
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-primary);
  user-select: none;
  background: var(--surface-card);
}
.chip:hover { background: var(--surface-hover); }
.chip.active {
  background: var(--office-blue);
  color: white;
  border-color: var(--office-blue);
  font-weight: 600;
}

/* ==========================================================
   SEARCH BAR
   ========================================================== */
.search-bar {
  display: flex; gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}
.search-input {
  flex: 1;
  background: var(--surface-card);
  border: 1px solid var(--stroke-default);
  border-radius: var(--radius-sm);
  padding: 7px 12px 7px 34px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23616161' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}
.search-input:focus { border-color: var(--office-blue); }

/* ==========================================================
   LOGIN
   ========================================================== */
.login-page {
  height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at top right, #DCEAFB 0%, transparent 60%),
    radial-gradient(ellipse at bottom left, #E8F1FB 0%, transparent 50%),
    #F3F3F3;
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 440px;
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-28);
  padding: 44px;
  border: 1px solid var(--stroke-soft);
}
.login-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.login-card h2 {
  font-size: 24px; font-weight: 600;
  margin: 0 0 6px;
}
.login-card .subtitle {
  color: var(--text-secondary); font-size: 13px;
  margin-bottom: 24px;
}
.login-error {
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
}
.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12px; color: var(--text-tertiary);
}

/* ==========================================================
   MODALS
   ========================================================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 30px;
}
.modal-backdrop.show { display: flex; animation: fadeIn .15s ease; }
@keyframes fadeIn { from{opacity:0}to{opacity:1} }
.modal {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 720px;
  max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-28);
  animation: slideUp .2s ease;
}
@keyframes slideUp { from{transform:translateY(15px); opacity:0} to{transform:translateY(0); opacity:1} }
.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--stroke-soft);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--stroke-soft);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--surface-secondary);
}

/* ==========================================================
   TIMELINE
   ========================================================== */
.timeline {
  border-left: 2px solid var(--stroke-default);
  padding-left: 20px;
  margin-left: 8px;
}
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -27px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--office-blue);
}
.timeline-item.done::before { background: var(--office-blue); }
.timeline-item-time { font-size: 11px; color: var(--text-tertiary); font-weight: 600; }
.timeline-item-title { font-size: 13px; color: var(--text-primary); font-weight: 600; margin-top: 2px; }

/* ==========================================================
   TOAST
   ========================================================== */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--surface-card);
  border: 1px solid var(--stroke-soft);
  border-left: 4px solid var(--success);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  z-index: 200;
  transform: translateY(150%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-16);
  min-width: 280px;
}
.toast.show { transform: translateY(0); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast-text { font-size: 13px; color: var(--text-primary); }

/* ==========================================================
   TABS
   ========================================================== */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--stroke-soft);
  margin-bottom: 20px;
  gap: 0;
}
.tab {
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  text-decoration: none;
}
.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.active { color: var(--office-blue); border-bottom-color: var(--office-blue); }

/* ==========================================================
   SETTINGS LIST
   ========================================================== */
.settings-list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--stroke-divider);
}
.settings-list-item:last-child { border-bottom: none; }
.toggle {
  width: 38px; height: 20px;
  background: var(--text-tertiary);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: background .15s;
  border: none;
  padding: 0;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: white;
  border-radius: 50%;
  transition: all .15s;
}
.toggle.on { background: var(--office-blue); }
.toggle.on::after { left: 21px; }

/* ==========================================================
   CHARTS (CSS bars)
   ========================================================== */
.chart-wrap { height: 220px; position: relative; margin-top: 8px; }
.chart-bars {
  display: flex; align-items: flex-end;
  height: 180px; gap: 10px; padding: 0 4px;
}
.bar {
  flex: 1;
  background: linear-gradient(180deg, var(--office-blue) 0%, #4A9BE0 100%);
  border-radius: 3px 3px 0 0;
  position: relative;
  min-height: 4px;
}
.bar:hover { background: var(--office-blue-hover); }
.bar-label {
  position: absolute; top: -22px;
  left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--text-primary);
  font-weight: 600;
  background: white;
  padding: 1px 6px; border-radius: 3px;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.bar:hover .bar-label { opacity: 1; }
.chart-axis {
  display: flex; gap: 10px;
  padding: 6px 4px 0;
  border-top: 1px solid var(--stroke-soft);
  margin-top: 4px;
}
.chart-axis div {
  flex: 1;
  text-align: center;
  font-size: 11px; color: var(--text-tertiary);
  font-weight: 600;
}

/* ==========================================================
   SUPER-ADMIN BANNER
   ========================================================== */
.superadmin-banner {
  background: linear-gradient(135deg, #FFF8E0 0%, #FFFBEB 100%);
  border: 1px solid var(--warning);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.superadmin-banner-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--warning);
  display: flex; align-items: center; justify-content: center;
  color: white; flex-shrink: 0;
}
.superadmin-banner-icon svg { width: 16px; height: 16px; }
.superadmin-banner-text { flex: 1; font-size: 13px; color: #5C4500; }

.warning-banner {
  background: linear-gradient(135deg, #FFF8E0 0%, #FFFBEB 100%);
  border: 1px solid var(--warning);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex; gap: 14px; align-items: flex-start;
}
.warning-banner svg.icon { flex-shrink: 0; margin-top: 2px; }
.warning-banner-text { font-size: 13px; color: #5C4500; }

/* ==========================================================
   UTILITY
   ========================================================== */
.text-mono { font-family: 'Consolas', 'Courier New', monospace; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
}

/* ==========================================================
   AMÉLIORATIONS v1.1 — Retours client
   ========================================================== */

/* Point 12 : caractères plus grands sur le dashboard */
.page-title { font-size: 32px !important; font-weight: 700; }
.kpi-value  { font-size: 36px !important; font-weight: 700; letter-spacing: -0.02em; }
.kpi-label  { font-size: 13px; font-weight: 600; }
.kpi-trend  { font-size: 13px; font-weight: 500; }
.card-title { font-size: 16px; font-weight: 700; }

/* Point 4 : icônes plus visibles (partout) */
.nav-item svg   { width: 20px !important; height: 20px !important; stroke-width: 2 !important; }
.btn svg        { width: 16px !important; height: 16px !important; stroke-width: 2.2 !important; }
.icon-btn svg   { width: 17px !important; height: 17px !important; stroke-width: 2.2 !important; }
.kpi-icon svg   { width: 20px !important; height: 20px !important; stroke-width: 2 !important; }
.kpi-icon      { width: 36px !important; height: 36px !important; border-radius: 8px !important; }

/* Alignement à gauche par défaut (point 4) */
table td, table th { text-align: left; vertical-align: middle; }
table th.text-right, table td.text-right { text-align: right !important; }
table th.text-center, table td.text-center { text-align: center !important; }

/* Statut couleur pour visiteurs présents / en pause (point 2) */
.status-dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  vertical-align: middle; margin-right: 8px;
  box-shadow: 0 0 0 3px rgba(255,255,255,.6);
}
.status-dot.in       { background: #10a710; box-shadow: 0 0 0 3px rgba(16,167,16,.15); animation: pulseGreen 2s infinite; }
.status-dot.on_break { background: #C42B1C; box-shadow: 0 0 0 3px rgba(196,43,28,.15); animation: pulseRed 1.5s infinite; }
.status-dot.out      { background: #A19F9D; }
.status-dot.expected { background: #0F6CBD; }
@keyframes pulseGreen { 0%,100% { box-shadow: 0 0 0 3px rgba(16,167,16,.15); } 50% { box-shadow: 0 0 0 6px rgba(16,167,16,.05); } }
@keyframes pulseRed   { 0%,100% { box-shadow: 0 0 0 3px rgba(196,43,28,.15); } 50% { box-shadow: 0 0 0 8px rgba(196,43,28,.05); } }

/* Pill "on break" */
.pill.on_break { background: #FDE7E9; color: #C42B1C; }
.pill.on_break::before { background: #C42B1C; animation: pulseRed 1.5s infinite; }

/* Point 3 : grille visuelle de badges */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  padding: 4px;
}
.badge-tile {
  aspect-ratio: 1;
  border-radius: 12px;
  padding: 12px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border: 2px solid var(--stroke-default);
  background: var(--surface-card);
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
  text-decoration: none;
  color: inherit;
  position: relative;
}
.badge-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-8); text-decoration: none; }
.badge-tile .badge-num {
  font-size: 28px; font-weight: 800; letter-spacing: -0.02em;
  font-family: 'Consolas','Courier New',monospace;
}
.badge-tile .badge-state {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  margin-top: 6px; letter-spacing: .04em;
}
.badge-tile .badge-holder {
  font-size: 11px; margin-top: 4px;
  color: var(--text-tertiary);
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge-tile.state-available { border-color: #10a710; background: #F1FBF1; color: #0e6b0e; }
.badge-tile.state-assigned  { border-color: #0F6CBD; background: #EBF3FC; color: #0F6CBD; }
.badge-tile.state-on_break  { border-color: #C42B1C; background: #FDE7E9; color: #C42B1C; }
.badge-tile.state-disabled  { border-color: var(--stroke-strong); background: #F5F5F5; color: var(--text-tertiary); opacity: .7; }
.badge-tile.state-lost      { border-color: var(--warning); background: #FFF8E0; color: #8A6A00; }

.badge-tile-status-icon {
  position: absolute; top: 6px; right: 6px;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 12px;
}
.badge-tile.state-available .badge-tile-status-icon { background: #10a710; }
.badge-tile.state-assigned  .badge-tile-status-icon { background: #0F6CBD; }
.badge-tile.state-on_break  .badge-tile-status-icon { background: #C42B1C; }
.badge-tile.state-disabled  .badge-tile-status-icon { background: var(--text-tertiary); }
.badge-tile.state-lost      .badge-tile-status-icon { background: var(--warning); }

/* Point 5 : bouton "Nouveau visiteur" plus visuel */
.btn-new-visitor {
  background: linear-gradient(135deg, var(--office-blue) 0%, #4A9BE0 100%);
  border-color: transparent;
  color: white !important;
  font-weight: 700;
  padding: 8px 16px;
  box-shadow: 0 2px 8px rgba(15,108,189,.25);
}
.btn-new-visitor:hover {
  background: linear-gradient(135deg, var(--office-blue-hover) 0%, #3d8ad0 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15,108,189,.35);
}
.btn-new-visitor svg { width: 18px !important; height: 18px !important; stroke-width: 2.5 !important; }

/* Bandeau d'alerte proéminent */
.alert-banner {
  background: linear-gradient(135deg, #FDE7E9 0%, #FFFBEB 100%);
  border: 1px solid var(--danger);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 14px;
}
.alert-banner-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--danger);
  display: flex; align-items: center; justify-content: center;
  color: white; flex-shrink: 0;
}
.alert-banner-text { flex: 1; font-size: 14px; color: #6B1F17; font-weight: 500; }
.alert-banner-text strong { font-weight: 700; }

.alert-banner.success { border-color: var(--success); background: linear-gradient(135deg, #DFF6DD 0%, #F0FCF0 100%); }
.alert-banner.success .alert-banner-icon { background: var(--success); }
.alert-banner.success .alert-banner-text { color: #0d5c0d; }

/* Icônes dans les cellules de table */
td .cell-with-icon { display: flex; align-items: center; gap: 8px; }
td .cell-with-icon svg { width: 14px; height: 14px; color: var(--text-tertiary); flex-shrink: 0; }

/* Boutons d'export */
.export-btns { display: flex; gap: 8px; }
.btn-excel { background: #107C41; border-color: #107C41; color: white; }
.btn-excel:hover { background: #0B5F32; border-color: #0B5F32; color: white; }
.btn-pdf   { background: #C42B1C; border-color: #C42B1C; color: white; }
.btn-pdf:hover { background: #A92218; border-color: #A92218; color: white; }

/* Impression pour PDF */
@media print {
  .sidebar, .breadcrumb-bar, .btn, .icon-btn, .search-bar, .modal-backdrop, .toast { display: none !important; }
  .app-body { display: block !important; }
  .main, .content { overflow: visible !important; height: auto !important; padding: 0 !important; background: white !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; page-break-inside: avoid; }
  body { background: white !important; }
  .page-title { font-size: 20px !important; }
  table { font-size: 11px; }
  th, td { padding: 4px 8px !important; }
}

/* ==========================================================
   MATRICE DES DROITS & APERÇU
   ========================================================== */
.perm-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
  background: var(--surface-secondary);
  border: 1px solid var(--stroke-default);
  border-radius: var(--radius-md);
  margin-top: 4px;
}
.perm-group {
  background: white;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  border: 1px solid var(--stroke-default);
}
.perm-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--office-blue);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--stroke-default);
}
.perm-items { display: flex; flex-direction: column; gap: 3px; }
.perm-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; line-height: 1.4;
  padding: 2px 0;
}
.perm-item.yes { color: #0e6b0e; }
.perm-item.no  { color: #999; text-decoration: line-through; }
.perm-item .perm-icon {
  font-weight: 800; font-size: 12px; width: 14px; text-align: center;
}
.perm-item.yes .perm-icon { color: var(--success); }
.perm-item.no  .perm-icon { color: var(--danger); text-decoration: none; }
.perm-item .perm-label { flex: 1; }

/* Page matrice détaillée */
.perm-matrix {
  width: 100%; border-collapse: collapse;
  background: white; font-size: 13px;
}
.perm-matrix th, .perm-matrix td {
  padding: 10px 14px; border-bottom: 1px solid var(--stroke-default);
  text-align: center; vertical-align: middle;
}
.perm-matrix thead th {
  background: var(--surface-secondary);
  font-weight: 700; text-transform: uppercase;
  font-size: 11px; letter-spacing: 0.05em;
  color: var(--office-blue);
}
.perm-matrix th:first-child, .perm-matrix td:first-child {
  text-align: left; font-weight: 500;
}
.perm-matrix tr.perm-group-row td {
  background: var(--surface-tertiary);
  font-weight: 700; text-transform: uppercase;
  font-size: 11px; letter-spacing: 0.05em;
  color: var(--text-secondary);
  text-align: left; padding: 8px 14px;
}
.perm-matrix .perm-yes { color: var(--success); font-size: 18px; font-weight: 800; }
.perm-matrix .perm-no  { color: #C42B1C; font-size: 16px; font-weight: 800; opacity: 0.6; }
.perm-matrix .perm-super { color: var(--warning); font-size: 16px; font-weight: 800; }

.role-header {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 12px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.role-header.super_admin { background: #FFF8E0; color: #8A6A00; }
.role-header.admin      { background: #EFDBFB; color: #6B37A0; }
.role-header.reception  { background: #EBF3FC; color: #0F6CBD; }
.role-header.security   { background: #FFEBED; color: #C42B1C; }

/* ==========================================================
   MATRICE ÉDITABLE PAR UTILISATEUR (tri-state)
   ========================================================== */
.perm-matrix.perm-editable tr.perm-overridden {
  background: linear-gradient(90deg, #FFFBEB 0%, transparent 60%);
  border-left: 3px solid #F7B500;
}
.perm-matrix.perm-editable td { padding: 8px 14px; }

.tri-state {
  display: inline-flex;
  gap: 4px;
  background: #F5F5F5;
  border-radius: 6px;
  padding: 3px;
  border: 1px solid var(--stroke-default);
}
.tri-btn {
  flex: 1;
  min-width: 76px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  user-select: none;
  transition: all 0.1s;
  border: 1px solid transparent;
}
.tri-btn:hover { background: white; color: var(--text-primary); }
.tri-btn input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.tri-btn.active.default { background: white; color: var(--text-primary); border-color: var(--stroke-strong); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.tri-btn.active.grant   { background: #DFF6DD; color: #0e6b0e; border-color: var(--success); }
.tri-btn.active.revoke  { background: #FDE7E9; color: #C42B1C; border-color: var(--danger); }
.tri-btn input[disabled] + span { opacity: 0.4; cursor: not-allowed; }
