/* ---------- theme ----------
   Light is the default. Dark applies when Windows is set to dark (unless the person chose Light),
   or when they chose Dark in the account menu (theme.js sets data-theme on <html>). */
:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --hover: #f9fafb;
  --subtle: #f3f4f6;
  --subtle-2: #fafafa;
  --tint-base: #ffffff;       /* person colours are mixed with this for soft backgrounds */
  --ink: #111827;
  --ink-2: #374151;
  --ink-3: #4b5563;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #2563eb;
  --accent-solid: #2563eb;    /* filled buttons/badges with white text */
  --accent-hover: #1d4ed8;
  --accent-soft: #eff4ff;
  --accent-soft-2: #dfe8ff;
  --accent-line: #c7d2fe;
  --accent-line-2: #93b4ff;
  --on-accent: #ffffff;
  --danger: #dc2626;
  --danger-solid: #dc2626;
  --danger-soft: #fef2f2;
  --danger-soft-2: #fee2e2;
  --danger-line: #fecaca;
  --danger-line-2: #fca5a5;
  --ok: #15803d;
  --ok-soft: #ecfdf3;
  --warn-bg: #fffbeb;
  --warn-line: #fcd34d;
  --warn-ink: #78350f;
  --toast-bg: #111827;
  --toast-ink: #ffffff;
  --overlay: rgba(17, 24, 39, 0.4);
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.06), 0 1px 3px rgba(17, 24, 39, 0.08);
  --shadow-pop: 0 10px 30px rgba(17, 24, 39, 0.18);
  --radius: 8px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1115; --surface: #171a21; --hover: #1f232c; --subtle: #1c2028; --subtle-2: #191c23; --tint-base: #171a21;
    --ink: #e5e7eb; --ink-2: #cbd5e1; --ink-3: #a3acb9; --muted: #9ca3af; --line: #2a2f3a; --line-strong: #3a4150;
    --accent: #5b93ff; --accent-solid: #2f6be0; --accent-hover: #2559c4; --accent-soft: #1b2a4a; --accent-soft-2: #233863; --accent-line: #2f4a80; --accent-line-2: #4a6db0;
    --on-accent: #ffffff;
    --danger: #f87171; --danger-solid: #dc2626; --danger-soft: #2a1618; --danger-soft-2: #3a1a1d; --danger-line: #5c2a2e; --danger-line-2: #8a3a3f;
    --ok: #4ade80; --ok-soft: #12291c; --warn-bg: #2a2410; --warn-line: #7a5f12; --warn-ink: #fcd34d;
    --toast-bg: #e5e7eb; --toast-ink: #111827; --overlay: rgba(0, 0, 0, 0.6);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45); --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115; --surface: #171a21; --hover: #1f232c; --subtle: #1c2028; --subtle-2: #191c23; --tint-base: #171a21;
  --ink: #e5e7eb; --ink-2: #cbd5e1; --ink-3: #a3acb9; --muted: #9ca3af; --line: #2a2f3a; --line-strong: #3a4150;
  --accent: #5b93ff; --accent-solid: #2f6be0; --accent-hover: #2559c4; --accent-soft: #1b2a4a; --accent-soft-2: #233863; --accent-line: #2f4a80; --accent-line-2: #4a6db0;
  --on-accent: #ffffff;
  --danger: #f87171; --danger-solid: #dc2626; --danger-soft: #2a1618; --danger-soft-2: #3a1a1d; --danger-line: #5c2a2e; --danger-line-2: #8a3a3f;
  --ok: #4ade80; --ok-soft: #12291c; --warn-bg: #2a2410; --warn-line: #7a5f12; --warn-ink: #fcd34d;
  --toast-bg: #e5e7eb; --toast-ink: #111827; --overlay: rgba(0, 0, 0, 0.6);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45); --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h2 { font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.loading { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

/* ---------- buttons & inputs ---------- */

.btn {
  border: 1px solid transparent; border-radius: 6px; padding: 7px 14px; font-weight: 600; cursor: pointer;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap; transition: background 0.1s, border-color 0.1s;
}
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.btn:hover { background: var(--accent-soft-2); }
.btn.primary { background: var(--accent-solid); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--hover); border-color: var(--line-strong); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger-solid { background: var(--danger-solid); color: var(--on-accent); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.big { padding: 10px 16px; font-size: 15px; width: 100%; }
.btn:disabled { opacity: 0.6; cursor: default; }

.icon-btn {
  width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line); cursor: pointer;
  background: var(--surface); color: var(--ink); font-size: 18px; line-height: 1; display: grid; place-items: center; padding-bottom: 2px;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn.sm { width: 26px; height: 26px; font-size: 16px; }

input, select, textarea {
  width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 13px; color: var(--ink-2); padding: 0; margin-bottom: 6px; }
.stack { display: grid; gap: 12px; }
.form-error { margin: 0; color: var(--danger); font-weight: 600; font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
kbd { font-family: inherit; font-size: 12px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface); }
code { font-family: Consolas, ui-monospace, monospace; font-size: 13px; background: var(--subtle); border-radius: 4px; padding: 1px 5px; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 52px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.brand-company { font-weight: 400; font-size: 13px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.brand-company:empty { display: none; }
pre.cmd { background: var(--hover); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 4px 0;
  font-family: Consolas, ui-monospace, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; user-select: all; }
.nav { display: flex; gap: 2px; height: 100%; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav a {
  display: flex; align-items: center; padding: 0 14px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
.me { margin-left: auto; position: relative; }
/* "Online now": who else has Crewboard open */
.presence { margin-left: auto; position: relative; }
.presence + .me { margin-left: 10px; }
.presence-btn {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 10px 3px 8px; cursor: pointer; font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.presence-btn:hover { background: var(--hover); }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
.presence-avatars { display: flex; }
.presence-avatar {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700;
  background: var(--c, var(--muted)); color: #fff; border: 2px solid var(--surface); flex: none;
}
.presence-avatars .presence-avatar + .presence-avatar { margin-left: -7px; }
.presence-avatar.more { background: var(--subtle); color: var(--ink-2); }
.presence-list { right: 0; left: auto; min-width: 240px; }
.presence-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px 10px; font-size: 13px; }
.presence-row .presence-avatar { border-color: transparent; margin-top: 2px; }
@media (max-width: 1279px) { .presence-count { display: none; } .presence-btn { padding: 3px 6px; } }
.me-btn {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 10px 3px 3px; cursor: pointer; font-weight: 600;
}
.me-btn:hover { background: var(--hover); }
.me-avatar { width: 26px; height: 26px; border-radius: 4px; background: var(--accent-solid); color: var(--on-accent); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.role {
  display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
  padding: 1px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent);
}
.role.planner { background: var(--ok-soft); color: var(--ok); }
.role.viewer { background: var(--subtle); color: var(--ink-3); }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow-pop); padding: 4px; min-width: 210px; display: grid;
}
.menu button { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--subtle); }
.menu-info { padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

.menu-theme { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; font-size: 13px; }
.menu .seg { display: flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.menu .seg button { border-radius: 0; padding: 3px 8px; font-size: 12px; }
.menu .seg button + button { border-left: 1px solid var(--line-strong); }
.menu .seg button[aria-pressed="true"] { background: var(--accent-solid); color: var(--on-accent); }

main { padding: 16px 24px 32px; }

.update-banner {
  display: grid; gap: 2px; margin: 12px 24px 0; padding: 10px 14px; border-radius: 8px;
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink);
}
.update-banner span { font-size: 13px; }

/* ---------- calendar page ---------- */

.cal-layout {
  display: grid; grid-template-columns: var(--crew-w, 230px) minmax(0, 1fr) var(--panel-w, 330px); gap: 16px; align-items: start;
  position: relative;
}
/* Drag handles in the gaps between the columns (column widths are set in --crew-w / --panel-w). */
.col-resizer {
  position: absolute; top: 0; bottom: 0; width: 14px; z-index: 5; cursor: col-resize; touch-action: none;
  border-radius: 4px; outline: none;
}
.col-resizer::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 6px; width: 2px; border-radius: 2px; background: transparent;
  transition: background 0.15s;
}
.col-resizer:hover::after, .col-resizer:focus-visible::after, .resizing .col-resizer::after { background: var(--accent-line); }
.col-resizer[data-resize="crew"] { left: calc(var(--crew-w, 230px) + 1px); }
.col-resizer[data-resize="panel"] { right: calc(var(--panel-w, 330px) + 1px); }
.cal-layout.resizing, .cal-layout.resizing * { cursor: col-resize !important; user-select: none; }

/* crew list (left) */
.crew { padding: 14px; position: sticky; top: 68px; display: grid; gap: 10px; }
.crew-head { display: flex; align-items: baseline; justify-content: space-between; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.crew-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; max-height: calc(100vh - 340px); min-height: 40px; overflow: auto; }

.chip {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); user-select: none; box-shadow: inset 3px 0 0 var(--c);
}
.chip:hover { background: var(--hover); }
.can-edit .chip { cursor: grab; touch-action: none; }
.chip.armed { border-color: var(--accent); background: var(--accent-soft); }
.chip .name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .count { font-size: 12px; color: var(--muted); min-width: 20px; text-align: right; }
.chip.busy { opacity: 0.45; background: var(--hover); box-shadow: none; }
.chip.busy .avatar { filter: grayscale(1); }
.chip .tag { font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.can-edit.picking .chip:not(.busy) { cursor: copy; }
.can-edit.picking .chip:not(.busy):hover::after {
  content: 'Add'; position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--accent-solid); color: var(--on-accent); font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 4px;
}

/* initials avatar in each person's colour */
.avatar {
  width: 26px; height: 26px; border-radius: 4px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--c) 28%, var(--tint-base)); border: 1px solid var(--c);
  font-size: 11px; font-weight: 700; color: var(--ink);
}

.quick-add { display: flex; gap: 6px; }
.quick-add input { padding: 6px 8px; }

.trash { border: 1px dashed var(--line-strong); border-radius: 6px; padding: 8px; text-align: center; color: var(--muted); font-size: 12px; }
.is-dragging-assignment .trash, .is-dragging-job .trash { border-color: var(--danger-line-2); color: var(--danger); background: var(--danger-soft); }
.trash.drop-over { background: var(--danger-soft-2); border-style: solid; }

.empty { text-align: center; padding: 14px 8px; color: var(--muted); font-size: 13px; }

/* month grid (middle) */
.cal { padding: 14px; }
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cal-head h1 { font-size: 20px; flex: 1; min-width: 0; }
.cal-nav { display: flex; gap: 4px; }

.stamp-banner {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 6px 10px; border-radius: 6px;
  background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 13px;
}
.stamp-banner .btn { margin-left: auto; }

.weekdays, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays div { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 6px 6px; }
.grid { border-top: 1px solid var(--line); border-left: 1px solid var(--line); }

.day {
  position: relative; min-height: 110px; padding: 4px; cursor: pointer; background: var(--surface);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px; outline: 2px solid transparent; outline-offset: -2px;
}
.day:hover { background: var(--hover); }
.day.weekend { background: var(--subtle-2); }
.day.out .num, .day.out .pills { opacity: 0.45; }
.day.today .num { background: var(--accent-solid); color: var(--on-accent); }
.day.selected { outline-color: var(--accent); background: var(--accent-soft); }
.day.drop-over { outline-color: var(--accent); background: var(--accent-soft-2); }
.stamping .day { cursor: copy; }
.day-top { display: flex; align-items: center; justify-content: space-between; }
.num { font-size: 12px; font-weight: 600; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 4px; display: grid; place-items: center; }
.day-count { font-size: 11px; color: var(--muted); padding-right: 2px; }

.pills { display: flex; flex-direction: column; gap: 2px; }
.pill {
  position: relative; display: flex; align-items: center; gap: 4px; padding: 1px 4px 1px 6px; border-radius: 3px;
  background: color-mix(in srgb, var(--c) 18%, var(--tint-base)); box-shadow: inset 3px 0 0 var(--c);
  font-size: 12px; user-select: none;
}
.can-edit .pill { cursor: grab; touch-action: none; }
.pill .ini { display: none; font-size: 10px; font-weight: 700; }
.pill .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.pill .sh { font-size: 10px; font-weight: 600; color: var(--muted); flex: none; }
.pill.has-job .nm { font-weight: 600; }
.pill .x {
  position: absolute; right: 1px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; display: grid; place-items: center; padding: 0 0 1px;
  border: 0; border-radius: 3px; background: var(--surface); cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1; opacity: 0;
}
.pill:hover .x, .pill .x:focus-visible { opacity: 1; }
.pill .x:hover { color: var(--on-accent); background: var(--danger-solid); }
.grid.highlighting .pill:not(.hl), .grid.highlighting .jobpill:not(.hl) { opacity: 0.25; }
.grid.highlighting .pill.hl { outline: 1px solid var(--c); }
.grid.highlighting .jobpill.hl { outline: 1px solid var(--accent); }

/* one entry per job on the calendar: name, AM/PM, a dot per team member, head count */
.jobpill {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1px 4px; padding: 1px 4px 2px; border-radius: 3px;
  background: color-mix(in srgb, var(--jc, var(--accent)) 13%, var(--tint-base));
  border: 1px solid color-mix(in srgb, var(--jc, var(--accent)) 40%, var(--tint-base));
  box-shadow: inset 4px 0 0 var(--jc, var(--accent));
  font-size: 12px; user-select: none;
}
.can-edit .jobpill { cursor: grab; touch-action: none; }
.jobpill .jt { flex: 1 0 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; padding-left: 3px; }
.jobpill .sh { font-size: 10px; font-weight: 600; color: var(--muted); flex: none; padding-left: 3px; }
.jobpill .dots { display: flex; gap: 1px; flex: 1; min-width: 0; overflow: hidden; padding-left: 3px; }
.jobpill .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.jobpill .jn { font-size: 11px; color: var(--muted); flex: none; min-width: 10px; text-align: right; }
.jobpill .dn { font-size: 10px; font-weight: 600; color: var(--accent); flex: none; padding-left: 3px; }

/* multi-day jobs in the day panel */
.series-tag { font-size: 12px; font-weight: 600; color: var(--accent); }
.series-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.series-row input { width: auto; flex: 1 0 135px; min-width: 135px; padding: 4px 6px; font-size: 13px; }
.jobpill.drop-over { outline: 2px solid var(--accent); outline-offset: 0; background: var(--accent-soft); }
.is-dragging-worker .jobpill, .is-dragging-assignment .jobpill { border-style: dashed; border-color: var(--accent-line-2); }
.jobpill.flash { animation: member-flash 1.2s ease-out; }

/* dragging */
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; opacity: 0.9; box-shadow: var(--shadow-pop); margin: 0; }
.drag-ghost .x { display: none; }
.dragging { opacity: 0.3; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }

/* day panel (right) */
.day-panel { padding: 14px; position: sticky; top: 68px; max-height: calc(100vh - 84px); overflow: auto; }
.panel-empty { text-align: center; padding: 32px 8px; color: var(--muted); }
.panel-empty h3 { color: var(--ink); margin-bottom: 4px; font-size: 15px; }
.panel-empty p { margin: 0; font-size: 13px; }

.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.panel-weekday { font-size: 12px; font-weight: 600; color: var(--muted); }
.panel-head h2 { font-size: 20px; }
.panel-sub { font-size: 12px; color: var(--muted); }

.shift-summary { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.shift-summary span { border: 1px solid var(--line); border-radius: 4px; padding: 1px 8px; font-size: 12px; }
.shift-summary span.zero { color: var(--muted); }

.job-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.job-card {
  border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: grid; gap: 8px;
  background: var(--surface); box-shadow: inset 3px 0 0 var(--c);
}
.job-card > * { min-width: 0; }
.job-card.flash { animation: card-flash 1.2s ease-out; }
.job-top { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.job-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.saved { font-size: 12px; color: var(--ok); opacity: 0; transition: opacity 0.2s; }
.saved.show { opacity: 1; }
.x-btn {
  border: 1px solid var(--line); background: var(--surface); width: 24px; height: 24px; border-radius: 4px; cursor: pointer; flex: none;
  color: var(--muted); font-size: 15px; line-height: 1; display: grid; place-items: center; padding: 0 0 2px;
}
.x-btn:hover { background: var(--danger-solid); border-color: var(--danger-solid); color: var(--on-accent); }
.job-input { padding: 6px 8px; }
.job-text { font-weight: 600; }
.shift-badge { font-size: 12px; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; white-space: nowrap; }

.shift-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.shift-pick label { position: relative; display: block; cursor: pointer; color: var(--ink); font-size: 12px; font-weight: 400; }
.shift-pick label + label { border-left: 1px solid var(--line-strong); }
.shift-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.shift-pick span { display: block; text-align: center; padding: 5px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shift-pick span:hover { background: var(--hover); }
.shift-pick input:checked + span { background: var(--accent-solid); color: var(--on-accent); font-weight: 600; }
.shift-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

.time-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.time-row input { width: auto; flex: 1; min-width: 0; padding: 4px 6px; font-size: 13px; }

/* job groups in the day panel */
.new-job { width: 100%; margin-bottom: 10px; }
.job-card { box-shadow: inset 4px 0 0 var(--jc, var(--accent)); background: color-mix(in srgb, var(--jc, var(--accent)) 6%, var(--surface)); }
.job-colors { display: flex; flex-wrap: wrap; gap: 5px; }
.job-colors label { position: relative; cursor: pointer; display: block; }
.job-colors input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.job-colors span { display: block; width: 18px; height: 18px; border-radius: 4px; background: var(--c); }
.job-colors input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.job-colors input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
/* "No colour": a grey swatch with a diagonal line */
.job-colors .no-color span {
  --c: #9ca3af; background: linear-gradient(135deg, transparent 45%, var(--danger) 45%, var(--danger) 55%, transparent 55%), var(--subtle);
  border: 1px solid var(--line-strong);
}
.job-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--jc); margin-right: 6px; vertical-align: 0; }
.job-row td.jn { box-shadow: inset 4px 0 0 var(--jc); padding-left: 12px; }
.job-title { padding: 5px 8px; font-weight: 600; flex: 1; min-width: 0; }
.job-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.members { display: flex; flex-wrap: wrap; gap: 4px; min-height: 24px; align-items: center; }
.member {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px 2px 2px; border-radius: 4px;
  background: color-mix(in srgb, var(--c) 14%, var(--tint-base)); border: 1px solid color-mix(in srgb, var(--c) 45%, var(--tint-base));
  font-size: 12px; user-select: none; max-width: 100%;
}
.can-edit .member { cursor: grab; touch-action: none; }
.member .avatar { width: 20px; height: 20px; font-size: 9px; border-radius: 3px; }
.member .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .x { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; padding: 0 2px; border-radius: 3px; }
.member .x:hover { background: var(--danger-solid); color: var(--on-accent); }
.member.flash { animation: member-flash 1.2s ease-out; }
.add-person { padding: 4px 8px; font-size: 13px; color: var(--muted); }
.unassigned {
  margin-top: 10px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 6px; display: grid; gap: 6px; background: var(--subtle-2);
}
.job-card.drop-over, .unassigned.drop-over { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--accent-soft); }
.is-dragging-worker .job-card, .is-dragging-assignment .job-card, .is-dragging-assignment .unassigned { border-style: dashed; border-color: var(--accent-line-2); }

/* ---------- jobs page ---------- */

.jobs-page { max-width: 1200px; margin: 0 auto; }
.jobs-page .card { padding: 18px; }
.jobs-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.jobs-filters input[type="search"] { width: 240px; }
.jobs-filters select { width: auto; }
.jobs-filters .seg { display: flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.jobs-filters .seg button { border: 0; background: var(--surface); padding: 6px 12px; cursor: pointer; font-size: 13px; }
.jobs-filters .seg button + button { border-left: 1px solid var(--line-strong); }
.jobs-filters .seg button:hover { background: var(--hover); }
.jobs-filters .seg button[aria-pressed="true"] { background: var(--accent-solid); color: var(--on-accent); }
.jobs-summary { margin-bottom: 8px; min-height: 18px; }

.jobs-table { width: 100%; border-collapse: collapse; }
.jobs-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.jobs-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.job-row { cursor: pointer; }
.job-row:hover, .job-row:focus-visible { background: var(--hover); }
.job-row.now { box-shadow: inset 3px 0 0 var(--accent); }
.job-row.past { opacity: 0.7; }
.job-row .jd > b, .job-row .jd > span, .job-row .jn > b { display: block; }
.jobs-table .jd { white-space: nowrap; width: 150px; }
.jobs-table .js { white-space: nowrap; width: 120px; }
.jobs-table .js span { display: block; }
.jobs-table .jteam { display: flex; flex-wrap: wrap; gap: 4px; }
.jobs-table .jo { width: 60px; text-align: right; }
.now-tag { color: var(--accent); font-weight: 600; }
.warn-tag { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 4px; padding: 0 6px; }

/* ---------- team page ---------- */

.team-page { display: grid; gap: 16px; max-width: 1000px; margin: 0 auto; }
.team-page .card { padding: 18px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.card-head p { margin: 2px 0 0; font-size: 13px; }

.worker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.worker-card {
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; font: inherit; color: inherit;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: inset 3px 0 0 var(--c);
}
button.worker-card { cursor: pointer; }
button.worker-card:hover { background: var(--hover); border-color: var(--line-strong); }
.worker-card .avatar { width: 32px; height: 32px; font-size: 12px; }
.worker-card .who { display: grid; min-width: 0; }
.worker-card .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.worker-card.hidden-worker { opacity: 0.55; }

.roles-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.table-wrap { overflow-x: auto; }
.users { width: 100%; border-collapse: collapse; }
.users th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.users td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.users select { width: auto; padding: 4px 8px; }
.users .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- dialogs ---------- */

dialog.dlg {
  border: 1px solid var(--line); border-radius: 10px; padding: 0; width: min(440px, calc(100vw - 32px));
  box-shadow: var(--shadow-pop); color: var(--ink);
}
dialog.dlg::backdrop { background: var(--overlay); }
.dlg-form { padding: 20px; display: grid; gap: 14px; }
.dlg-body { display: grid; gap: 12px; }
.dlg-text { margin: 0; color: var(--muted); }
.dlg-actions { display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }

.color-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.color-pick label { cursor: pointer; position: relative; display: block; }
.color-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.color-pick span { display: block; width: 26px; height: 26px; border-radius: 4px; background: var(--c); }
.color-pick input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.color-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; color: var(--ink); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.pw-row { display: flex; gap: 6px; }
.creds {
  background: var(--hover); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: 0;
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: baseline; word-break: break-all;
}
.creds dt { font-size: 12px; color: var(--muted); }
.dlg-body > .btn { justify-self: start; }
.creds dd { margin: 0; user-select: all; }
.creds code { background: none; padding: 0; font-size: 14px; }
.creds code.big { font-size: 18px; letter-spacing: 0.04em; }

/* ---------- users, settings, audit ---------- */

.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 4px; margin-left: 4px;
  background: var(--subtle); color: var(--ink-3); border: 1px solid var(--line); vertical-align: 1px; }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.badge.off { background: var(--subtle); color: var(--muted); }
.users tr.inactive td { opacity: 0.6; }
.users .actions { flex-wrap: wrap; }
label small.hint { font-weight: 400; }
.role-picker { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; }
.role-picker[disabled] { opacity: 0.6; }
.role-option { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  cursor: pointer; font-weight: 400; color: var(--ink); }
.role-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.role-option input { width: auto; margin-top: 3px; accent-color: var(--accent); }
.role-option span { display: grid; gap: 1px; }
.settings-form { display: grid; gap: 18px; max-width: 640px; }
.setting { display: grid; gap: 6px; }
.setting label:not(.check) { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.setting select { width: auto; min-width: 200px; }
.audit-table td { font-size: 13px; }
.audit-table .jd { white-space: nowrap; }
.audit-changes { margin: 0; padding-left: 16px; }
.audit-changes li { margin: 1px 0; }
.audit-warn { box-shadow: inset 3px 0 0 var(--danger); }
.audit-more { display: flex; justify-content: center; margin-top: 12px; }
.alert { padding: 8px 12px; border-radius: 6px; font-size: 13px; }
.alert.info { background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--ink); }
.menu-info code { font-size: 12px; }
.menu-info b { color: var(--ink); }

/* ---------- toasts ---------- */

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 6px; z-index: 2000; justify-items: center; pointer-events: none; }
.toast { background: var(--toast-bg); color: var(--toast-ink); padding: 8px 14px; border-radius: 6px; box-shadow: var(--shadow-pop); transition: opacity 0.2s; }
.toast.error { background: var(--danger-solid); }
.toast.out { opacity: 0; }

/* ---------- sign-in ---------- */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(380px, 100%); padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); display: grid; gap: 6px; }
.auth-card form { margin-top: 12px; }
.auth-card p { margin: 0; }
.auth-card h1 { font-size: 20px; }
.auth-brand { font-weight: 700; color: var(--accent); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; }
.auth-card { width: min(420px, 100%); }
.auth-card .stack .btn.ghost { width: 100%; }
.remember-hint { margin-top: -6px; font-size: 12px; color: var(--muted); }
.auth-footer { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.auth-pref { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.auth-footer .seg, .menu .seg { display: flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.auth-footer .seg button { border: 0; border-radius: 0; background: var(--surface); padding: 3px 9px; font-size: 12px; cursor: pointer; color: var(--ink); }
.auth-footer .seg button + button { border-left: 1px solid var(--line-strong); }
.auth-footer .seg button[aria-pressed="true"] { background: var(--accent-solid); color: var(--on-accent); }

@keyframes card-flash {
  0% { box-shadow: inset 4px 0 0 var(--jc, var(--accent)), 0 0 0 3px var(--accent); }
  100% { box-shadow: inset 4px 0 0 var(--jc, var(--accent)), 0 0 0 0 transparent; }
}
@keyframes member-flash {
  0% { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- medium & small screens ---------- */

/* Not enough room for three columns: the day panel opens as a drawer on the right. */
@media (max-width: 1279px) {
  .cal-layout { grid-template-columns: var(--crew-w, 210px) minmax(0, 1fr); }
  .col-resizer[data-resize="crew"] { left: calc(var(--crew-w, 210px) + 1px); }
  .col-resizer[data-resize="panel"] { display: none; } /* the day panel is a drawer here */
  .day-panel {
    position: fixed; top: 60px; right: 12px; bottom: 12px; z-index: 30; max-height: none;
    width: min(340px, calc(100vw - 24px)); box-shadow: var(--shadow-pop);
  }
  .cal-layout:not(.picking) .day-panel { display: none; }
}

@media (max-width: 900px) {
  .topbar { padding: 0 12px; gap: 12px; }
  .me-name { display: none; }
  main { padding: 12px; }
  .update-banner { margin: 12px 12px 0; }
  .cal-layout { grid-template-columns: 1fr; }
  .col-resizer { display: none !important; }
  .crew { position: static; }
  .crew-list { display: flex; overflow-x: auto; max-height: none; padding-bottom: 4px; }
  .chip { flex: none; }
  .cal { padding: 10px; }
  .cal-head h1 { font-size: 17px; }
  .weekdays div { padding: 0 2px 4px; font-size: 11px; }
  .day { min-height: 76px; padding: 2px; }
  .pill { justify-content: center; padding: 1px 2px; box-shadow: none; }
  .pill .ini { display: block; }
  .pill .nm, .pill .x, .pill .sh { display: none; }
  .jobpill { padding: 1px 2px; box-shadow: none; justify-content: center; }
  .jobpill { flex-wrap: nowrap; }
  .jobpill .jt, .jobpill .sh, .jobpill .dots { display: none; }
  .day-count { display: none; }
  .users .actions { flex-direction: column; align-items: flex-end; }
  .jobs-table thead { display: none; }
  .jobs-table, .jobs-table tbody, .job-row, .job-row td { display: block; width: auto; }
  .job-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .job-row td { border: 0; padding: 2px 4px; }
  .jobs-table .jo { display: none; }
  .jobs-filters input[type="search"] { width: 100%; }
}

.role { white-space: nowrap; }
.me-name { white-space: nowrap; }
.role.technician { background: var(--warn-bg); color: var(--warn-ink); }

.pw-choice { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; }
.pw-choice legend { font-weight: 600; font-size: 13px; color: var(--ink-2); margin-bottom: 2px; }
.pw-choice label.check { font-weight: 400; }

.log-filters select { max-width: 220px; }
.work-tabs { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.work-tabs button { border: 0; background: var(--surface); padding: 7px 18px; cursor: pointer; font-weight: 600; }
.work-tabs button + button { border-left: 1px solid var(--line-strong); }
.work-tabs button[aria-pressed="true"] { background: var(--accent-solid); color: var(--on-accent); }

/* "N entries are not sorted yet" on the Projects page */
.unsorted-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 12px; padding: 10px 14px;
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); border-radius: var(--radius);
  text-decoration: none; font-size: 14px;
}
.unsorted-box:hover { filter: brightness(0.97); }
.unsorted-go { margin-left: auto; font-weight: 600; }
.entry-target.unsorted { color: var(--warn-ink); }
.nav-badge {
  margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger-solid); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
button.unsorted-box, a.unsorted-box { cursor: pointer; }

/* ---------- settings page ---------- */

.settings-page { display: grid; gap: 16px; max-width: 1000px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 10px; }
.stat { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--subtle); }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 20px; }
.usage-h { font-size: 14px; margin: 18px 0 6px; }
.usage-table th.num, .usage-table td.num { text-align: right; white-space: nowrap; }
@media (max-width: 900px) {
  .usage-table thead { display: table-header-group; }
  .usage-table { display: table; width: 100%; }
  .usage-table tbody { display: table-row-group; }
  .usage-table tr { display: table-row; }
  .usage-table td, .usage-table th { display: table-cell; padding: 6px 4px; }
  .setting label:not(.check) { flex-direction: column; align-items: stretch; }
  .setting select { min-width: 0; width: 100%; }
}

/* ---------- field page (technician's phone) ---------- */

main.main-field { padding: 12px 14px 40px; }
.field { max-width: 560px; margin: 0 auto; display: grid; gap: 10px; }
.field-hello { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 17px; }
.field-hello .muted { font-size: 14px; }
.field-warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; }
.field-label { display: block; font-size: 14px; margin-top: 6px; }
.field-select, .field-note { font-size: 16px; padding: 12px; border-radius: 10px; } /* 16px: phones don't zoom in */
.field-select { min-height: 52px; }
.field-select.empty-choice { border-color: var(--accent); }
.field-note { resize: vertical; min-height: 96px; }
.field-photo-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.field-big-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 96px;
  border: 2px dashed var(--accent-line); border-radius: 12px; background: var(--accent-soft); color: var(--accent);
  font-size: 15px; font-weight: 600; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
}
.field-big-btn:active { background: var(--accent-soft-2, var(--accent-soft)); transform: scale(0.98); }
.field-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.field-thumbs:empty { display: none; }
.field-thumb { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--subtle); }
.field-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.field-thumb-x {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
}
.field-thumb-count { grid-column: 1 / -1; }
.btn.field-save { min-height: 56px; font-size: 18px; border-radius: 12px; margin-top: 6px; }
.btn.field-save.saved { background: var(--ok); }
.field-h2 { font-size: 16px; margin-top: 18px; }
.field-list { display: grid; gap: 10px; }

/* ---------- entries (photos + note) ---------- */

.entry { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 6px; }
.entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 14px; }
.entry-actions { margin-left: auto; display: flex; gap: 6px; }
.entry-target { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.entry-note { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.entry-photo { position: relative; padding: 0; border: 0; border-radius: 6px; overflow: hidden; aspect-ratio: 1; background: var(--subtle); cursor: zoom-in; }
.entry-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-badge { position: absolute; left: 4px; bottom: 4px; font-size: 10px; font-weight: 600; background: rgba(0, 0, 0, 0.6); color: #fff; border-radius: 3px; padding: 1px 5px; }
.timeline { display: grid; gap: 10px; }
.timeline-day { font-size: 13px; color: var(--muted); margin-top: 8px; }
.load-more { text-align: center; margin-top: 12px; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--muted); text-decoration: none; font-weight: 600; }
.back-link:hover { color: var(--ink); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.inline-label input { width: auto; }
.projects-table td .muted.small { display: block; }

dialog.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(0, 0, 0, 0.92); }
dialog.lightbox::backdrop { background: rgba(0, 0, 0, 0.92); }
.lightbox img { position: absolute; inset: 0 0 52px; margin: auto; max-width: 100%; max-height: calc(100% - 52px); object-fit: contain; }
.lb-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 12px; color: #fff; font-size: 13px; }
.lb-caption { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 72px; border: 0; background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 36px; cursor: pointer; border-radius: 8px; }
.lb-nav.prev { left: 8px; }
.lb-nav.next { right: 8px; }

/* job card on the calendar: its project and what was sent */
.job-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 4px 0 2px; }
.job-meta:empty { display: none; }
.job-no { font: 600 12px/1.6 Consolas, ui-monospace, monospace; color: var(--ink-2); background: var(--subtle); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.po-chip { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); border-radius: 999px; padding: 0 4px 0 8px; line-height: 1.6; }
.po-chip .po-name { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.po-chip .po-name:hover { text-decoration: underline; }
.po-chip .x { background: none; border: 0; color: inherit; cursor: pointer; padding: 0 2px; font-size: 14px; line-height: 1; opacity: 0.7; }
.po-chip .x:hover { opacity: 1; }
.po-add { width: 90px; padding: 1px 6px; font-size: 12px; border-radius: 999px; }
.leave-section { margin-top: 12px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius); display: grid; gap: 6px; justify-items: start; }
.leave-member { opacity: 0.85; border-style: dashed; }
.pill.leave-pill { opacity: 0.7; border-style: dashed; background: var(--subtle); }
.pill.leave-pill .lv { font-size: 10px; text-transform: uppercase; color: var(--warn-ink); margin-left: auto; }
.chip .leave-tag { color: var(--warn-ink); }
.warn-text { color: var(--warn-ink); }
.job-note-row { display: grid; gap: 2px; font-weight: 400; margin: 6px 0; }
.job-note-row textarea { resize: vertical; min-height: 44px; max-height: 220px; font-size: 13px; padding: 6px 8px; field-sizing: content; } /* grows with the text */
.job-note-text { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.job-note-line { display: block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.field-job-note { margin: -2px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--subtle); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.project-row { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 6px 0; }
.project-row span { font-size: 12px; color: var(--muted); min-width: 44px; }
.project-row select { flex: 1; min-width: 0; padding: 4px 6px; font-size: 13px; }
.entries-toggle { margin-top: 8px; width: 100%; }
.job-entries { display: grid; gap: 6px; margin-top: 6px; }
.job-entries .entry { padding: 8px; font-size: 13px; }
.job-entries .entry-photos { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }

@media (max-width: 900px) {
  .nav { overflow-x: auto; scrollbar-width: none; }
  .nav a { padding: 0 10px; white-space: nowrap; }
  .brand-company { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
