/* ─────────────────────────────────────────────────────────────────────────
   shared-light.css — Light theme design system for LEO
   ───────────────────────────────────────────────────────────────────────── */

:root { color-scheme: light !important; }
* { color-scheme: light !important; }

:root {
  color-scheme: light !important;
  /* Brand */
  --accent:        #4F6AF5;
  --accent-soft:   rgba(79, 106, 245, 0.10);
  --accent-strong: #3955d8;

  /* Status */
  --ok:            #16a34a;
  --ok-soft:       rgba(22, 163, 74, 0.10);
  --warn:          #d97706;
  --warn-soft:     rgba(217, 119, 6, 0.10);
  --danger:        #dc2626;
  --danger-soft:   rgba(220, 38, 38, 0.10);

  /* Surfaces */
  --bg:            #f8f8f6;
  --bg-elevated:   #ffffff;
  --bg-soft:       #f3f4f6;
  --border:        #e5e7eb;
  --border-subtle: #f0f0ee;

  /* Typography */
  --text:          #111827;
  --text-muted:    #6b7280;
  --text-light:    #9ca3af;

  /* Layout */
  --sidebar-width:           210px;
  --sidebar-collapsed-width: 52px;

  /* Radii */
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 16px rgba(0,0,0,.08);
  --shadow-soft: 0 20px 40px rgba(0,0,0,.12);

  /* Motion */
  --transition:          150ms ease;
  --sidebar-transition:  240ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── App Shell ─────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
  overflow: hidden;
  transition: width var(--sidebar-transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 14px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-width: 0;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-name-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--sidebar-transition);
}
.brand-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  line-height: 1.2;
}
.brand-sub {
  font-size: 9px;
  color: #94a3b8;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}

/* ── Sidebar Toggle Row ────────────────────────────────────────────────── */
.sidebar-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 10px;
  flex-shrink: 0;
}

.sidebar-toggle-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--sidebar-transition);
}

.sidebar-toggle-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.sidebar-toggle-btn:hover {
  background: #e9eaf0;
  color: var(--accent);
  border-color: rgba(79,106,245,.3);
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}
.sidebar-link:hover {
  background: var(--bg-soft);
  color: var(--text);
}
.sidebar-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.sidebar-link svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.sidebar-link span {
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--sidebar-transition);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 10px 4px;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--sidebar-transition);
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
  transition: opacity var(--sidebar-transition);
}

.sidebar-user-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  opacity: 1;
  transition: opacity var(--sidebar-transition);
}

.sidebar-logout {
  margin-top: 8px;
  width: 100%;
  padding: 6px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--sidebar-transition), background var(--transition), color var(--transition);
}
.sidebar-logout:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(220,38,38,.25);
}

/* ── Sidebar Collapsed State ───────────────────────────────────────────── */
.app-shell[data-sidebar-collapsed="true"] .sidebar {
  width: var(--sidebar-collapsed-width);
}
.app-shell[data-sidebar-collapsed="true"] .brand-name-group,
.app-shell[data-sidebar-collapsed="true"] .brand-name,
.app-shell[data-sidebar-collapsed="true"] .sidebar-link span,
.app-shell[data-sidebar-collapsed="true"] .sidebar-section-label,
.app-shell[data-sidebar-collapsed="true"] .sidebar-user-name,
.app-shell[data-sidebar-collapsed="true"] .sidebar-user-role,
.app-shell[data-sidebar-collapsed="true"] .sidebar-logout,
.app-shell[data-sidebar-collapsed="true"] .sidebar-toggle-label {
  opacity: 0;
  pointer-events: none;
}
.app-shell[data-sidebar-collapsed="true"] .sidebar-footer {
  padding: 12px 6px;
}
.app-shell[data-sidebar-collapsed="true"] .sidebar-nav {
  padding: 10px 6px;
  align-items: center;
}
.app-shell[data-sidebar-collapsed="true"] .sidebar-link {
  padding: 8px;
  justify-content: center;
}
.app-shell[data-sidebar-collapsed="true"] .sidebar-toggle-row {
  justify-content: center;
  padding: 4px 0 10px;
}

/* ── Page Wrapper ──────────────────────────────────────────────────────── */
.page-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--sidebar-transition);
}
.app-shell[data-sidebar-collapsed="true"] .page-wrapper {
  margin-left: var(--sidebar-collapsed-width);
}

/* ── Page Header ───────────────────────────────────────────────────────── */
.page-header {
  padding: 12px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Page Main ─────────────────────────────────────────────────────────── */
.page-main {
  flex: 1;
  padding: 24px 28px 40px;
  max-width: 1280px;
  width: 100%;
}

/* ── Restaurant Picker ─────────────────────────────────────────────────── */
.restaurant-picker {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.restaurant-picker .field-label { font-size: 10px; }

/* ── Greeting Row ──────────────────────────────────────────────────────── */
.greeting-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.greeting-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.greeting-date {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Metrics Grid ──────────────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric-tile {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition);
}
.metric-tile:hover {
  box-shadow: var(--shadow-md);
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.metric-icon--blue   { background: rgba(79,106,245,.10); color: #4F6AF5; }
.metric-icon--green  { background: rgba(22,163,74,.10);  color: #16a34a; }
.metric-icon--orange { background: rgba(217,119,6,.10);  color: #d97706; }
.metric-icon--red    { background: rgba(220,38,38,.10);  color: #dc2626; }

.metric-body { min-width: 0; flex: 1; }

.metric-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.5px;
}
.metric-value.ok     { color: var(--ok); }
.metric-value.danger { color: var(--danger); }
.metric-value.warn   { color: var(--warn); }
.metric-value.accent { color: var(--accent); }

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.metric-meta {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ── Content Columns ───────────────────────────────────────────────────── */
.content-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px 0;
  margin-bottom: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body {
  font-size: 13px;
  padding: 0 20px 16px;
}

/* Variant used when card wraps a form (no horizontal padding on body) */
.card-full-body {
  padding: 16px 20px;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition);
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover {
  background: #e9eaf0;
}
.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent-strong);
}
.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-outline:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.btn-small {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 6px;
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 7px;
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(220,38,38,.2);
}
.btn-danger:hover {
  background: rgba(220,38,38,.18);
}

/* ── Inputs ────────────────────────────────────────────────────────────── */
.field-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.select-input,
.text-input,
.date-input {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
  min-width: 0;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.select-input:focus,
.text-input:focus,
.date-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,106,245,.12);
}

/* ── Data Table ────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  white-space: nowrap;
}
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text);
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}
.data-table tbody tr:hover td {
  background: var(--bg-soft);
}

/* ── Empty State ───────────────────────────────────────────────────────── */
.empty-state {
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 0;
}

/* ── Progress Bar ──────────────────────────────────────────────────────── */
.progress-track {
  height: 4px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}
.progress-fill--blue   { background: var(--accent); }
.progress-fill--green  { background: var(--ok); }
.progress-fill--orange { background: var(--warn); }
.progress-fill--red    { background: var(--danger); }

/* ── Checklist Progress Row ────────────────────────────────────────────── */
.cl-progress-row {
  margin-bottom: 14px;
}
.cl-progress-row:last-child { margin-bottom: 0; }

.cl-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.cl-progress-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.cl-progress-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
}
.cl-progress-count.done { color: var(--ok); }

/* ── Status Pills ──────────────────────────────────────────────────────── */
.status-pill {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.status-pill.ok      { background: var(--ok-soft);      color: var(--ok); }
.status-pill.danger  { background: var(--danger-soft);  color: var(--danger); }
.status-pill.warn    { background: var(--warn-soft);    color: var(--warn); }
.status-pill.accent  { background: var(--accent-soft);  color: var(--accent); }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

/* ── Issue List Item ───────────────────────────────────────────────────── */
.issue-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.issue-row:last-child { border-bottom: none; }

.issue-priority {
  font-size: 10px;
  font-weight: 700;
  min-width: 56px;
  padding: 2px 7px;
  border-radius: 5px;
  text-align: center;
  flex-shrink: 0;
}

.issue-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.issue-meta {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Activity List ─────────────────────────────────────────────────────── */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--ok);
  flex-shrink: 0;
}

.activity-name {
  flex: 1;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-meta {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Alert Item ────────────────────────────────────────────────────────── */
.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  margin-bottom: 8px;
  font-size: 13px;
}
.alert-item:last-child { margin-bottom: 0; }

.alert-main { display: flex; flex-direction: column; gap: 2px; }
.alert-title { font-weight: 500; color: var(--text); }
.alert-meta  { font-size: 11px; color: var(--text-muted); }

.alert-severity-high   { color: var(--danger); font-weight: 600; font-size: 11px; }
.alert-severity-medium { color: var(--warn);   font-weight: 600; font-size: 11px; }
.alert-severity-low    { color: var(--ok);     font-weight: 600; font-size: 11px; }

/* ── Tab Switcher ──────────────────────────────────────────────────────── */
.tab-switcher {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}
.tab-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-family: inherit;
}
.tab-btn-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

/* ── Reports Tabs ──────────────────────────────────────────────────────── */
.reports-tabs {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
  width: fit-content;
}
.reports-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 18px;
  border-radius: 7px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  font-family: inherit;
}
.reports-tab:hover { color: var(--text); }
.reports-tab-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

/* ── Summary Tiles (Reports) ───────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.summary-tile {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-card);
}
.tile-label  { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.tile-value  { font-size: 26px; font-weight: 700; color: var(--text); }
.tile-value.ok     { color: var(--ok); }
.tile-value.danger { color: var(--danger); }
.tile-value.warn   { color: var(--warn); }
.tile-value.accent { color: var(--accent); }
.tile-meta  { font-size: 11px; color: var(--text-muted); }
.tile-sub   { font-size: 12px; color: var(--text-muted); }

/* ── Panel Toolbar ─────────────────────────────────────────────────────── */
.panel-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 0;
}

/* ── Dash Grid (compat) ────────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.dash-tile {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}

/* ── Overview Grid (compat) ────────────────────────────────────────────── */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.overview-item {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-card);
}
.overview-label { font-size: 11px; color: var(--text-muted); }
.overview-value { font-size: 20px; font-weight: 600; color: var(--text); }
.overview-value.danger { color: var(--danger); }
.overview-value.ok     { color: var(--ok); }
.overview-meta  { font-size: 11px; color: var(--text-muted); }

/* ── Device Card ───────────────────────────────────────────────────────── */
.devices-list {
  display: flex; flex-direction: column; gap: 10px;
  max-height: calc(100vh - 200px); overflow: auto; padding-right: 4px;
}
.device-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(0,1.5fr) minmax(0,1.3fr) auto auto;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow-card);
}
.device-name  { font-size: 14px; font-weight: 600; color: var(--text); }
.device-meta  { font-size: 11px; color: var(--text-muted); }
.device-range { font-size: 11px; color: var(--text-muted); }
.device-temp  { font-size: 13px; }
.device-status { display: inline-flex; align-items: center; }
.device-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* ── Tasks / Logs (compat) ─────────────────────────────────────────────── */
.tasks-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 210px; overflow: auto;
}
.task-item {
  display: grid;
  grid-template-columns: auto minmax(0,1.9fr) auto;
  gap: 8px; align-items: center;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  border: 1px solid var(--border);
  font-size: 12px;
  box-shadow: var(--shadow-card);
}
.task-name  { font-weight: 500; }
.task-meta  { font-size: 11px; color: var(--text-muted); }
.task-stats { font-size: 11px; color: var(--text-muted); }

.logs-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; font-size: 12px; }
.log-item {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 7px 10px;
  background: var(--bg-elevated);
  display: flex; flex-direction: column; gap: 2px;
}
.log-meta { font-size: 10px; color: var(--text-muted); }

/* ── Bulk Import Modal ─────────────────────────────────────────────────── */
.inv-modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.inv-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.35); backdrop-filter: blur(4px);
}
.inv-modal-box {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 22px 24px 18px;
  width: 100%; max-width: 680px; max-height: 90vh; overflow-y: auto;
}
.inv-modal-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.inv-modal-title { font-size: 15px; font-weight: 600; color: var(--text); }
.inv-modal-footer {
  display: flex; align-items: center; gap: 10px; margin-top: 16px;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.inv-file-label {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 8px;
  border: 1.5px dashed var(--border);
  background: var(--bg-soft); color: var(--text-muted);
  font-size: 12px; cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.inv-file-label:hover { border-color: var(--accent); color: var(--text); }

/* ── Checklist Frequency Tabs (manager page) ───────────────────────────── */
.cl-freq-tab {
  padding: 7px 20px;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 13px; cursor: pointer;
  font-family: inherit; font-weight: 500;
  transition: color var(--transition), border-color var(--transition);
}
.cl-freq-tab:hover { color: var(--text); }

/* ── Manager Mode Banner ───────────────────────────────────────────────── */
.manager-mode-banner {
  background: var(--accent-soft);
  border: 1px solid rgba(79,106,245,.25);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

/* ── Form utilities ─────────────────────────────────────────────────────── */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.form-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}
.form-static-text {
  font-size: 13px;
  color: var(--text);
}

/* ── Filter bar (used across super-admin, owner-dashboard) ─────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* ── Staff Checklists 3-column layout ──────────────────────────────────── */
.cl-freq-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.cl-freq-col {
  min-width: 0;
  /* Each column scrolls independently when it has many templates */
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  /* Subtle scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.cl-freq-col::-webkit-scrollbar { width: 5px; }
.cl-freq-col::-webkit-scrollbar-track { background: transparent; }
.cl-freq-col::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.cl-freq-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  /* Stick to top of the column scroll area */
  position: sticky;
  top: 0;
  z-index: 2;
}

.cl-col-empty {
  font-size: 12px;
  color: var(--text-light);
  padding: 4px 2px;
  font-style: italic;
}

.cl-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.cl-item-row:last-child {
  border-bottom: none;
}

.cl-item-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--ok);
  flex-shrink: 0;
  cursor: pointer;
}

.cl-item-label {
  font-size: 13px;
  flex: 1;
  line-height: 1.4;
}

.cl-all-done {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 16px;
  color: var(--ok);
  font-weight: 600;
  font-size: 14px;
}

.cl-no-items {
  padding: 10px 20px 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   NOTIFICATION BELL
   ═══════════════════════════════════════════════════════════════════════════ */

.notif-bell-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.notif-bell-btn:hover { background: #e9eaf0; color: var(--text); }

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 1.5px solid var(--bg-elevated);
  line-height: 1;
  pointer-events: none;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  z-index: 300;
  overflow: hidden;
}

.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.notif-dropdown-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.notif-list {
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.notif-empty {
  padding: 24px 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
  background: rgba(79,106,245,.03);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-soft); }
.notif-item.notif-read { background: transparent; opacity: 0.7; }

.notif-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.notif-icon--temp-alert   { background: var(--danger-soft);  color: var(--danger); }
.notif-icon--new-issue    { background: var(--warn-soft);    color: var(--warn); }
.notif-icon--low-stock    { background: var(--accent-soft);  color: var(--accent); }
.notif-icon--overdue-duty { background: var(--warn-soft);    color: var(--warn); }
.notif-icon--system       { background: var(--ok-soft);      color: var(--ok); }

.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.3; }
.notif-msg   { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.notif-time  { font-size: 10px; color: var(--text-light); margin-top: 3px; }

.notif-unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 5px;
}

@media (max-width: 768px) {
  .notif-dropdown {
    position: fixed !important;
    top: 50px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
    z-index: 9999 !important;
    border-radius: 0 !important;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18) !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   Mobile ≤767px  |  Tablet 768–1023px  |  Desktop ≥1024px
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Hamburger button (shown only on mobile via media query) ───────────── */
.hamburger-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}
.hamburger-btn:hover { background: #e9eaf0; }

/* ── Sidebar close (X) button — shown only in mobile overlay ───────────── */
.sidebar-close-btn {
  display: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
  transition: background var(--transition), color var(--transition);
}
.sidebar-close-btn:hover { background: var(--bg-soft); color: var(--text); }

/* ── Mobile sidebar overlay backdrop ───────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 299;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-backdrop.active { display: block; }

/* ══ TABLET 768px–1023px ════════════════════════════════════════════════════
   Sidebar collapses to icon-only. CSS takes precedence over localStorage
   state so the sidebar stays compact on tablet regardless.                  */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Force icon-only sidebar */
  .app-shell .sidebar       { width: var(--sidebar-collapsed-width) !important; }
  .app-shell .page-wrapper  { margin-left: var(--sidebar-collapsed-width) !important; }

  /* Hide text labels */
  .sidebar .brand-name-group,
  .sidebar .brand-name,
  .sidebar .sidebar-link span,
  .sidebar .sidebar-section-label,
  .sidebar .sidebar-user-name,
  .sidebar .sidebar-user-role,
  .sidebar .sidebar-logout,
  .sidebar .sidebar-toggle-label { opacity: 0; pointer-events: none; }
  .sidebar .sidebar-footer { padding: 12px 6px; }
  .sidebar .sidebar-nav    { padding: 10px 6px; align-items: center; }
  .sidebar .sidebar-link   { padding: 8px; justify-content: center; }
  .sidebar .sidebar-toggle-row { justify-content: center; padding: 4px 0 10px; }

  /* Grids: 2 columns */
  .metrics-grid, .dash-grid,
  .summary-grid, .overview-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .content-cols-2               { grid-template-columns: repeat(2, minmax(0,1fr)); }

  /* Tighter padding */
  .page-main   { padding: 20px 20px 36px; }
  .page-header { padding: 10px 20px; }
}

/* ══ MOBILE ≤767px ══════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── Hamburger ── */
  .hamburger-btn { display: flex; }

  /* ── Sidebar close button: show inside overlay ── */
  .sidebar-close-btn { display: flex; }

  /* ── App shell: block so sidebar doesn't steal flex width ── */
  .app-shell { display: block !important; }

  /* ── Sidebar: hidden from layout; slides in as fixed overlay when opened ── */
  .app-shell .sidebar {
    display: none !important;
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100vh;
    width: 270px !important;
    z-index: 300;
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
    overflow-y: auto;
  }
  .app-shell .sidebar.mobile-open {
    display: flex !important;
  }

  /* Ensure all text visible inside open mobile overlay */
  .app-shell .sidebar.mobile-open .brand-name-group,
  .app-shell .sidebar.mobile-open .brand-name,
  .app-shell .sidebar.mobile-open .sidebar-link span,
  .app-shell .sidebar.mobile-open .sidebar-section-label,
  .app-shell .sidebar.mobile-open .sidebar-user-name,
  .app-shell .sidebar.mobile-open .sidebar-user-role,
  .app-shell .sidebar.mobile-open .sidebar-logout,
  .app-shell .sidebar.mobile-open .sidebar-toggle-label { opacity: 1 !important; pointer-events: auto !important; }
  .app-shell .sidebar.mobile-open .sidebar-footer  { padding: 12px 14px !important; }
  .app-shell .sidebar.mobile-open .sidebar-nav     { padding: 10px 8px !important; align-items: stretch !important; }
  .app-shell .sidebar.mobile-open .sidebar-link    { padding: 10px 12px !important; justify-content: flex-start !important; }
  .app-shell .sidebar.mobile-open .sidebar-toggle-row { display: none; }

  /* ── Page wrapper: full width, no left margin ── */
  .app-shell .page-wrapper { margin-left: 0 !important; width: 100% !important; }

  /* ── Page layout ── */
  /* Header wraps: row 1 = hamburger + title, row 2 = actions */
  .page-header {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }
  /* Title container stretches in first row */
  .page-header > div:first-of-type {
    flex: 1;
    min-width: 0;
  }
  .page-main            { padding: 12px 12px 32px; }
  .page-title {
    font-size: 15px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
  }
  .page-subtitle { display: none !important; }
  /* Actions take full second row, scroll horizontally if needed */
  .page-header-actions  {
    gap: 6px;
    flex-wrap: wrap;
    width: 100%;
  }
  /* Remove forced min-width on restaurant picker select */
  .restaurant-picker .select-input { min-width: 0 !important; }
  .restaurant-picker { flex: 1; min-width: 0; }

  /* ── All grids → 1 column ── */
  .metrics-grid, .dash-grid,
  .summary-grid, .overview-grid { grid-template-columns: 1fr; }
  .content-cols-2               { grid-template-columns: 1fr; }

  /* ── Cards ── */
  .card-header    { padding: 12px 14px 0; }
  .card-body      { padding: 0 14px 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card-full-body { padding: 12px 14px; }
  .metric-tile    { padding: 14px 14px; gap: 10px; }
  .metric-value   { font-size: 22px; }

  /* ── Buttons: 44px min tap target ── */
  .btn       { min-height: 44px; padding: 10px 16px; font-size: 13px; }
  .btn-small { min-height: 38px; padding: 8px 12px; font-size: 12px; }
  .btn-icon  { min-height: 44px; width: 44px; height: 44px; }

  /* ── Inputs: 44px tap target; font-size 16px prevents iOS zoom ── */
  .select-input,
  .text-input,
  .date-input { min-height: 44px; font-size: 16px; padding: 10px 12px; }
  input[type="number"] { min-height: 44px; font-size: 18px; font-weight: 600; text-align: center; }

  /* ── Forms: single-column stacked layout ── */
  .panel-toolbar              { flex-direction: column; align-items: stretch; gap: 8px; }
  .panel-toolbar .select-input,
  .panel-toolbar .text-input,
  .panel-toolbar .date-input,
  .panel-toolbar .btn         { width: 100%; }
  .filter-bar                 { flex-direction: column; align-items: stretch; }
  .filter-bar > *             { width: 100%; }
  .filter-bar .select-input,
  .filter-bar .text-input     { width: 100%; box-sizing: border-box; }


  /* ── Sub-edit row (super-admin inline subscription editor) ── */
  .sub-edit-row              { flex-direction: column; gap: 6px; }
  .sub-edit-row select,
  .sub-edit-row .btn         { width: 100%; min-height: 38px; }

  /* ── Reports tabs: full width ── */
  .reports-tabs { width: 100%; }
  .reports-tab  { flex: 1; text-align: center; padding: 8px 4px; font-size: 11px; }

  /* ── Greeting row ── */
  .greeting-row   { flex-direction: column; gap: 8px; }
  .greeting-title { font-size: 19px; }

  /* ── Staff checklists: 1 column ── */
  .cl-freq-grid { grid-template-columns: 1fr; }
  .cl-freq-col  { max-height: none; overflow-y: visible; }

  /* ── Checklist items: large tap targets for kitchen use ── */
  .cl-item-row                        { padding: 14px 16px; gap: 14px; }
  .cl-item-row input[type="checkbox"] { width: 22px; height: 22px; flex-shrink: 0; }
  .cl-item-label                      { font-size: 15px; }
  .cl-all-done                        { font-size: 15px; }

  /* ── Issue rows: wrap on mobile ── */
  .issue-row   { flex-wrap: wrap; }
  .issue-title { min-width: 100%; order: 1; white-space: normal; }

  /* ── Alert items: wrap ── */
  .alert-item { flex-wrap: wrap; }

  /* ── Activity items ── */
  .activity-name { font-size: 12px; }

  /* ── Device card: 2-col grid ── */
  .device-card {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }

  /* ── Modal: bottom sheet ── */
  .inv-modal     { padding: 0; align-items: flex-end; }
  .inv-modal-box {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
    max-width: 100%;
  }

  /* ── Manager mode banner ── */
  .manager-mode-banner { font-size: 12px; padding: 8px 12px; }

  /* ── Summary / dash tiles: compact ── */
  .summary-tile { padding: 12px 14px; }
  .tile-value   { font-size: 22px; }
  .overview-value { font-size: 18px; }
}

/* ────────────────────────────────────────────────────────────────────────────
   PHOTO EVIDENCE — thumbnails, upload strip, lightbox
   ────────────────────────────────────────────────────────────────────────── */

/* ── Photo strip (thumbnail row) ── */
.photo-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.photo-thumb-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.photo-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
  display: block;
}
.photo-thumb:hover {
  opacity: 0.85;
  transform: scale(1.04);
}

.photo-del-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.photo-thumb-wrap:hover .photo-del-btn {
  opacity: 1;
}

/* ── Photo upload area ── */
.photo-upload-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.photo-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.photo-upload-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.photo-upload-btn svg { flex-shrink: 0; }
.photo-upload-input { display: none; }

.photo-upload-limit {
  font-size: 11px;
  color: var(--text-light);
}

/* ── Lightbox overlay ── */
.leo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: lbFadeIn 0.18s ease;
}

@keyframes lbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.leo-lightbox-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  max-height: 100%;
}

.leo-lightbox-img {
  max-width: min(90vw, 900px);
  max-height: min(80vh, 700px);
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.6);
  user-select: none;
  -webkit-user-drag: none;
}

.leo-lightbox-caption {
  margin-top: 12px;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  text-align: center;
  max-width: 560px;
}

.leo-lightbox-counter {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

.leo-lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10001;
}
.leo-lightbox-close:hover { background: rgba(255,255,255,0.2); }

.leo-lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  width: 44px;
  height: 44px;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 10001;
  user-select: none;
}
.leo-lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.leo-lightbox-nav.prev { left: 12px; }
.leo-lightbox-nav.next { right: 12px; }
.leo-lightbox-nav[hidden] { display: none !important; }

@media (max-width: 600px) {
  .leo-lightbox-img { max-width: 96vw; max-height: 72vh; }
  .leo-lightbox-nav.prev { left: 4px; }
  .leo-lightbox-nav.next { right: 4px; }
}

/* ── Mobile bottom navigation bar ──────────────────────────────────────────── */
#mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  z-index: 200;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.mob-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  padding: 4px 2px;
  cursor: pointer;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  gap: 2px;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}
.mob-nav-item.active { color: var(--accent); }
.mob-nav-item:active  { opacity: 0.7; }
.mob-nav-item span.mob-icon { font-size: 21px; line-height: 1; }
.mob-nav-item span.mob-label { font-size: 10px; line-height: 1; white-space: nowrap; }

@media (max-width: 767px) {
  #mobile-bottom-nav { display: flex; }

  /* Push page content above bottom nav */
  .page-main { padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important; }

  /* Tables: always scrollable */
  .data-table-wrap,
  .card-body table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Mobile content sizing ───────────────────────────────────────────────── */
@media (max-width: 767px) {
  /* Base font size */
  body { font-size: 14px !important; }

  /* Topbar */
  .topbar h1 { font-size: 16px !important; }
  .topbar p { display: none !important; }

  /* Cards */
  .card {
    padding: 12px !important;
    margin: 8px 0 !important;
    border-radius: 8px !important;
  }

  /* Stats/metric tiles */
  .stat-card, .metric-card, [class*="stat"] {
    padding: 12px !important;
  }

  /* Tables */
  .data-table th, .data-table td {
    padding: 8px 6px !important;
    font-size: 12px !important;
  }

  /* Hide less important table columns on mobile */
  .hide-mobile { display: none !important; }

  /* Buttons */
  .btn-primary, .btn-secondary {
    padding: 10px 14px !important;
    font-size: 14px !important;
  }

  /* Grid layouts become single column */
  .grid, [class*="grid"], .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* Forms */
  .form-group { margin-bottom: 12px !important; }
  .form-input, input, select, textarea {
    font-size: 16px !important;
    padding: 10px 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Modals full screen on mobile */
  [class*="modal"] > div, .modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 10px auto !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
  }

  /* Hide description text */
  .page-description, .subtitle { display: none !important; }

  /* Notification dropdown */
  .notification-dropdown, [class*="notif-dropdown"] {
    right: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-height: 60vh !important;
    overflow-y: auto !important;
    position: fixed !important;
    top: 50px !important;
  }

  /* Main content padding */
  .main-content { padding: 0 !important; }

  /* Page sections */
  .section, .page-section { padding: 12px !important; }

  /* Flex layouts wrap on mobile */
  .flex-row, [class*="flex"] {
    flex-wrap: wrap !important;
  }

  /* Hide decorative elements */
  .decorative, .illustration { display: none !important; }

  /* Charts smaller on mobile */
  canvas { max-height: 200px !important; }

  /* LEO chat bubble position */
  #leo-assistant #leo-chat-bubble {
    bottom: 80px !important;
    right: 16px !important;
    width: 48px !important;
    height: 48px !important;
  }

  #leo-assistant #leo-chat-window {
    bottom: 140px !important;
    right: 8px !important;
    left: 8px !important;
    width: auto !important;
    height: 65vh !important;
  }
}

/* ── Loading Skeletons ─────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text       { height: 14px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-title      { height: 20px; margin-bottom: 12px; width: 60%; border-radius: 4px; }
.skeleton-card       { height: 80px; margin-bottom: 12px; border-radius: 8px; }
.skeleton-row        { height: 44px; margin-bottom: 4px; border-radius: 4px; }
.skeleton-table-row  { height: 44px; margin-bottom: 4px; border-radius: 4px; }
.skeleton-circle     { border-radius: 50%; }

/* ── Dark mode (data-theme="dark") ────────────────────────────────────────── */
[data-theme="dark"] body,
[data-theme="dark"] .app-shell,
[data-theme="dark"] .page-wrapper,
[data-theme="dark"] .main-content {
  background: #0f172a !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .sidebar {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .sidebar-link { color: #94a3b8 !important; }
[data-theme="dark"] .sidebar-link:hover,
[data-theme="dark"] .sidebar-link.active {
  background: #334155 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .page-header,
[data-theme="dark"] .topbar {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .page-title  { color: #f1f5f9 !important; }
[data-theme="dark"] .page-subtitle { color: #94a3b8 !important; }

[data-theme="dark"] .card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .card-title   { color: #f1f5f9 !important; }
[data-theme="dark"] .card-subtitle { color: #94a3b8 !important; }

[data-theme="dark"] .data-table th {
  background: #0f172a !important;
  color: #94a3b8 !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .data-table td {
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .data-table tr:hover td { background: #334155 !important; }

[data-theme="dark"] .text-input,
[data-theme="dark"] .select-input,
[data-theme="dark"] .form-input,
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .text-input::placeholder,
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #475569 !important;
}

[data-theme="dark"] .field-label { color: #94a3b8 !important; }

[data-theme="dark"] .stat-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .stat-label { color: #94a3b8 !important; }
[data-theme="dark"] .stat-value { color: #f1f5f9 !important; }

[data-theme="dark"] #mobile-bottom-nav {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .mob-nav-btn { color: #64748b !important; }
[data-theme="dark"] .mob-nav-btn.active { color: #4F6AF5 !important; }

[data-theme="dark"] .btn-outline,
[data-theme="dark"] .btn-secondary {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .sidebar-footer,
[data-theme="dark"] .sidebar-user-role { color: #64748b !important; }
[data-theme="dark"] .sidebar-user-name { color: #f1f5f9 !important; }

[data-theme="dark"] .tab-btn { color: #64748b !important; border-bottom-color: transparent !important; }
[data-theme="dark"] .tab-btn.active { color: #4F6AF5 !important; border-bottom-color: #4F6AF5 !important; }

[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3 { color: #f1f5f9 !important; }

[data-theme="dark"] .nav-item { color: #94a3b8 !important; }
[data-theme="dark"] .nav-item:hover,
[data-theme="dark"] .nav-item.active {
  background: #334155 !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .badge,
[data-theme="dark"] .status-badge { filter: brightness(0.9); }

