/* ============================================================ Yardline UI */

:root {
  --bg: #eef1f4;
  --bg-2: #e4e9ee;
  --card: #ffffff;
  --card-2: #fafbfc;
  --ink: #12202e;
  --ink-soft: #2c3e50;
  --muted: #5b6b7c;
  --line: #d5dde6;
  --line-2: #edf1f5;
  --sidebar: #101820;
  --sidebar-2: #18222c;
  --side-text: #9aa8b5;
  --side-head: #6b7887;
  --accent: #c45c14;
  --accent-soft: rgba(196, 92, 20, .14);
  --accent-2: #0f6e62;
  --ok: #1f7a4d;
  --ok-bg: #e6f5ec;
  --warn: #9a6700;
  --warn-bg: #fff4d6;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --info: #185fa5;
  --info-bg: #e7f1fb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06);
  --shadow-lg: 0 18px 44px rgba(16, 24, 32, .18);
  --font: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #0f151b;
  --bg-2: #1a222b;
  --card: #161e26;
  --card-2: #1b242d;
  --ink: #e6edf3;
  --ink-soft: #c3ced9;
  --muted: #8d9bab;
  --line: #2a3541;
  --line-2: #222c36;
  --sidebar: #0a0f14;
  --sidebar-2: #111820;
  --side-text: #8d9bab;
  --side-head: #63717f;
  --accent: #e07b2f;
  --accent-soft: rgba(224, 123, 47, .16);
  --accent-2: #2aa094;
  --ok: #57c98b;
  --ok-bg: rgba(87, 201, 139, .14);
  --warn: #e2b33c;
  --warn-bg: rgba(226, 179, 60, .14);
  --bad: #f07268;
  --bad-bg: rgba(240, 114, 104, .14);
  --info: #6ab0f3;
  --info-bg: rgba(106, 176, 243, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
hr { border: none; border-top: 1px solid var(--line-2); margin: 16px 0; }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }
kbd {
  background: var(--bg-2); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 5px; font-size: 11px; font-weight: 600;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0; font-weight: 700;
}
.skip-link:focus { left: 0; text-decoration: none; }

/* ------------------------------------------------------------- structure */

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 272px;
  background: linear-gradient(180deg, var(--sidebar) 0%, #0a0f14 100%);
  color: var(--side-text);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 14px; color: #fff; text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand:hover { text-decoration: none; }
.brand > div { min-width: 0; }
.mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-weight: 800; letter-spacing: -.04em;
  flex-shrink: 0;
}
.brand strong {
  display: block; color: #fff; font-size: 14px; letter-spacing: -.02em; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand span {
  display: block; margin-top: 2px; font-size: 11px; color: #8b98a6; font-weight: 500; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav { padding: 8px 10px 14px; overflow-y: auto; flex: 1; }
.nav h6 {
  margin: 14px 10px 5px; font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--side-head); font-weight: 700;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--side-text); text-decoration: none; font-weight: 550; font-size: 13.5px;
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: #fff; }
.nav a.active svg { color: #f0a36a; }
.nav .nav-count {
  margin-left: auto; background: var(--bad); color: #fff;
  font-size: 10px; font-weight: 800; border-radius: 999px; padding: 1px 6px; min-width: 18px; text-align: center;
}
.nav .nav-count.warn { background: var(--warn); color: #1b1200; }
.side-foot {
  padding: 12px 16px 16px; border-top: 1px solid rgba(255, 255, 255, .06);
  font-size: 11px; color: #6b7887; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.side-foot a { color: #8b98a6; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 22px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.menu-btn, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--line); border-radius: 8px;
  width: 36px; height: 36px; cursor: pointer; color: var(--ink); flex-shrink: 0; padding: 0;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; font-size: 18px; }
.icon-btn.has-badge { position: relative; }
.icon-btn .badge {
  position: absolute; top: -5px; right: -5px; background: var(--bad); color: #fff;
  font-size: 10px; font-weight: 800; border-radius: 999px; min-width: 17px; padding: 0 4px; line-height: 17px;
}
.icon-btn .badge.warn { background: var(--warn); color: #1b1200; }

.search { flex: 1; max-width: 440px; position: relative; }
.search input {
  width: 100%; padding: 9px 12px 9px 36px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); font: inherit;
}
.search svg {
  position: absolute; left: 10px; top: 10px; width: 18px; height: 18px; color: var(--muted); pointer-events: none;
}
.search .kbd-hint {
  position: absolute; right: 8px; top: 8px; pointer-events: none;
}
.who { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.who > a.whoami { color: inherit; text-decoration: none; text-align: right; }
.who > a.whoami:hover .name { color: var(--accent); }
.who .name { font-weight: 650; font-size: 13px; line-height: 1.2; }
.who .role { font-size: 11px; color: var(--muted); }
.content { padding: 20px 22px 60px; width: 100%; }

/* ------------------------------------------------------------- headings */

.page-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 0 0 16px; flex-wrap: wrap; }
.page-h h1 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.page-h p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.page-h .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.section-title { margin: 22px 0 8px; font-size: 15px; letter-spacing: -.01em; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.tabs a {
  padding: 8px 13px; color: var(--muted); font-weight: 650; font-size: 13.5px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- layout */

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > input[type=date], .row > input[type=email], .row > input[type=number], .row > input[type=text], .row > input[type=search], .row > select {
  width: auto; min-width: 150px; flex: 0 1 auto;
}
.row > input[type=search] { min-width: 240px; }
.row.end { justify-content: flex-end; }
.toolbar { margin-bottom: 14px; }
.toolbar label {
  margin: 0; width: auto; display: flex; flex-direction: column; gap: 4px;
}
.toolbar label input, .toolbar label select { width: auto; min-width: 150px; }
.toolbar label input[type=search] { min-width: 200px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }
.grid-sidebar { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.day-plan { align-items: start; }
.dash-label {
  margin: 20px 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ----------------------------------------------------------------- cards */

.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 24px; letter-spacing: -.03em; line-height: 1.15; }
.stat span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .045em; }
.stat small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.stat.alert { border-color: var(--bad); background: var(--bad-bg); }
.stat.alert b { color: var(--bad); }
.stat.good b { color: var(--ok); }
.stat.warn { border-color: var(--warn); }
.stat.warn b { color: var(--warn); }
a.stat { text-decoration: none; color: inherit; display: block; }
a.stat:hover { border-color: var(--accent); text-decoration: none; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden;
}
.card-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 15px; border-bottom: 1px solid var(--line-2); font-weight: 700; font-size: 14.5px;
}
.card-h .row { gap: 6px; }
.card-b { padding: 14px 15px; }
.card-b.tight { padding: 0; }
.card-h a { font-weight: 650; font-size: 13px; }
.card-link { display: block; text-decoration: none; color: inherit; transition: border-color .12s, transform .12s; }
.card-link:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.card-link strong { color: var(--accent); }

.section-h { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.card-f { padding: 10px 15px; border-top: 1px solid var(--line-2); background: var(--card-2); font-size: 13px; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; background: var(--card-2); white-space: nowrap;
}
tbody tr:hover td { background: var(--card-2); }
tfoot td { font-weight: 700; background: var(--card-2); border-top: 2px solid var(--line); }
.table-link { color: var(--ink); font-weight: 700; }
.table-link:hover { color: var(--accent); text-decoration: none; }
.sort-link { color: var(--muted); font-weight: 700; }
.sort-link:hover { color: var(--ink); text-decoration: none; }
.muted { color: var(--muted); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-bad { color: var(--bad); }
.right { text-align: right !important; }
.center { text-align: center !important; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 700; }
.small { font-size: 12.5px; }
.tnum { font-variant-numeric: tabular-nums; }
.row-bad td { background: var(--bad-bg) !important; }
.row-warn td { background: var(--warn-bg) !important; }
.row-muted td { opacity: .6; }
table.compact th, table.compact td { padding: 6px 9px; font-size: 13px; }

/* Matrix of ticks — role permissions, training records. First column stays put
   when the grid is wider than the screen. */
.grid-table td, .grid-table th { border-left: 1px solid var(--line-2); }
.grid-table td:first-child, .grid-table th:first-child { border-left: none; }
.grid-table tr.row-head td { background: var(--card-2); border-left: none; }
.grid-table tr:hover td.tick-yes { background: var(--ok-bg); }
.grid-table td.tick-yes { color: var(--ok); background: var(--ok-bg); text-align: center; }
.grid-table td.tick-no { color: var(--line); text-align: center; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 15px; flex-wrap: wrap; }
.pager .pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pager .pages a, .pager .pages span {
  min-width: 32px; text-align: center; padding: 5px 8px; border: 1px solid var(--line);
  border-radius: 7px; font-size: 13px; font-weight: 650; color: var(--ink); text-decoration: none;
}
.pager .pages a:hover { background: var(--bg); text-decoration: none; }
.pager .pages span.current { background: var(--ink); color: var(--card); border-color: var(--ink); }
.pager .pages span.gap { border: none; }

/* ----------------------------------------------------------------- pills */

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  background: var(--bg-2); color: var(--muted); white-space: nowrap;
}
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-neutral { background: var(--bg-2); color: var(--muted); }
.pill-lg { font-size: 13px; padding: 4px 11px; }

.tag-list { display: flex; gap: 5px; flex-wrap: wrap; }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 13px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 700;
  cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); color: #fff; filter: brightness(1.08); }
.btn-teal { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn-teal:hover { background: var(--accent-2); color: #fff; filter: brightness(1.08); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: var(--bad); color: #fff; filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 9px; font-size: 12.5px; border-radius: 7px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
form.inline { display: inline; }

/* ---------------------------------------------------------------- alerts */

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 650; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-bad { background: var(--bad-bg); color: var(--bad); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }
.flash-info { background: var(--info-bg); color: var(--info); }

.callout {
  border: 1px solid var(--line); border-left: 4px solid var(--muted);
  border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 14px; background: var(--card);
}
.callout.bad { border-left-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.callout.warn { border-left-color: var(--warn); background: var(--warn-bg); color: var(--warn); }
.callout.ok { border-left-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.callout.info { border-left-color: var(--info); background: var(--info-bg); color: var(--info); }
.callout strong { display: block; margin-bottom: 2px; }
.callout ul { margin: 6px 0 0; padding-left: 20px; }
.callout-lines { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 4px; }

.hidden { display: none !important; }

.tight-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.tight-list li { margin-bottom: 2px; }
.tight-list li:last-child { margin-bottom: 0; }

.page-issues { margin-bottom: 16px; }
.page-issues .card-b.tight { padding: 0; }
.alert-row {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 11px 15px; border-bottom: 1px solid var(--line-2); text-decoration: none; color: inherit;
}
.alert-row:last-child { border-bottom: none; }
.alert-row:hover { background: var(--card-2); text-decoration: none; }
.alert-row .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--info); }
.alert-row.critical .dot { background: var(--bad); }
.alert-row.warn .dot { background: var(--warn); }
.alert-row.info .dot { background: var(--info); }
.alert-row strong { display: block; font-size: 14px; }
.alert-row p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.alert-row .when { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; padding-top: 2px; }

/* ----------------------------------------------------------------- forms */

label {
  display: block; font-size: 11.5px; font-weight: 700; color: var(--muted);
  margin: 0 0 5px; text-transform: uppercase; letter-spacing: .04em;
}
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time],
input[type=number], input[type=search], input[type=tel], input[type=url], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; background: var(--card); color: var(--ink);
}
input[type=file] {
  width: 100%; padding: 8px; border: 1px dashed var(--line); border-radius: var(--radius-sm);
  background: var(--card-2); color: var(--ink); font: inherit; font-size: 13px;
}
textarea { min-height: 88px; resize: vertical; }
textarea.tall { min-height: 200px; }
input:disabled, select:disabled, textarea:disabled { background: var(--bg-2); color: var(--muted); }
.field { margin-bottom: 12px; }
.field .hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; text-transform: none; letter-spacing: 0; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-grid .full, .form-grid-3 .full { grid-column: 1 / -1; }
label.check {
  display: flex; align-items: flex-start; gap: 8px;
  text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 650;
  color: var(--ink); margin: 0; cursor: pointer;
}
label.check input { width: auto; margin: 2px 0 0; flex-shrink: 0; }
label.check span.hint { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px 16px; }
.radio-row { display: flex; flex-direction: column; gap: 8px; }
.radio-row label.check { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.radio-row label.check:has(input:checked) { border-color: var(--accent); background: var(--info-bg); }
.form-actions {
  display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding-top: 10px; flex-wrap: wrap;
}
.form-actions .check, .form-actions .spacer { margin-right: auto; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 14px; }
legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0 6px; }
.lines-table input, .lines-table select { padding: 6px 8px; }
.lines-table td { padding: 5px 6px; }
.money-input { position: relative; }
.money-input span { position: absolute; left: 10px; top: 9px; color: var(--muted); pointer-events: none; }
.money-input input { padding-left: 24px; }

.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty h3 { margin: 0 0 6px; color: var(--ink); font-size: 16px; }
.empty p { margin: 0 auto 14px; max-width: 46ch; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters a, .filters span {
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font-size: 12.5px; font-weight: 650; text-decoration: none;
}
.filters a.active, .filters a:hover { background: var(--ink); color: var(--card); border-color: var(--ink); text-decoration: none; }

/* --------------------------------------------------------------- diary */

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: 10px; min-height: 170px; padding: 8px; }
.day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.day.weekend { background: var(--card-2); }
.day h4 { margin: 0 0 8px; font-size: 11.5px; color: var(--muted); }
.day h4 b { display: block; color: var(--ink); font-size: 16px; }
.chip {
  display: block; padding: 5px 8px; border-radius: 7px; margin-bottom: 5px;
  font-size: 11.5px; font-weight: 650; background: var(--info-bg); color: var(--info); text-decoration: none;
}
.chip:hover { filter: brightness(.97); text-decoration: none; }
.chip.del, .chip-out { background: var(--ok-bg); color: var(--ok); }
.chip.col, .chip-in, .chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip.clash, .chip-bad { background: var(--bad-bg); color: var(--bad); }
.chip.abs, .chip-off { background: var(--bg-2); color: var(--muted); }
.chip-crew { background: var(--info-bg); color: var(--info); }
.chip small { display: block; font-weight: 500; opacity: .85; }
.chip-plan { background: var(--card); color: var(--ink); border: 1px dashed var(--line); }
.chip[draggable="true"] { cursor: grab; }
.job-tray { display: flex; flex-wrap: wrap; gap: 8px; }
.job-tray .chip { margin: 0; max-width: 240px; }
.day.drop-on { outline: 2px solid var(--accent); outline-offset: -2px; }
.month-scroll { overflow-x: auto; }
.month-head, .month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; min-width: 840px; }
.month-head { margin-bottom: 6px; }
.month-head span {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.day.day-month { min-height: 96px; padding: 6px; }
.day.day-month h4 { margin-bottom: 6px; }
.day.day-month h4 a { color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: none; }
.day.day-month h4 a:hover { color: var(--accent); }
.day.outside { opacity: .55; }
.day.day-month .chip {
  padding: 2px 5px; font-size: 10.5px; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.day.day-month .chip small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.span-bar {
  display: block; margin-bottom: 3px; padding: 1px 5px;
  font-size: 10.5px; font-weight: 650; text-decoration: none;
  color: var(--muted); background: var(--card-2);
  border-left: 3px solid var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.span-bar:hover { text-decoration: none; color: var(--ink); }
.span-bar.span-warn { border-left-color: var(--warn); color: var(--warn); }

/* ---------------------------------------------------------------- job hero */

.job-hero {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 14px;
}
.job-hero h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.job-hero .meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.job-hero .meta div { font-size: 13px; }
.job-hero .meta dt { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.job-hero .meta dd { margin: 1px 0 0; font-weight: 650; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 18px; margin: 0; }
.dl-grid dt { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.dl-grid dd { margin: 2px 0 0; font-weight: 600; word-break: break-word; }

/* --------------------------------------------------------------- timeline */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0 10px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 15px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.timeline li:last-child { border-left-color: transparent; }
.timeline .who { font-size: 12px; color: var(--muted); }
.timeline p { margin: 3px 0 0; white-space: pre-wrap; }

/* ------------------------------------------------------------- risk grid */

.risk-score {
  display: inline-grid; place-items: center; width: 30px; height: 26px;
  border-radius: 6px; font-weight: 800; font-size: 13px; color: #fff; background: var(--ok);
}
.risk-score.r-med { background: var(--warn); color: #1b1200; }
.risk-score.r-high { background: #e07020; }
.risk-score.r-crit { background: var(--bad); }

/* -------------------------------------------------------------- login etc */

.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(circle at 20% 15%, #1b2734 0%, #0a0f14 65%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 420px; background: var(--card); border-radius: 16px;
  padding: 28px; box-shadow: var(--shadow-lg);
}
.login-card h1 { margin: 10px 0 4px; font-size: 22px; }
.login-card .foot { margin-top: 18px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.hint {
  background: var(--bg); border-radius: 10px; padding: 11px 13px; font-size: 12.5px; color: var(--muted); margin-top: 16px;
}
.hint code { color: var(--ink); font-weight: 700; }
.code-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  font-family: var(--mono); font-size: 14px; background: var(--bg); padding: 12px; border-radius: 10px;
}
.otp-input {
  font-family: var(--mono); font-size: 26px; letter-spacing: .32em; text-align: center; padding: 12px !important;
}
.qr { display: block; margin: 0 auto 12px; background: #fff; padding: 10px; border-radius: 10px; width: max-content; }
.qr svg { display: block; }

/* ---------------------------------------------------- command palette */

.palette-backdrop {
  position: fixed; inset: 0; background: rgba(8, 12, 16, .55); z-index: 60;
  display: none; padding: 10vh 16px; overflow-y: auto;
}
.palette-backdrop.open { display: block; }
.palette {
  max-width: 560px; margin: 0 auto; background: var(--card);
  border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--line);
}
.palette input {
  border: none; border-bottom: 1px solid var(--line); border-radius: 0;
  padding: 14px 16px; font-size: 16px; background: var(--card);
}
.palette input:focus-visible { outline: none; }
.palette-results { max-height: 52vh; overflow-y: auto; }
.palette-results a {
  display: flex; gap: 10px; align-items: center; padding: 10px 16px;
  color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-2);
}
.palette-results a:last-child { border-bottom: none; }
.palette-results a:hover, .palette-results a.sel { background: var(--accent-soft); text-decoration: none; }
.palette-results a svg { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.palette-results .r-title { font-weight: 650; }
.palette-results .r-sub { font-size: 12px; color: var(--muted); }
.palette-results .r-kind {
  margin-left: auto; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; white-space: nowrap;
}
.palette-foot { padding: 8px 16px; background: var(--card-2); font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line-2); }
.palette-empty { padding: 26px 16px; text-align: center; color: var(--muted); }

/* ----------------------------------------------------------- drawer/panel */

.drawer-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 16, .45); z-index: 55; display: none; }
.drawer-backdrop.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%);
  background: var(--card); border-left: 1px solid var(--line); z-index: 56;
  transform: translateX(100%); transition: transform .18s ease; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-h { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.drawer-b { overflow-y: auto; flex: 1; }

/* ------------------------------------------------------------ phone view */

.phone-page { max-width: 600px; }
.phone-page .phone-job {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px; margin-bottom: 10px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
}
.phone-page .phone-job:hover { border-color: var(--accent); text-decoration: none; }
.phone-page .phone-job strong { display: block; font-size: 17px; letter-spacing: -.02em; }
.phone-page .phone-job .site { display: block; margin-top: 3px; font-weight: 650; }
.phone-page .phone-job .cust { display: block; margin: 2px 0 9px; color: var(--muted); font-size: 13px; }
.phone-page input, .phone-page select, .phone-page textarea { min-height: 44px; font-size: 16px; }
.phone-page .btn-block, .phone-page .field.full .btn { min-height: 48px; font-size: 16px; }
.big-actions { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.big-actions .btn { min-height: 62px; flex-direction: column; gap: 3px; font-size: 13.5px; }
.big-actions .btn svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------- utilities */

.overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 30; }
.overlay.show { display: block; }
.bar { height: 7px; border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent-2); }
.bar > i.hot { background: var(--bad); }
.bar > i.warm { background: var(--warn); }
.spark { display: flex; gap: 3px; align-items: flex-end; height: 44px; }
.spark i { flex: 1; background: var(--accent-2); border-radius: 2px 2px 0 0; min-height: 2px; }
.insp-photo {
  max-width: 220px; max-height: 160px; border-radius: 8px; display: block;
  margin: 6px 0 12px; object-fit: cover; border: 1px solid var(--line);
}
.thumb-row { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb-row img { width: 96px; height: 72px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.sig-pad {
  border: 1px dashed var(--line); border-radius: var(--radius-sm); background: var(--card-2);
  width: 100%; height: 140px; touch-action: none; display: block;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1200px) {
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
  .grid-sidebar { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .grid-4, .grid-5 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .week { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 40; width: 260px;
    transform: translateX(-105%); transition: transform .18s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .form-grid, .form-grid-3, .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: 1fr; }
  .content { padding: 14px 14px 50px; }
  .topbar { padding: 10px 14px; }
  .who .name, .who .role { display: none; }
  .week { grid-template-columns: 1fr; }
  .page-h h1 { font-size: 21px; }
  .search .kbd-hint { display: none; }
}
@media (max-width: 420px) {
  .big-actions { grid-template-columns: 1fr; }
  .code-list { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- print */

@media print {
  .sidebar, .topbar, .btn, .filters, .form-actions, .tabs, .no-print,
  .palette-backdrop, .drawer, .drawer-backdrop, .pager, .overlay { display: none !important; }
  .app { display: block; }
  .content { max-width: none; padding: 0; }
  .card, .job-hero { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  body { background: #fff; font-size: 12px; }
  a { color: inherit; text-decoration: none; }
  table { break-inside: auto; }
  tr { break-inside: avoid; }
}

/* ------------------------------------------------------- printed documents */

.doc {
  max-width: 800px; margin: 0 auto; padding: 32px; background: #fff; color: #12202e;
  font-size: 13.5px; line-height: 1.5;
}
.doc-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; border-bottom: 3px solid #c45c14; padding-bottom: 14px; }
.doc-head h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.doc-head .co { text-align: right; font-size: 12.5px; }
.doc-head .co strong { font-size: 15px; display: block; }
.doc-meta { display: flex; gap: 32px; flex-wrap: wrap; margin: 18px 0; }
.doc-meta section { min-width: 180px; }
.doc-meta h3 { margin: 0 0 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: #5b6b7c; }
.doc table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.doc th { background: #f2f5f7; font-size: 10.5px; border-bottom: 2px solid #12202e; color: #12202e; }
.doc th, .doc td { padding: 7px 9px; border-bottom: 1px solid #e3e9ee; }
.doc tfoot td { border-bottom: none; }
.doc .totals { margin-left: auto; width: 290px; margin-top: 14px; }
.doc .totals td { padding: 5px 9px; }
.doc .totals tr.grand td { border-top: 2px solid #12202e; font-weight: 800; font-size: 15px; }
.doc-foot { margin-top: 26px; padding-top: 12px; border-top: 1px solid #d5dde6; font-size: 11.5px; color: #5b6b7c; }
.doc-notes { margin-top: 18px; white-space: pre-wrap; }
.doc .sign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 30px; }
.doc .sign-box { border-top: 1px solid #12202e; padding-top: 5px; font-size: 11.5px; color: #5b6b7c; }
.doc .stamp {
  display: inline-block; border: 3px solid #b42318; color: #b42318; padding: 5px 13px;
  border-radius: 7px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; transform: rotate(-3deg);
}
.doc .stamp.ok { border-color: #1f7a4d; color: #1f7a4d; }
.doc-actions { max-width: 800px; margin: 16px auto 0; display: flex; gap: 8px; justify-content: flex-end; }

/* scaffold tag, printed and cut out for the site */
.scaff-tag {
  width: 360px; border: 3px solid #12202e; border-radius: 10px; padding: 14px; margin: 0 auto;
  background: #fff; color: #12202e;
}
.scaff-tag h2 { margin: 0 0 2px; font-size: 19px; text-align: center; text-transform: uppercase; letter-spacing: .05em; }
.scaff-tag .band { background: #1f7a4d; color: #fff; text-align: center; font-weight: 800; padding: 5px; border-radius: 5px; margin-bottom: 10px; }
.scaff-tag .band.bad { background: #b42318; }
.scaff-tag table { font-size: 12px; }
.scaff-tag td { padding: 4px 5px; border-bottom: 1px solid #e3e9ee; }

.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;
}
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.prose ol, .prose ul { margin: 0; padding-left: 1.2em; }
.prose li { margin: 0 0 8px; }
.prose p { margin: 0 0 10px; }
.phone-links { display: flex; gap: 8px; flex-wrap: wrap; }
.phone-page .sig-pad { width: 100%; height: 110px; background: var(--card-2); border: 1px dashed var(--line); border-radius: 8px; touch-action: none; }
.shortcuts-backdrop {
  position: fixed; inset: 0; background: rgba(16,24,32,.45); z-index: 80;
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.shortcuts-backdrop.open, .shortcuts-backdrop:not([hidden]) { display: flex; }
.shortcuts-backdrop[hidden] { display: none !important; }
.shortcuts-panel {
  width: min(420px, 100%); background: var(--card); color: var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden;
}
.tight-list { margin: 0; padding-left: 1.2em; }
.tight-list li { margin: 0 0 8px; }
