/*
 * AppSite Shared Layout CSS — canonical design system for all 31 modules
 * Hosted at: https://gallery-appsite.web.app/shared/layout.css
 *        and https://gallery.appsite.ca/shared/layout.css
 * Load with:
 *   <link rel="stylesheet" href="https://gallery-appsite.web.app/shared/layout.css" crossorigin="anonymous">
 *
 * Load ORDER: module style.css FIRST, then this file.
 * layout.css wins by default; module can override with !important.
 *
 * SIDEBAR PATTERN (all modules must use this):
 *   - Vertical nav list on the left, 172–264px wide
 *   - Chevron toggle button, JS-positioned (position:fixed + getBoundingClientRect)
 *   - Collapsed = 36px rail with rotated label, items fade out
 *   - Smooth CSS transition on grid-template-columns
 */

/* ── Reset / base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #f4f6f9;
  --panel:        #ffffff;
  --ink:          #1f2933;
  --muted:        #697586;
  --line:         #d9dee7;
  --accent:       #1d4ed8;
  --accent-dark:  #1e40af;
  --soft:         #eff6ff;
  --danger:       #dc2626;
  --danger-hover: #b91c1c;
  --danger-light: #fef2f2;
  --success:      #16a34a;
  --warn:         #d97706;
  --shadow:       0 1px 4px rgba(0,0,0,0.08);
  --radius:       8px;

  /* Aliases — many modules use these names */
  --surface:      var(--panel);
  --border:       var(--line);
  --text:         var(--ink);
  --text-muted:   var(--muted);
  --primary:      var(--accent);
  --primary-hover:var(--accent-dark);
  --primary-light:var(--soft);
  --surface-raised:#f8fafc;
  --card:         var(--panel);

  /* Sidebar */
  --sidebar-w:             264px;
  --sidebar-collapsed-w:   36px;
  --sidebar-transition:    0.22s cubic-bezier(.4,0,.2,1);
}

html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--ink);
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.landing { height: auto; overflow: auto; min-height: 100dvh; }

button, input, select, textarea { font: inherit; }
a { color: var(--accent); }

#app, .app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Suppress topnav modules from stretching */
#appsiteTopNav, #appsite-topnav, .appsite-topnav,
.appsite-topnav-shell, header.appsite-topnav,
.tl-topnav, .topnav-module {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  z-index: 1000;
}

/* ── Status bar ─────────────────────────────────────────────────────────── */
#statusBar {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 3px 14px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 22px;
  display: flex;
  align-items: center;
}
#statusBar.error   { color: var(--danger); }
#statusBar.success { color: var(--success); }

/* ── Bottom status bar (Books, Invoice, etc.) ────────────────────────────── */
.module-status-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 100;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.module-status-bar.error   { color: var(--danger); }
.module-status-bar.success { color: var(--success); }

/* ── Topbar ─────────────────────────────────────────────────────────────── */
header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex-wrap: nowrap;
  flex-shrink: 0;
  overflow: hidden;
}
header.topbar h1 {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
header.topbar .actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  flex: 1;
  justify-content: flex-end;
}
header.topbar .actions input[type="search"],
header.topbar .actions select {
  font-size: 11px;
  padding: 2px 6px;
  height: 26px;
  min-width: 80px;
  max-width: 130px;
}
header.topbar .actions button,
header.topbar .actions .btn {
  font-size: 11px;
  padding: 0 8px;
  height: 26px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Workspace ──────────────────────────────────────────────────────────── */
.workspace {
  padding: 12px;
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: visible;
}

/* ── App layout wrapper ─────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  flex-direction: row;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* ── List+Editor layout grid ────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(140px, var(--sidebar-w)) 1fr;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow: visible;
  position: relative;
  transition: grid-template-columns var(--sidebar-transition);
}
.layout.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-w) 1fr;
}

/* ── Order list (left sidebar in list-editor modules) ───────────────────── */
.order-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: visible;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}
.order-list-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.order-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.order-list-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

/* ── Order editor (right panel in list-editor modules) ──────────────────── */
.order-editor {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Hide list content when collapsed */
.layout.sidebar-collapsed .order-list-scroll,
.layout.sidebar-collapsed .order-list > :not(.sidebar-toggle-btn):not(.sidebar-toggle-wrap):not(.sidebar-rail-label) {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}

/* ── Sidebar toggle chevron button ──────────────────────────────────────── */
/* JS positions this via position:fixed + getBoundingClientRect */
.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 0 6px 6px 0;
  border-left: none;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.sidebar-toggle-btn:hover {
  color: var(--ink);
  background: var(--soft);
  border-color: var(--accent);
}
.sidebar-toggle-btn svg {
  display: block;
  transition: transform var(--sidebar-transition);
}
/* Rotate chevron when collapsed */
.layout.sidebar-collapsed .sidebar-toggle-btn svg,
.hub-sidebar.collapsed .sidebar-toggle-btn svg {
  transform: rotate(180deg);
}

/* ── Collapsed rail label (rotated tab text) ─────────────────────────────── */
/*
 * Add <span class="sidebar-rail-label">Name</span> inside .order-list or .hub-sidebar.
 * Hidden by default; shown as vertical rotated text when collapsed.
 */
.sidebar-rail-label {
  display: none;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  align-self: center;
  flex-shrink: 0;
  padding: 8px 0;
}

/* Show when .order-list's parent .layout is collapsed */
.layout.sidebar-collapsed .order-list .sidebar-rail-label {
  display: block;
}

/* Show when .hub-sidebar is collapsed */
.hub-sidebar.collapsed .sidebar-rail-label {
  display: block !important;
}

/* ── Hub category nav sidebar ───────────────────────────────────────────── */
.hub-body {
  display: flex;
  align-items: flex-start;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 40px;
}
.hub-main {
  flex: 1;
  min-width: 0;
}
.hub-sidebar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 172px;
  flex-shrink: 0;
  padding: 4px 0 0;
  margin-right: 20px;
  position: sticky;
  top: 16px;
  overflow: visible;
  transition: width var(--sidebar-transition);
  align-self: flex-start;
}
.hub-sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
  margin-right: 8px;
  align-items: center;
}

/* hub-sidebar chevron */
.hub-sidebar .sidebar-toggle-btn {
  border-radius: 0 6px 6px 0;
  border-left: none;
}

/* Hide nav items when collapsed */
.hub-sidebar .filter-chip {
  transition: opacity 0.12s;
}
.hub-sidebar.collapsed .filter-chip {
  opacity: 0;
  pointer-events: none;
}

/* ── Shared filter chip (hub nav items) ─────────────────────────────────── */
.filter-chip {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.filter-chip:hover {
  background: var(--soft);
  color: var(--ink);
}
.filter-chip.active {
  background: var(--accent);
  color: #fff;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
button { cursor: pointer; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-surface { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn-surface:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; padding: 5px 8px; }
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-sm { padding: 4px 10px; font-size: 12px; min-height: 0; }
.btn-primary-action {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  min-height: 32px;
}
.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-header {
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.card-body { padding: 0; }

/* ── Summary grid ────────────────────────────────────────────────────────── */
.summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.summary-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 4px; }
.summary-value { font-size: 20px; font-weight: 700; color: var(--ink); }
.summary-value.positive { color: var(--success); }
.summary-value.negative { color: var(--danger); }

/* ── Form fields ─────────────────────────────────────────────────────────── */
.form-grid { display: grid; gap: 12px; }
.form-grid.two   { grid-template-columns: 1fr 1fr; }
.form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
label.field, .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field-input,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="search"],
input[type="url"],
select,
textarea {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: var(--panel);
  outline: none;
  transition: border-color 0.15s;
}
.field-input:focus,
input:focus,
select:focus,
textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 60px; }
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
}

/* ── Work-order editor chrome ────────────────────────────────────────────── */
.wo-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
.wo-header-left { display: flex; align-items: center; gap: 10px; }
.wo-header-left h2 { font-size: 16px; font-weight: 700; }
.wo-status-chip {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2px 9px;
}
.wo-header-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.wo-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 20px 0;
  background: var(--panel);
  border-bottom: 2px solid var(--line);
  position: sticky;
  top: 57px;
  z-index: 9;
  flex-wrap: wrap;
}
.wo-tab {
  padding: 7px 14px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.wo-tab.active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--accent);
  margin-bottom: -2px;
  padding-bottom: 9px;
}
.wo-tab-panel { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; }
.wo-form { display: flex; flex-direction: column; }
.wo-row { display: flex; gap: 12px; }
.wo-row.four-col { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }

/* ── Data table ──────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  padding: 9px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table th.num, .data-table td.num { text-align: right; }
.data-table td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg); }
.table-wrap { width: 100%; overflow-x: auto; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15,23,42,0.38);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.active, .modal-backdrop.open, .modal-backdrop.show { display: flex; }
.modal {
  display: none; position: fixed; inset: 0; z-index: 2001;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(15,23,42,0.38);
}
.modal.active, .modal.open, .modal.show, .modal[aria-hidden="false"] { display: flex; }
.modal-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(15,23,42,0.38); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.hidden { display: none; }
.modal-card, .dialog, .modal-content, .modal-overlay > .modal {
  width: min(720px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(15,23,42,0.22);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.modal-close { border: none; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal-body { padding: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 3000;
  padding: 10px 14px; border-radius: 8px;
  background: var(--ink); color: #fff;
  box-shadow: var(--shadow); font-size: 13px;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden, [hidden] { display: none !important; }
.empty-state, .loading-state { padding: 42px 20px; text-align: center; color: var(--muted); }
.empty-state-title { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }

/* Order list item */
.order-item { padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.order-item:hover { background: var(--bg); }
.order-item.active { background: var(--soft); border-left: 3px solid var(--accent); }
.order-item:last-child { border-bottom: 0; }

/* ── Landing page ────────────────────────────────────────────────────────── */
.sso-banner { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1000; }
.sso-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--line); }
.sso-name { font-weight: 600; font-size: 14px; }
.sso-actions { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.btn-link { color: var(--accent); font-size: 13px; font-weight: 600; text-decoration: none; }
.eyebrow { margin: 0 0 2px; color: var(--accent-dark); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.landing-wrap { max-width: 900px; margin: 0 auto; padding: 48px 24px 32px; }
.landing-hero { text-align: center; margin-bottom: 40px; }
.landing-hero h1 { font-size: 40px; font-weight: 800; margin: 0 0 10px; }
.landing-sub { color: var(--muted); font-size: 16px; margin-top: 6px; max-width: 520px; margin-left: auto; margin-right: auto; }
.landing-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 24px; justify-content: center; }
.btn-signin { display: inline-block; padding: 10px 28px; background: var(--accent); color: #fff; border-radius: 8px; font-size: 15px; font-weight: 700; text-decoration: none; border: none; cursor: pointer; }
.btn-signin:hover { background: var(--accent-dark); }
.btn-hub { display: inline-block; padding: 10px 20px; background: transparent; color: var(--muted); border-radius: 8px; font-size: 14px; font-weight: 600; text-decoration: none; border: 1px solid var(--line); }
.btn-hub:hover { border-color: var(--accent); color: var(--accent-dark); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.feature-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px 18px; }
.feature-card svg { width: 26px; height: 26px; stroke: var(--accent); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; display: block; margin-bottom: 12px; }
.feature-card h3 { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.feature-card p { margin: 0; color: var(--muted); font-size: 13px; }
.landing-cta { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px; color: var(--muted); font-size: 14px; }
.landing-footer { text-align: center; padding: 24px 16px; font-size: 12px; color: var(--muted); }
.landing-footer a { color: inherit; text-decoration: underline; }

/* ── Cybersecurity / dark-app shared components ─────────────────────────── */

/* Severity badges */
.badge-severity {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 100px;
  font-size: 0.6875rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.badge-severity.critical { background: hsla(0,84%,60%,.12);  color: hsl(0,84%,60%); }
.badge-severity.high     { background: hsla(22,92%,58%,.12); color: hsl(22,92%,58%); }
.badge-severity.medium   { background: hsla(42,92%,56%,.12); color: hsl(42,92%,56%); }
.badge-severity.low      { background: hsla(192,85%,55%,.12);color: hsl(192,85%,55%); }
.badge-severity.info     { background: rgba(0,0,0,.06);       color: #8a94a6; }

/* Status badges */
.badge-status {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 100px;
  font-size: 0.6875rem; font-weight: 600;
}
.badge-status.open        { background: hsla(0,84%,60%,.12);  color: hsl(0,84%,60%); }
.badge-status.in-progress { background: hsla(42,92%,56%,.12); color: hsl(42,92%,56%); }
.badge-status.patched     { background: hsla(155,66%,48%,.12);color: hsl(155,66%,48%); }
.badge-status.wont-fix    { background: rgba(0,0,0,.06);       color: #8a94a6; }
.badge-status.pending     { background: hsla(192,85%,55%,.12);color: hsl(192,85%,55%); }

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--panel, #fff); border: 1px solid var(--line, #d9dee7);
  border-radius: 10px; padding: 1.125rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.375rem;
}
.stat-card-label {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted, #8a94a6);
}
.stat-card-value {
  font-size: 2rem; font-weight: 700; line-height: 1; color: var(--ink, #1a1f36);
}
.stat-card-sub { font-size: 0.75rem; color: var(--muted, #8a94a6); }
.stat-card.critical { border-left: 3px solid hsl(0,84%,60%); }
.stat-card.high     { border-left: 3px solid hsl(22,92%,58%); }
.stat-card.medium   { border-left: 3px solid hsl(42,92%,56%); }
.stat-card.low      { border-left: 3px solid hsl(192,85%,55%); }
.stat-card.ok       { border-left: 3px solid hsl(155,66%,48%); }

/* Skeleton loader */
.skeleton {
  background: var(--line, #d9dee7); border-radius: 4px;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Loading overlay */
#loading-overlay {
  position: fixed; inset: 0;
  background: var(--bg, #f4f6f9);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; transition: opacity 0.3s;
}
#loading-overlay.hidden { opacity: 0; pointer-events: none; }

.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--line, #d9dee7);
  border-top-color: var(--accent, #0e7490);
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Filter chips */
.filter-chips { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.chip {
  padding: 0.25rem 0.75rem; border-radius: 100px;
  font-size: 0.75rem; font-weight: 600;
  border: 1px solid var(--line, #d9dee7);
  color: var(--muted, #8a94a6);
  background: var(--panel, #fff);
  cursor: pointer; transition: all 0.15s;
}
.chip:hover { border-color: var(--accent, #0e7490); color: var(--ink, #1a1f36); }
.chip.active { background: hsla(187,82%,31%,.1); border-color: var(--accent, #0e7490); color: var(--accent, #0e7490); }

/* Search bar */
.search-bar {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--panel, #fff); border: 1px solid var(--line, #d9dee7);
  border-radius: 8px; padding: 0.375rem 0.75rem; min-width: 220px;
}
.search-bar input { flex: 1; font-size: 0.8125rem; color: var(--ink, #1a1f36); }
.search-bar input::placeholder { color: var(--muted, #8a94a6); }

/* App layout (multi-page SPA pattern: sidebar + main) */
.app-layout { display: flex; height: 100vh; overflow: hidden; }
.app-layout .main {
  flex: 1; display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
}
.app-layout .content { flex: 1; overflow-y: auto; padding: 1.5rem; }

/* Cyber topbar title */
.topbar-title {
  font-size: 1rem; font-weight: 600; flex: 1;
  color: var(--ink, #1a1f36);
}

/* Grid utils */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.font-mono { font-family: "Geist Mono", monospace; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  html, body { overflow: auto; }
  body { min-height: 100vh; }
  .workspace { overflow: visible; padding: 8px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  header.topbar .actions { gap: 6px; }
}

@media (max-width: 700px) {
  /* Hub sidebar — horizontal chips */
  .hub-body { flex-direction: column; padding: 0 14px 32px; }
  .hub-sidebar {
    width: 100% !important;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    margin-right: 0;
    margin-bottom: 12px;
    position: static;
    overflow: visible;
    transition: none;
  }
  .hub-sidebar .sidebar-toggle-btn { display: none; }
  .hub-sidebar .filter-chip {
    width: auto !important;
    padding: 5px 12px !important;
    border-radius: 20px !important;
    border: 1px solid var(--line) !important;
    background: var(--panel) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .hub-sidebar .filter-chip.active {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
  }

}

/* ── Module mobile sidebar (hamburger) ────────────────────────────────────── */
/* Hamburger button — injected into .topbar by desk-bridge.js on mobile */
.sidebar-ham-btn {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--ink, #1f2933);
  flex-shrink: 0;
  line-height: 1;
}
.sidebar-ham-btn svg { display: block; }
.sidebar-ham-btn:hover { background: var(--soft, #eff6ff); }

/* Overlay backdrop */
.sidebar-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 299;
}

@media (max-width: 768px) {
  /* Show hamburger button */
  .sidebar-ham-btn { display: flex; align-items: center; }

  /* Sidebar hides off-screen left by default on mobile */
  .app-layout .sidebar {
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    z-index: 300;
    transform: translateX(-110%);
    transition: transform 0.22s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
    width: 260px !important;
    min-width: 0 !important;
    max-height: 100vh;
    overflow-y: auto;
  }

  /* Sidebar slides in when app-layout has .mobile-sidebar-open */
  .app-layout.mobile-sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  }

  /* Backdrop visible when open */
  .app-layout.mobile-sidebar-open .sidebar-mobile-overlay {
    display: block;
  }

  /* Main area takes full width */
  .app-layout .main { width: 100%; }

  /* List-editor layout (.layout + .order-list) — hide sidebar off-screen, slide in via hamburger */
  .layout { grid-template-columns: 1fr !important; overflow: hidden; position: relative; }
  .layout .order-list {
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    z-index: 300;
    width: 260px !important;
    height: 100%;
    max-height: none !important;
    transform: translateX(-110%);
    transition: transform 0.22s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
  }
  .layout.mobile-sidebar-open .order-list {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  }
  .layout.mobile-sidebar-open .sidebar-mobile-overlay { display: block; }

  /* Topbar: show hamburger at far left */
  header.topbar { gap: 8px; }
}
