/* =====================================================================
   Saqr Crowd — Design System (RTL-first, logical properties, no build step)
   Tokens → base → layout → components → utilities
   ===================================================================== */

:root {
  --c-primary: #0f5c4d;          /* deep teal: trust, operations */
  --c-primary-600: #0b4a3e;
  --c-primary-50: #e8f3f0;
  --c-accent: #d98f2b;           /* desert amber: highlights */
  --c-accent-50: #fbf2e4;
  --c-ink: #14211e;
  --c-ink-2: #3f4f4b;
  --c-muted: #6b7b77;
  --c-line: #dfe6e4;
  --c-line-2: #eef2f1;
  --c-bg: #f5f7f6;
  --c-surface: #ffffff;
  --c-success: #1f8a4c;
  --c-success-50: #e7f5ec;
  --c-warning: #b7791f;
  --c-warning-50: #fdf3e1;
  --c-danger: #c2410c;
  --c-danger-50: #fdece6;
  --c-info: #2563a8;
  --c-info-50: #e8f0fa;
  --c-neutral-50: #f0f2f2;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(20, 33, 30, .06);
  --shadow: 0 4px 16px rgba(20, 33, 30, .08);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  --sidebar-w: 248px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--c-ink);
  background: var(--c-bg);
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 var(--space-3); color: var(--c-ink); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 var(--space-3); }
hr { border: 0; border-top: 1px solid var(--c-line); margin: var(--space-5) 0; }
small, .text-small { font-size: .85rem; }
code, .mono { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; direction: ltr; unicode-bidi: embed; }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; inset-inline-start: 0; }
/* Hidden above the viewport (not sideways: a horizontal offset widens RTL pages) */
.skip-link { position: absolute; inset-inline-start: 8px; top: -64px; background: var(--c-ink); color: #fff; padding: 8px 12px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { top: 8px; }

/* ---------------- App shell (dashboards) ---------------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--c-ink);
  color: #cfdad7;
  padding: var(--space-4) var(--space-3);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: var(--space-2); color: #fff; font-weight: 700; font-size: 1.1rem; padding: var(--space-2) var(--space-2) var(--space-4); }
.sidebar .brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--c-accent); display: grid; place-items: center; color: var(--c-ink); font-weight: 800; }
.sidebar .nav-group { margin-top: var(--space-4); }
.sidebar .nav-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #8fa39e; padding: 0 var(--space-3) var(--space-1); }
.sidebar a.nav-link {
  display: flex; align-items: center; gap: var(--space-2);
  color: #d8e3e0; padding: 8px var(--space-3); border-radius: var(--radius-sm); font-size: .93rem;
}
.sidebar a.nav-link:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.sidebar a.nav-link.active { background: var(--c-primary); color: #fff; }
.sidebar .nav-count { margin-inline-start: auto; background: var(--c-accent); color: var(--c-ink); border-radius: 999px; font-size: .72rem; padding: 0 7px; font-weight: 700; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--c-surface); border-bottom: 1px solid var(--c-line);
  display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-5); position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }
.topbar .menu-toggle { display: none; }
.content { padding: var(--space-5); max-width: 1400px; width: 100%; }
.tenant-switch select { min-width: 180px; }

/* ---------------- Public site ---------------- */
.site-header { background: var(--c-surface); border-bottom: 1px solid var(--c-line); position: sticky; top: 0; z-index: 30; }
.site-header .inner, .site-footer .inner, .container { max-width: 1180px; margin: 0 auto; padding: 0 var(--space-4); }
.site-header .inner { display: flex; align-items: center; gap: var(--space-4); height: 68px; }
.site-header .brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 800; color: var(--c-ink); font-size: 1.15rem; }
.site-header .brand .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--c-primary); color: #fff; display: grid; place-items: center; }
.site-nav { display: flex; gap: var(--space-4); align-items: center; flex: 1; }
.site-nav a { color: var(--c-ink-2); font-weight: 500; }
.site-nav a.active { color: var(--c-primary); }
.site-actions { display: flex; gap: var(--space-2); align-items: center; }
.hero { background: linear-gradient(135deg, var(--c-primary) 0%, #0d3f36 100%); color: #fff; padding: var(--space-7) 0; }
.hero h1 { color: #fff; font-size: 2.2rem; }
.hero p.lead { font-size: 1.15rem; color: #d4e7e2; max-width: 640px; }
.section { padding: var(--space-7) 0; }
.section.alt { background: var(--c-surface); }
.section-title { text-align: center; margin-bottom: var(--space-6); }
.section-title p { color: var(--c-muted); }
.site-footer { background: var(--c-ink); color: #b9c8c4; padding: var(--space-6) 0 var(--space-4); margin-top: var(--space-6); }
.site-footer a { color: #e3ece9; }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--space-5); }
.site-footer .bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: var(--space-5); padding-top: var(--space-4); font-size: .85rem; }
.feature-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--c-primary-50); color: var(--c-primary); display: grid; place-items: center; font-size: 1.3rem; margin-bottom: var(--space-3); }
.auth-wrap { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: var(--space-6) var(--space-4); }
.auth-card { width: 100%; max-width: 460px; }
.auth-card.wide { max-width: 820px; }

/* ---------------- Page header & toolbars ---------------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap; }
.page-header h1 { margin: 0; }
.page-header .subtitle { color: var(--c-muted); margin: 2px 0 0; }
.page-header .actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.breadcrumbs { font-size: .85rem; color: var(--c-muted); margin-bottom: var(--space-2); }
.breadcrumbs a { color: var(--c-muted); }
.toolbar, .filters { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--space-4); }
.filters .field { margin: 0; min-width: 150px; }
.tabs { position: relative; display: flex; gap: 2px; border-bottom: 1px solid var(--c-line); margin-bottom: var(--space-4); overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--c-ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600; }
.tabs a:hover { text-decoration: none; background: var(--c-line-2); }

/* ---------------- Cards & grids ---------------- */
.card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: var(--space-5); margin-bottom: var(--space-4); }
.card.flush { padding: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; }
.card.flush .card-header { padding: var(--space-4) var(--space-5) 0; }
.card-footer { border-top: 1px solid var(--c-line-2); margin-top: var(--space-4); padding-top: var(--space-4); display: flex; gap: var(--space-2); justify-content: flex-end; flex-wrap: wrap; }
.card-footer.block { display: block; } /* footer holding a sub-section (heading + form) rather than action buttons */
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-aside { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
/* Grid items may shrink below their content width (long links/codes wrap instead of widening the page) */
.grid > *, .form-grid > * { min-width: 0; }
.stack > * + * { margin-top: var(--space-3); }

/* KPI tiles */
.stat { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: var(--space-4); }
.stat .label { color: var(--c-muted); font-size: .85rem; }
.stat .value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.stat .meta { font-size: .8rem; color: var(--c-muted); margin-top: 4px; }
.stat.accent { border-inline-start: 4px solid var(--c-accent); }
.stat.good { border-inline-start: 4px solid var(--c-success); }
.stat.bad { border-inline-start: 4px solid var(--c-danger); }
.stat.info { border-inline-start: 4px solid var(--c-info); }

/* Definition list */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--space-4); margin: 0; }
.dl dt { color: var(--c-muted); }
.dl dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* ---------------- Tables ---------------- */
/* position: relative keeps absolutely-positioned children (e.g. .sr-only) inside the scroll box */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-surface); }
.card .table-wrap { border: 0; border-radius: 0; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--c-line-2); vertical-align: middle; }
.table th { background: #f9fbfa; color: var(--c-ink-2); font-weight: 600; font-size: .82rem; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcfb; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.table .actions { white-space: nowrap; text-align: end; }
.table .actions form { display: inline; }
.empty-state { text-align: center; padding: var(--space-6) var(--space-4); color: var(--c-muted); }
.empty-state .icon { font-size: 2rem; margin-bottom: var(--space-2); }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); }
.form-grid .span-2, .form-grid .full { grid-column: 1 / -1; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: var(--space-3); }
.form-grid .field { margin-bottom: 0; }
.field label, .label { font-weight: 600; font-size: .88rem; color: var(--c-ink-2); }
.field .hint { font-size: .8rem; color: var(--c-muted); }
.field .req { color: var(--c-danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=url],
input[type=date], input[type=time], input[type=datetime-local], input[type=search], input[type=month], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--c-ink); background: #fff;
  border: 1px solid #cfd9d6; border-radius: var(--radius-sm); padding: 9px 11px; min-height: 40px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--c-primary); outline: none; box-shadow: 0 0 0 3px var(--c-primary-50); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--c-danger); }
.field-error { color: var(--c-danger); font-size: .82rem; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--c-primary); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px var(--space-3); }
input[dir=ltr] { direction: ltr; text-align: start; }
/* Phones, emails, codes, numbers inside Arabic text: isolate so "+966…" keeps its "+" in front,
   while blocks stay aligned with the surrounding RTL text */
.ltr { direction: ltr; unicode-bidi: isolate; }
[dir=rtl] .ltr:not(input):not(textarea) { text-align: right; }
fieldset { border: 1px solid var(--c-line); border-radius: var(--radius); padding: var(--space-4); margin: 0 0 var(--space-4); }
legend { font-weight: 700; padding: 0 6px; }
.repeat-row { display: grid; gap: var(--space-2); grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto; align-items: end; margin-bottom: var(--space-2); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .92rem; line-height: 1;
  padding: 10px 16px; min-height: 40px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  background: var(--c-line-2); color: var(--c-ink);
}
.btn:hover { filter: brightness(.96); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-600); }
.btn-accent { background: var(--c-accent); color: var(--c-ink); }
.btn-secondary { background: #fff; border-color: #cfd9d6; color: var(--c-ink); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-success { background: var(--c-success); color: #fff; }
.btn-ghost { background: transparent; color: var(--c-primary); }
.btn-link { background: none; border: 0; color: var(--c-primary); padding: 0; min-height: auto; font-weight: 500; }
.btn-sm { padding: 6px 10px; min-height: 32px; font-size: .85rem; }
.btn-lg { padding: 14px 22px; min-height: 52px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: var(--space-2); flex-wrap: wrap; }

/* ---------------- Badges / status ---------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-success { background: var(--c-success-50); color: var(--c-success); }
.badge-info { background: var(--c-info-50); color: var(--c-info); }
.badge-warning { background: var(--c-warning-50); color: var(--c-warning); }
.badge-danger { background: var(--c-danger-50); color: var(--c-danger); }
.badge-neutral { background: var(--c-neutral-50); color: var(--c-ink-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }
.pill { display: inline-block; background: var(--c-primary-50); color: var(--c-primary); border-radius: 999px; padding: 2px 10px; font-size: .8rem; margin: 2px; }

/* ---------------- Alerts ---------------- */
.alert { border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); border: 1px solid; display: flex; gap: var(--space-2); align-items: flex-start; }
.alert-success { background: var(--c-success-50); border-color: #bfe3cd; color: #155c35; }
.alert-error, .alert-danger { background: var(--c-danger-50); border-color: #f5c6b4; color: #8a2e08; }
.alert-warning { background: var(--c-warning-50); border-color: #f1d7a8; color: #7a4f12; }
.alert-info { background: var(--c-info-50); border-color: #c4d8f0; color: #1c4a7e; }

/* ---------------- Progress / meters ---------------- */
.progress { height: 8px; background: var(--c-line-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--c-primary); border-radius: 999px; }
.progress.warn > span { background: var(--c-warning); }
.progress.danger > span { background: var(--c-danger); }
.meter-row { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--space-3); align-items: center; margin-bottom: var(--space-3); font-size: .88rem; }
.meter-row .progress { grid-column: 1 / -1; }

/* ---------------- Timeline / log ---------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding-inline-start: 22px; padding-bottom: var(--space-3); border-inline-start: 2px solid var(--c-line); margin-inline-start: 6px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--c-primary); border: 2px solid #fff; }
.timeline .when { font-size: .8rem; color: var(--c-muted); }

/* ---------------- Calendar (availability) ---------------- */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar .dow { font-size: .78rem; color: var(--c-muted); text-align: center; font-weight: 600; }
.calendar .day { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius-sm); min-height: 74px; padding: 6px; font-size: .82rem; }
.calendar .day.off { background: var(--c-danger-50); }
.calendar .day.on { background: var(--c-success-50); }
.calendar .day.busy { box-shadow: inset 0 -3px 0 var(--c-accent); }
.calendar .day.blank { background: transparent; border: 0; }

/* ---------------- Mobile field UI (worker & supervisor) ---------------- */
.mobile { max-width: 640px; margin: 0 auto; }
.big-action { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); text-align: center; padding: var(--space-5); }
.big-action .btn { width: 100%; min-height: 64px; font-size: 1.15rem; border-radius: var(--radius-lg); }
.worker-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--c-line-2); background: #fff; }
.worker-row .who { flex: 1; min-width: 0; }
.worker-row .who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.worker-row .acts { display: flex; gap: 6px; }
.chip-filter { position: relative; display: flex; gap: 6px; overflow-x: auto; padding-bottom: var(--space-2); margin-bottom: var(--space-3); }
.chip-filter a { padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--c-line); color: var(--c-ink-2); white-space: nowrap; font-size: .88rem; }
.chip-filter a.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.qr-box { background: #fff; padding: var(--space-5); border-radius: var(--radius-lg); display: inline-block; }
.map { height: 380px; border-radius: var(--radius); border: 1px solid var(--c-line); background: var(--c-line-2); }
.map.small { height: 240px; }

/* ---------------- Dialog ---------------- */
dialog { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(560px, 94vw); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(20, 33, 30, .45); }
dialog .dialog-head { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--c-line-2); display: flex; justify-content: space-between; align-items: center; }
dialog .dialog-head h3 { margin: 0; }
dialog .dialog-body { padding: var(--space-5); }
dialog .dialog-foot { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--c-line-2); display: flex; justify-content: flex-end; gap: var(--space-2); }

/* ---------------- Pagination ---------------- */
.pagination { display: flex; gap: 4px; justify-content: center; margin: var(--space-4) 0; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: grid; place-items: center; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--c-line); background: #fff; color: var(--c-ink-2); font-size: .88rem; }
.pagination .current { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

/* ---------------- Job / pricing cards ---------------- */
.job-card { display: flex; flex-direction: column; gap: var(--space-2); }
.job-card .company { display: flex; align-items: center; gap: var(--space-2); color: var(--c-muted); font-size: .88rem; }
.job-card .company img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.job-card .pay { font-weight: 700; color: var(--c-primary); }
.price-card { text-align: center; position: relative; }
.price-card.featured { border: 2px solid var(--c-accent); }
.price-card .price { font-size: 2rem; font-weight: 800; color: var(--c-ink); }
.price-card ul { list-style: none; padding: 0; margin: var(--space-4) 0; text-align: start; }
.price-card li { padding: 6px 0; border-bottom: 1px dashed var(--c-line); font-size: .9rem; }
.ribbon { position: absolute; top: -12px; inset-inline-end: 16px; background: var(--c-accent); color: var(--c-ink); font-weight: 700; font-size: .75rem; padding: 3px 10px; border-radius: 999px; }

/* ---------------- Utilities ---------------- */
.muted { color: var(--c-muted); }
.text-end { text-align: end; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--space-2); } .mt-4 { margin-top: var(--space-4); } .mt-5 { margin-top: var(--space-5); }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--space-2); } .mb-4 { margin-bottom: var(--space-4); }
.flex { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.hidden { display: none !important; }
.w-100 { width: 100%; }
.danger-text { color: var(--c-danger); }
.success-text { color: var(--c-success); }
.warning-text { color: var(--c-warning); }

/* ---------------- Responsive ---------------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-aside { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  /* Off-canvas menu is hidden (not translated sideways: that widens the page in RTL) */
  .sidebar { display: none; position: fixed; inset-inline-start: 0; top: 0; width: 280px; max-width: 85vw; z-index: 50; }
  .sidebar.open { display: block; box-shadow: var(--shadow); }
  .topbar .menu-toggle { display: inline-flex; }
  .content { padding: var(--space-4); }
  .site-nav { display: none; }
  .site-nav.open { display: flex; position: absolute; top: 68px; inset-inline: 0; background: #fff; flex-direction: column; padding: var(--space-4); border-bottom: 1px solid var(--c-line); align-items: flex-start; }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4, .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.6rem; }
  .page-header h1 { font-size: 1.3rem; }
  .card { padding: var(--space-4); }
  .repeat-row { grid-template-columns: 1fr 1fr; }
  .site-actions .btn-secondary { display: none; }
  .topbar { padding: 0 var(--space-3); gap: var(--space-1); }
  .topbar .user-name, .tenant-switch select { max-width: 120px; }
  .topbar .user-name { display: none; }
  .topbar > strong { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar > .badge { display: none; } /* company status badge; the status banner below still explains it */
  .worker-row { flex-wrap: wrap; }
  .worker-row .who { flex: 1 1 60%; }
  .worker-row .acts { flex: 1 1 100%; justify-content: flex-end; flex-wrap: wrap; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { margin-top: 6px; }
}

/* ---------------- Print (reports → PDF) ---------------- */
@media print {
  .sidebar, .topbar, .no-print, .site-header, .site-footer { display: none !important; }
  .shell { display: block; }
  body { background: #fff; font-size: 11px; }
  .card, .table-wrap { border: 0; box-shadow: none; }
  .table th, .table td { padding: 4px 6px; }
  @page { margin: 12mm; }
}

/* Command center live zone map legend (colours match app.js zone markers) */
.map-legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); list-style: none; margin: var(--space-2) 0 0; padding: 0; }
.map-legend li { display: inline-flex; align-items: center; gap: 6px; }
.dot.zone-ok { background: #1f8a4c; }
.dot.zone-warn { background: #d98f2b; }
.dot.zone-alert { background: #c0392b; }
.dot.zone-idle { background: #7a8691; }
