/* ============================================================
   RapidCrews v2 — design system
   Clean light SaaS · RSGx red accent · Manrope
   ============================================================ */
:root {
  /* brand + accent */
  --red: #DE0A1C; --red-600: #B80815; --red-700: #97060f; --red-tint: #FDECEE;
  /* ink + neutrals */
  --ink: #14171F; --ink-2: #3D4552; --muted: #6B7482; --faint: #98A1B0;
  --line: #E7EAF0; --line-2: #F0F2F6; --surface: #FFFFFF; --canvas: #F6F7F9;
  /* status */
  --ok: #12864F; --ok-bg: #E6F4EC;
  --warn: #A85C08; --warn-bg: #FBEEDA;
  --bad: #C9271D; --bad-bg: #FBE8E6;
  --info: #2456C7; --info-bg: #E8EDFB;
  --violet: #6D28D9; --violet-bg: #EFE9FB;
  /* geometry */
  --r: 12px; --r-sm: 9px; --r-xs: 6px;
  --sh-1: 0 1px 2px rgba(20,23,31,.05), 0 1px 3px rgba(20,23,31,.05);
  --sh-2: 0 10px 30px rgba(20,23,31,.12), 0 2px 8px rgba(20,23,31,.06);
  --nav-w: 250px; --top-h: 62px;
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: var(--red-tint); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

/* ---------------- layout shell ---------------- */
.app { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 20px 16px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--red); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; box-shadow: 0 2px 6px rgba(222,10,28,.35);
}
.brand-name { font-weight: 800; letter-spacing: -.02em; font-size: 16px; }
.brand-name span { color: var(--red); }
.brand-sub { font-size: 10.5px; color: var(--faint); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

.nav { padding: 6px 12px 20px; overflow-y: auto; flex: 1; }
.nav-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--faint); padding: 16px 12px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 600; cursor: pointer; margin-bottom: 1px; position: relative;
  transition: background .12s, color .12s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; color: var(--faint); transition: color .12s; }
.nav-item:hover { background: var(--line-2); color: var(--ink); }
.nav-item:hover svg { color: var(--ink-2); }
.nav-item.active { background: var(--red-tint); color: var(--red-700); }
.nav-item.active svg { color: var(--red); }
.nav-item .count {
  margin-left: auto; font-size: 11px; font-weight: 700; background: var(--line-2);
  color: var(--muted); border-radius: 20px; padding: 1px 8px; min-width: 20px; text-align: center;
}
.nav-item.active .count { background: #fff; color: var(--red); }
.nav-item .count.alert { background: var(--bad-bg); color: var(--bad); }

.nav-user { border-top: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg,#2b303b,#454c5b); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.nav-user .who { font-weight: 700; font-size: 12.5px; }
.nav-user .role { font-size: 11px; color: var(--faint); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--top-h); background: rgba(255,255,255,.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px;
  padding: 0 26px; position: sticky; top: 0; z-index: 20;
}
.page-title { font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.page-title .crumb { color: var(--faint); font-weight: 600; }
.search {
  margin-left: auto; display: flex; align-items: center; gap: 9px; background: var(--canvas);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; width: 300px; color: var(--muted);
  transition: border-color .12s, background .12s;
}
.search:focus-within { border-color: var(--red); background: #fff; }
.search input { border: none; background: none; outline: none; width: 100%; color: var(--ink); }
.search svg { width: 16px; height: 16px; flex: none; }
.icon-btn { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); position: relative; }
.icon-btn:hover { background: var(--line-2); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }

.content { padding: 26px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.03em; }
.page-head p { color: var(--muted); margin-top: 3px; }
.head-actions { display: flex; gap: 10px; align-items: center; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 9px;
  font-weight: 700; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: background .12s, border-color .12s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 1px 2px rgba(222,10,28,.3); }
.btn.primary:hover { background: var(--red-600); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--line-2); color: var(--ink); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }

/* ---------------- cards ---------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1); }
.card-pad { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.card-head .sub { font-size: 12px; color: var(--faint); font-weight: 600; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------------- KPI stat ---------------- */
.stat { padding: 18px 20px; }
.stat .label { font-size: 12px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat .label .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--line-2); color: var(--ink-2); }
.stat .value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.stat .foot { font-size: 12px; color: var(--faint); margin-top: 4px; font-weight: 600; }
.stat .foot b { font-variant-numeric: tabular-nums; }
.trend-up { color: var(--ok); } .trend-down { color: var(--bad); }

/* ---------------- badges / pills ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }
.badge.info { color: var(--info); background: var(--info-bg); }
.badge.violet { color: var(--violet); background: var(--violet-bg); }
.badge.grey { color: var(--muted); background: var(--line-2); }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--faint); padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface);
}
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tbody tr { cursor: default; transition: background .1s; }
table.data tbody tr.click { cursor: pointer; }
table.data tbody tr:hover { background: #FAFBFC; }
table.data tbody tr:last-child td { border-bottom: none; }
.num { font-variant-numeric: tabular-nums; }
.cell-name { font-weight: 700; }
.cell-sub { font-size: 12px; color: var(--faint); }
.person-cell { display: flex; align-items: center; gap: 10px; }
.person-cell .avatar { width: 30px; height: 30px; font-size: 11px; }

/* ---------------- gap bar (signature: staffing gap) ---------------- */
.gapbar { display: flex; height: 9px; border-radius: 20px; overflow: hidden; background: var(--line-2); min-width: 120px; }
.gapbar i { display: block; height: 100%; }
.gapbar .onsite { background: var(--ok); }
.gapbar .mobilising { background: var(--info); }
.gapbar .booked { background: #8FA6E8; }
.gapbar .tofill { background: repeating-linear-gradient(45deg, #EEDFE0, #EEDFE0 4px, #F7ECED 4px, #F7ECED 8px); }
.gap-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.gap-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gap-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ---------------- charts (svg/css) ---------------- */
.barchart { display: flex; flex-direction: column; gap: 11px; }
.barrow { display: grid; grid-template-columns: 130px 1fr 34px; align-items: center; gap: 12px; font-size: 12.5px; }
.barrow .bl { color: var(--ink-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bartrack { background: var(--line-2); border-radius: 20px; height: 10px; overflow: hidden; }
.barfill { height: 100%; border-radius: 20px; background: var(--red); }
.barrow .bv { text-align: right; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut-legend { display: flex; flex-direction: column; gap: 9px; font-size: 12.5px; }
.donut-legend span { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-2); }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------------- filters bar ---------------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
select, input.inp, textarea.inp {
  border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 8px 11px; outline: none; min-width: 120px;
  transition: border-color .12s;
}
select:focus, input.inp:focus, textarea.inp:focus { border-color: var(--red); }
.search-inline { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; background: var(--surface); min-width: 240px; }
.search-inline:focus-within { border-color: var(--red); }
.search-inline input { border: none; outline: none; width: 100%; }
.search-inline svg { width: 16px; height: 16px; color: var(--faint); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.chip:hover { background: var(--line-2); }
.chip.on { background: var(--red-tint); border-color: transparent; color: var(--red-700); }

/* ---------------- tabs ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 15px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--red-700); border-bottom-color: var(--red); }
.tab .n { font-size: 11px; background: var(--line-2); color: var(--muted); padding: 1px 7px; border-radius: 20px; }
.tab.active .n { background: var(--red-tint); color: var(--red); }

/* ---------------- kanban ---------------- */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.kcol { background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r); }
.kcol-head { padding: 12px 14px; display: flex; align-items: center; gap: 8px; font-weight: 800; border-bottom: 1px solid var(--line); }
.kcol-head svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.kcol-head .n { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 1px 8px; border-radius: 20px; }
.kcol-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; min-height: 60px; max-height: 62vh; overflow-y: auto; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; box-shadow: var(--sh-1); cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.kcard:hover { border-color: var(--faint); box-shadow: var(--sh-2); }
.kcard .kname { font-weight: 700; }
.kcard .kmeta { font-size: 12px; color: var(--faint); margin-top: 2px; }
.kcard .kfoot { display: flex; gap: 8px; margin-top: 10px; }

/* ---------------- matrix heat grid ---------------- */
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; }
.matrix th.rot { height: 128px; white-space: nowrap; }
.matrix th.rot > div { transform: translateX(10px) rotate(-58deg); width: 22px; transform-origin: bottom left; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.matrix td.mc { text-align: center; padding: 0; }
.matrix .cellname { padding: 7px 12px; font-weight: 700; white-space: nowrap; position: sticky; left: 0; background: var(--surface); }
.mcell { width: 26px; height: 26px; margin: 2px auto; border-radius: 6px; display: grid; place-items: center; }
.mcell.valid { background: var(--ok-bg); } .mcell.expiring { background: var(--warn-bg); }
.mcell.expired { background: var(--bad-bg); } .mcell.pending { background: var(--violet-bg); }
.mcell.none { background: repeating-linear-gradient(45deg,#F1F3F6,#F1F3F6 3px,#fff 3px,#fff 6px); }

/* ---------------- modal ---------------- */
.overlay { position: fixed; inset: 0; background: rgba(20,23,31,.4); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--sh-2); width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; animation: pop .18s cubic-bezier(.2,.8,.3,1); }
.modal.wide { max-width: 760px; }
.modal-head { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--canvas); border-radius: 0 0 16px 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .full { grid-column: 1 / -1; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------------- drawer (detail panel) ---------------- */
.drawer-overlay { position: fixed; inset: 0; background: rgba(20,23,31,.35); z-index: 90; animation: fade .15s ease; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 480px; max-width: 94vw; background: var(--surface); box-shadow: var(--sh-2); z-index: 95; overflow-y: auto; animation: slide .22s cubic-bezier(.2,.8,.3,1); transition: width .22s cubic-bezier(.2,.8,.3,1); }
.drawer.max { width: 1100px; }
@keyframes slide { from { transform: translateX(20px); opacity: .6; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.drawer-actions { display: flex; align-items: center; gap: 6px; flex: none; }

/* ---------------- misc ---------------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--faint); margin-bottom: 10px; }
.empty h4 { font-weight: 800; color: var(--ink-2); margin-bottom: 4px; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--sh-2); font-weight: 600; display: flex; align-items: center; gap: 10px; animation: pop .18s ease; }
.toast.ok { background: #14603b; } .toast svg { width: 17px; height: 17px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); font-weight: 600; font-size: 12.5px; } .kv dd { font-weight: 600; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.progress-ring { transform: rotate(-90deg); }
.mobile-only { display: none; }

/* ---------------- responsive ---------------- */
@media (max-width: 1080px) { .cols-4 { grid-template-columns: repeat(2,1fr); } .cols-3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; transform: translateX(-100%); transition: transform .22s; width: 260px; }
  .sidebar.open { transform: none; }
  .mobile-only { display: grid; }
  .search { width: 180px; }
  .cols-2 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .cols-4, .cols-3 { grid-template-columns: 1fr; }
  .content { padding: 16px; } .topbar { padding: 0 16px; } .search { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Role Requirements editor */
.rr-table td, .rr-table th { vertical-align: middle; }
.rr-cat td { background: var(--canvas); color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; padding-top: 12px; padding-bottom: 6px; }
.rr-table input[type=checkbox] { cursor: pointer; }
.rr-table input[type=checkbox]:disabled { cursor: not-allowed; opacity: .4; }
.req-list { display: flex; flex-direction: column; gap: 2px; }
.req-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 4px; border-bottom: 1px solid var(--line); }
.req-row:last-child { border-bottom: 0; }

/* ===== Edit Job screen ===== */
.crumb-row { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.crumb-link { color: var(--muted); display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }
.crumb-link:hover { color: var(--red); }
.crumb-link svg { width: 14px; height: 14px; }
.job-cols { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 16px; align-items: start; }
.job-main, .job-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.job-main .card, .job-side .card { margin: 0; }
@media (max-width: 1100px) { .job-cols { grid-template-columns: 1fr; } }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.switch input { width: 16px; height: 16px; accent-color: var(--red); }

.inp-flat { border-color: transparent; background: transparent; padding: 6px 8px; }
.inp-flat:hover { border-color: var(--line); background: #fff; }
.inp-flat:focus { border-color: var(--red); background: #fff; }
textarea.inp { resize: vertical; font-family: inherit; }

table.data.compact th, table.data.compact td { padding: 6px 10px; font-size: 12.5px; }
.num.neg { color: var(--bad); font-weight: 700; }
.num.pos { color: var(--ok); }

.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi-v { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.kpi-v.neg { color: var(--bad); } .kpi-v.pos { color: var(--ok); }
.kpi-l { font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 2px; }

.con-grp { margin-bottom: 12px; }
.con-h { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.con-row { display: flex; align-items: flex-start; gap: 9px; padding: 7px 4px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.con-row:last-child { border-bottom: 0; }
.con-row input { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--red); }
.con-row .cell-sub { display: block; }

/* Roster preview grid */
.roster-wrap { overflow-x: auto; }
.roster-grid { border-collapse: collapse; font-size: 11px; white-space: nowrap; }
.roster-grid th, .roster-grid td { border: 1px solid var(--line-2); text-align: center; }
.roster-grid .rname { position: sticky; left: 0; background: var(--surface); text-align: left; padding: 6px 12px; font-weight: 700; min-width: 92px; z-index: 1; }
.roster-grid thead .rname { background: var(--canvas); }
.roster-grid .rmonth { background: var(--canvas); color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 4px 8px; }
.roster-grid .rdate { background: var(--canvas); color: var(--faint); font-weight: 600; width: 34px; padding: 3px 0; }
.rcell { width: 34px; height: 34px; font-weight: 700; padding: 2px; }
.rcell i { display: block; font-style: normal; font-weight: 500; font-size: 9px; opacity: .8; }
.rcell.day { background: var(--ok-bg); color: var(--ok); }
.rcell.night { background: var(--info-bg); color: var(--info); }
.rcell.off { background: var(--canvas); color: var(--faint); }
.rcell.blank { background: repeating-linear-gradient(45deg, transparent, transparent 4px, var(--line-2) 4px, var(--line-2) 5px); }

/* ===== Schedule pattern builder ===== */
.cyc-strip { display: flex; flex-wrap: wrap; gap: 3px; }
.cyc { width: 26px; height: 22px; border-radius: 4px; font-size: 9px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; }
.cyc.day { background: var(--ok-bg); color: var(--ok); }
.cyc.night { background: var(--info-bg); color: var(--info); }
.cyc.off { background: var(--canvas); color: var(--faint); border-color: var(--line-2); }
.seg-row { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--canvas); flex-wrap: wrap; }
.seg-row .seg-kind { width: 96px; }
.seg-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.seg-row .seg-del { margin-left: auto; }
.seg-inline input:disabled { opacity: .4; }
.pat-preview { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ===== Signed-in user footer ===== */
.nav-user-id { flex: 1; min-width: 0; }
.nav-user-id .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-signout { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); flex-shrink: 0; }
.nav-signout:hover { background: var(--line-2); color: var(--red); }
.nav-signout svg { width: 16px; height: 16px; }

/* ---- Advanced Search: competency picker ---- */
.linklike { border: none; background: none; color: var(--red-700); font-weight: 700; font-size: 12.5px; cursor: pointer; padding: 0; margin-left: 8px; }
.linklike:hover { text-decoration: underline; }
.sel-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 12px; }
.sel-chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 6px 5px 12px; border-radius: 20px; background: var(--red-tint); color: var(--red-700); font-weight: 600; font-size: 12.5px; }
.sel-chip .sel-x { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border: none; border-radius: 50%; background: rgba(151,6,15,.12); color: var(--red-700); cursor: pointer; }
.sel-chip .sel-x:hover { background: rgba(151,6,15,.22); }
.sel-chip .sel-x svg { width: 12px; height: 12px; }
.comp-picker { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.comp-search { display: flex; align-items: center; gap: 9px; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.comp-search > svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.comp-search input { flex: 1; border: none; outline: none; background: none; font: inherit; font-size: 14px; color: var(--ink); }
.comp-search input::placeholder { color: var(--faint); }
.comp-clear { display: inline-grid; place-items: center; padding: 2px; border: none; background: none; color: var(--muted); cursor: pointer; }
.comp-clear:hover { color: var(--ink); }
.comp-clear svg { width: 15px; height: 15px; }
.comp-groups { max-height: 400px; overflow: auto; }
.cgroup { border-bottom: 1px solid var(--line-2); }
.cgroup:last-child { border-bottom: none; }
.cgroup-head { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 14px; border: none; background: none; cursor: pointer; font: inherit; color: var(--ink); }
.cgroup-head:hover { background: var(--line-2); }
.cgroup-head .chev { display: inline-grid; place-items: center; color: var(--faint); transition: transform .15s ease; }
.cgroup-head .chev svg { width: 15px; height: 15px; }
.cgroup.open .cgroup-head .chev { transform: rotate(90deg); }
.cgroup-name { font-weight: 700; font-size: 13.5px; }
.cgroup-count { color: var(--faint); font-weight: 600; font-size: 12px; }
.cgroup-sel { margin-left: auto; background: var(--red-tint); color: var(--red-700); font-weight: 700; font-size: 11.5px; padding: 2px 9px; border-radius: 20px; }
.cgroup-body { display: none; flex-wrap: wrap; gap: 8px; padding: 2px 14px 14px 34px; }
.cgroup.open .cgroup-body { display: flex; }
.comp-none { padding: 14px; color: var(--muted); font-size: 13.5px; }

/* ---- Performance reviews ---- */
.score-pick { display: flex; align-items: center; gap: 7px; }
.score-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-weight: 800; font-size: 15px; color: var(--muted); cursor: pointer; transition: all .1s; }
.score-btn:hover { border-color: var(--faint); }
.score-btn.on { background: var(--red-tint); border-color: transparent; color: var(--red-700); }
.score-btn.sel { background: var(--red); color: #fff; box-shadow: var(--sh-1); }
.score-hint { margin-left: 6px; font-size: 12.5px; color: var(--faint); font-weight: 600; }
.rv-jobs { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.rv-job { display: flex; align-items: flex-start; gap: 11px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; background: var(--surface); }
.rv-job:hover { background: var(--line-2); }
.rv-job input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--red); flex: none; }
.rv-job:has(input:checked) { border-color: var(--red); background: var(--red-tint); }
