/* SDI light theme. Layout and visual controls only; shift/status colors stay semantic. */
:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: #17263b; background: #f4f6f9;
  --hub-border: #dce3ec; --hub-radius: 12px; --hub-table-head: #f1f5fa;
  --hub-blue: #235cb8; --hub-muted: #56677d;
}
body { background: #f4f6f9; -webkit-font-smoothing: antialiased; }
.workspace .sidebar {
  width: 208px; padding: 23px 16px 16px; background: #edf1f6;
  border-right: 1px solid var(--hub-border); overflow-y: auto;
}
.sidebar .brand { gap: 10px; padding: 0 7px; font-size: 16px; letter-spacing: -.4px; font-weight: 750; }
.sidebar .brand img { width: 32px; height: 32px; border-radius: 9px; }
.sidebar nav { margin-top: 28px; }
.sidebar .nav-item { min-height: 38px; padding: 9px 10px; gap: 10px; border-radius: 8px; color: #435571; font-size: 13px; font-weight: 600; transition: background .15s, color .15s; }
.sidebar .nav-item + .nav-item { margin-top: 4px; }
.sidebar .nav-item:hover { background: #e2e9f3; color: #17263b; }
.sidebar .nav-item.selected { background: #dce8fc; color: #174b9a; }
.sidebar .grid-icon { width: 18px; height: 18px; color: inherit; stroke-width: 1.65; }
.sidebar .nav-section { margin: 30px 13px 12px; color: #6a7586; font-size: 11px; font-weight: 600; letter-spacing: .65px; text-transform: uppercase; }
.sidebar .account { padding: 20px 12px 0; margin-top: auto; }
.sidebar .account-text strong { font-weight: 600; color: #303b4a; }
.sidebar .account-text span { color: var(--hub-muted); }
.sidebar .logout { color: #667181; font-size: 12px; }
.workspace .main-content { background: #f4f6f9; }
.workspace .main-content > .page-header { padding: 26px clamp(18px, 3vw, 44px) 14px; }
.page-header h1 { font-size: clamp(26px, 3.3vw, 36px); letter-spacing: -.045em; line-height: 1.12; font-weight: 720; color: #17263b; }
.workspace .main-content > .page-body { padding: 8px clamp(18px, 3vw, 44px) 32px; }
.page-body h2 { color: #283342; letter-spacing: -.25px; }
.muted, .field-help, .cell-detail, .profile-email { color: var(--hub-muted); }
.page-body .hub-panel, .account-profile, .account-shifts, .status-tool, .system-check-result,
.schedule-staff-layout > section, .page-body > .edit-form, .default-role, .schedule-cover,
.page-body > .table-scroll { box-shadow: 0 3px 14px #22354b04; }
.button, .login-button { background: var(--hub-blue); border-color: var(--hub-blue); border-radius: 10px; min-height: 36px; padding: 8px 14px; font-size: 13px; font-weight: 600; line-height: 1.4; transition: background .15s, box-shadow .15s; }
.button:hover, .login-button:hover { background: #125bb9; border-color: #125bb9; }
.button.secondary { background: #fff; color: #40516a; border-color: #dce2eb; }
.button.secondary:hover { background: #edf3fb; border-color: #c9d8ed; }
.button.danger { color: #b43232; background: #fff5f4; border-color: #eed6d3; }
.button.danger:hover { background: #fce9e6; border-color: #e4c1bc; }
.button:disabled { opacity: .45; cursor: not-allowed; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not(.sheet-cell-input), select, textarea {
  font-family: inherit; font-size: 14px; color: #25344a; border: 1px solid #dce2eb;
  border-radius: 10px; background: #fff; padding: 9px 12px; min-height: 38px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #b8d4fa; outline-offset: 1px; border-color: #176bd6; }
input[type=checkbox], input[type=radio], .check-row input { accent-color: var(--hub-blue); }
a:focus-visible, button:focus-visible { outline: 3px solid #87b8f5; outline-offset: 3px; }
.text-link { color: #1764c4; }
.back-link { color: #56708e; }
.check-row { padding: 12px; border-radius: 10px; margin-top: 5px; }
.check-row:hover { background: #f6f8fc; }
.page-body > .table-scroll th { color: #67758a; font-size: 12px; font-weight: 600; }
.page-body > .table-scroll td { color: #344154; }
.page-body > .table-scroll tbody tr:hover { background: #f4f7fc; }
.status-badge { border-radius: 7px; }
.status-tool details { margin-top: 14px; }
.status-tool summary { color: #5b7091; }
.account-month-nav { background: #f1f4f9; border-radius: 10px; padding: 3px; }
.schedule-toolbar, .matrix-page .matrix-toolbar { background: #fff; }
.schedule-sheet-bar { background: #f7f9fc; }
.schedule-sheet-actions button { border-radius: 7px; color: #40516a; }
.schedule-formula { background: #fff; }
.schedule-body .schedule-scroll { background: #fff; max-height: none; height: auto; overflow-x: auto; overflow-y: hidden; }
.schedule-formula input:not([type=hidden]) { padding: 4px 8px; min-height: 28px; }
.schedule-table thead th, .schedule-table .schedule-time { color: #62728a; }
.schedule-table .schedule-name { color: #344154; }
.schedule-body .schedule-toolbar {
  padding: 0;
  background: transparent;
  border: 0;
  gap: 8px 16px;
  margin-bottom: 14px;
}
.schedule-context { color: var(--hub-muted); }
.schedule-toolbar-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.schedule-toolbar-controls .schedule-month {
  gap: 0;
  flex-wrap: nowrap;
  border: 1px solid var(--hub-border);
  border-radius: 8px;
  background: #fff;
}
.schedule-toolbar-controls .schedule-month h2 { min-width: 116px; margin: 0; font-size: 13px; }
.schedule-toolbar-controls .schedule-month .button { border: 0; font-size: 18px; padding-block: 4px; }
.schedule-toolbar-controls .schedule-picker { gap: 4px; }
.schedule-body .schedule-day-grid:focus-visible { outline: 2px solid var(--hub-blue); outline-offset: 2px; }
.schedule-body .schedule-table th,
.schedule-body .schedule-table td { border-right-color: #e8edf4; border-bottom-color: #e8edf4; }
.schedule-body .schedule-table thead th { background: #f1f5fa; color: #465975; }
.schedule-body .schedule-table thead .weekend { background: #e9eff7; }
.schedule-body .schedule-table thead .schedule-today { background: #e0ebfc; color: #194f9f; box-shadow: none; }
.schedule-body .schedule-table .schedule-name { border-right-color: #ccd8e8; padding-block: 5px; }
.schedule-body .schedule-table .schedule-time { padding: 3px 2px; }
.schedule-body .schedule-table .schedule-time:nth-child(even) { border-left: 0; }
.schedule-body .schedule-cell.day-edge { border-left-color: #ccd8e8; }
.schedule-body .schedule-table .schedule-group .schedule-name,
.schedule-body .schedule-table .schedule-group td { background: #e9eff7; color: #3a5271; }
.schedule-body .schedule-table .schedule-group .schedule-name { text-align: left; font-size: 11px; }
.schedule-body .schedule-table .schedule-group td { padding-block: 3px; }
.schedule-body .schedule-cell { height: 32px; }
.schedule-body .schedule-cell a { min-height: 32px; }
.schedule-body .schedule-cell .sheet-absence:empty { display: none; }
.schedule-body .schedule-cell[data-mark="Д"]:not([class*="absence-"]) .sheet-mark,
.schedule-body .schedule-cell[data-mark="Н"]:not([class*="absence-"]) .sheet-mark {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  min-height: 22px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 650;
}
.schedule-body .schedule-cell[data-mark="Д"]:not([class*="absence-"]) .sheet-mark { background: #e5efff; color: #1f559f; }
.schedule-body .schedule-cell[data-mark="Н"]:not([class*="absence-"]) .sheet-mark { background: #e8edf8; color: #435883; }
.schedule-body .schedule-table .today-cell:not([class*="absence-"]) { background: #f1f6ff; }
.schedule-body .schedule-self > th,
.schedule-body .schedule-self > td:not([class*="absence-"]) { background-color: #f3f7ff; }
.schedule-body .schedule-self-label { background: transparent; color: #235cb8; font-weight: 650; }

/* Keep the palette order in sync with person_color() in schedule.py. */
.schedule-cell[data-person-color="0"] { --absence-hue: 8; }
.schedule-cell[data-person-color="1"] { --absence-hue: 145; }
.schedule-cell[data-person-color="2"] { --absence-hue: 282; }
.schedule-cell[data-person-color="3"] { --absence-hue: 60; }
.schedule-cell[data-person-color="4"] { --absence-hue: 197; }
.schedule-cell[data-person-color="5"] { --absence-hue: 334; }
.schedule-cell[data-person-color="6"] { --absence-hue: 111; }
.schedule-cell[data-person-color="7"] { --absence-hue: 248; }
.schedule-cell[data-person-color="8"] { --absence-hue: 26; }
.schedule-cell[data-person-color="9"] { --absence-hue: 163; }
.schedule-cell[data-person-color="10"] { --absence-hue: 300; }
.schedule-cell[data-person-color="11"] { --absence-hue: 77; }
.schedule-cell[data-person-color="12"] { --absence-hue: 214; }
.schedule-cell[data-person-color="13"] { --absence-hue: 351; }
.schedule-cell[data-person-color="14"] { --absence-hue: 128; }
.schedule-cell[data-person-color="15"] { --absence-hue: 265; }
.schedule-cell[data-person-color="16"] { --absence-hue: 43; }
.schedule-cell[data-person-color="17"] { --absence-hue: 180; }
.schedule-cell[data-person-color="18"] { --absence-hue: 317; }
.schedule-cell[data-person-color="19"] { --absence-hue: 94; }
.schedule-cell[data-person-color="20"] { --absence-hue: 231; }
.schedule-cell[data-person-color="21"] { --absence-hue: 359; }
.schedule-cell[data-person-color="22"] { --absence-hue: 155; }
.schedule-cell[data-person-color="23"] { --absence-hue: 274; }
.schedule-body .schedule-table .schedule-cell[data-person-color] {
  background-color: hsl(var(--absence-hue) 68% 86%);
}
.schedule-body .schedule-cell[data-person-color] .sheet-mark { background: transparent; color: inherit; }

/* A colored shift with no absence marker is an assigned replacement. */
.schedule-cell.absence-pink { --shift-color: #f6c6c9; }
.schedule-cell.absence-orange { --shift-color: #ffdfc4; }
.schedule-cell.absence-yellow { --shift-color: #ffe982; }
.schedule-cell.absence-purple { --shift-color: #dfcdeb; }
.schedule-cell[data-person-color] { --shift-color: hsl(var(--absence-hue) 68% 86%); }
.schedule-cell.today-cell { --shift-cell-background: #f1f6ff; }
.schedule-self .schedule-cell { --shift-cell-background: #f3f7ff; }
.schedule-body .schedule-table .schedule-cell:is([data-person-color], [class*="absence-"]):not([data-absent]):has(.sheet-mark:not(:empty)):not(:has(.sheet-absence:not(:empty))) {
  background-color: var(--shift-cell-background, #fff);
}
.schedule-body .schedule-cell:is([data-person-color], [class*="absence-"]):not([data-absent]):has(.sheet-mark:not(:empty)):not(:has(.sheet-absence:not(:empty))) .sheet-mark {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  min-height: 22px;
  padding-inline: 3px;
  border-radius: 4px;
  background: var(--shift-color);
  color: #17263b;
  font-size: 12px;
  font-weight: 650;
}

.schedule-body .schedule-table .schedule-cell[data-absent] {
  background-color: var(--shift-cell-background, #fff);
}
.schedule-cell[data-absent]::before {
  content: "";
  position: absolute;
  inset: 50% var(--absence-end, 2px) auto var(--absence-start, 2px);
  height: 26px;
  transform: translateY(-50%);
  border-radius: var(--absence-start-radius, 6px) var(--absence-end-radius, 6px)
                 var(--absence-end-radius, 6px) var(--absence-start-radius, 6px);
  background: var(--shift-color);
  pointer-events: none;
}
.schedule-cell[data-absent] :is(.sheet-mark, .sheet-absence) { position: relative; }

/* A 5/2 date spans four columns. Skip its three hidden cells when joining days. */
tr:not([data-group="52"]) .schedule-cell[data-absent] + .schedule-cell[data-absent],
tr[data-group="52"] .schedule-cell[data-absent]:not([hidden]) + [hidden] + [hidden] + [hidden] + .schedule-cell[data-absent] {
  --absence-start: -1px;
  --absence-start-radius: 0px;
}
tr:not([data-group="52"]) .schedule-cell[data-absent]:has(+ .schedule-cell[data-absent]),
tr[data-group="52"] .schedule-cell[data-absent]:not([hidden]):has(+ [hidden] + [hidden] + [hidden] + .schedule-cell[data-absent]) {
  --absence-end: -1px;
  --absence-end-radius: 0px;
}
.tools-intro { margin: 0 0 26px; color: var(--hub-muted); font-size: 15px; }
.tools-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.tools-grid .tool-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 16px; min-height: 138px; margin: 0; padding: 24px; background: #fff; border-radius: 18px; border-color: #e2e7ee; box-shadow: 0 4px 18px #253d5a04; transition: border-color .15s, box-shadow .15s; }
.tools-grid .tool-row:hover { border-color: #b7cfee; box-shadow: 0 6px 24px #253d5a0a; }
.tools-grid .tool-icon { width: 48px; height: 48px; border: 0; border-radius: 14px; background: #edf3fc; color: #386ba9; }
.tools-grid .tool-icon svg { width: 24px; height: 24px; color: inherit; }
.tools-grid .tool-row strong { font-size: 16px; letter-spacing: -.25px; color: #273447; }
.tools-grid .cell-detail { line-height: 1.6; margin-top: 6px; font-size: 13px; }
.tools-grid .tool-arrow { color: #1764c4; background: #edf4fe; border-radius: 9px; padding: 8px 11px; font-size: 12px; font-weight: 600; }
.login-layout { background: #f2f4f8; }
.login-card { background: #fff; border: 1px solid #e5e9f0; border-radius: 24px; padding: 36px; box-shadow: 0 16px 50px #243c5a0a; }
.login-card .login-button { min-height: 44px; font-size: 14px; }
@media (max-width: 1200px) { .tools-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .workspace .sidebar { width: 190px; padding: 20px 12px 16px; }
  .sidebar .brand { font-size: 16px; }
  .sidebar .nav-item { font-size: 13px; gap: 9px; }
  .workspace .main-content > .page-header { padding: 28px 20px 18px; }
  .workspace .main-content > .page-body { padding: 8px 20px 32px; }
  .page-header h1 { font-size: 26px; }
  .tools-grid .tool-row { padding: 20px; gap: 12px; }
}
@media (max-width: 640px) {
  .workspace .sidebar { width: 100%; height: auto; position: static; padding: 18px 16px; }
  .sidebar nav { display: flex; flex-wrap: nowrap; overflow-x: auto; padding: 4px 0 8px; margin-top: 18px; gap: 6px; }
  .sidebar .nav-item, .sidebar .nav-item + .nav-item { flex-shrink: 0; margin: 0; min-height: 44px; }
  .sidebar .nav-section { display: none; }
  .sidebar .account { margin-top: 8px; padding: 12px 4px 0; }
  .tools-grid .tool-row { grid-template-columns: 42px minmax(0, 1fr); min-height: 144px; }
  .tools-grid .tool-icon { width: 42px; height: 42px; }
  .tools-grid .tool-arrow { grid-column: 2; justify-self: start; margin-left: 0; }
  .page-header .button { min-height: 40px; }
}
.account-shifts { container-type: inline-size; }
.shift-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 22px 0; padding: 18px 6px; background: #f3f5f9; border-radius: 14px; }
.shift-totals > div { display: flex; flex-direction: column-reverse; align-items: center; gap: 5px; padding: 0 4px; }
.shift-totals > div + div { border-left: 1px solid #dfe4ed; }
.shift-totals dt { color: #626f83; font-size: 12px; }
.shift-totals dd { margin: 0; font-size: 25px; font-weight: 650; letter-spacing: -.7px; color: #273447; }
.shift-grid-caption { display: flex; justify-content: space-between; margin: 0 0 14px; color: #626f83; font-size: 13px; font-weight: 500; }
.shift-grid-caption span { font-size: 12px; font-weight: 400; }
.shift-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.shift-card { padding: 17px 16px; border: 1px solid; border-radius: 14px; min-width: 0; }
.shift-card.shift-day { background: #fdfaf5; border-color: #eee3d1; }
.shift-card.shift-night { background: #f5f5ff; border-color: #dfdff5; }
.shift-card-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 12px; }
.shift-card-heading > strong { font-size: 21px; letter-spacing: -.6px; font-weight: 650; color: #273447; font-variant-numeric: tabular-nums; }
.shift-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; }
.shift-day .shift-kind { color: #986021; }
.shift-night .shift-kind { color: #5552a3; }
.shift-kind svg { width: 23px; height: 23px; flex-shrink: 0; }
.shift-card-time { margin: 10px 0 0; color: #52617a; font-size: 15px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.shift-card-time span { font-size: 12px; white-space: nowrap; }
.shift-card-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 10px; font-size: 12px; color: #5f6b7e; }
.shift-extra { padding: 3px 7px; border-radius: 6px; color: #245b91; background: #e5effa; }
.shift-source { flex-basis: 100%; overflow-wrap: anywhere; line-height: 1.5; }
.shift-card.absence-pink { border-left: 4px solid #e8a2aa; }
.shift-card.absence-orange { border-left: 4px solid #edbb86; }
.shift-card.absence-yellow { border-left: 4px solid #d8b93f; }
.shift-card.absence-purple { border-left: 4px solid #b69bcf; }
@container (max-width: 470px) { .shift-card-grid { grid-template-columns: 1fr; } .shift-totals dt { font-size: 11px; } }
@media (prefers-reduced-motion: reduce) { .sidebar .nav-item, .button, .login-button, .tools-grid .tool-row { transition: none; } }
