:root {
  --primary: #6366f1;
  --primary-dark: #4338ca;
  --primary-soft: rgba(99, 102, 241, 0.12);
  --secondary: #0f172a;
  --bg: #f4f5fb;
  --card: #ffffff;
  --border: #e5e7eb;
  --border-strong: #c7d2fe;
  --ok: #22c55e;
  --problem: #ef4444;
  --pending: #f59e0b;
  --muted: #64748b;
  --surface: #0b1120;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 18px 30px rgba(15, 23, 42, 0.12);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--secondary);
  min-height: 100vh;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1.2rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
}

.topbar .brand {
  font-weight: 700;
}

.topbar nav a {
  margin-right: 1rem;
  text-decoration: none;
  color: var(--secondary);
  font-weight: 500;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.7rem;
  margin: 0 0 0.4rem;
  color: var(--muted);
}

.container {
  padding: 2rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  border: 1px solid rgba(226, 232, 240, 0.7);
}

.form {
  display: grid;
  gap: 1rem;
}

.form label {
  display: grid;
  gap: 0.5rem;
  font-weight: 600;
}

.form input,
.form textarea,
.form select {
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 1rem;
}

.btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  font-weight: 600;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

.btn.secondary {
  background: #64748b;
  box-shadow: none;
}

.btn.danger {
  background: var(--problem);
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  color: #475569;
  border: 1px solid rgba(100, 116, 139, 0.4);
  box-shadow: none;
}

.btn.ghost:hover {
  background: rgba(148, 163, 184, 0.2);
}

.btn.small {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

.btn:disabled {
  background: #cbd5f5;
  cursor: not-allowed;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.panel {
  background: var(--bg);
  border-radius: 12px;
  padding: 1rem;
}

.list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  padding: 0.75rem;
  border-radius: 10px;
  gap: 1rem;
}

.list-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.badge {
  background: var(--pending);
  color: white;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.badge.danger {
  background: var(--problem);
}

.error {
  color: var(--problem);
  font-weight: 600;
}

.success {
  color: var(--ok);
  font-weight: 600;
}

.warning {
  color: var(--pending);
  font-weight: 600;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.progress {
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-bar {
  background: var(--ok);
  height: 100%;
  transition: width 0.3s ease;
}

.stats {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.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;
}

.stats.modern {
  gap: 0.5rem;
}

.stat-pill {
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(100, 116, 139, 0.1);
}

.stat-pill.ok {
  background: rgba(34, 197, 94, 0.28);
  color: #166534;
}

.stat-pill.problem {
  background: rgba(239, 68, 68, 0.28);
  color: #b91c1c;
}

.stat-pill.pending {
  background: rgba(249, 115, 22, 0.28);
  color: #9a3412;
}

.event-page {
  display: grid;
  gap: 1.5rem;
}

.event-hero {
  background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 50%),
    #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
}

.event-hero .muted {
  color: rgba(226, 232, 240, 0.75);
}

.event-hero-top {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.event-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.event-actions .btn.ghost {
  background: transparent;
  color: #e2e8f0;
  border: 1px solid rgba(226, 232, 240, 0.4);
}

.event-actions .btn.ghost:hover {
  background: rgba(148, 163, 184, 0.2);
}

.event-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.event-hero .meta-pill {
  background: rgba(148, 163, 184, 0.2);
  color: #f8fafc;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.event-public {
  margin-top: 1.2rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.event-public-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.event-public .label {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.7);
}

.event-public-qr {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  border-radius: 12px;
  background: rgba(226, 232, 240, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.event-public .qr-code {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background: #fff;
}

.event-summary {
  margin-top: 1.5rem;
  display: grid;
  gap: 1rem;
}

.event-hero .summary-card {
  background: rgba(15, 23, 42, 0.65);
  border-radius: 18px;
  padding: 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  display: grid;
  gap: 0.75rem;
}

.event-hero #event-parent-summary {
  background: rgba(15, 23, 42, 0.4);
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
  color: #f8fafc;
}

.event-hero #event-parent-summary .parent-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: #f8fafc;
}

.event-hero #event-parent-summary .parent-summary-title {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #cbd5f5;
}

.event-hero #event-parent-summary .parent-summary-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.event-hero #event-parent-summary .parent-summary-note {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.4;
  color: #94a3b8;
  max-width: 42ch;
}

.event-hero #event-parent-summary .parent-summary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.event-hero #event-parent-summary .status-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.72), rgba(30, 41, 59, 0.7));
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.3);
  color: #f8fafc;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 0.75rem;
  display: grid;
  gap: 0.5rem;
  align-content: space-between;
  aspect-ratio: auto;
}

.event-hero #event-parent-summary .parent-summary-item-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.event-hero #event-parent-summary .parent-summary-item-name {
  color: #f8fafc;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
}

.event-hero #event-parent-summary .parent-summary-item-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.event-hero #event-parent-summary .parent-summary-item-badge.ok {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.event-hero #event-parent-summary .parent-summary-item-badge.problem {
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.event-hero #event-parent-summary .parent-summary-item-badge.pending {
  background: rgba(249, 115, 22, 0.2);
  color: #fed7aa;
  border: 1px solid rgba(249, 115, 22, 0.4);
}

.event-hero #event-parent-summary .parent-summary-item-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #cbd5f5;
  font-size: 0.78rem;
}

.event-hero #event-parent-summary .parent-summary-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.6);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.1);
}

.event-hero #event-parent-summary .parent-summary-item-dot.ok {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.event-hero #event-parent-summary .parent-summary-item-dot.problem {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.event-hero #event-parent-summary .parent-summary-item-dot.pending {
  background: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.event-hero .summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.event-hero .summary-value {
  font-size: 1.2rem;
  font-weight: 700;
}

.event-hero .progress {
  background: rgba(148, 163, 184, 0.25);
}

.event-hero .progress-bar {
  background: linear-gradient(90deg, #38bdf8, #22c55e);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20px, 1fr));
  gap: 0.35rem;
  padding-top: 0.35rem;
}

.status-grid--parents {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.55rem;
  padding-top: 0.45rem;
}

.status-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
  padding-top: 0;
}

.parent-summary-grid {
  margin-top: 0.2rem;
}

.status-card {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: transparent;
  border: 1.5px solid rgba(148, 163, 184, 0.7);
  color: #0f172a;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.4rem;
  gap: 0.3rem;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.monitor-tiles .status-card {
  aspect-ratio: auto;
  min-height: 160px;
  justify-content: flex-start;
}

.status-card-name {
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: center;
  color: #0f172a;
}

.status-card-pill {
  align-self: flex-start;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.35);
  color: #1f2937;
}

.status-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.status-card.ok {
  border-color: #16a34a;
}

.status-card.problem {
  border-color: #dc2626;
}

.status-card.pending {
  border-color: #ea580c;
}

.status-card-pill.ok {
  background: rgba(34, 197, 94, 0.3);
  color: #166534;
}

.status-card-pill.problem {
  background: rgba(239, 68, 68, 0.3);
  color: #991b1b;
}

.status-card-pill.pending {
  background: rgba(249, 115, 22, 0.3);
  color: #9a3412;
}

.status-card.loaded {
  border-color: #7c3aed;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.18);
}

.status-card-pill.loaded {
  background: rgba(124, 58, 237, 0.2);
  color: #4c1d95;
}

.lot-badge {
  --lot-color: #475569;
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--lot-color);
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--lot-color) 55%, white);
  background: color-mix(in srgb, var(--lot-color) 14%, white);
  color: var(--lot-color);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
}

.lot-badge::before {
  content: "";
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 999px;
  background: var(--lot-color);
  flex: 0 0 auto;
}

.status-card-location {
  font-size: 0.72rem;
  color: #4c1d95;
  font-weight: 600;
  text-align: center;
}

.status-card-load {
  width: 100%;
  justify-content: center;
}

.status-square {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  padding: 0.6rem 0.75rem;
  background: #f8fafc;
  display: grid;
  gap: 0.35rem;
  min-height: 72px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.status-square.ok {
  border-color: rgba(34, 197, 94, 0.5);
  background: #dcfce7;
}

.status-square.problem {
  border-color: rgba(239, 68, 68, 0.5);
  background: #fee2e2;
}

.status-square.pending {
  border-color: rgba(249, 115, 22, 0.5);
  background: #ffedd5;
}

.status-square.loaded {
  border-color: rgba(124, 58, 237, 0.6);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.18);
}

.status-square-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
}

.status-square-status {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.event-checklist .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.event-checklist .section-chip {
  background: rgba(15, 23, 42, 0.1);
  color: #0f172a;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tree {
  display: grid;
  gap: 0.75rem;
}

.tree-node {
  background: #f8fafc;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid transparent;
  border-left: 6px solid var(--border);
  display: grid;
  gap: 0.75rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.tree-node.loaded {
  border-color: rgba(124, 58, 237, 0.35);
  border-left-color: #7c3aed;
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.18);
}

.tree-node.ok {
  border-left-color: var(--ok);
  border-color: rgba(34, 197, 94, 0.35);
  background: #dcfce7;
}

.tree-node.problem {
  border-left-color: var(--problem);
  border-color: rgba(239, 68, 68, 0.35);
  background: #fee2e2;
}

.tree-node.pending {
  border-left-color: var(--pending);
  border-color: rgba(249, 115, 22, 0.35);
  background: #ffedd5;
}

.tree-node.is-container {
  padding: 0;
  overflow: hidden;
}

.tree-node summary {
  list-style: none;
  cursor: pointer;
}

.tree-node summary::-webkit-details-marker {
  display: none;
}

.tree-parent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1rem 0.9rem;
}

.tree-parent-actions .btn {
  flex: 1 1 120px;
  justify-content: center;
}

.tree-title {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  position: relative;
}

.tree-node.is-container .tree-title {
  padding: 1rem;
}

.tree-node .fold-icon {
  position: absolute;
  right: 1.2rem;
  top: 1.2rem;
  font-size: 0.95rem;
  color: #64748b;
  transition: transform 0.2s ease;
  pointer-events: none;
}

.tree-node.is-container[open] .fold-icon {
  transform: rotate(180deg);
}

.tree-title-main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tree-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tree-name {
  font-weight: 700;
}

.tree-subtitle {
  font-size: 0.85rem;
  color: #64748b;
}

.tree-destination {
  font-size: 0.75rem;
  font-weight: 600;
  color: #4c1d95;
}

.tree-title .qty {
  font-size: 0.85rem;
  color: #475569;
}

.tree-title .status {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  background: var(--border);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
}

.tree-title .status.ok {
  background: rgba(34, 197, 94, 0.35);
  color: #14532d;
}

.tree-title .status.problem {
  background: rgba(239, 68, 68, 0.35);
  color: #991b1b;
}

.tree-title .status.pending {
  background: rgba(249, 115, 22, 0.35);
  color: #7c2d12;
}

.tree-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.count-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.count-pill {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.2);
  color: #0f172a;
}

.count-pill.ok {
  background: rgba(34, 197, 94, 0.3);
  color: #14532d;
}

.count-pill.problem {
  background: rgba(239, 68, 68, 0.3);
  color: #991b1b;
}

.count-pill.pending {
  background: rgba(249, 115, 22, 0.3);
  color: #7c2d12;
}

.count-pill.neutral {
  background: rgba(100, 116, 139, 0.15);
  color: #0f172a;
}

.tree-note {
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.15);
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
}

.tree-actor {
  font-size: 0.8rem;
  color: #1e293b;
  background: rgba(59, 130, 246, 0.12);
  padding: 0.45rem 0.75rem;
  border-radius: 12px;
  font-weight: 600;
}

.tree-children {
  margin: 0 1rem 1rem;
  display: grid;
  gap: 0.6rem;
}

.tree-empty {
  margin: 0 1rem 1rem;
  padding: 0.8rem;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
  font-size: 0.85rem;
}

.phone {
  background: #0b1220;
}

.phone-container {
  max-width: 520px;
  margin: 0 auto;
  padding: 1.2rem;
}

.phone .card {
  border-radius: 24px;
}

.check-hero {
  background: radial-gradient(circle at top left, #1e293b 0%, #0f172a 50%, #1d4ed8 100%);
  color: #f8fafc;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.4);
}

.check-hero .progress {
  background: rgba(255, 255, 255, 0.2);
}

.check-hero .progress-bar {
  background: #38bdf8;
}

.check-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.check-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  margin: 0 0 0.3rem;
  color: rgba(248, 250, 252, 0.7);
}

.check-subtitle {
  margin: 0.4rem 0 0;
  color: rgba(226, 232, 240, 0.8);
  font-size: 0.9rem;
}

.check-progress-pill {
  background: rgba(56, 189, 248, 0.2);
  color: #e0f2fe;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-weight: 700;
}

.sync-pill {
  margin-top: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.sync-time {
  font-weight: 600;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}

.check-body {
  background: #0f172a;
  color: #f8fafc;
}

.check-guide {
  background: #111827;
  color: #e2e8f0;
}

.check-guide h2 {
  margin-top: 0;
}

.guide-steps {
  display: grid;
  gap: 0.75rem;
}

.guide-step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 0.75rem;
  align-items: center;
  background: rgba(15, 23, 42, 0.7);
  padding: 0.75rem 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.guide-step span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.2);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #bae6fd;
}

.stat-chip {
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

.stat-chip.ok {
  background: rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
}

.stat-chip.problem {
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
}

.stat-chip.pending {
  background: rgba(249, 115, 22, 0.2);
  color: #fed7aa;
}

.checklist-section {
  background: rgba(15, 23, 42, 0.8);
  border-radius: 20px;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.checklist-section.ok {
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 12px 30px rgba(34, 197, 94, 0.08);
}

.checklist-section.problem {
  border-color: rgba(239, 68, 68, 0.45);
}

.checklist-section.pending {
  border-color: rgba(249, 115, 22, 0.45);
}

.checklist-section.loaded {
  border-color: rgba(124, 58, 237, 0.6);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.18);
}

.checklist-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  cursor: pointer;
  list-style: none;
}

.checklist-section-header::-webkit-details-marker {
  display: none;
}

.checklist-section-header::after {
  content: "▾";
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.7);
  margin-left: auto;
  transition: transform 0.2s ease;
}

.checklist-section[open] .checklist-section-header::after {
  transform: rotate(180deg);
}

.checklist-section-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.section-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: rgba(226, 232, 240, 0.7);
}

.section-destination {
  display: inline-flex;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #c4b5fd;
}

.section-status {
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.2);
  color: #e2e8f0;
}

.section-status.ok {
  background: rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
}

.section-status.problem {
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
}

.section-status.pending {
  background: rgba(249, 115, 22, 0.2);
  color: #fed7aa;
}

.checklist-section-body {
  display: grid;
  gap: 0.75rem;
}

.checklist-item {
  background: rgba(30, 41, 59, 0.8);
  border-radius: 14px;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(71, 85, 105, 0.6);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.checklist-item.ok {
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 10px 20px rgba(34, 197, 94, 0.1);
}

.checklist-item.problem {
  border-color: rgba(239, 68, 68, 0.4);
}

.checklist-item.pending {
  border-color: rgba(249, 115, 22, 0.4);
}

.checklist-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.checklist-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.checklist-item-name {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.checklist-item-name strong {
  font-size: 0.9rem;
}

.checklist-item-info .qty {
  font-size: 0.7rem;
  color: rgba(226, 232, 240, 0.7);
}

.builder-item .checklist-item-info .qty {
  color: #2563eb;
}

.checklist-item-name .status {
  text-transform: uppercase;
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.2);
  color: #e2e8f0;
}

.checklist-item-name .status.ok {
  background: rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
}

.checklist-item-name .status.problem {
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
}

.checklist-item-name .status.pending {
  background: rgba(249, 115, 22, 0.2);
  color: #fed7aa;
}

.checklist-form {
  display: grid;
  gap: 0.6rem;
}

.checklist-form.compact {
  margin: 0;
}

.checklist-form input {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  color: #e2e8f0;
}

.checklist-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

.toggle-btn {
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
}

.toggle-btn.ok {
  background: rgba(34, 197, 94, 0.2);
  color: #bbf7d0;
}

.toggle-btn.problem {
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 40;
  border: none;
  padding: 0;
}

.modal.is-open,
.modal[open] {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(92vw, 420px);
  background: #ffffff;
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
  display: grid;
  gap: 0.85rem;
}

.modal-title {
  margin: 0;
}

.modal-form {
  display: grid;
  gap: 0.85rem;
}

.modal-form textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 0.75rem;
  font-family: inherit;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.inline-form input {
  min-width: 200px;
}

.inline-form input[type="text"] {
  flex: 1;
}

.link {
  background: var(--bg);
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.public-link {
  display: none;
  margin: 0.6rem 0;
  background: var(--bg);
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  word-break: break-all;
}

.public-link.visible {
  display: block;
}

.public-link-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sacs-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.sacs-controls {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sac-search {
  display: flex;
  align-items: center;
  width: min(320px, 100%);
}

.sac-search input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  background: #fff;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}

.sac-search input:focus {
  outline: 2px solid rgba(56, 189, 248, 0.4);
  border-color: rgba(56, 189, 248, 0.6);
}

.sac-card {
  background: var(--bg);
  border-radius: 16px;
  padding: 1rem;
  border: 1px solid var(--border);
  display: grid;
  gap: 0.85rem;
}

.material-workflow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.workflow-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  padding: 0.85rem;
  border: 1px solid rgba(226, 232, 240, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.workflow-index {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 800;
}

.workflow-step strong,
.workflow-step span {
  display: block;
}

.workflow-step span:not(.workflow-index) {
  color: rgba(226, 232, 240, 0.78);
  font-size: 0.84rem;
  line-height: 1.35;
}

.sac-card-main {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.sac-card-main h3 {
  margin: 0;
}

.material-type-badge {
  width: fit-content;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #1e293b;
  background: #e2e8f0;
}

.material-type-badge.container {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.15);
}

.material-type-badge.item {
  color: #166534;
  background: rgba(34, 197, 94, 0.16);
}

.sac-card.is-hidden {
  display: none;
}

.kanban {
  display: grid;
  gap: 1rem;
}

.kanban-board {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
}

.kanban-column {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.85rem;
  display: grid;
  gap: 0.75rem;
  min-height: 180px;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
}

.kanban-column-title {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.35rem 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  background: transparent;
  width: 100%;
}

.kanban-column-title:focus {
  outline: none;
  border-color: #94a3b8;
  background: #fff;
}

.kanban-column-body {
  display: grid;
  gap: 0.5rem;
  min-height: 120px;
}

.kanban-column-body.is-over {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 12px;
}

.kanban-card {
  cursor: grab;
  font-size: 0.9rem;
}

.kanban-card.is-dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.lot-card {
  padding: 1rem;
}

.lot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.lot-card-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.lot-edit-form {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  display: grid;
  gap: 0.75rem;
}

.sac-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.builder-canvas {
  background: #f8fafc;
  color: #0f172a;
  border-radius: 18px;
  padding: 1.25rem;
  border: 1px solid #cbd5f5;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.08);
}

.builder-canvas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.builder-canvas-meta {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.builder-count-pill {
  background: rgba(56, 189, 248, 0.2);
  color: #bae6fd;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.builder-pill {
  background: rgba(99, 102, 241, 0.12);
  color: #3730a3;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.builder-visual .builder-child-empty {
  color: #475569;
}

.builder-section {
  background: #e2e8f0;
  border: 1px solid #cbd5f5;
  color: #0f172a;
}

.builder-section.active,
.builder-item.active {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.builder-section-header {
  gap: 0.75rem;
}

.builder-node-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.builder-node-actions .btn {
  box-shadow: none;
}

.builder-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

.builder-panel {
  background: var(--card);
  border-radius: 18px;
  padding: 1.25rem;
  border: 1px solid var(--border);
  display: grid;
  gap: 1rem;
}

.builder-helper {
  align-self: start;
  position: sticky;
  top: 1rem;
}

.builder-section-header-text h3 {
  margin: 0;
}

.builder-selected-card {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
}

.builder-selected-card strong {
  color: #0f172a;
}

.builder-selected-card span {
  font-size: 0.85rem;
}

.builder-helper-actions {
  display: grid;
  gap: 0.6rem;
}

.builder-helper-actions .btn {
  justify-content: center;
}

.builder-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

@media (max-width: 960px) {
  .builder-grid {
    grid-template-columns: 1fr;
  }
}

/* Material model editor */
.material-editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.material-editor-heading h2,
.material-editor-heading p {
  margin-top: 0;
}

.material-editor-heading-actions {
  display: flex;
  gap: 0.6rem;
  flex: 0 0 auto;
}

.builder-grid {
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 1.25rem;
}

.builder-canvas {
  min-height: 420px;
  padding: 0;
  overflow: visible;
  background: #f8fafc;
  border: 1px solid #dbe3ee;
  box-shadow: none;
}

.builder-canvas-header {
  margin: 0;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid #dbe3ee;
  background: #fff;
  border-radius: 8px 8px 0 0;
}

.builder-canvas-header h3,
.builder-canvas-header p {
  margin: 0;
}

.builder-canvas-header p {
  margin-top: 0.25rem;
}

.builder-count-pill {
  color: #075985;
  background: #e0f2fe;
}

.builder-root {
  padding: 1rem;
}

.builder-visual .checklist-section-body {
  display: grid;
  gap: 0.45rem;
  padding: 0.45rem 0 0.25rem 1.4rem;
  margin-left: 1.15rem;
  border-left: 2px solid #dbe3ee;
}

.builder-section {
  margin: 0;
  overflow: visible;
  color: #172033;
  background: transparent;
  border: 0;
}

.builder-section > .builder-section-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 62px;
  padding: 0.75rem 2.75rem 0.75rem 0.9rem;
  align-items: center;
  background: #fff;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  cursor: pointer;
}

.builder-section > .builder-section-header::after {
  right: 1rem;
  color: #64748b;
}

.builder-section.active > .builder-section-header,
.builder-item.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
  background: #eff6ff;
}

.builder-node-title h2 {
  margin: 0;
  color: #172033;
  font-size: 0.98rem;
}

.builder-node-title .section-subtitle {
  margin: 0.2rem 0 0;
  color: #64748b;
  font-size: 0.78rem;
}

.builder-node-kind,
.builder-item-qty,
.builder-selected-type {
  display: inline-flex;
  width: fit-content;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  color: #475569;
  background: #eef2f7;
  font-size: 0.72rem;
  font-weight: 700;
}

.builder-item {
  margin: 0;
  padding: 0;
  background: #fff;
  border-color: #dbe3ee;
  border-radius: 8px;
  cursor: pointer;
}

.builder-item .checklist-item-row {
  min-height: 52px;
  padding: 0.65rem 0.85rem;
  align-items: center;
}

.builder-item .checklist-item-name {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #172033;
}

.builder-item-icon {
  display: grid;
  width: 1.4rem;
  height: 1.4rem;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
  color: #2563eb;
  background: #dbeafe;
  font-size: 1rem;
}

.builder-item-qty {
  white-space: nowrap;
  color: #1d4ed8;
  background: #dbeafe;
}

.builder-empty {
  min-height: 330px;
  padding: 2rem;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.6rem;
  color: #64748b;
  text-align: center;
}

.builder-empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 12px;
  color: #2563eb;
  background: #dbeafe;
  font-size: 1.8rem;
}

.builder-empty strong {
  color: #172033;
  font-size: 1.05rem;
}

.builder-panel {
  gap: 0.85rem;
  padding: 1rem;
  box-shadow: none;
}

.builder-selected-card {
  min-height: 96px;
  align-content: center;
  padding: 1rem;
  border-color: #dbe3ee;
  background: #f8fafc;
}

.builder-selected-card strong {
  font-size: 1rem;
}

.builder-context-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.builder-context-actions .btn:first-child {
  grid-column: 1 / -1;
}

.builder-context-actions .btn {
  justify-content: center;
}

.builder-context-actions .btn.danger {
  color: #b42318;
  background: #fff;
  border-color: #fecdca;
}

.builder-context-actions .btn:disabled {
  display: none;
}

.builder-tip {
  display: grid;
  gap: 0.35rem;
  padding: 0.8rem;
  border-radius: 8px;
  color: #475569;
  background: #f1f5f9;
  font-size: 0.8rem;
  line-height: 1.45;
}

.builder-tip strong {
  color: #334155;
}

.builder-helper-actions {
  padding-top: 0.15rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 960px) {
  .builder-grid {
    grid-template-columns: 1fr;
  }

  .builder-helper {
    position: static;
  }
}

@media (max-width: 640px) {
  .material-editor-heading,
  .material-editor-heading-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .material-editor-heading-actions,
  .material-editor-heading-actions .btn {
    width: 100%;
  }

  .builder-visual .checklist-section-body {
    padding-left: 0.7rem;
    margin-left: 0.45rem;
  }
}

.user-role-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0;
}

.event-view-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem;
  margin-bottom: 1rem;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  background: #eef2f7;
  border-radius: 10px;
}

.event-view-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 42px;
  padding: 0.55rem 0.8rem;
  white-space: nowrap;
  color: #475569;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.event-view-tab span {
  display: grid;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.35rem;
  place-items: center;
  color: #475569;
  background: #dbe3ee;
  border-radius: 999px;
  font-size: 0.72rem;
}

.event-view-tab.active {
  color: #1d4ed8;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.event-view-tab.active span {
  color: #fff;
  background: #2563eb;
}

.public-lot-calendar-page {
  min-height: 100vh;
  color: #172033;
  background: #eef2f7;
}

.public-lot-calendar-shell {
  width: min(1800px, 100%);
  margin: 0 auto;
  padding: 1.25rem;
}

.public-calendar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem;
  margin-bottom: 0.8rem;
  color: #fff;
  background: linear-gradient(135deg, #0f172a, #1e3a5f 60%, #2563eb);
  border-radius: 12px;
}

.public-calendar-header h1,
.public-calendar-header p {
  margin: 0;
}

.public-calendar-header .eyebrow {
  margin-bottom: 0.4rem;
  color: #bfdbfe;
}

.public-calendar-header > div > p:last-child {
  margin-top: 0.4rem;
  color: #dbeafe;
}

.public-calendar-privacy {
  padding: 0.5rem 0.7rem;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

.public-calendar-navigation {
  margin-bottom: 0.8rem;
}

.public-reservation {
  background: #fef2f2;
  border-left-color: #ef4444;
}

.public-reservation .reservation-source {
  color: #b91c1c;
}

.public-calendar-legend {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.9rem 1rem;
  margin-top: 0.25rem;
  color: #64748b;
  background: #fff;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  .public-lot-calendar-shell {
    padding: 0.65rem;
  }

  .public-calendar-header {
    display: grid;
  }
}

.user-role-form select,
.mobile-user-form select {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.75rem;
  color: #172033;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .user-role-form {
    grid-template-columns: 1fr;
  }
}

.wizard-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.monitor-page {
  display: grid;
  gap: 1.5rem;
}

.monitor-hero {
  padding: 2rem;
}

.monitor-hero-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.monitor-actions {
  align-items: center;
}

.monitor-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.meta-pill {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-dark);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.meta-pill.live {
  background: rgba(34, 197, 94, 0.15);
  color: #166534;
}

.meta-pill.closed {
  background: rgba(15, 23, 42, 0.2);
  color: #0f172a;
}

.meta-pill.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #92400e;
}

.meta-pill.ok {
  background: rgba(34, 197, 94, 0.18);
  color: #166534;
}

.monitor-summary-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.monitor-quick-overview {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.75rem;
}

.monitor-quick-overview .overview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.monitor-quick-grid {
  margin-top: 0;
}

.summary-card {
  background: #f8fafc;
  border-radius: 16px;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  display: grid;
  gap: 0.75rem;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.summary-value {
  font-weight: 700;
  color: var(--secondary);
}

.progress-value {
  color: #ffffff;
  background: #0f172a;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.85rem;
}

.sync-status {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.summary-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.monitor-checklist {
  min-height: 400px;
}

.monitor-tiles {
  margin-bottom: 1rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-chip {
  background: rgba(34, 197, 94, 0.15);
  color: #166534;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.75rem;
}

.monitor-aside {
  display: grid;
  gap: 1.5rem;
}

.quick-panel {
  display: grid;
  gap: 0.75rem;
}

.panel-title {
  font-weight: 700;
}

.final-checklist {
  display: grid;
  gap: 0.75rem;
}

.final-step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 0.75rem;
  align-items: center;
  background: rgba(148, 163, 184, 0.1);
  padding: 0.75rem;
  border-radius: 12px;
}

@media (max-width: 960px) {
  .monitor-grid {
    grid-template-columns: 1fr;
  }
}

/* New layout & modern components */
.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #0f172a;
  color: #f8fafc;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.03em;
}

.sidebar-user {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: 16px;
  background: rgba(148, 163, 184, 0.15);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(99, 102, 241, 0.35);
  color: #fff;
  font-weight: 700;
}

.sidebar-user-info {
  display: grid;
  gap: 0.2rem;
  font-size: 0.85rem;
}

.sidebar-user-info strong {
  font-size: 0.95rem;
}

.sidebar-nav {
  display: grid;
  gap: 0.6rem;
}

.nav-link {
  color: rgba(248, 250, 252, 0.7);
  text-decoration: none;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  font-weight: 600;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  transition: all 0.2s ease;
}

.nav-link.active,
.nav-link:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  font-size: 0.8rem;
  color: rgba(226, 232, 240, 0.6);
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar-main {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.topbar-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.page-title {
  margin: 0;
}

.page-subtitle {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.page-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.hero-card {
  background: linear-gradient(135deg, #0f172a 0%, #111827 40%, #1d4ed8 100%);
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
}

.hero-card .page-subtitle {
  color: rgba(226, 232, 240, 0.7);
}

.stat-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat-card {
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  display: grid;
  gap: 0.6rem;
  color: #0f172a;
}

.stat-card strong {
  font-size: 1.4rem;
  color: #0f172a;
}

.stat-card .stat-label {
  color: #334155;
  font-size: 0.85rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-dark);
}

.pill.ok {
  background: rgba(34, 197, 94, 0.15);
  color: #166534;
}

.pill.problem {
  background: rgba(239, 68, 68, 0.15);
  color: #0f172a;
}

.pill.pending {
  background: rgba(245, 158, 11, 0.18);
  color: #0f172a;
}

.search-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  min-width: 240px;
}

.search-input input {
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
}

.filter-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--secondary);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-chip.active {
  background: var(--primary-soft);
  border-color: var(--border-strong);
  color: var(--primary-dark);
}

.list-card {
  display: grid;
  gap: 0.8rem;
}

.list-card-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.list-card-item h3 {
  margin: 0;
}

.list-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.list-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.empty-state {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(148, 163, 184, 0.6);
  border-radius: var(--radius-md);
  background: rgba(148, 163, 184, 0.08);
}

.section-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.info-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.info-list strong {
  color: var(--secondary);
}

.vigicrues-card {
  border-left: 4px solid #f59e0b;
}

.vigicrues-list {
  display: grid;
  gap: 0.7rem;
}

.vigicrues-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.vigicrues-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  text-decoration: none;
  color: var(--secondary);
  background: #f8fafc;
}

.vigicrues-item.jaune {
  background: #fef9c3;
  border-color: rgba(202, 138, 4, 0.35);
}

.vigicrues-item.orange {
  background: #ffedd5;
  border-color: rgba(234, 88, 12, 0.35);
}

.vigicrues-item.rouge {
  background: #fee2e2;
  border-color: rgba(220, 38, 38, 0.35);
}

.vigicrues-item.unknown {
  background: #f1f5f9;
}

.vigicrues-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
}

.vigicrues-dot.jaune {
  background: #eab308;
  box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.18);
}

.vigicrues-dot.orange {
  background: #f97316;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.18);
}

.vigicrues-dot.rouge {
  background: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18);
}

.vigicrues-dot.unknown {
  background: #64748b;
  box-shadow: 0 0 0 4px rgba(100, 116, 139, 0.16);
}

.vigicrues-level.vert {
  background: rgba(34, 197, 94, 0.15);
  color: #166534;
}

.vigicrues-level.jaune {
  background: rgba(234, 179, 8, 0.24);
  color: #713f12;
}

.vigicrues-level.orange {
  background: rgba(249, 115, 22, 0.22);
  color: #9a3412;
}

.vigicrues-level.rouge {
  background: rgba(220, 38, 38, 0.18);
  color: #991b1b;
}

.vigicrues-level.unknown {
  background: rgba(100, 116, 139, 0.16);
  color: #334155;
}

.vigicrues-updated {
  margin: 0.8rem 0 0;
  font-size: 0.82rem;
}

.timeline {
  display: grid;
  gap: 0.75rem;
}

.timeline-item {
  background: rgba(99, 102, 241, 0.08);
  border-radius: 16px;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(99, 102, 241, 0.12);
  display: grid;
  gap: 0.2rem;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, #e0e7ff, #f8fafc 40%, #ffffff 80%);
  padding: 2rem;
}

.auth-card {
  max-width: 440px;
  width: 100%;
  border-radius: 28px;
  padding: 2rem;
}

.auth-brand {
  font-weight: 800;
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.form .help-text {
  font-size: 0.8rem;
  color: var(--muted);
}

.tag {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(148, 163, 184, 0.2);
  color: #1f2937;
}

.tag.live {
  background: rgba(34, 197, 94, 0.2);
  color: #166534;
}

.tag.closed {
  background: rgba(15, 23, 42, 0.2);
  color: #0f172a;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th,
.table td {
  text-align: left;
  padding: 0.7rem;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--muted);
  font-weight: 600;
}

.highlight {
  background: rgba(99, 102, 241, 0.08);
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }
}

/* Usability pass: field-first layout for rescue equipment checks */
:root {
  --field-blue: #1d4ed8;
  --field-blue-dark: #0f172a;
  --field-green: #16a34a;
  --field-red: #dc2626;
  --field-amber: #d97706;
  --tap-size: 46px;
}

html {
  -webkit-text-size-adjust: 100%;
}

button,
a,
input,
select,
textarea,
summary {
  touch-action: manipulation;
}

.btn,
.toggle-btn,
.filter-chip,
.nav-link {
  min-height: var(--tap-size);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  white-space: nowrap;
}

.form input,
.form textarea,
.form select,
.modal-form textarea,
.modal-form input,
.modal-card input,
.modal-card select {
  min-height: var(--tap-size);
  width: 100%;
  font-size: 1rem;
}

.sidebar {
  background: linear-gradient(180deg, #101827 0%, #0b1220 100%);
  border-right: 1px solid rgba(148, 163, 184, 0.18);
}

.sidebar .muted {
  color: rgba(226, 232, 240, 0.72);
}

.nav-icon {
  width: 1.35rem;
  height: 1.35rem;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  font-weight: 800;
}

.nav-link.active .nav-icon,
.nav-link:hover .nav-icon {
  background: rgba(255, 255, 255, 0.18);
}

.card,
.stat-card,
.list-card-item,
.panel,
.sac-card,
.summary-card,
.builder-canvas,
.builder-panel {
  border-radius: 8px;
}

.hero-card,
.event-hero,
.check-hero {
  background: linear-gradient(135deg, #101827 0%, #123b63 54%, #2563eb 100%);
}

.page-title,
.event-hero h1,
.check-hero h1 {
  line-height: 1.08;
  letter-spacing: 0;
}

.page-actions,
.actions,
.list-card-actions,
.sac-card-actions,
.builder-header-actions {
  align-items: stretch;
}

.page-actions .btn,
.actions .btn,
.list-card-actions .btn,
.list-card-actions form,
.sac-card-actions .btn,
.sac-card-actions form {
  min-width: 0;
}

.search-input {
  min-height: var(--tap-size);
  border-radius: 8px;
}

.filter-chips {
  margin-bottom: 1rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  flex-wrap: nowrap;
  scrollbar-width: thin;
}

.filter-chip {
  flex: 0 0 auto;
  border-radius: 8px;
}

.list-card-item {
  align-items: start;
}

.progress {
  height: 12px;
}

.stat-pill,
.pill,
.meta-pill,
.section-chip,
.tag {
  border-radius: 8px;
}

.pill.problem,
.stat-pill.problem,
.meta-pill.problem,
.section-chip.problem {
  color: #991b1b;
}

.pill.pending,
.stat-pill.pending,
.meta-pill.pending {
  color: #92400e;
}

.event-public {
  border-radius: 8px;
}

.status-square {
  border-radius: 8px;
  min-height: 76px;
}

.tree-node {
  border-radius: 8px;
}

.tree-title {
  align-items: flex-start;
}

.tree-meta {
  min-width: min(240px, 100%);
}

.tree-parent-actions {
  width: 100%;
}

.tree-parent-actions .btn,
.tree-parent-actions form {
  flex: 1 1 140px;
}

.phone {
  background: #08111f;
}

.phone-container {
  max-width: 680px;
  padding: 0.85rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

.phone .card {
  border-radius: 8px;
  margin-bottom: 0.85rem;
}

.public-sticky-status {
  position: static !important;
  top: auto !important;
  z-index: 12;
}

.check-hero {
  padding: 1rem;
}

.check-hero h1 {
  margin: 0;
  font-size: clamp(1.35rem, 7vw, 2rem);
}

.check-eyebrow {
  letter-spacing: 0;
  font-weight: 700;
}

.check-progress-pill {
  min-width: 64px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 1.05rem;
}

.public-meta-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.public-meta-row .sync-pill {
  margin-top: 0;
}

.sync-pill {
  border-radius: 8px;
  min-height: 36px;
}

.check-body {
  padding: 0.75rem;
  background: #0b1220;
}

.checklist-section {
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: #111827;
}

.checklist-section-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0;
}

.checklist-section-header h2 {
  font-size: 1rem;
  line-height: 1.2;
}

.checklist-section[open] .checklist-section-header {
  margin-bottom: 0.75rem;
}

.section-subtitle {
  display: none;
}

.section-status,
.checklist-item-name .status {
  border-radius: 8px;
  letter-spacing: 0;
  white-space: nowrap;
}

.checklist-section.ok,
.checklist-item.ok {
  background: rgba(22, 101, 52, 0.35);
}

.checklist-section.problem,
.checklist-item.problem {
  background: rgba(127, 29, 29, 0.42);
}

.checklist-section.pending,
.checklist-item.pending {
  background: rgba(146, 64, 14, 0.24);
}

.checklist-item {
  border-radius: 8px;
  padding: 0.65rem;
  background: #1f2937;
}

.checklist-item-row {
  align-items: stretch;
}

.checklist-item-info {
  justify-content: center;
}

.checklist-item-name strong {
  font-size: 0.98rem;
  line-height: 1.2;
}

.checklist-actions {
  gap: 0.45rem;
}

.toggle-btn {
  border-radius: 8px;
  min-width: 76px;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
}

.toggle-btn.ok {
  background: #15803d;
  color: #fff;
}

.toggle-btn.problem {
  background: #b91c1c;
  color: #fff;
}

.modal-card {
  border-radius: 8px;
  max-height: calc(100dvh - 2rem);
  overflow: auto;
}

.builder-canvas {
  overflow: hidden;
}

.builder-node-actions .btn {
  flex: 1 1 auto;
}

.restock-panel {
  border-left: 4px solid var(--field-amber);
}

.restock-form {
  margin-bottom: 1rem;
}

.restock-list {
  display: grid;
  gap: 0.75rem;
}

.restock-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.85rem;
  border: 1px solid rgba(217, 119, 6, 0.28);
  border-radius: 8px;
  background: rgba(255, 251, 235, 0.9);
  color: #0f172a;
}

.restock-entry p {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
  line-height: 1.4;
}

.restock-meta {
  display: grid;
  justify-items: end;
  gap: 0.35rem;
  text-align: right;
}

.public-parent-validate {
  display: grid;
  gap: 0.35rem;
  margin: 0.75rem 0;
  padding: 0.65rem;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
}

.public-parent-validate .muted {
  margin: 0;
  color: rgba(226, 232, 240, 0.78);
}

.validate-all-btn {
  width: 100%;
}

.users-layout {
  grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.25fr);
  align-items: start;
}

.user-create-card,
.user-list-card {
  margin-bottom: 0;
}

.user-card {
  grid-template-columns: minmax(0, 0.85fr) minmax(280px, 1fr);
}

.user-card-main {
  min-width: 0;
}

.user-card-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e0f2fe;
  color: #075985;
  font-weight: 800;
  flex: 0 0 auto;
}

.user-password-form {
  flex: 1 1 260px;
  margin-top: 0;
}

.user-password-form input {
  min-height: var(--tap-size);
}

.mobile-users-list {
  display: none;
}

.mobile-user-card {
  display: grid;
  gap: 0.85rem;
  padding: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

.mobile-user-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
}

.mobile-user-title {
  min-width: 0;
}

.mobile-user-title h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.mobile-user-title span {
  color: var(--muted);
  font-size: 0.88rem;
}

.mobile-user-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mobile-user-form {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.mobile-user-form label {
  display: grid;
  gap: 0.45rem;
  font-weight: 600;
}

.mobile-user-form input {
  width: 100%;
  min-width: 0;
  min-height: var(--tap-size);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  font: inherit;
}

@media (max-width: 1024px) {
  .topbar {
    display: none;
  }

  .sidebar {
    position: relative;
    top: auto;
    z-index: 20;
    display: grid;
    gap: 0.75rem;
    padding: 0.75rem;
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  }

  .sidebar > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
  }

  .sidebar-brand {
    font-size: 1rem;
  }

  .sidebar > div:first-child .muted,
  .sidebar-user {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding-bottom: 0.1rem;
    scrollbar-width: thin;
  }

  .nav-link {
    flex: 0 0 auto;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    font-size: 0.82rem;
  }

  .nav-link span:last-child {
    white-space: nowrap;
  }

  .container {
    padding: 1rem;
  }
}

@media (max-width: 760px) {
  body {
    background: #eef2f7;
  }

  .container {
    padding: 0.75rem;
  }

  .card {
    padding: 1rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  }

  .page-header,
  .event-hero-top,
  .monitor-hero-main,
  .builder-canvas-header,
  .lot-card-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    align-items: stretch;
  }

  .page-title {
    font-size: 1.45rem;
  }

  .page-subtitle,
  .muted {
    font-size: 0.88rem;
  }

  .page-actions,
  .actions,
  .event-actions,
  .monitor-actions,
  .builder-header-actions,
  .sac-card-actions,
  .list-card-actions,
  .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .page-actions > *,
  .actions > *,
  .event-actions > *,
  .monitor-actions > *,
  .builder-header-actions > *,
  .sac-card-actions > *,
  .list-card-actions > *,
  .modal-actions > *,
  .list-card-actions form,
  .sac-card-actions form {
    width: 100%;
  }

  .page-actions form .btn,
  .actions form .btn,
  .event-actions form .btn,
  .monitor-actions form .btn,
  .sac-card-actions form .btn,
  .list-card-actions form .btn,
  .modal-actions form .btn {
    width: 100%;
  }

  .restock-entry {
    grid-template-columns: 1fr;
  }

  .restock-meta {
    justify-items: start;
    text-align: left;
  }

  .users-layout,
  .user-card {
    grid-template-columns: 1fr;
  }

  .users-page {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .users-page > .page-header,
  .users-page > .error,
  .users-page > .success {
    padding: 0 0.25rem;
  }

  .user-create-card,
  .user-list-card {
    padding: 1rem;
  }

  .user-list-card .page-header {
    margin-bottom: 1rem;
  }

  .users-desktop-list {
    display: none;
  }

  .mobile-users-list {
    display: grid;
    gap: 0.75rem;
  }

  .user-card-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .user-card-actions form,
  .user-card-actions input,
  .user-card-actions .btn {
    width: 100%;
  }

  .search-input {
    width: 100%;
    min-width: 0;
  }

  .hero-card {
    padding: 1rem;
  }

  .material-workflow {
    grid-template-columns: 1fr;
  }

  .stat-grid,
  .section-grid,
  .monitor-summary-grid,
  .wizard-grid,
  .sacs-grid,
  .kanban-board {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .stat-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.3rem 0.75rem;
  }

  .stat-card .stat-label,
  .stat-card .pill {
    grid-column: 1 / -1;
  }

  .stat-card strong {
    font-size: 1.8rem;
  }

  .list-card-item {
    grid-template-columns: 1fr;
  }

  .list-card-meta,
  .stats {
    gap: 0.4rem;
  }

  .event-public {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .event-public-qr {
    grid-row: span 2;
  }

  .event-public .qr-code {
    width: 84px;
    height: 84px;
  }

  .event-summary,
  .monitor-grid,
  .builder-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .builder-helper {
    position: static;
  }

  .tree-title {
    display: grid;
    grid-template-columns: 1fr;
    padding-right: 2.5rem;
  }

  .tree-node .fold-icon {
    right: 0.9rem;
    top: 0.9rem;
  }

  .tree-meta {
    align-items: stretch;
  }

  .count-row {
    justify-content: flex-start;
  }

  .tree-parent-actions {
    padding: 0 0.75rem 0.75rem;
    display: grid;
    grid-template-columns: 1fr;
  }

  .tree-children {
    margin: 0 0.75rem 0.75rem;
  }

  .inline-form {
    width: 100%;
  }

  .inline-form input {
    min-width: 0;
    width: 100%;
  }

  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .auth-shell {
    padding: 1rem;
    align-items: start;
  }

  .auth-card {
    margin-top: 1rem;
    padding: 1.25rem;
  }
}

@media (max-width: 520px) {
  .phone-container {
    padding: 0.5rem;
  }

  .check-hero {
    padding: 0.85rem;
  }

  .check-hero-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .check-subtitle {
    font-size: 0.82rem;
  }

  .stat-chip {
    flex: 1 1 30%;
    justify-content: center;
    text-align: center;
  }

  .checklist-section-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .checklist-section-header::after {
    grid-column: 2;
    grid-row: 1;
  }

  .section-status {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .checklist-item-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .checklist-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toggle-btn {
    min-width: 0;
    width: 100%;
  }

  .public-meta-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .modal {
    align-items: end;
  }

  .modal-card {
    width: 100%;
    border-radius: 8px 8px 0 0;
  }
}

/* Weekly lot availability */
.event-schedule-fields,
.reservation-form {
  display: grid;
  gap: 1rem;
}

.event-schedule-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.event-schedule-fields label,
.reservation-form label {
  display: grid;
  gap: 0.45rem;
  font-weight: 600;
}

.event-schedule-fields input,
.reservation-form input,
.reservation-form select {
  width: 100%;
  min-height: 46px;
  padding: 0.7rem 0.8rem;
  color: #172033;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
}

.availability-notice {
  padding: 0.8rem 0.9rem;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left-width: 4px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
}

.availability-notice.pending,
.availability-notice.loading {
  border-left-color: #f59e0b;
}

.availability-notice.available {
  color: #166534;
  background: #f0fdf4;
  border-color: #86efac;
}

.availability-notice.warning {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fca5a5;
}

.availability-notice.error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #ef4444;
}

#lot-select:disabled,
#template-select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

#lot-select option.unavailable-option,
#template-select option.unavailable-option {
  color: #b91c1c;
  background: #fef2f2;
  font-weight: 700;
}

#template-select {
  min-height: 360px;
  padding: 0.35rem;
}

#template-select option {
  min-height: 30px;
  padding: 0.4rem 0.55rem;
}

#template-select optgroup {
  margin: 0.35rem 0;
  color: #1d4ed8;
  font-weight: 800;
}

#template-select optgroup option {
  color: #172033;
  font-weight: 500;
}

#template-select optgroup option.unavailable-option {
  color: #b91c1c;
  font-weight: 700;
}

.root-quantity-panel {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  color: #172033;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
}

.root-quantity-panel > div:first-child {
  display: grid;
  gap: 0.2rem;
}

.root-quantity-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.6rem;
}

.root-quantity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem;
  background: #fff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
}

.root-quantity-row > span {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.root-quantity-row small {
  color: #64748b;
}

.root-quantity-row input {
  width: 84px;
  min-height: 42px;
  padding: 0.5rem;
  color: #172033;
  background: #fff;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 640px) {
  #template-select {
    min-height: 280px;
  }
}

.inline-link {
  width: fit-content;
  color: #1d4ed8;
  font-size: 0.85rem;
  font-weight: 700;
}

.calendar-hero {
  color: #fff;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 58%, #2563eb 100%);
}

.calendar-hero .page-subtitle,
.calendar-hero .eyebrow {
  color: #dbeafe;
}

.calendar-navigation {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.reservation-form {
  grid-template-columns: minmax(150px, 0.8fr) minmax(180px, 1.2fr) repeat(2, minmax(190px, 1fr)) auto;
  align-items: end;
}

.reservation-form .btn {
  min-height: 46px;
}

.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(210px, 1fr));
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.calendar-day {
  min-height: 430px;
  overflow: hidden;
  scroll-snap-align: start;
  background: #fff;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.calendar-day.is-today {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.calendar-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem;
  color: #334155;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.calendar-day.is-today .calendar-day-header {
  color: #1d4ed8;
  background: #eff6ff;
}

.calendar-lot-status {
  display: flex;
  gap: 0.35rem;
  padding: 0.7rem;
  flex-wrap: wrap;
  border-bottom: 1px solid #e2e8f0;
}

.lot-availability {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  color: #166534;
  background: #f0fdf4;
  font-size: 0.72rem;
  font-weight: 700;
}

.lot-availability i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
}

.lot-availability.reserved {
  color: #991b1b;
  background: #fef2f2;
}

.lot-availability.reserved i {
  background: #ef4444;
}

.calendar-reservations {
  display: grid;
  gap: 0.55rem;
  padding: 0.7rem;
}

.calendar-reservation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  padding: 0.7rem;
  color: #172033;
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  border-radius: 7px;
}

.calendar-reservation.manual {
  background: #fff7ed;
  border-left-color: #f97316;
}

.calendar-reservation > div {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.calendar-reservation strong,
.calendar-reservation span,
.calendar-reservation time {
  overflow-wrap: anywhere;
}

.reservation-items {
  color: #334155;
  font-size: 0.75rem;
  font-weight: 700;
}

.calendar-reservation time {
  color: #475569;
  font-size: 0.72rem;
}

.reservation-source {
  color: #1d4ed8;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.manual .reservation-source {
  color: #c2410c;
}

.calendar-reservation-link,
.calendar-delete {
  align-self: start;
  color: #1d4ed8;
  background: transparent;
  border: 0;
  font-weight: 800;
  text-decoration: none;
}

.calendar-delete {
  color: #b42318;
  cursor: pointer;
  font-size: 1.2rem;
}

.calendar-day-empty {
  margin: 0;
  padding: 1rem 0.4rem;
  color: #64748b;
  text-align: center;
  font-size: 0.82rem;
}

@media (max-width: 1100px) {
  .reservation-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .event-schedule-fields,
  .reservation-form {
    grid-template-columns: 1fr;
  }

  .calendar-navigation {
    display: grid;
  }

  .calendar-week {
    grid-template-columns: repeat(7, minmax(85vw, 1fr));
  }
}

/* Keep the model editor light even though its tree reuses checklist primitives. */
#material-editor .builder-canvas {
  overflow: visible;
  color: #172033 !important;
  background: #f8fafc !important;
}

#material-editor .builder-root,
#material-editor .builder-visual,
#material-editor .checklist-section-body {
  color: #172033 !important;
  background: transparent !important;
}

#material-editor .builder-section {
  padding: 0;
  margin: 0;
  color: #172033 !important;
  background: transparent !important;
}

#material-editor .builder-section[open] > .builder-section-header {
  margin-bottom: 0;
}

#material-editor .builder-section > .builder-section-header {
  color: #172033 !important;
  background: #fff !important;
  border-color: #dbe3ee !important;
}

#material-editor .builder-section.active > .builder-section-header {
  background: #eff6ff !important;
  border-color: #2563eb !important;
}

#material-editor .builder-section .section-subtitle {
  display: block;
  color: #64748b !important;
}

#material-editor .builder-item {
  padding: 0;
  color: #172033 !important;
  background: #fff !important;
  border-color: #dbe3ee !important;
}

#material-editor .builder-item.active {
  background: #eff6ff !important;
  border-color: #2563eb !important;
}

#material-editor .checklist-item-info {
  justify-content: center;
}

#material-editor .checklist-item-name,
#material-editor .checklist-item-name strong {
  color: #172033 !important;
}

#material-editor .builder-item-qty {
  color: #1d4ed8 !important;
  background: #dbeafe !important;
}

#node-modal {
  color: #172033;
}

#node-modal .modal-card {
  width: min(calc(100vw - 2rem), 520px);
  max-width: 520px;
  overflow-x: hidden;
}

#node-modal h3 {
  margin: 0 0 0.25rem;
}

#node-modal-edit,
#node-modal-add {
  min-width: 0;
}

#node-modal-edit:not(.hidden),
#node-modal-add:not(.hidden) {
  display: grid;
  gap: 0.8rem;
}

#node-modal label {
  display: grid;
  min-width: 0;
  gap: 0.35rem;
  color: #334155;
  font-weight: 600;
}

#node-modal input,
#node-modal select {
  display: block;
  min-width: 0;
  max-width: 100%;
  padding: 0.7rem 0.75rem;
  color: #172033;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}

#node-modal .modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: 0.55rem;
  padding-top: 0.35rem;
}

#node-modal .modal-actions .btn {
  width: 100%;
  min-width: 0;
}

@media (max-width: 520px) {
  #material-editor .builder-section > .builder-section-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #material-editor .builder-item .checklist-item-row {
    display: flex;
  }

  #node-modal {
    padding: 0.75rem;
    align-items: center;
  }

  #node-modal .modal-card {
    width: 100%;
    max-height: calc(100dvh - 1.5rem);
    border-radius: 10px;
  }
}
/* Availability of catalogue bags. */
.service-badge { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; }
.service-down { color: #b91c1c; }
.service-up { color: #15803d; }
.service-dot { width: .7rem; height: .7rem; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.material-status-title { display: flex; align-items: center; gap: .5rem; }
.material-status-dot { display: inline-block; width: .6rem; height: .6rem; }
.bag-group-panel { margin: 1rem 0; padding: 1rem; border: 1px solid #cbd5e1; border-radius: .75rem; }
.bag-group-panel > summary { cursor: pointer; font-weight: 700; }
.bag-group-panel .form { margin-top: 1rem; }
.bag-group-members { display: grid; gap: .6rem; max-height: 18rem; overflow-y: auto; border: 1px solid #cbd5e1; border-radius: .5rem; padding: 1rem; }
.form .bag-group-members label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .75rem;
  min-height: var(--tap-size);
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.form .bag-group-members input[type="checkbox"] {
  flex: 0 0 1.25rem;
  width: 1.25rem;
  height: 1.25rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}
.bag-group-members label:has(input:checked) { background: #eff6ff; border-color: var(--primary); }
.bag-group-members label:has(input:disabled) { opacity: .55; cursor: default; }
.bag-group-notice { background: #eff6ff; color: #1e40af; padding: .85rem; border-radius: .5rem; }
.bag-group-notice[hidden] { display: none; }
.bag-group-remove { margin-top: 1rem; }
.bag-group-badge { margin-bottom: .6rem; text-decoration: none; }
.service-note { white-space: pre-wrap; overflow-wrap: anywhere; margin: .5rem 0; }
.service-form { display: grid; gap: .6rem; margin-top: 1rem; }
.service-summary { padding: .8rem 0; border-bottom: 1px solid #e5e7eb; }
