:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f8f9fb; --border: #e3e6ea; --border-strong: #cfd4da;
  --text: #16191d; --text-2: #4b5563; --muted: #6b7280;
  /* Events United blue for buttons and active items, EU navy for the sidebar, Studio Lab green for highlights */
  --nav: #2b5672; --nav-text: #d3dee7; --nav-active: #ffffff; --nav-dim: #b5cddc; --nav-hover: rgb(255 255 255 / 9%); --nav-sel: rgb(255 255 255 / 15%);
  --accent: #44a0c8; --accent-strong: #2f88b0; --accent-ink: #062534; --link: #1f6f99;
  --highlight: #44b844; --highlight-ink: #06290a; --brand-strip: linear-gradient(90deg, #44a0c8, #44b844);
  --green: #257a2f; --green-bg: #e6f6e6; --teal: #0f766e; --teal-bg: #ccfbf1; --amber: #a16207; --amber-bg: #fef3c7;
  --red: #b91c1c; --red-bg: #fee2e2; --blue: #1d4ed8; --blue-bg: #dbeafe; --gray: #4b5563; --gray-bg: #eef0f3;
  --green-solid: #44b844; --green-btn: #257a2f;
  --radius: 10px; --radius-sm: 6px; --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 8%);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / 18%);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1113; --surface: #181b1f; --surface-2: #1e2226; --border: #2b3036; --border-strong: #3a4047;
    --text: #eceef1; --text-2: #b6bcc5; --muted: #8b939e; --nav: #10283a; --link: #6cbde0;
    --green: #6fd36f; --green-bg: #12301f; --green-btn: #2e8a38; --teal: #5eead4; --teal-bg: #0f2e2b; --amber: #fbbf24; --amber-bg: #33270b;
    --red: #f87171; --red-bg: #3a1616; --blue: #93c5fd; --blue-bg: #172745; --gray: #b6bcc5; --gray-bg: #262a30;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%); --shadow-lg: 0 12px 32px rgb(0 0 0 / 50%);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1; }
.hide { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.sidebar { background: var(--nav); color: var(--nav-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; color: #fff; font-weight: 700; font-size: 15px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--accent) 55%, var(--highlight)); display: grid; place-items: center; color: var(--accent-ink); font-weight: 800; }
.brand small { display: block; font-weight: 500; color: var(--nav-text); font-size: 11px; }
.sidebar .brand { border-bottom: 2px solid; border-image: var(--brand-strip) 1; margin-bottom: 4px; }
.nav-group { padding: 6px 8px; }
.nav-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--nav-dim); padding: 10px 10px 4px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--nav-text); font-weight: 500; }
.nav-link:hover { background: var(--nav-hover); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--nav-sel); color: var(--nav-active); box-shadow: inset 3px 0 0 var(--highlight); }
.nav-link .ico { width: 18px; text-align: center; opacity: .85; }
.nav-link .pill { margin-left: auto; background: var(--highlight); color: var(--highlight-ink); border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--nav-sel); font-size: 12px; }
.sidebar-foot button { width: 100%; }
.main { min-width: 0; }
.topbar { display: none; }
.content { padding: 22px 28px 60px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-title::after { content: ""; display: block; width: 28px; height: 3px; border-radius: 2px; margin-top: 6px; background: var(--brand-strip); }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 7px 12px; border-radius: var(--radius-sm); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; min-height: 34px; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-dark { background: var(--text); color: var(--surface); border-color: var(--text); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-ghost { color: var(--red); border-color: transparent; background: transparent; margin-right: auto; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 4px 9px; min-height: 28px; font-size: 12.5px; }
.btn-lg { padding: 12px 18px; font-size: 16px; min-height: 48px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-green { background: var(--green-btn); border-color: var(--green-btn); color: #fff; }
.icon-btn { border: 0; background: transparent; color: inherit; font-size: 16px; cursor: pointer; width: 32px; height: 32px; border-radius: 6px; }
.icon-btn:hover { background: var(--surface-2); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; width: 100%; min-height: 34px; }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--highlight); }
input[type=color] { padding: 2px; height: 34px; }
.search { max-width: 260px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters select, .filters input { width: auto; }
.seg { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: thin; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.seg a, .seg button { white-space: nowrap; padding: 6px 11px; color: var(--text-2); background: var(--surface); border: 0; font: inherit; cursor: pointer; border-right: 1px solid var(--border); }
.seg a:last-child, .seg button:last-child { border-right: 0; }
.seg .active { background: var(--text); color: var(--surface); box-shadow: inset 0 -3px 0 var(--highlight); }
.seg a:hover { text-decoration: none; }

/* ---------------------------------------------------------------- cards / kpis */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 10px; }
.card-body { padding: 0 16px 16px; }
.card-pad { padding: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); color: inherit; display: block; }
a.kpi:hover { border-color: var(--highlight); text-decoration: none; }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 550; }
.kpi-value { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--muted); font-size: 12px; }
.fill-box { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.fill-box > div { padding: 10px 6px; }
.fill-box .big { font-size: 26px; font-weight: 700; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.list > li:first-child { border-top: 0; }
.list .meta { color: var(--muted); font-size: 12px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--highlight); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.callout { padding: 10px 12px; border-radius: 8px; background: var(--amber-bg); color: var(--amber); font-size: 13px; }
.callout.info { background: var(--blue-bg); color: var(--blue); }
.callout.ok { background: var(--green-bg); color: var(--green); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--c, var(--muted)); flex: none; }

/* ---------------------------------------------------------------- badges / chips / avatars */
.badge { display: inline-flex; align-items: center; align-self: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-teal { background: var(--teal-bg); color: var(--teal); }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-blue { background: var(--blue-bg); color: var(--blue); }
.tone-gray { background: var(--gray-bg); color: var(--gray); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; background: var(--gray-bg); color: var(--text-2); font-size: 12px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: none;
  background: hsl(var(--h) 55% 88%); color: hsl(var(--h) 45% 28%); }
@media (prefers-color-scheme: dark) { .avatar { background: hsl(var(--h) 35% 25%); color: hsl(var(--h) 60% 85%); } }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.stars { color: var(--amber); font-weight: 600; white-space: nowrap; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table .sel { width: 34px; }
.table tr.warn td { background: color-mix(in srgb, var(--amber-bg) 45%, transparent); }
.card > .table-wrap .table th:first-child, .card > .table-wrap .table td:first-child { padding-left: 16px; }
.name-cell { display: flex; align-items: center; gap: 10px; }
.name-cell strong { display: block; }
.bulkbar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 9px 13px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--highlight); }
.tabs .count { margin-left: 6px; font-size: 11px; background: var(--gray-bg); border-radius: 999px; padding: 1px 6px; }

/* ---------------------------------------------------------------- event header & crewing */
.event-head { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.event-swatch { width: 6px; align-self: stretch; border-radius: 4px; background: var(--c); }
.fill-metrics { display: inline-grid; grid-template-columns: repeat(4, auto); gap: 2px 12px; font-size: 12px; }
.fill-metrics span { color: var(--muted); }
.fill-metrics b { font-variant-numeric: tabular-nums; }
.meter { height: 6px; background: var(--gray-bg); border-radius: 99px; overflow: hidden; min-width: 70px; }
.meter > i { display: block; height: 100%; background: var(--green-solid); }
.meter.low > i { background: var(--red); }
.meter.mid > i { background: var(--amber); }
.call-group { margin-bottom: 16px; }
.call-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--nav); color: #fff; border-radius: var(--radius) var(--radius) 0 0; flex-wrap: wrap; }
.call-head .muted { color: #aab1ba; }
.call-head .btn { background: transparent; color: #fff; border-color: #3a4047; }
.pos { border: 1px solid var(--border); border-top: 0; background: var(--surface); border-left: 4px solid var(--red); }
.pos.full { border-left-color: var(--highlight); }
.pos.part { border-left-color: var(--amber); }
.pos:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.pos-row { display: grid; grid-template-columns: minmax(180px, 1.6fr) repeat(5, minmax(56px, .5fr)) auto; gap: 8px; align-items: center; padding: 10px 14px; }
.pos-row .stat { text-align: center; }
.pos-row .stat b { display: block; font-size: 15px; }
.pos-row .stat small { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.pos-title { font-weight: 650; }
.pos-sub { color: var(--muted); font-size: 12px; }
.pos-crew { padding: 0 14px 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.crew-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 2px 4px 2px 2px; background: var(--surface-2); font-size: 12.5px; }
.crew-pill .avatar { width: 22px; height: 22px; font-size: 9.5px; }
.crew-pill button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 4px; font-size: 13px; }
.toggle { position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; color: var(--muted); }
.toggle input { appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; border: 0; min-height: 0; padding: 0; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked { background: var(--green-solid); }
.toggle input:checked::after { transform: translateX(14px); }

/* ---------------------------------------------------------------- schedule / calendar */
.sched { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.sched table { border-collapse: collapse; width: 100%; min-width: 900px; table-layout: fixed; }
.sched th, .sched td { border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); padding: 6px; vertical-align: top; }
.sched th { background: var(--surface-2); font-size: 12px; font-weight: 600; text-align: left; }
.sched th.today { background: var(--amber-bg); }
.sched td.name { width: 180px; border-left: 0; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched th:first-child { width: 180px; border-left: 0; }
.slot { display: block; border-radius: 5px; padding: 3px 6px; font-size: 11.5px; margin-bottom: 3px; background: color-mix(in srgb, var(--c) 18%, var(--surface)); border-left: 3px solid var(--c); color: var(--text); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.pending { border-left-style: dashed; opacity: .75; }
.slot:hover { text-decoration: none; filter: brightness(.97); }
.unav { display: block; font-size: 11px; color: var(--red); background: var(--red-bg); border-radius: 4px; padding: 2px 5px; margin-bottom: 3px; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.month .dow { background: var(--surface-2); font-size: 11.5px; font-weight: 600; padding: 6px; color: var(--muted); border-bottom: 1px solid var(--border); }
.month .day { min-height: 110px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); padding: 4px; }
.month .day:nth-child(7n+1) { border-left: 0; }
.month .day.other { background: var(--surface-2); color: var(--muted); }
.month .day.today .dnum { background: var(--highlight); color: var(--highlight-ink); border-radius: 99px; padding: 0 6px; }
.month .dnum { font-size: 12px; font-weight: 600; margin-bottom: 3px; display: inline-block; }

/* ---------------------------------------------------------------- forms */
.form-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.field { flex: 1 1 100%; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.half { flex: 1 1 calc(50% - 6px); }
.field.third { flex: 1 1 calc(33% - 8px); }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.req { color: var(--red); margin-left: 2px; }
.help { color: var(--muted); font-size: 11.5px; }
.check { display: flex; gap: 8px; align-items: center; flex: 1 1 100%; font-weight: 500; flex-wrap: wrap; }
.check.half { flex: 1 1 calc(50% - 6px); }
.form-section { flex: 1 1 100%; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 6px; }
.multicheck { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { display: inline-flex; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { border: 1px solid var(--border-strong); border-radius: 999px; padding: 4px 10px; cursor: pointer; font-size: 12.5px; }
.chip-check input:checked + span { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); }

/* ---------------------------------------------------------------- modal / toast */
.modal-wrap { position: fixed; inset: 0; background: rgb(10 12 15 / 55%); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .12s ease-out; }
.modal { background: var(--surface); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); outline: none; }
.modal-wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 550; transition: opacity .3s, transform .3s; }
.toast-error { background: var(--red); color: #fff; }
.toast:not(.toast-error) { border-left: 4px solid var(--highlight); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------------------------------------------------------------- bars (reports) */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 180px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; background: var(--gray-bg); border-radius: 4px; overflow: hidden; }
.bar-track > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar-track.alt > i { background: var(--teal); }
.cols { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.cols .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.cols .pair { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.cols .pair i { width: 40%; max-width: 26px; border-radius: 4px 4px 0 0; background: var(--accent); min-height: 2px; }
.cols .pair i.rev { background: var(--teal); }
.cols small { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------------------------------------------------------------- documents (quote / invoice) */
.doc { background: #fff; color: #111; max-width: 820px; margin: 0 auto; padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow); }
.doc table { width: 100%; border-collapse: collapse; margin-top: 18px; }
.doc th, .doc td { padding: 8px 6px; border-bottom: 1px solid #e5e7eb; text-align: left; }
.doc th { font-size: 11px; text-transform: uppercase; color: #6b7280; }
.doc .totals { margin-left: auto; width: 280px; margin-top: 14px; }
.doc .totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.doc .totals .grand { font-weight: 700; font-size: 17px; border-top: 2px solid #111; padding-top: 8px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; }
.doc h1 { font-size: 28px; }
.line-edit input { min-height: 30px; padding: 4px 6px; }
@media print {
  .sidebar, .topbar, .no-print, .bottom-nav, #toasts { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  body { background: #fff; }
  .doc { box-shadow: none; padding: 0; }
}

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1100px 560px at 15% -10%, rgb(68 160 200 / 45%) 0%, transparent 60%), radial-gradient(900px 520px at 105% 110%, rgb(68 184 68 / 28%) 0%, transparent 60%), var(--nav); }
.auth-card { background: var(--surface); border-radius: 16px; padding: 28px; width: min(400px, 100%); box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--brand-strip); }
.auth-card .brand { color: var(--text); padding: 0 0 18px; font-size: 18px; }
.auth-card .brand small { color: var(--muted); }
.demo-box { margin-top: 18px; border-top: 1px dashed var(--border-strong); padding-top: 14px; }
.demo-box .row .btn { flex: 1; }

/* ---------------------------------------------------------------- crew (mobile-first) app */
.m-shell { max-width: 640px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.m-top { position: sticky; top: 0; z-index: 10; background: var(--nav); color: #fff; border-bottom: 3px solid; border-image: var(--brand-strip) 1; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; gap: 10px; }
.m-top h1 { font-size: 17px; flex: 1; }
.m-top .icon-btn { color: #fff; }
.m-top .icon-btn:hover { background: var(--nav-hover); }
.m-content { padding: 14px 14px 20px; }
.m-content > * + * { margin-top: 14px; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 9px; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; }
.bottom-nav a .ico { font-size: 20px; line-height: 1; }
.bottom-nav a.active { color: var(--text); }
.bottom-nav a.active .ico { transform: translateY(-1px); }
.bottom-nav a:hover { text-decoration: none; }
.bottom-nav .pill { position: absolute; top: 4px; left: calc(50% + 8px); background: var(--red); color: #fff; border-radius: 99px; font-size: 10px; padding: 0 5px; }
.m-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.m-card h2 { font-size: 15px; }
.m-sec { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; margin: 18px 2px 8px; }
.shift-card { display: block; color: inherit; border-left: 5px solid var(--c, var(--accent)); }
.shift-card:hover { text-decoration: none; }
.shift-when { font-weight: 700; font-size: 15px; }
.shift-what { color: var(--text-2); margin-top: 2px; }
.shift-where { color: var(--muted); font-size: 13px; margin-top: 2px; }
.clock-card { background: var(--nav); color: #fff; border: 0; }
.clock-card .muted { color: #aab1ba; }
.clock-big { font-size: 36px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-pair .m-card b { display: block; font-size: 22px; }
.actions-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.info-list { list-style: none; padding: 0; margin: 0; }
.info-list li { padding: 10px 0; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.info-list li:first-child { border-top: 0; }
.info-list .k { color: var(--muted); width: 92px; flex: none; font-size: 13px; }
.msg { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.msg.mine { background: var(--blue-bg); border-color: transparent; }
.compose { display: flex; gap: 8px; margin-top: 10px; }
.compose textarea { min-height: 40px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) { .grid-main { grid-template-columns: minmax(0, 1fr); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .doc { padding: 18px; } .doc .totals { width: auto; max-width: 280px; } .doc-head { flex-wrap: wrap; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgb(0 0 0 / 40%); z-index: 30; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--nav); color: #fff; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; }
  .topbar .icon-btn { color: #fff; }
  .topbar strong { flex: 1; }
  .content { padding: 16px 16px 60px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .pos-row { grid-template-columns: repeat(4, 1fr); }
  .pos-row > div:first-child { grid-column: 1 / -1; }
  .pos-row .stat.opt { display: none; }
  .pos-row .pos-actions { grid-column: 1 / -1; }
  .field.half, .field.third, .check.half { flex-basis: 100%; }
  .table.stack-sm thead { display: none; }
  .table.stack-sm tr { display: block; border-bottom: 1px solid var(--border); padding: 6px 0; }
  .table.stack-sm td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 4px 16px; }
  .table.stack-sm td::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  .search { max-width: none; }
}

/* grid children may hold wide tables (inside .table-wrap); never let them widen the page */
.grid > * { min-width: 0; }

/* staging / demo copies (CORRAL_ENV_LABEL) */
.env-banner { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 60; pointer-events: none; background: var(--amber-bg); color: var(--amber); border: 1px solid currentColor; border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700; letter-spacing: .02em; box-shadow: var(--shadow); }
