/* ==========================================================================
   App design system
   Layered on Bootstrap 4.6 (grid, utilities, modal JS). All colours derive
   from the tokens below; --brand and --accent are set per tenant from the
   branding settings (see brand_style_tag()).
   ========================================================================== */

:root {
  --brand: #1849A9;
  --accent: #0E9384;
  --brand-soft: color-mix(in srgb, var(--brand) 9%, #fff);
  --brand-strong: color-mix(in srgb, var(--brand) 82%, #000);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, #fff);

  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --border: #E4E7EC;
  --border-strong: #D0D5DD;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --faint: #687284; /* ≥ 4.5:1 on white (WCAG AA) */

  --success: #067647; --success-bg: #ECFDF3; --success-bd: #ABEFC6;
  --warning: #B54708; --warning-bg: #FFFAEB; --warning-bd: #FEDF89;
  --danger:  #B42318; --danger-bg:  #FEF3F2; --danger-bd:  #FECDCA;
  --info:    #175CD3; --info-bg:    #EFF8FF; --info-bd:    #B2DDFF;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 20px -6px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .18);
  --ring: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 256px;
  --topbar-h: 60px;
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 650; letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.2rem; } h4 { font-size: 1.05rem; }
a { color: var(--brand); }
a:hover { color: var(--brand-strong); }
small, .small { font-size: 85%; }
.text-muted { color: var(--muted) !important; }
.text-brand { color: var(--brand) !important; }
.fw-600 { font-weight: 600; }
.mono { font-family: var(--font-mono); font-size: .92em; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
.sr-only-focusable:focus { position: static; width: auto; height: auto; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--surface); padding: .5rem 1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
.skip-link:focus { left: 8px; }
hr { border-top-color: var(--border); }

/* ---------- Buttons ---------- */
.btn {
  font-weight: 600; font-size: .925rem; border-radius: var(--radius-sm);
  padding: .55rem 1rem; line-height: 1.25; border-width: 1px;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:focus, .btn.focus { box-shadow: var(--ring); }
.btn-sm { padding: .38rem .7rem; font-size: .84rem; }
.btn-lg { padding: .8rem 1.35rem; font-size: 1rem; border-radius: var(--radius); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover, .btn-primary:not(:disabled):active { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.btn-primary:disabled { background: var(--brand); border-color: var(--brand); opacity: .55; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(.93); color: #fff; }
.btn-secondary, .btn-light, .btn-default, .btn-outline {
  background: var(--surface); border-color: var(--border-strong); color: var(--text-2); box-shadow: var(--shadow-xs);
}
.btn-secondary:hover, .btn-light:hover, .btn-default:hover, .btn-outline:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); color: #fff; }
.btn-outline-danger { background: var(--surface); border-color: var(--danger-bd); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bd); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.92); color: #fff; }
.btn-icon { padding: .45rem; width: 36px; height: 36px; }
.btn-block { display: flex; width: 100%; }

/* ---------- Forms ---------- */
label, .form-label { font-weight: 600; font-size: .875rem; color: var(--text-2); margin-bottom: .35rem; }
.form-group { margin-bottom: 1.1rem; }
.form-control, .custom-select {
  height: auto; min-height: 42px; padding: .55rem .8rem; font-size: .95rem;
  color: var(--text); background-color: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s;
}
.form-control-sm { min-height: 36px; padding: .4rem .65rem; font-size: .875rem; }
.form-control:focus, .custom-select:focus { border-color: var(--brand); box-shadow: var(--ring); }
.form-control::placeholder { color: var(--faint); }
.form-control.is-invalid, .was-validated .form-control:invalid { border-color: var(--danger); background-image: none; padding-right: .8rem; }
.form-control.is-invalid:focus { box-shadow: 0 0 0 4px rgba(180, 35, 24, .12); }
.invalid-feedback { color: var(--danger); font-size: .82rem; }
.form-text, .help { color: var(--muted); font-size: .82rem; margin-top: .3rem; }
textarea.form-control { min-height: 96px; }
.required::after { content: " *"; color: var(--danger); }
input[type="color"].form-control { padding: 3px; width: 48px; height: 42px; cursor: pointer; }
.form-control-file { font-size: .85rem; color: var(--muted); }
.input-group-text { background: var(--surface-2); border-color: var(--border-strong); color: var(--muted); }
.custom-control-label { font-weight: 500; }
.custom-control-input:checked ~ .custom-control-label::before { background-color: var(--brand); border-color: var(--brand); }
.form-section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 1.5rem 0 .75rem; }

/* Choice chips (segmented radio/checkbox) */
.choice-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice { position: relative; margin: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; user-select: none;
  padding: .5rem .85rem; border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--text-2); font-weight: 500; font-size: .9rem;
}
.choice input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
.choice input:focus-visible + span { box-shadow: var(--ring); }

/* ---------- Cards / panels ---------- */
.card {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.card-header {
  background: transparent; border-bottom: 1px solid var(--border); padding: 1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card-title { font-size: 1rem; font-weight: 650; margin: 0; }
.card-subtitle { color: var(--muted); font-size: .85rem; margin: .15rem 0 0; }
.card-body { padding: 1.25rem; }
.card-footer { background: var(--surface-2); border-top: 1px solid var(--border); padding: .9rem 1.25rem; }
.card-footer:last-child { border-radius: 0 0 var(--radius) var(--radius); }

/* Detail list */
.dl-grid { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: .6rem 1rem; margin: 0; }
.dl-grid dt { color: var(--muted); font-weight: 500; font-size: .88rem; }
.dl-grid dd { margin: 0; color: var(--text); word-break: break-word; }
@media (max-width: 575px) { .dl-grid { grid-template-columns: 1fr; gap: .15rem; } .dl-grid dd { margin-bottom: .6rem; } }

/* ---------- Pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  padding: .18rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill-info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info); }
.pill-success { background: var(--success-bg); border-color: var(--success-bd); color: var(--success); }
.pill-warning { background: var(--warning-bg); border-color: var(--warning-bd); color: var(--warning); }
.pill-danger { background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger); }
.pill-brand { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, #fff); color: var(--brand-strong); }
.badge { font-weight: 600; border-radius: 999px; padding: .3em .6em; }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius-sm); border: 1px solid; font-size: .92rem; padding: .8rem 1rem; }
.alert-info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info); }
.alert-success { background: var(--success-bg); border-color: var(--success-bd); color: var(--success); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-bd); color: var(--warning); }
.alert-danger { background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger); }
.alert a { color: inherit; text-decoration: underline; font-weight: 600; }

/* ---------- Tables ---------- */
.table { color: var(--text); margin-bottom: 0; }
.table thead th {
  border-top: 0; border-bottom: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: .7rem 1rem; white-space: nowrap;
}
.table td { border-top: 1px solid var(--border); padding: .8rem 1rem; vertical-align: middle; font-size: .92rem; }
.table-hover tbody tr:hover { background: var(--surface-2); }
.table-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.table-responsive { border-radius: var(--radius); }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--muted); font-size: .82rem; }
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; }

/* DataTables integration */
.dataTables_wrapper { padding: 0; }
.dataTables_wrapper .dt-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.dataTables_wrapper .dt-footer { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; padding: .85rem 1.25rem; border-top: 1px solid var(--border); }
.dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_length { margin: 0; }
.dataTables_wrapper .dataTables_filter label, .dataTables_wrapper .dataTables_length label { margin: 0; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: .5rem; }
.dataTables_wrapper .dataTables_filter input { margin: 0 !important; min-width: 240px; min-height: 38px; }
.dataTables_wrapper .dataTables_length select { min-height: 36px; }
.dataTables_wrapper .dataTables_info { color: var(--muted); font-size: .85rem; padding: 0 !important; }
.dataTables_wrapper .pagination { margin: 0 !important; }
.page-link { color: var(--text-2); border-color: var(--border); padding: .4rem .75rem; font-size: .85rem; }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.page-item:first-child .page-link { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.page-item:last-child .page-link { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
table.dataTable { margin: 0 !important; border-collapse: collapse !important; }
table.dataTable thead .sorting::before, table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::before, table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::before, table.dataTable thead .sorting_desc::after { bottom: .7em; }
td.dataTables_empty { padding: 2.5rem 1rem !important; color: var(--muted); }
@media (max-width: 575px) { .dataTables_wrapper .dataTables_filter input { min-width: 0; width: 100%; } .dataTables_wrapper .dataTables_filter { width: 100%; } .dataTables_wrapper .dataTables_filter label { width: 100%; } }

/* Filter tabs */
.filter-tabs { display: flex; gap: .25rem; flex-wrap: wrap; padding: .25rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.filter-tabs a { padding: .4rem .8rem; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 600; font-size: .86rem; text-decoration: none; display: inline-flex; gap: .4rem; align-items: center; }
.filter-tabs a:hover { background: var(--surface); color: var(--text); }
.filter-tabs a.active { background: var(--surface); color: var(--brand-strong); box-shadow: var(--shadow-sm); }
.filter-tabs .count { font-size: .72rem; background: var(--border); color: var(--text-2); border-radius: 999px; padding: 0 .45rem; }
.filter-tabs a.active .count { background: var(--brand-soft); color: var(--brand-strong); }

/* ---------- Empty / loading states ---------- */
.empty-state { text-align: center; padding: 2.75rem 1.5rem; color: var(--muted); }
.empty-state-icon { width: 48px; height: 48px; margin: 0 auto 1rem; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 1.2rem; }
.empty-state h3 { font-size: 1rem; margin-bottom: .35rem; }
.empty-state p { margin: 0 auto 1rem; max-width: 36ch; font-size: .9rem; }

.app-loader { position: fixed; inset: 0; z-index: 3000; background: rgba(255, 255, 255, .55); display: grid; place-items: center; backdrop-filter: blur(1px); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } * { scroll-behavior: auto !important; } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; border-radius: var(--radius-sm); min-height: 1rem; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; top: 1rem; right: 1rem; z-index: 3100; display: flex; flex-direction: column; gap: .5rem; max-width: min(380px, calc(100vw - 2rem)); }
.app-toast { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: .9rem; color: var(--text); }
.app-toast i { margin-top: .15rem; }
.app-toast.success i { color: var(--success); }
.app-toast.error i, .app-toast.danger i { color: var(--danger); }
.app-toast.warning i { color: var(--warning); }
.app-toast.info i { color: var(--info); }
.app-toast .close-toast { margin-left: auto; background: none; border: 0; color: var(--faint); padding: 0 0 0 .5rem; line-height: 1; font-size: 1.1rem; }

/* ---------- Modals ---------- */
.modal-content { border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); padding: 1rem 1.25rem; align-items: center; }
.modal-title { font-size: 1.05rem; font-weight: 650; }
.modal-body { padding: 1.25rem; }
.modal-footer { border-top: 1px solid var(--border); padding: .85rem 1.25rem; gap: .5rem; }
.modal-footer > * { margin: 0; }
.modal-backdrop.show { opacity: .4; }
.modal .close { font-weight: 400; font-size: 1.5rem; color: var(--muted); opacity: 1; }

/* ==========================================================================
   Public site
   ========================================================================== */
.site-header { position: sticky; top: 0; z-index: 1020; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; align-items: center; gap: 1rem; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; font-size: 1.05rem; text-decoration: none !important; }
.brand:hover { color: var(--text); }
.brand img { height: 36px; width: auto; max-width: 160px; object-fit: contain; }
.site-nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.site-nav a { color: var(--text-2); font-weight: 550; font-size: .93rem; padding: .5rem .75rem; border-radius: var(--radius-sm); text-decoration: none; }
.site-nav a:hover { background: var(--surface-2); color: var(--text); }
.site-nav a.active { color: var(--brand-strong); background: var(--brand-soft); }
.site-nav .btn { margin-left: .5rem; padding: .5rem 1rem; color: #fff; }
.site-nav .btn:hover { color: #fff; }
.nav-toggle { display: none; margin-left: auto; }
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .site-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: .5rem 1rem 1rem; box-shadow: var(--shadow-md); }
  .site-nav.open { display: flex; }
  .site-nav a { padding: .75rem .5rem; }
  .site-nav .btn { margin: .5rem 0 0; }
}

.hero { position: relative; background: var(--surface); border-bottom: 1px solid var(--border); overflow: hidden; }
.hero-inner { padding: 4.5rem 0 4rem; position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -0.025em; max-width: 18ch; margin-bottom: 1rem; }
.hero p.lead { font-size: 1.15rem; color: var(--text-2); max-width: 52ch; margin-bottom: 1.75rem; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: .5rem; font-size: .82rem; font-weight: 600; color: var(--brand-strong); background: var(--brand-soft); border-radius: 999px; padding: .3rem .8rem; margin-bottom: 1.25rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.hero-media { position: relative; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-lg); aspect-ratio: 4 / 3; background: var(--surface-2); }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-media .carousel, .hero-media .carousel-inner, .hero-media .carousel-item { height: 100%; }
.trust-row { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: 2rem; color: var(--muted); font-size: .9rem; }
.trust-row span { display: inline-flex; align-items: center; gap: .45rem; }
.trust-row i { color: var(--accent); }

.section { padding: 4rem 0; }
.section-sm { padding: 2.5rem 0; }
.section-head { max-width: 640px; margin-bottom: 2rem; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head .eyebrow { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: .5rem; }
.section-head p { color: var(--text-2); }
.page-hero { background: var(--surface); border-bottom: 1px solid var(--border); padding: 2.75rem 0 2.25rem; }
.page-hero h1 { margin-bottom: .35rem; }
.page-hero p { color: var(--text-2); margin: 0; max-width: 60ch; }
.breadcrumbs { font-size: .85rem; color: var(--muted); margin-bottom: .75rem; }
.breadcrumbs a { color: var(--muted); }

.service-card { display: flex; flex-direction: column; height: 100%; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; color: inherit; text-decoration: none !important; transition: box-shadow .15s, transform .15s, border-color .15s; }
.service-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); color: inherit; }
.service-card .media { aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.service-card .media img { width: 100%; height: 100%; object-fit: cover; }
.service-card .body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; flex: 1; }
.service-card h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.service-card p { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; flex: 1; }
.service-card .more { font-weight: 600; font-size: .88rem; color: var(--brand); }

.feature { display: flex; gap: 1rem; }
.feature-icon { flex: none; width: 44px; height: 44px; border-radius: var(--radius); background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.feature h3 { font-size: 1rem; margin-bottom: .25rem; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }

.cta-band { background: var(--brand); color: #fff; border-radius: var(--radius-lg); padding: 2.5rem; display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; justify-content: space-between; }
.cta-band h2 { color: #fff; margin: 0 0 .35rem; }
.cta-band p { margin: 0; opacity: .85; }
.cta-band .btn { background: #fff; color: var(--brand-strong); border-color: #fff; }

.prose { color: var(--text-2); font-size: 1rem; line-height: 1.7; }
.prose h1, .prose h2, .prose h3 { margin-top: 1.5rem; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); }

.site-footer { background: #0B1220; color: #CBD2E0; padding: 3rem 0 1.5rem; margin-top: 4rem; font-size: .9rem; }
.site-footer h4 { color: #fff; font-size: .9rem; margin-bottom: .9rem; }
.site-footer a { color: #CBD2E0; }
.site-footer a:hover { color: #fff; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .45rem; }
.site-footer .legal { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 2rem; padding-top: 1.25rem; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; color: #8A94A7; font-size: .82rem; }
.site-footer .brand { color: #fff; }

/* ==========================================================================
   Back office shell
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: transform .2s ease;
}
.app-sidebar .sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; padding: 0 1.1rem; border-bottom: 1px solid var(--border); }
.app-sidebar .sidebar-brand .brand { font-size: .98rem; }
.app-sidebar .sidebar-brand img { height: 30px; }
.sidebar-nav { padding: .9rem .7rem; overflow-y: auto; flex: 1; }
.sidebar-section { font-size: .7rem; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; padding: .9rem .6rem .4rem; }
.sidebar-link { display: flex; align-items: center; gap: .7rem; padding: .55rem .65rem; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 550; font-size: .9rem; text-decoration: none !important; margin-bottom: 2px; }
.sidebar-link i { width: 18px; text-align: center; color: var(--faint); font-size: .95rem; }
.sidebar-link:hover { background: var(--surface-2); color: var(--text); }
.sidebar-link:hover i { color: var(--text-2); }
.sidebar-link.active { background: var(--brand-soft); color: var(--brand-strong); }
.sidebar-link.active i { color: var(--brand); }
.sidebar-link .count { margin-left: auto; font-size: .72rem; font-weight: 700; padding: .05rem .5rem; border-radius: 999px; background: var(--brand); color: #fff; }
.sidebar-footer { padding: .9rem; border-top: 1px solid var(--border); font-size: .78rem; color: var(--faint); }

.app-main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.app-topbar { position: sticky; top: 0; z-index: 1030; height: var(--topbar-h); background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; }
.app-topbar .sidebar-toggle { display: none; }
.app-topbar .topbar-title { font-weight: 600; color: var(--text-2); font-size: .92rem; }
.app-topbar .topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.user-menu { display: inline-flex; align-items: center; gap: .6rem; padding: .3rem .5rem .3rem .3rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: .88rem; }
.user-menu:hover { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--brand-soft); color: var(--brand-strong); display: inline-grid; place-items: center; font-size: .75rem; font-weight: 700; flex: none; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; }
.dropdown-menu { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .4rem; font-size: .9rem; }
.dropdown-item { border-radius: var(--radius-sm); padding: .5rem .7rem; color: var(--text-2); display: flex; gap: .6rem; align-items: center; }
.dropdown-item i { width: 16px; color: var(--faint); }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-header { font-size: .78rem; color: var(--muted); padding: .5rem .7rem; }

.app-content { padding: 1.75rem 1.5rem 3rem; max-width: 1360px; width: 100%; margin: 0 auto; flex: 1; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; margin: 0; }
.page-header p { margin: .25rem 0 0; color: var(--muted); font-size: .92rem; }
.page-header p a { text-decoration: underline; }
.page-header .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); margin-bottom: .5rem; font-weight: 500; }
.app-footer { padding: 1rem 1.5rem; color: var(--faint); font-size: .8rem; border-top: 1px solid var(--border); background: var(--surface); }
.sidebar-scrim { display: none; }

@media (max-width: 991px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.sidebar-open .app-sidebar { transform: none; }
  body.sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(16, 24, 40, .35); z-index: 1035; }
  .app-main { margin-left: 0; }
  .app-topbar { padding: 0 1rem; }
  .app-topbar .sidebar-toggle { display: inline-flex; }
  .app-content { padding: 1.25rem 1rem 2.5rem; }
}

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-xs); text-decoration: none !important; color: inherit; display: block; }
a.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); color: inherit; }
.stat .label { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .84rem; font-weight: 550; }
.stat .label i { color: var(--brand); }
.stat .value { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; margin-top: .35rem; line-height: 1.1; }
.stat .hint { color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.stat.attention { border-color: var(--warning-bd); background: linear-gradient(0deg, var(--warning-bg), var(--surface) 70%); }

.list-clean { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: .85rem; padding: .8rem 1.25rem; border-top: 1px solid var(--border); color: inherit; text-decoration: none !important; }
.list-row:first-child { border-top: 0; }
a.list-row:hover { background: var(--surface-2); color: inherit; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .meta { color: var(--muted); font-size: .82rem; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 1rem 1.5rem; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: .5rem; bottom: -.25rem; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: .35rem; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline .when { font-size: .8rem; color: var(--muted); }

/* Auth screens */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 3rem clamp(1.5rem, 6vw, 5rem); background: var(--surface); }
.auth-panel .auth-card { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-art { background-size: cover; background-position: center; position: relative; }
.auth-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 70%, transparent), rgba(11, 18, 32, .7)); }
.auth-art .art-copy { position: absolute; left: 3rem; right: 3rem; bottom: 3rem; color: #fff; z-index: 1; }
.auth-art .art-copy h2 { color: #fff; font-size: 1.6rem; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* Image upload preview */
.image-picker { display: flex; align-items: center; gap: 1rem; }
.image-picker .preview { width: 96px; height: 96px; border-radius: var(--radius); border: 1px dashed var(--border-strong); background: var(--surface-2) center / contain no-repeat; flex: none; }
.image-picker .preview.wide { width: 180px; height: 96px; background-size: cover; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.thumb { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); aspect-ratio: 16 / 9; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .btn { position: absolute; top: .4rem; right: .4rem; }

/* Summernote polish */
.note-editor.note-frame { border-color: var(--border-strong) !important; border-radius: var(--radius-sm); }
.note-editor .note-toolbar { background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }

/* Select2 polish */
.select2-container--bootstrap4 .select2-selection { border-color: var(--border-strong); border-radius: var(--radius-sm); min-height: 42px; }
.select2-container--bootstrap4.select2-container--focus .select2-selection { border-color: var(--brand); box-shadow: var(--ring); }
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 25%, #fff); color: var(--brand-strong); border-radius: 999px; }

/* Utilities */
.gap-2 { gap: .5rem; } .gap-3 { gap: 1rem; }
.stack > * + * { margin-top: 1rem; }
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }
.kbd { font-family: var(--font-mono); font-size: .8rem; padding: .1rem .35rem; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); }
.text-success { color: var(--success) !important; } .text-danger { color: var(--danger) !important; } .text-warning { color: var(--warning) !important; }
.bg-surface { background: var(--surface); }
.w-fit { width: fit-content; }
.truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media print {
  .app-sidebar, .app-topbar, .app-footer, .no-print, .site-header, .site-footer { display: none !important; }
  .app-main { margin: 0 !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* ==========================================================================
   Quotation wizard
   ========================================================================== */
.wizard { padding-top: 2rem; padding-bottom: 4rem; }
.wizard-steps { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1.75rem; counter-reset: step; overflow-x: auto; }
.wizard-steps li { flex: 1; min-width: 120px; }
.wizard-steps button {
  width: 100%; display: flex; align-items: center; gap: .6rem; text-align: left; background: none; border: 0; padding: .5rem 0;
  color: var(--muted); font-weight: 600; font-size: .86rem; border-top: 3px solid var(--border); border-radius: 0; cursor: default;
}
.wizard-steps .num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; background: var(--surface); border: 1.5px solid var(--border-strong); color: var(--muted); }
.wizard-steps li.done button { color: var(--text-2); border-top-color: var(--brand); cursor: pointer; }
.wizard-steps li.done .num { background: var(--brand); border-color: var(--brand); color: #fff; }
.wizard-steps li.current button { color: var(--brand-strong); border-top-color: var(--brand); }
.wizard-steps li.current .num { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
@media (max-width: 767px) { .wizard-steps .label { display: none; } .wizard-steps li { min-width: 0; } .wizard-steps button { justify-content: center; } }

.wizard-panel { display: none; }
.wizard-panel.active { display: block; }
.wizard-panel > .card > .card-body { padding: 1.75rem; }
.wizard-panel h2 { font-size: 1.35rem; margin-bottom: .25rem; }
.wizard-panel .lead-sm { color: var(--muted); margin-bottom: 1.5rem; }
.wizard-nav { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1.25rem; }
.wizard-nav .btn { min-width: 140px; }
@media (max-width: 575px) { .wizard-panel > .card > .card-body { padding: 1.25rem; } .wizard-nav .btn { min-width: 0; flex: 1; } }

.address-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.1rem .25rem; background: var(--surface-2); height: 100%; }
.address-block h3 { font-size: .95rem; display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.address-block h3 .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.address-block.delivery h3 .dot { background: var(--accent); }

.yn { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; padding: .75rem 0; border-top: 1px solid var(--border); }
.yn:first-child { border-top: 0; }
.yn > span { font-weight: 500; color: var(--text-2); }

.room-group-title { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 1.5rem 0 .75rem; }
.room-group-title:first-child { margin-top: 0; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; }
.room-card {
  border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 1rem;
  display: flex; flex-direction: column; gap: .75rem; transition: border-color .15s, box-shadow .15s, background .15s;
}
.room-card.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: var(--shadow-sm); }
.room-card .room-head { display: flex; align-items: center; gap: .7rem; }
.room-card .room-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--brand); display: grid; place-items: center; font-size: 1.05rem; flex: none; }
.room-card.selected .room-icon { background: var(--surface); }
.room-card .room-name { font-weight: 650; font-size: .95rem; line-height: 1.2; }
.room-card .room-sub { font-size: .78rem; color: var(--muted); }
.room-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .8rem; color: var(--muted); font-weight: 600; }
.room-sizes { display: flex; flex-direction: column; gap: .35rem; }
.room-size-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .82rem; color: var(--text-2); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: .2rem .7rem; font-size: .78rem; font-weight: 600; color: var(--text-2); }
.seg button.on { background: var(--brand); color: #fff; }
.seg button:focus-visible { box-shadow: inset var(--ring); }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); height: 36px; }
.qty button { width: 36px; height: 34px; border: 0; background: none; color: var(--text-2); font-size: 1rem; border-radius: 999px; display: grid; place-items: center; }
.qty button:hover:not(:disabled) { background: var(--surface-2); color: var(--brand); }
.qty button:disabled { opacity: .35; }
.qty output, .qty input { width: 34px; text-align: center; font-weight: 700; font-size: .92rem; border: 0; background: none; padding: 0; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.inv-room { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; background: var(--surface); }
.inv-room > header { display: flex; align-items: center; gap: .75rem; padding: .85rem 1.1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); cursor: pointer; }
.inv-room > header h3 { font-size: .98rem; margin: 0; flex: 1; }
.inv-room > header .count { font-size: .8rem; color: var(--muted); }
.inv-room > header .chev { color: var(--faint); transition: transform .15s; }
.inv-room.collapsed > header .chev { transform: rotate(-90deg); }
.inv-room.collapsed > .inv-body { display: none; }
.inv-body { padding: .25rem 1.1rem .9rem; }
.inv-item { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--border); }
.inv-item:first-child { border-top: 0; }
.inv-item .name { flex: 1; font-size: .92rem; }
.inv-item .name small { display: block; color: var(--warning); font-size: .78rem; }
.inv-item.has-qty .name { font-weight: 600; }
.custom-add { display: flex; gap: .5rem; margin-top: .75rem; }
.custom-add input[type=text] { flex: 1; }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: .05rem .4rem; border-radius: 4px; background: var(--warning-bg); color: var(--warning); margin-left: .35rem; vertical-align: middle; }
.tag.big { background: var(--info-bg); color: var(--info); }

.summary-panel { position: sticky; top: 88px; }
.summary-panel .card-body { padding: 1.1rem 1.25rem; }
.summary-row { display: flex; justify-content: space-between; gap: 1rem; font-size: .88rem; padding: .35rem 0; }
.summary-row span:first-child { color: var(--muted); }
.summary-row span:last-child { font-weight: 600; text-align: right; }
.summary-rooms { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .85rem; max-height: 260px; overflow: auto; }
.summary-rooms li { display: flex; justify-content: space-between; padding: .3rem 0; border-top: 1px dashed var(--border); }
.summary-rooms li span:last-child { color: var(--muted); }
@media (max-width: 991px) { .summary-panel { position: static; margin-top: 1rem; } }

.estimate-box { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.estimate-total { background: var(--brand); color: #fff; padding: 1.5rem; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.estimate-total .label { opacity: .85; font-size: .88rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.estimate-total .amount { font-size: 2.4rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1; }
.estimate-total .note { font-size: .85rem; opacity: .85; max-width: 32ch; }
.estimate-lines { width: 100%; font-size: .9rem; }
.estimate-lines td { padding: .55rem 1.25rem; border-top: 1px solid var(--border); }
.estimate-lines td:last-child, .estimate-lines th:last-child { text-align: right; white-space: nowrap; }
.estimate-lines tr.sub td { background: var(--surface-2); font-weight: 600; }
.estimate-lines tr.total td { font-weight: 750; font-size: 1rem; }
.estimate-lines .qty-col { color: var(--muted); white-space: nowrap; }

.confirm-hero { text-align: center; padding: 1rem 0 1.5rem; }
.confirm-hero .check { width: 64px; height: 64px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: grid; place-items: center; font-size: 1.6rem; margin: 0 auto 1rem; }
.ref-chip { display: inline-block; font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; letter-spacing: .04em; padding: .5rem 1.1rem; border: 2px solid var(--brand); border-radius: var(--radius); color: var(--brand-strong); background: var(--brand-soft); }
.copy-field { display: flex; gap: .5rem; }
.copy-field input { font-family: var(--font-mono); font-size: .8rem; }
.next-steps { counter-reset: ns; list-style: none; padding: 0; margin: 0; }
.next-steps li { counter-increment: ns; position: relative; padding: 0 0 1rem 2.4rem; }
.next-steps li::before { content: counter(ns); position: absolute; left: 0; top: -.1rem; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }

/* Customer quotation document */
.quote-doc { max-width: 920px; margin: 0 auto; }
.quote-doc .doc-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.quote-doc .doc-head img { height: 44px; }
.quote-doc .doc-meta { text-align: right; font-size: .9rem; }
.quote-doc .doc-meta .ref { font-family: var(--font-mono); font-weight: 700; font-size: 1.2rem; }
@media (max-width: 575px) { .quote-doc .doc-meta { text-align: left; } }
.status-banner { display: flex; gap: .85rem; align-items: flex-start; padding: 1rem 1.15rem; border-radius: var(--radius); border: 1px solid; margin-bottom: 1.25rem; }
.status-banner i { margin-top: .2rem; }
.status-banner.info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info); }
.status-banner.success { background: var(--success-bg); border-color: var(--success-bd); color: var(--success); }
.status-banner.warning { background: var(--warning-bg); border-color: var(--warning-bd); color: var(--warning); }
.status-banner.neutral { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.status-banner p { margin: 0; color: var(--text-2); }
.status-banner strong { display: block; color: inherit; }
@media (max-width: 575px) {
  .estimate-lines td { padding: .5rem .75rem; }
  .estimate-lines .qty-col { display: none; }
  .estimate-total { padding: 1.1rem; }
  .estimate-total .amount { font-size: 2rem; }
  .quote-doc .card-body { padding: 1.1rem !important; }
}

/* Schedule */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .6rem; }
.week-grid .day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-height: 220px; padding: .6rem; display: flex; flex-direction: column; gap: .5rem; }
.week-grid .day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.week-grid .day.past { background: var(--surface-2); }
.week-grid .day header { display: flex; align-items: baseline; gap: .35rem; padding: .1rem .2rem .4rem; border-bottom: 1px solid var(--border); }
.week-grid .dow { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.week-grid .dom { font-size: 1.2rem; font-weight: 700; }
.week-grid .mon { font-size: .75rem; color: var(--muted); }
.week-grid .today .dom { color: var(--brand); }
.job-chip { display: flex; flex-direction: column; gap: .1rem; padding: .5rem .6rem; border-radius: var(--radius-sm); background: var(--brand-soft); border-left: 3px solid var(--brand); color: var(--text) !important; text-decoration: none !important; font-size: .8rem; }
.job-chip:hover { box-shadow: var(--shadow-sm); }
.job-chip .time { font-weight: 700; color: var(--brand-strong); font-size: .76rem; }
.job-chip .who { font-weight: 600; }
.job-chip .where, .job-chip .meta { color: var(--text-2); font-size: .74rem; }
.job-chip.pending { background: var(--warning-bg); border-left: 3px dashed var(--warning); }
.job-chip.pending .time { color: var(--warning); }
.job-chip.cancelled { background: var(--surface-2); border-left-color: var(--faint); opacity: .7; }
.job-chip.cancelled .who { text-decoration: line-through; }
.day-empty { color: var(--faint); font-size: .78rem; padding: .25rem; }
@media (max-width: 1199px) { .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 767px) { .week-grid { grid-template-columns: 1fr; } .week-grid .day { min-height: 0; } }

/* ==========================================================================
   Crew portal (mobile-first)
   ========================================================================== */
body.crew { background: var(--bg); padding-bottom: env(safe-area-inset-bottom); }
.crew-header { position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: .75rem; height: 56px; padding: 0 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.crew-header .brand img { height: 30px; }
.crew-main { max-width: 720px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.crew-hello h1 { font-size: 1.5rem; margin: .25rem 0 0; }
.crew-hello p { color: var(--muted); margin: 0 0 1rem; }
.crew-title { font-size: 1.35rem; margin: .25rem 0 .75rem; }
.crew-section { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 1.25rem 0 .5rem; }
.crew-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem; margin-bottom: .85rem; box-shadow: var(--shadow-xs); }
.crew-card-title { font-size: 1rem; margin-bottom: .75rem; }
.crew-job { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: .9rem 1rem; margin-bottom: .6rem; color: var(--text) !important; text-decoration: none !important; box-shadow: var(--shadow-xs); }
.crew-job:active { background: var(--surface-2); }
.crew-job .when { display: flex; justify-content: space-between; font-size: .85rem; }
.crew-job .when .d { font-weight: 700; color: var(--brand-strong); }
.crew-job .when .t { color: var(--muted); }
.crew-job .who { font-weight: 650; font-size: 1.05rem; margin-top: .2rem; }
.crew-job .where { color: var(--text-2); font-size: .9rem; }
.crew-job .where i { color: var(--faint); margin-right: .25rem; }
.crew-job .foot { display: flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .8rem; margin-top: .4rem; }
.crew-job-head { margin-bottom: .85rem; }
.crew-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .85rem; }
.crew-quick .btn { padding: .65rem .5rem; }
.crew-action { min-height: 56px; font-size: 1.05rem; margin-top: 1rem; }
.crew-step { border-top: 1px solid var(--border); margin-top: 1rem; padding-top: 1rem; }
.stage-track { list-style: none; padding: 0; margin: 0; }
.stage-track li { display: flex; align-items: center; gap: .65rem; padding: .35rem 0; color: var(--faint); font-size: .92rem; position: relative; }
.stage-track li:not(:last-child)::after { content: ""; position: absolute; left: 11px; top: 1.75rem; bottom: -.5rem; width: 2px; background: var(--border); }
.stage-track li.done::after { background: var(--brand); }
.stage-track .dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-size: .65rem; background: var(--surface); flex: none; z-index: 1; }
.stage-track li.done { color: var(--text); }
.stage-track li.done .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.stage-track li.next { color: var(--brand-strong); font-weight: 600; }
.stage-track li.next .dot { border-color: var(--brand); }
.stage-track .tm { margin-left: auto; font-size: .8rem; color: var(--muted); }
.crew-times { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .85rem; }
.crew-times div { background: var(--surface-2); border-radius: var(--radius-sm); padding: .5rem .6rem; }
.crew-times span { display: block; font-size: .72rem; color: var(--muted); }
.crew-times strong { font-size: .98rem; }
.crew-address { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--border); }
.crew-address:first-of-type { border-top: 0; }
.crew-room { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: .9rem 0 .25rem; }
.crew-item { display: flex; align-items: center; gap: .4rem; padding: .45rem 0; border-top: 1px solid var(--border); }
.crew-item .name { flex: 1; font-size: .92rem; min-width: 0; }
.qty-pill { display: inline-block; min-width: 2rem; font-weight: 700; color: var(--brand-strong); }
.tick { min-width: 78px; height: 40px; border-radius: 999px; border: 1.5px solid var(--border-strong); background: var(--surface); font-size: .78rem; font-weight: 600; color: var(--text-2); }
.tick.on { background: var(--success); border-color: var(--success); color: #fff; }
.tick.on::before { content: "\f00c"; font-family: "Font Awesome 5 Free"; font-weight: 900; margin-right: .3rem; }
.tick:disabled { opacity: .4; }
.crew-exception { border-left: 3px solid var(--warning); background: var(--warning-bg); border-radius: var(--radius-sm); padding: .6rem .75rem; margin-top: .6rem; }
.crew-exception.resolved { border-left-color: var(--success); background: var(--surface-2); }
.sop-item { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem 0; border-top: 1px solid var(--border); cursor: pointer; margin: 0; font-weight: 400; }
.sop-item:first-of-type { border-top: 0; }
.sop-item input { position: absolute; opacity: 0; }
.sop-item .box { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--border-strong); display: grid; place-items: center; color: transparent; background: var(--surface); }
.sop-item.on .box { background: var(--success); border-color: var(--success); color: #fff; }
.sop-item input:focus-visible + .box { box-shadow: var(--ring); }
.sop-item .txt { display: flex; flex-direction: column; }
.sop-item .lbl { font-weight: 600; color: var(--text); font-size: .95rem; }
.sop-item .help { color: var(--muted); font-size: .84rem; margin-top: .15rem; }
.sop-item .by { color: var(--success); font-size: .78rem; margin-top: .15rem; }

/* Ledger */
.ledger-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.ledger-summary > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: .65rem .8rem; }
.ledger-summary span { display: block; font-size: .76rem; color: var(--muted); }
.ledger-summary strong { font-size: 1.15rem; }
.ledger-summary .owing { background: var(--warning-bg); }
.ledger-summary .owing strong { color: var(--warning); }
.ledger-summary .clear { background: var(--success-bg); }
.ledger-summary .clear strong { color: var(--success); }
.ledger-summary .over { background: var(--danger-bg); }
.ledger-summary .over strong { color: var(--danger); }
.border-top { border-top: 1px solid var(--border) !important; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 30%) 1fr auto; gap: .75rem; align-items: center; padding: .4rem 0; font-size: .88rem; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 999px; }
.bar-row .val { font-weight: 600; text-align: right; min-width: 4rem; }
.funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.funnel .step { background: var(--surface-2); border-radius: var(--radius); padding: .9rem 1rem; }
.funnel .step .n { font-size: 1.6rem; font-weight: 700; }
.funnel .step .l { color: var(--muted); font-size: .84rem; }
.funnel .step .r { font-size: .78rem; color: var(--brand-strong); font-weight: 600; }
