/* SCS Dashboard · Direction 1 "Ops console" on Tabler 1.5.0
   Tokens from the SCS site: navy #2E2F5E, pale blue #C4D3E6, Archivo (self-hosted). */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/Archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --scs-navy: #2E2F5E;
  --scs-navy-deep: #1F2048;
  --scs-pale: #C4D3E6;
  --scs-ink2: #5B5E86;
  --scs-paper: #F4F5F9;
  --scs-line: #DDE1EC;
  --scs-chip: #EEF1F8;
  --scs-ok: #1E8A5A;   --scs-ok-bg: #E6F4EC;
  --scs-warn: #8A5A00; --scs-warn-bg: #FFF4DB;
  --scs-bad: #B42318;  --scs-bad-bg: #FDECEA;

  /* Tabler token overrides */
  --tblr-font-sans-serif: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tblr-body-font-family: "Archivo", system-ui, sans-serif;
  --tblr-body-bg: var(--scs-paper);
  --tblr-body-color: var(--scs-navy);
  --tblr-primary: var(--scs-navy);
  --tblr-primary-rgb: 46, 47, 94;
  --tblr-link-color: var(--scs-navy);
  --tblr-link-hover-color: var(--scs-navy-deep);
  --tblr-border-color: var(--scs-line);
  --tblr-secondary: var(--scs-ink2);
  --tblr-secondary-color: var(--scs-ink2);
  --tblr-muted: var(--scs-ink2);
  --tblr-card-border-color: var(--scs-line);
  --tblr-focus-ring-color: rgba(46, 47, 94, .25);
}

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Archivo", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  background: var(--scs-paper);
  color: var(--scs-navy);
  letter-spacing: 0;
}
h1, h2, h3, h4 { letter-spacing: -0.02em; font-weight: 600; margin: 0; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; }
.muted { color: var(--scs-ink2); }
.small { font-size: 12.5px; }

/* ---------- shell ---------- */
.scs-app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.scs-rail {
  background: var(--scs-navy); color: #fff;
  display: flex; flex-direction: column; padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.scs-brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 18px; border-bottom: 1px solid rgba(196, 211, 230, .22); margin-bottom: 12px; text-decoration: none; color: #fff; }
.scs-brand svg { width: 34px; height: 34px; border-radius: 7px; flex: none; }
.scs-brand b { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; }
.scs-brand span { font-size: 11px; color: var(--scs-pale); }
.scs-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin: 2px 0;
  border-radius: 8px; color: #D7DFEE; text-decoration: none; font-size: 14px; line-height: 1.2;
}
.scs-nav a:hover { background: rgba(196, 211, 230, .12); color: #fff; }
.scs-nav a.on { background: var(--scs-pale); color: var(--scs-navy); font-weight: 600; }
.scs-nav a.soon { color: rgba(215, 223, 238, .45); cursor: default; }
.scs-nav a.soon:hover { background: none; color: rgba(215, 223, 238, .45); }
.scs-nav a.soon small { margin-left: auto; font-size: 10.5px; }
.scs-nav svg { width: 18px; height: 18px; flex: none; }
.scs-me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid rgba(196, 211, 230, .22); font-size: 13px; line-height: 1.25; }
.scs-me svg { width: 18px; height: 18px; flex: none; }
.scs-me small { display: block; color: var(--scs-pale); font-size: 11px; }

.scs-main { display: flex; flex-direction: column; min-width: 0; }
.scs-top {
  height: 60px; background: #fff; border-bottom: 1px solid var(--scs-line);
  display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.scs-top h1 { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scs-top .sub { color: var(--scs-ink2); font-size: 13px; white-space: nowrap; }
.scs-top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.scs-menu { display: none; }
.scs-body { padding: 20px 24px 40px; }

@media (max-width: 991px) {
  .scs-app { grid-template-columns: 1fr; }
  .scs-rail { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .18s ease-out; height: 100vh; }
  .scs-rail.open { transform: none; box-shadow: 0 0 0 100vw rgba(31, 32, 72, .35); }
  .scs-menu { display: inline-flex; }
  .scs-top { padding: 0 14px; height: 56px; }
  .scs-body { padding: 14px 12px 32px; }
  .scs-top .sub { display: none; }
}

/* ---------- components ---------- */
.card { border: 1px solid var(--scs-line); border-radius: 10px; box-shadow: none; background: #fff; }
.card-header { padding: 12px 16px; border-bottom: 1px solid var(--scs-line); display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; }
.card-header h3, .card-header .card-title { font-size: 14px; font-weight: 600; margin: 0; }
.card-header a, .card-header .hint { font-size: 12px; color: var(--scs-ink2); text-decoration: none; font-weight: 500; }
.card-body { padding: 14px 16px; }

.table { --tblr-table-color: var(--scs-navy); font-size: 13px; margin-bottom: 0; }
.table th { font-weight: 600; color: var(--scs-ink2); font-size: 11.5px; text-transform: none; letter-spacing: 0; padding: 8px 14px; background: #F7F8FB; border-bottom: 1px solid var(--scs-line); }
.table td { padding: 9px 14px; border-bottom: 1px solid var(--scs-line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td, tr.tot td { font-weight: 600; background: #FAFBFD; }
.table td:first-child, .table th:first-child { white-space: nowrap; }
.table tr.dim td { color: var(--scs-ink2); }
.table tr.sel td { background: #F1F4FA; }
.table tr.clickable { cursor: pointer; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.pill.ok { background: var(--scs-ok-bg); color: var(--scs-ok); }
.pill.warn { background: var(--scs-warn-bg); color: var(--scs-warn); }
.pill.bad { background: var(--scs-bad-bg); color: var(--scs-bad); }
.pill.pale { background: var(--scs-pale); color: var(--scs-navy); }
.pill.grey { background: var(--scs-chip); color: var(--scs-ink2); }

.btn { border-radius: 9px; font-weight: 600; font-size: 13.5px; height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; box-shadow: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { --tblr-btn-bg: var(--scs-navy); --tblr-btn-border-color: var(--scs-navy); --tblr-btn-hover-bg: var(--scs-navy-deep); --tblr-btn-hover-border-color: var(--scs-navy-deep); --tblr-btn-active-bg: var(--scs-navy-deep); --tblr-btn-color: #fff; --tblr-btn-hover-color: #fff; }
.btn-ghost { background: #fff; border: 1px solid var(--scs-line); color: var(--scs-navy); }
.btn-ghost:hover { background: var(--scs-chip); color: var(--scs-navy); border-color: var(--scs-line); }
.btn-pale { background: var(--scs-pale); border-color: var(--scs-pale); color: var(--scs-navy); }
.btn-pale:hover { background: #B3C6DE; border-color: #B3C6DE; color: var(--scs-navy); }
.btn-icon { width: 36px; padding: 0; justify-content: center; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }

.form-control, .form-select { border-color: var(--scs-line); border-radius: 8px; height: 36px; font-size: 14px; color: var(--scs-navy); }
.form-control:focus, .form-select:focus { border-color: var(--scs-navy); box-shadow: 0 0 0 3px rgba(46, 47, 94, .12); }
.form-label { font-weight: 600; font-size: 12.5px; color: var(--scs-ink2); margin-bottom: 4px; }
.form-control.num { text-align: right; }

.empty { border: 1px dashed var(--scs-line); border-radius: 10px; padding: 16px; color: var(--scs-ink2); font-size: 13px; text-align: center; }
.empty b { color: var(--scs-navy); font-weight: 600; }
.empty .btn { margin-top: 8px; }

.modal-content { border-radius: 12px; border: 1px solid var(--scs-line); }
.modal-header { border-bottom: 1px solid var(--scs-line); }
.modal-title { font-weight: 600; font-size: 15px; }
.modal-footer { border-top: 1px solid var(--scs-line); }

.blocked { max-width: 520px; margin: 80px auto; background: #fff; border: 1px solid var(--scs-line); border-radius: 12px; padding: 28px; }
.blocked h1 { font-size: 20px; margin-bottom: 10px; }
.blocked p { color: var(--scs-ink2); font-size: 14px; }

/* ---------- home ---------- */
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-content: start; }
.home-grid .span2 { grid-column: 1 / -1; }
@media (max-width: 1199px) { .home-grid { grid-template-columns: 1fr; } }
.strip { display: grid; grid-template-columns: repeat(5, 1fr); background: #fff; border: 1px solid var(--scs-line); border-radius: 10px; overflow: hidden; }
.strip > div { padding: 12px 16px; border-right: 1px solid var(--scs-line); min-width: 0; }
.strip > div:last-child { border-right: 0; }
.strip small { display: block; color: var(--scs-ink2); font-size: 11.5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip b { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.strip .pill, .strip .muted { margin-left: 6px; font-size: 11.5px; }
@media (max-width: 1199px) { .strip { grid-template-columns: repeat(3, 1fr); } .strip > div:nth-child(3n) { border-right: 0; } .strip > div { border-bottom: 1px solid var(--scs-line); } }
@media (max-width: 640px) { .strip { grid-template-columns: 1fr 1fr; } .strip > div:nth-child(3n) { border-right: 1px solid var(--scs-line); } .strip > div:nth-child(2n) { border-right: 0; } }

.att { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.att li { display: flex; gap: 10px; padding: 12px 16px; border-right: 1px solid var(--scs-line); border-bottom: 1px solid var(--scs-line); font-size: 13px; align-items: flex-start; }
.att li:nth-child(3n) { border-right: 0; }
.att li svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.att li b { display: block; font-weight: 600; }
.att li span { color: var(--scs-ink2); font-size: 12px; }
.att li a { color: inherit; text-decoration: none; }
.att li.bad svg { color: var(--scs-bad); } .att li.warn svg { color: var(--scs-warn); } .att li.muted svg { color: var(--scs-ink2); }
@media (max-width: 991px) { .att { grid-template-columns: 1fr; } .att li { border-right: 0; } }

/* ---------- planning grid ---------- */
.grid-wrap { overflow-x: auto; }
table.rgrid { table-layout: fixed; min-width: 760px; }
.rgrid th:first-child, .rgrid td:first-child { width: 96px; font-weight: 600; text-align: left; }
.rgrid th:not(:first-child), .rgrid td:not(:first-child) { text-align: center; padding: 6px 4px; font-size: 11.5px; }
.rgrid th:not(:first-child) { padding: 8px 4px; }
.rgrid th.today { color: var(--scs-navy); background: var(--scs-pale); }
.rgrid th.weekend, .rgrid td.weekend { background: #FAFBFD; }
.rgrid td { vertical-align: top; height: 44px; }
.rgrid td.editable { cursor: pointer; }
.rgrid td.editable:hover { background: #F1F4FA; }
.rgrid td.today { box-shadow: inset 0 0 0 1.5px var(--scs-navy); }
.chip { display: block; background: var(--scs-chip); border-radius: 5px; padding: 4px 5px; line-height: 1.25; margin: 2px 0; text-align: left; word-break: break-word; }
.chip.job { background: var(--scs-pale); }
.chip.off { background: none; color: var(--scs-ink2); text-align: center; }
.chip.nojob { background: #fff; border: 1px dashed var(--scs-line); }
.chip .nt { display: inline-flex; vertical-align: -2px; margin-right: 3px; }
.chip .nt svg { width: 11px; height: 11px; }
.rgrid tr.unassigned td:first-child { color: var(--scs-bad); }
.rgrid tr.unassigned .chip { background: var(--scs-bad-bg); color: var(--scs-bad); }

/* ---------- costs ---------- */
.weeknav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.weeknav .label { font-weight: 600; font-size: 15px; min-width: 200px; }
.days { display: flex; gap: 6px; margin: 14px 0; }
.days button { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--scs-line); border-radius: 8px; padding: 6px 0; text-align: center; font-size: 12px; line-height: 1.2; color: var(--scs-navy); font-family: inherit; cursor: pointer; }
.days button b { display: block; font-size: 14px; }
.days button small { display: block; color: var(--scs-ink2); font-size: 10.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.days button.on { background: var(--scs-pale); border-color: var(--scs-pale); }
.days button.today { box-shadow: inset 0 0 0 1.5px var(--scs-navy); }
.days button.empty-day small { color: var(--scs-warn); }
.costs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-content: start; }
.costs-grid .span2 { grid-column: 1 / -1; }
@media (max-width: 1199px) { .costs-grid { grid-template-columns: 1fr; } }
.rowbtns { white-space: nowrap; text-align: right; }
.rowbtns .btn { height: 28px; width: 28px; padding: 0; justify-content: center; }
.rowbtns .btn svg { width: 14px; height: 14px; }
.total-line { display: flex; justify-content: space-between; padding: 10px 16px; background: #F7F8FB; border-top: 1px solid var(--scs-line); font-weight: 600; font-size: 13px; }

.toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast-msg { background: var(--scs-navy); color: #fff; padding: 10px 14px; border-radius: 9px; font-size: 13px; box-shadow: 0 6px 18px rgba(46, 47, 94, .2); }
.toast-msg.bad { background: var(--scs-bad); }
