:root {
  color-scheme: light;
  --disha-deep-green: #0d3555;
  --disha-sidebar-top: #0d3555;
  --nav-ink: #f8fafc;
  --nav-muted: #c6d7e5;
  --nav-hover-bg: rgba(255,255,255,.12);
  --disha-mint: #169c7b;
  --disha-pale-mint: #eef4fa;
  --disha-orange: #d97706;
  --disha-coral: #d95740;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: var(--disha-pale-mint);
  --ink: #102a43;
  --muted: #62758a;
  --line: #d9e3ec;
  --brand: var(--disha-deep-green);
  --brand-dark: #082c49;
  --accent: var(--disha-mint);
  --warning: #b45309;
  --danger: #c2413b;
  --ok: #138568;
  --shadow: 0 5px 16px rgba(31, 67, 98, .08);
  font-size: var(--base-font-size, 16px);
  font-family: var(--font-family, Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

.app-shell { width: 100%; max-width: none; min-width: 0; min-height: 100vh; display: grid; grid-template-columns: 264px minmax(0, 1fr); }
.app-sidebar { position: sticky; top: 0; height: 100vh; padding: 18px 14px; background: var(--disha-sidebar-top); color: var(--nav-ink); border-right: 1px solid rgba(48,40,70,.15); overflow: auto; }
.app-workspace { width: 100%; max-width: none; min-width: 0; display: flex; flex-direction: column; }
.app-topbar { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 26px; background: var(--disha-sidebar-top); border-bottom: 1px solid rgba(48,40,70,.15); position: sticky; top: 0; z-index: 8; backdrop-filter: blur(10px); }
.app-main { width: 100%; max-width: none; min-width: 0; margin: 0; padding: 24px; flex: 1; overflow: visible; }

.brand { display: flex; gap: 12px; align-items: center; padding: 8px 8px 20px; color: var(--nav-ink); }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; background: var(--disha-mint); color: var(--disha-deep-green); font-weight: 800; }
.brand small, .user-summary span, .eyebrow, .muted { color: var(--muted); }
.brand small { display: block; color: var(--nav-muted); }
.eyebrow { margin: 0 0 4px; text-transform: uppercase; font-size: .72rem; letter-spacing: .08em; font-weight: 700; }
#page-title, .app-topbar h1 { margin: 0; font-size: 1.55rem; line-height: 1.2; }

.app-nav { display: flex; flex-direction: column; gap: 22px; }
.nav-section { display: grid; gap: 6px; }
.nav-link { color: var(--nav-ink); padding: 10px 12px; border-radius: 7px; display: flex; align-items: center; min-height: 40px; }
.nav-link:hover, .nav-link.active { background: var(--nav-hover-bg); color: var(--nav-ink); text-decoration: none; }
.nav-label, .nav-empty { color: var(--nav-muted); font-size: .78rem; text-transform: uppercase; font-weight: 700; padding: 0 12px; }

.user-menu { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.user-summary { text-align: right; line-height: 1.25; }
.user-summary strong { display: block; }
.user-summary span { font-size: .85rem; }
.mobile-only { display: none; }

.config-banner { margin: 16px 24px 0; padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; border: 1px solid rgba(246,94,34,.35); background: #fff5ef; color: #653018; border-radius: 8px; }
.config-banner[hidden] { display: none; }

.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 22px; }
.page-heading h2 { margin: 0 0 6px; font-size: 1.45rem; }
.page-heading p { margin: 0; color: var(--muted); max-width: 72ch; }
.page-actions, .actions, .button-row, .form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.panel, .metric-card, .roster-day, .shift-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.panel { padding: 18px; margin-bottom: 16px; }
.panel h2 { margin-top: 0; font-size: 1.05rem; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-heading h2 { margin: 0; }
.grid, .dashboard-grid, .dashboard-columns { display: grid; gap: 16px; }
.grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 18px; }
.dashboard-columns { grid-template-columns: minmax(0, 1.35fr) minmax(320px, .75fr); align-items: start; }

.metric-card { padding: 16px; display: grid; gap: 7px; }
.metric-card span { color: var(--muted); font-size: .86rem; }
.metric-card strong { font-size: 1.75rem; line-height: 1; }
.metric-card small { color: var(--muted); }
.metric-warning { border-color: rgba(246,94,34,.35); background: #fff5ef; }
.metric-ok { border-color: rgba(116,207,172,.55); background: var(--disha-pale-mint); }
.dashboard-list { display: grid; gap: 8px; }
.dashboard-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(90px, .8fr) minmax(86px, .7fr); gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dashboard-row:last-child { border-bottom: 0; }

.worker-hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px; margin-bottom: 18px; border-radius: 8px; background: #103b37; color: #fff; box-shadow: var(--shadow); }
.worker-hero h2 { margin: 8px 0; font-size: 1.65rem; }
.worker-hero p { margin: 6px 0; color: #d8efea; }
.worker-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.shift-mini { display: grid; gap: 8px; }

.toolbar, .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; margin-bottom: 16px; }
.field { display: grid; gap: 6px; color: var(--muted); font-weight: 700; font-size: .88rem; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); padding: 9px 10px; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(37,99,235,.18); border-color: var(--accent); }
.form-help { color: var(--muted); margin: 0; }

.btn, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; cursor: pointer; font-weight: 700; }
.btn:hover, .button:hover { text-decoration: none; border-color: var(--brand); }
.btn.primary, .button:not(.button-secondary) { color: #fff; background: var(--disha-deep-green); border-color: var(--disha-deep-green); }
.btn.primary:hover, .button:not(.button-secondary):hover { background: var(--brand-dark); }
.button-secondary { background: #fff; }
.icon-button { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 7px; min-height: 40px; padding: 8px 10px; }

.status-line { min-height: 1.4em; margin: 10px 0; color: var(--muted); }
.status-line.error, .error { color: var(--danger); }
.status-line.success, .success { color: var(--ok); }
.status-line.warning, .warning { color: var(--warning); }
.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 3px 8px; border-radius: 999px; background: var(--surface-soft); color: var(--brand-dark); font-size: .78rem; font-weight: 800; }
.badge.inactive, .status-cancelled { background: #fee2e2; color: var(--danger); }
.status-live, .status-published { border-left: 4px solid var(--accent); }
.status-completed { border-left: 4px solid var(--ok); }
.status-draft { border-left: 4px solid #94a3b8; }

.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-soft); font-size: .82rem; text-transform: uppercase; color: #47534f; }
tr:last-child td { border-bottom: 0; }
.empty, .empty-state { text-align: center; color: var(--muted); padding: 30px; }
.detail-list { display: grid; gap: 8px; }
.detail { display: grid; grid-template-columns: minmax(130px, .45fr) minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.detail span { color: var(--muted); font-weight: 700; }

.roster-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.roster-day { padding: 12px; box-shadow: none; }
.roster-day h2 { font-size: 1rem; margin: 0 0 10px; }
.shift-card { padding: 13px; margin-bottom: 10px; box-shadow: none; }
.shift-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.shift-card p { margin: 8px 0; }

.auth-panel { max-width: 760px; }
.settings-dialog { width: min(620px, calc(100vw - 28px)); border: 0; border-radius: 8px; padding: 22px; box-shadow: var(--shadow); }
.settings-dialog::backdrop { background: rgba(9, 18, 17, .38); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { position: fixed; inset: 0 auto 0 0; width: 286px; transform: translateX(-100%); transition: transform .18s ease; z-index: 20; }
  body.nav-open .app-sidebar { transform: translateX(0); }
  .mobile-only { display: inline-flex; }
  .app-topbar { padding: 14px; align-items: flex-start; }
  .app-main { padding: 16px; }
  .user-menu { align-items: flex-end; }
  .user-summary { display: none; }
  .dashboard-columns { grid-template-columns: 1fr; }
  .page-heading, .worker-hero { align-items: stretch; flex-direction: column; }
  .worker-actions { justify-content: stretch; }
  .worker-actions .btn, .worker-actions .button, .actions .btn { flex: 1 1 auto; min-height: 46px; }
  .dashboard-row { grid-template-columns: 1fr; gap: 4px; }
  .detail { grid-template-columns: 1fr; }
  .config-banner { margin: 12px 14px 0; flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  .toolbar, .form-grid { grid-template-columns: 1fr; }
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  table { min-width: 0; }
  thead { display: none; }
  tr { display: block; margin-bottom: 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
  td { display: grid; grid-template-columns: minmax(110px, .42fr) 1fr; gap: 8px; border-bottom: 1px solid var(--line); }
  td::before { content: attr(data-label); color: var(--muted); font-weight: 800; }
  td.actions { display: flex; }
}

.settings-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab-button { min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); cursor: pointer; font-weight: 800; }
.tab-button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.settings-intro p { margin: 0; color: var(--muted); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.setting-card { border: 1px solid var(--line); background: var(--surface-soft); border-radius: 8px; padding: 13px; display: grid; gap: 6px; }
.setting-card span { color: var(--muted); font-weight: 800; font-size: .84rem; }
.setting-card strong { font-size: 1rem; }
.setting-card small { color: var(--muted); }
.backend-gap, .warning-card { border: 1px solid #f0d283; background: #fff9e8; color: #5f4306; border-radius: 8px; padding: 13px; margin-top: 14px; }
.backend-gap p { margin: 6px 0 0; }
.warning-card ul { margin-bottom: 0; }

.roster-board-shell { display: grid; gap: 12px; }
.roster-filterbar { display: grid; grid-template-columns: auto repeat(5, minmax(140px, 1fr)) auto auto; gap: 10px; align-items: end; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); margin-bottom: 10px; }
.roster-range { align-self: end; }
.compact-field { min-width: 0; }
.compact-field input, .compact-field select { min-height: 38px; }
.compact-check { align-self: center; grid-template-columns: auto 1fr; color: var(--ink); }
.roster-kpis { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; padding: 8px 2px; color: var(--muted); }
.roster-kpis strong { color: var(--ink); }

.board-corner, .board-date, .board-participant, .board-cell { border-right: 1px solid #c3d3cb; border-bottom: 1px solid #c3d3cb; }
.board-corner, .board-date { position: sticky; top: 78px; z-index: 4; background: #edf5f2; }
.board-corner { left: 0; z-index: 5; padding: 12px; font-weight: 900; }
.board-date { min-height: 76px; padding: 10px; display: grid; gap: 3px; }
.board-date strong { font-size: .92rem; }
.board-date span, .board-date small { color: var(--muted); font-size: .78rem; }
.board-date.is-today { outline: 2px solid var(--accent); outline-offset: -2px; background: #e1efff; }
.board-date.is-weekend, .board-cell.is-weekend { background: #eee7d9; }
.board-date.is-holiday, .board-cell.is-holiday { background: #ffedd5; }
.board-date.is-past:not(.is-today), .board-cell.is-past:not(.is-today) { background-image: linear-gradient(135deg, rgba(15, 23, 42, .025) 25%, transparent 25%, transparent 50%, rgba(15, 23, 42, .025) 50%, rgba(15, 23, 42, .025) 75%, transparent 75%, transparent); background-size: 10px 10px; }
.board-participant { position: sticky; left: 0; z-index: 3; background: #fff; min-height: 128px; padding: 12px; display: grid; align-content: start; gap: 4px; }
.board-participant strong { font-size: .94rem; }
.board-participant span { color: var(--muted); font-size: .8rem; }
.board-cell { min-height: 128px; padding: 7px; display: grid; align-content: start; gap: 6px; }
.board-empty { grid-column: 1 / -1; padding: 28px; color: var(--muted); text-align: center; }
.roster-shift-card { width: 100%; display: grid; gap: 4px; text-align: left; padding: 8px; border: 1px solid var(--line); border-left: 4px solid #94a3b8; border-radius: 7px; background: #fff; color: var(--ink); cursor: pointer; min-height: 108px; }
.roster-shift-card:hover { border-color: var(--brand); box-shadow: 0 8px 18px rgba(15, 49, 45, .12); }
.roster-shift-card strong { font-size: .86rem; }
.roster-shift-card span { font-size: .78rem; color: #34413d; }
.roster-shift-card .service-code { font-family: "Segoe UI Mono", Consolas, monospace; color: var(--brand-dark); overflow-wrap: anywhere; }
.roster-shift-card.status-approved, .roster-shift-card.status-completed { border-left-color: var(--ok); }
.roster-shift-card.status-published, .roster-shift-card.status-confirmed, .roster-shift-card.status-in_progress { border-left-color: var(--accent); }
.roster-shift-card.status-cancelled, .roster-shift-card.status-no_show { border-left-color: var(--danger); opacity: .9; }
.badge-row { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.badge-row em, .badge-row b { font-style: normal; font-size: .68rem; border-radius: 999px; padding: 2px 6px; background: var(--surface-soft); color: var(--brand-dark); }
.badge-row b { background: #fff1c7; color: #6b4a05; }
.shift-drawer { width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 0; border-radius: 8px; padding: 0; box-shadow: var(--shadow); }
.shift-drawer::backdrop { background: rgba(9, 18, 17, .48); }
.shift-drawer article { padding: 18px; }
.shift-drawer header { display: flex; justify-content: space-between; gap: 16px; align-items: start; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 14px; }
.shift-drawer h2 { margin: 0 0 4px; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.drawer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mobile-roster-list { display: none; }
.compact-details summary { cursor: pointer; font-weight: 800; }
.allocation-row .btn { min-height: 32px; padding: 5px 9px; }

@media (max-width: 1180px) {
  .roster-filterbar { grid-template-columns: repeat(3, minmax(160px, 1fr)); }

}

@media (max-width: 760px) {

  .mobile-roster-list { display: none; }
  .roster-filterbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .roster-range { grid-column: 1 / -1; }
  .drawer-grid { grid-template-columns: 1fr; }
  .shift-drawer { width: calc(100vw - 16px); }
}

/* DISHA production-readiness layout refinements */
.operational-wide, .roster-wide, .dashboard-wide, .code-allocation-wide { width: 100%; max-width: none; min-width: 0; }
.nav-link.sub-nav { margin-left: 12px; min-height: 34px; padding-left: 18px; font-size: .92rem; border-left: 2px solid rgba(116,207,172,.35); }
.dashboard-control-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: minmax(118px, auto); gap: 14px; }
.dashboard-tile { display: grid; align-content: space-between; gap: 10px; padding: 16px; min-height: 118px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); color: var(--ink); }
.dashboard-tile:hover { text-decoration: none; border-color: var(--disha-mint); transform: translateY(-1px); }
.dashboard-tile strong { font-size: 1.9rem; line-height: 1; color: var(--disha-deep-green); }
.dashboard-tile span { color: var(--muted); }
.dashboard-tile h2 { margin: 0; font-size: 1rem; }
.dashboard-tile.tile-wide { grid-column: span 2; }
.dashboard-tile.tile-large { grid-column: span 2; grid-row: span 2; }
.dashboard-tile.attention { border-color: rgba(246,94,34,.45); background: #fff6f0; }
.dashboard-tile.blocking { border-color: rgba(220,50,24,.4); background: #fff1ef; }
.dashboard-tile.complete { background: var(--disha-pale-mint); border-color: rgba(116,207,172,.6); }
.dashboard-panel-list { display: grid; gap: 8px; }
.birthday-item { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.birthday-item:last-child { border-bottom: 0; }

.board-corner, .board-date { top: 78px; }
.board-date { min-height: 72px; text-transform: uppercase; }
.board-date.is-today { background: var(--disha-pale-mint); outline: 3px solid var(--disha-mint); }
.board-date.is-weekend, .board-cell.is-weekend { background: #fff8f1; }
.board-date.is-holiday, .board-cell.is-holiday { background: #fff0ea; }
.board-participant { min-height: 132px; height: auto; overflow: visible; }
.board-cell { min-height: 132px; height: auto; overflow: visible; align-content: start; }
.roster-shift-card { min-height: 118px; overflow: visible; border-left-color: var(--disha-deep-green); }
.roster-shift-card .card-worker { font-size: .95rem; font-weight: 900; color: var(--ink); }
.roster-shift-card .card-time { font-weight: 800; color: var(--disha-deep-green); }
.roster-shift-card .card-classification { text-transform: uppercase; font-weight: 900; color: var(--disha-deep-green); }
.roster-shift-card .card-status { text-transform: uppercase; letter-spacing: .04em; font-size: .7rem; font-weight: 900; }
.roster-shift-card .service-code.missing { color: var(--disha-coral); font-weight: 900; }
.shift-drawer { width: min(90vw, 1320px); max-height: 92vh; }
.shift-drawer article { max-height: 92vh; overflow: auto; }
.drawer-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inline-edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.code-allocation-form { display: grid; gap: 12px; }
.backend-pending { border: 1px solid rgba(246,94,34,.35); background: #fff5ef; color: #66321d; border-radius: 8px; padding: 12px; }
@media (max-width: 1280px) { .dashboard-control-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .drawer-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .dashboard-control-grid { grid-template-columns: 1fr; } .dashboard-tile, .dashboard-tile.tile-wide, .dashboard-tile.tile-large { grid-column: auto; grid-row: auto; } .drawer-grid.three { grid-template-columns: 1fr; } }

/* Roster compact operations board */
.roster-wide { height: calc(100dvh - 78px); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.roster-wide .page-heading { flex: 0 0 auto; align-items: center; margin: 0 0 8px; gap: 12px; min-height: 42px; }
.roster-wide .page-heading h2 { margin: 0; font-size: 1.18rem; line-height: 1.1; }
.roster-wide .page-heading p { margin: 2px 0 0; font-size: .82rem; max-width: none; }
.roster-wide .page-actions { align-items: center; }
.roster-wide .status-line { flex: 0 0 auto; min-height: 0; margin: 0; }
.roster-wide [data-roster], .roster-board-shell { min-height: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.roster-filterbar { flex: 0 0 auto; grid-template-columns: auto repeat(5, minmax(112px, 1fr)) auto; gap: 6px; align-items: end; padding: 7px 8px; margin: 0; box-shadow: none; }
.roster-filterbar .field { gap: 3px; font-size: .74rem; line-height: 1.05; }
.roster-filterbar input, .roster-filterbar select { min-height: 31px; height: 31px; padding: 4px 7px; font-size: .82rem; border-radius: 6px; }
.roster-filterbar .btn { min-height: 31px; padding: 4px 9px; font-size: .8rem; border-radius: 6px; white-space: nowrap; }
.roster-range { display: inline-flex; gap: 0; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; align-self: end; white-space: nowrap; }
.roster-range .btn { border: 0; border-right: 1px solid var(--line); border-radius: 0; min-width: 38px; }
.roster-range .btn:last-child { border-right: 0; }
.roster-kpis { flex: 0 0 auto; gap: 10px; padding: 4px 1px; font-size: .78rem; line-height: 1.1; }

.board-corner, .board-date { top: 0; z-index: 6; }
.board-corner { left: 0; z-index: 8; min-height: 50px; padding: 8px 9px; font-size: .75rem; display: flex; align-items: center; background: #f8fbfa; }
.board-date { min-height: 50px; padding: 6px 7px; gap: 1px; align-content: center; }
.board-date strong { font-size: .72rem; line-height: 1; letter-spacing: 0; }
.board-date span { font-size: .72rem; line-height: 1; font-weight: 900; color: var(--ink); }
.board-date small { font-size: .64rem; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-participant { left: 0; z-index: 5; width: 148px; min-height: 74px; padding: 8px 9px; gap: 2px; align-content: start; box-shadow: 4px 0 8px rgba(55,102,86,.06); }
.board-participant strong { font-size: .79rem; line-height: 1.14; }
.board-participant span { font-size: .7rem; line-height: 1; font-weight: 900; color: var(--disha-deep-green); }
.board-cell { min-height: 74px; padding: 4px; gap: 4px; align-content: start; overflow: visible; }
.roster-shift-card { min-height: 0; padding: 5px 6px; gap: 2px; border-left-width: 3px; border-radius: 6px; line-height: 1.08; }
.roster-shift-card strong, .roster-shift-card .card-worker { font-size: .74rem; line-height: 1.12; }
.roster-shift-card span, .roster-shift-card .card-time, .roster-shift-card .card-classification { font-size: .68rem; line-height: 1.1; }
.roster-shift-card .card-time { font-weight: 800; }
.roster-shift-card .card-classification { font-weight: 900; }
.roster-shift-card .service-code { font-size: .66rem; line-height: 1.05; }
.roster-shift-card .card-status { font-size: .61rem; line-height: 1; letter-spacing: 0; }
.badge-row { gap: 3px; margin-top: 1px; }
.badge-row b { font-size: .58rem; line-height: 1; padding: 2px 4px; border-radius: 999px; }
.compact-details { flex: 0 0 auto; padding: 7px 10px; margin: 0; box-shadow: none; }
.compact-details summary { font-size: .8rem; }
.compact-details .table-wrap { max-height: 180px; overflow: auto; margin: 8px 0 0; }
@media (max-width: 1180px) {
  .roster-filterbar { grid-template-columns: repeat(3, minmax(150px, 1fr)); }

  .board-participant { width: 140px; }
}
@media (max-width: 760px) {

  .roster-filterbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .roster-range { grid-column: 1 / -1; }

}

/* Roster/Create Shift management corrections */


.roster-shift-card .service-code.no-code { color: var(--muted); font-weight: 700; }
.shift-form-shell { display: grid; gap: 8px; max-width: none; }
.shift-form-compact { display: grid; gap: 8px; }
.shift-form-section { margin: 0; padding: 12px; box-shadow: none; }
.shift-form-section h2 { margin: 0 0 9px; font-size: .95rem; }
.shift-form-grid { display: grid; gap: 8px; align-items: end; }
.shift-form-grid.top-grid { grid-template-columns: repeat(6, minmax(130px, 1fr)); }
.shift-form-grid.people-grid { grid-template-columns: minmax(220px, 1.15fr) minmax(180px, .85fr) minmax(220px, 1.15fr) minmax(160px, .7fr) minmax(220px, 1fr); }
.shift-form-grid.notes-grid { grid-template-columns: repeat(3, minmax(220px, 1fr)); align-items: start; }
.shift-notes-list { display: grid; gap: 12px; }
.shift-note-editor { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.shift-note-meta { color: var(--muted); font-size: .82rem; font-weight: 700; }
.shift-form-grid.service-grid { grid-template-columns: repeat(4, minmax(160px, 1fr)); }
.shift-form-shell .field { gap: 4px; font-size: .78rem; }
.shift-form-shell input, .shift-form-shell select { min-height: 34px; padding: 6px 8px; }
.shift-form-shell select[multiple] { min-height: 92px; }
.shift-form-shell textarea { min-height: 74px; padding: 7px 8px; }
.shift-form-shell .button-row { margin-top: 2px; }
.optional-warning { min-height: 0; margin: 6px 0 0; font-size: .78rem; color: var(--muted); }
.service-code-section .selected-ratio { min-height: 72px; padding: 10px; }
.recurring-fields { margin: 0; }
.recurring-fields[open] { padding-bottom: 10px; }
@media (max-width: 1320px) {
  .shift-form-grid.top-grid, .shift-form-grid.service-grid { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
  .shift-form-grid.people-grid, .shift-form-grid.notes-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}
@media (max-width: 760px) {
  .shift-form-grid.top-grid, .shift-form-grid.people-grid, .shift-form-grid.notes-grid, .shift-form-grid.service-grid { grid-template-columns: 1fr; }
}

/* Live workflow integration and DISHA palette pass */
.app-sidebar { background: var(--disha-sidebar-top); }
.app-topbar { background: var(--disha-sidebar-top); }
.panel, .metric-card, .table-wrap, .shift-drawer article, .settings-dialog { background: var(--surface); }
.nav-link:hover, .nav-link.active { background: var(--nav-hover-bg); color: var(--nav-ink); }
.brand { color: var(--nav-ink); }
.btn.primary, .button, button.primary { background: var(--disha-deep-green); border-color: var(--disha-deep-green); color: #fff; }
.btn.primary:hover, .button:hover { background: #2f594b; }
.btn.danger, .button.danger, .shift-card-bin { background: var(--disha-coral); border-color: var(--disha-coral); color: #fff; }
.tab-button.active, .badge.ok { background: var(--disha-mint); border-color: var(--disha-mint); color: var(--disha-deep-green); }
.badge.warn, .metric-warning, .warning-card { background: #fff4ed; border-color: rgba(246,94,34,.45); color: #673018; }
.badge.danger, .status-line.error { background: #fff1ef; border-color: rgba(220,50,24,.45); color: var(--disha-coral); }
.roster-wide { width: 100%; max-width: none; }

.board-corner { width: 180px; }
.board-participant { width: 180px; min-width: 180px; }
.board-date { min-width: 150px; }
.board-cell { min-width: 150px; }
.roster-shift-wrap { position: relative; min-width: 0; }
.roster-shift-card { padding-right: 46px; }
.shift-card-bin { position: absolute; top: 4px; right: 4px; z-index: 2; width: 40px; min-height: 22px; padding: 2px 5px; border-radius: 6px; font-size: .62rem; font-weight: 900; cursor: pointer; opacity: .88; }
.shift-card-bin:hover, .shift-card-bin:focus-visible { opacity: 1; }
.roster-shift-card .card-ratio { font-weight: 900; color: var(--disha-deep-green); }
.roster-shift-card .service-code.no-code { color: var(--muted); }
.shift-drawer header { border-bottom-color: var(--line); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--disha-mint); outline-offset: 1px; border-color: var(--disha-deep-green); }
/* The app shell, page and board all shrink; only this outer element scrolls. */
.roster-wide [data-roster], .roster-board-shell, .roster-wide [data-board] {
  width: 100%; max-width: none; min-width: 0; min-height: 0;
  display: flex; flex-direction: column; flex: 1 1 0;
}
.roster-wide [data-patterns] { flex: 0 0 auto; min-width: 0; }
.roster-wide .page-actions .btn { min-height: 31px; padding: 5px 9px; font-size: .8rem; }
.fortnight-board-wrap {
  width: 100%; max-width: 100%; min-width: 0; min-height: 0;
  flex: 1 1 0; overflow-x: scroll; overflow-y: auto;
  scrollbar-gutter: stable; overscroll-behavior: contain;
}
.fortnight-board {
  display: grid; width: 100%; min-width: 2280px;
  grid-template-columns: 180px repeat(14, minmax(150px, 1fr));
  grid-auto-rows: minmax(74px, auto); align-items: stretch;
  overflow: visible; background: #fff;
}
.fortnight-board-wrap::-webkit-scrollbar { height: 14px; width: 14px; }
.fortnight-board-wrap::-webkit-scrollbar-track { background: #e0ebe5; }
.fortnight-board-wrap::-webkit-scrollbar-thumb { background: #637d70; border: 2px solid #e0ebe5; border-radius: 8px; }
.board-date.is-saturday, .board-cell.is-saturday { background: #f4f7f1; }
.board-date.is-sunday, .board-cell.is-sunday { background: #f8f3ed; }
.board-date.is-holiday, .board-cell.is-holiday { background: #fff3e4; }
.board-date.is-today { box-shadow: inset 0 -3px var(--brand); }
.empty-cell-add { display: grid; place-items: center; width: 28px; height: 28px; border: 1px dashed #aec2b7; border-radius: 6px; color: #637d70; margin: 4px auto; }
.empty-cell-add:hover, .empty-cell-add:focus-visible { background: var(--surface-soft); color: var(--brand); text-decoration: none; }
.recently-saved { outline: 3px solid var(--disha-orange); outline-offset: -3px; }

/* Catalogue controls stay compact without constraining the page shell. */
.shift-form-grid.people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.shift-form-grid.service-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.service-grid > .field, .service-grid > .setting-card { grid-column: span 3; min-width: 0; }
.service-grid > .billing-third { grid-column: span 2; }
.service-grid select, .service-grid input { width: 100%; min-width: 0; }
.service-grid input[readonly] { background: #f1f5f9; color: #334155; }
@media (max-width: 700px) {
  .shift-form-grid.people-grid, .shift-form-grid.service-grid { grid-template-columns: minmax(0, 1fr); }
  .service-grid > .field, .service-grid > .setting-card, .service-grid > .billing-third { grid-column: auto; }
}

.service-grid > .field.checkbox { display: flex; align-items: center; gap: .5rem; }
.service-grid input[type="checkbox"] { width: auto; min-height: 0; margin: 0; }

/* Timesheet review dashboard */
.timesheet-review-wide { width: 100%; max-width: none; min-width: 0; }
.timesheet-summary-grid { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.timesheet-summary-card { min-height: 104px; padding: 14px 15px; border: 1px solid var(--line); border-left: 4px solid var(--disha-deep-green); border-radius: 10px; background: #fff; display: grid; align-content: center; gap: 5px; box-shadow: 0 8px 20px rgba(55,102,86,.08); }
.timesheet-summary-card span { color: var(--muted); font-size: .78rem; font-weight: 800; }
.timesheet-summary-card strong { font-size: 1.42rem; line-height: 1.1; color: var(--ink); }
.timesheet-summary-card small { color: var(--muted); font-size: .76rem; }
.timesheet-summary-card.tone-warning { border-left-color: var(--disha-orange); }
.timesheet-summary-card.tone-ok { border-left-color: var(--disha-mint); }
.timesheet-summary-card.tone-danger { border-left-color: var(--disha-coral); }
.timesheet-filterbar { display: grid; grid-template-columns: minmax(190px, 1fr) 165px 165px minmax(330px, 1.4fr) auto; gap: 12px; align-items: end; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 14px; box-shadow: 0 8px 20px rgba(55,102,86,.06); }
.timesheet-status-field { align-self: stretch; }
.timesheet-status-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.timesheet-status-tab { min-height: 38px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font-weight: 800; cursor: pointer; }
.timesheet-status-tab.active { background: var(--disha-deep-green); border-color: var(--disha-deep-green); color: #fff; }
.timesheet-filter-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.timesheet-review-layout { display: grid; grid-template-columns: 255px minmax(0, 1fr); gap: 14px; align-items: stretch; min-height: 560px; }
.timesheet-worker-panel, .timesheet-table-panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 20px rgba(55,102,86,.06); min-width: 0; }
.timesheet-worker-panel { display: flex; flex-direction: column; overflow: hidden; }
.timesheet-worker-heading { display: flex; justify-content: space-between; align-items: center; padding: 16px 14px 10px; }
.timesheet-worker-heading h2 { margin: 0; font-size: 1rem; }
.timesheet-worker-heading span { min-width: 30px; height: 24px; border-radius: 999px; display: grid; place-items: center; background: var(--disha-pale-mint); color: var(--disha-deep-green); font-weight: 800; font-size: .75rem; }
.timesheet-worker-search { padding: 0 12px 10px; }
.timesheet-worker-search input { min-height: 38px; background: #fbfdfc; }
.timesheet-worker-list { display: grid; gap: 8px; padding: 0 10px 10px; overflow: auto; max-height: 560px; }
.timesheet-worker-item { width: 100%; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.timesheet-worker-item:hover { border-color: var(--disha-mint); }
.timesheet-worker-item.selected { background: var(--disha-pale-mint); border-color: var(--disha-mint); }
.timesheet-worker-item.has-pending:not(.selected) { background: #fff8eb; border-color: #f3cf86; }
.timesheet-worker-item strong, .timesheet-worker-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timesheet-worker-item small { margin-top: 2px; color: var(--muted); font-size: .74rem; }
.timesheet-worker-item b { min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; background: #fff1d3; color: #9a5b00; font-size: .72rem; }
.worker-avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: inline-grid; place-items: center; background: #e9f5f0; color: var(--disha-deep-green); font-weight: 800; font-size: .76rem; }
.timesheet-worker-footer { margin-top: auto; padding: 12px; background: var(--disha-deep-green); color: #fff; text-align: center; font-weight: 800; font-size: .82rem; }
.timesheet-table-panel { overflow: hidden; display: flex; flex-direction: column; }
.timesheet-table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.timesheet-table-scroll { overflow: auto; max-height: 590px; }
.timesheet-review-table { min-width: 980px; }
.timesheet-review-table thead { position: sticky; top: 0; z-index: 2; }
.timesheet-review-table th { background: #fbfdfc; color: #708079; font-size: .72rem; }
.timesheet-review-table td { padding: 10px 11px; vertical-align: middle; }
.timesheet-data-row { cursor: pointer; }
.timesheet-data-row:hover td { background: #fbfdfc; }
.timesheet-data-row.expanded td { background: #f7fbf9; }
.timesheet-person-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.participant-chip { display: inline-flex; align-items: center; min-height: 28px; margin: 2px 4px 2px 0; padding: 3px 8px; border-radius: 999px; background: #f0f5f3; color: var(--ink); font-size: .78rem; }
.timesheet-review-table td strong, .timesheet-review-table td small { display: block; }
.timesheet-review-table td small { color: var(--muted); margin-top: 2px; }
.actual-missing { color: var(--disha-coral); }
.round-action { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer; font-size: 1rem; font-weight: 900; }
.round-action.approve { background: #e2f8f1; color: #168267; }
.round-action.reject { background: #fff0f0; color: var(--disha-coral); }
.btn.danger { color: var(--disha-coral); border-color: rgba(220,50,24,.35); background: #fff5f3; }
.btn.danger:hover { border-color: var(--disha-coral); }
.timesheet-detail-row td { padding: 0; background: #f8fbfa; }
.timesheet-row-detail { padding: 15px 18px 18px 58px; border-bottom: 1px solid var(--line); }
.timesheet-detail-facts { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.timesheet-detail-facts > div { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.timesheet-detail-facts span, .timesheet-detail-facts strong { display: block; }
.timesheet-detail-facts span { color: var(--muted); font-size: .72rem; font-weight: 800; margin-bottom: 3px; }
.timesheet-inline-correction { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)) minmax(180px, 1.2fr) auto; gap: 8px; align-items: end; margin: 10px 0 12px; }
.timesheet-inline-correction input { min-height: 38px; }
.timesheet-table-footer { min-height: 46px; display: flex; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* Past-shift actual record */
.actual-shift-record { margin-top: 14px; }
.actual-worker-records { display: grid; gap: 10px; }
.actual-worker-card { border: 1px solid var(--line); border-radius: 9px; padding: 12px; background: #fbfdfc; }
.actual-worker-card h4 { margin: 0 0 10px; }
.actual-worker-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 8px; align-items: end; }
.actual-worker-grid input { min-height: 38px; }
.shift-note-entry { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(150px, .8fr) minmax(260px, 2fr) auto; gap: 8px; align-items: end; margin-top: 12px; }
.shift-note-history { display: grid; gap: 8px; margin-top: 12px; }
.shift-note-history article { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.shift-note-history article p { margin: 5px 0; }
.shift-note-history article small { color: var(--muted); }

/* Invoices */
.invoice-list-shell { display: grid; gap: 14px; }
.invoice-empty-state { padding: 34px; text-align: center; border: 1px dashed var(--line); border-radius: 10px; background: #fff; }

@media (max-width: 1280px) {
  .timesheet-summary-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .timesheet-filterbar { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
  .timesheet-status-field { grid-column: span 2; }
  .timesheet-filter-actions { justify-content: flex-start; }
  .timesheet-detail-facts { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .timesheet-inline-correction { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
  .actual-worker-grid { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
}

@media (max-width: 900px) {
  .timesheet-review-layout { grid-template-columns: 1fr; }
  .timesheet-worker-list { max-height: 260px; }
  .timesheet-summary-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .timesheet-filterbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timesheet-status-field, .timesheet-filter-actions { grid-column: 1 / -1; }
  .shift-note-entry { grid-template-columns: 1fr 1fr; }
  .shift-note-entry .field:nth-child(3) { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .timesheet-summary-grid { grid-template-columns: 1fr 1fr; }
  .timesheet-filterbar { grid-template-columns: 1fr; }
  .timesheet-status-field, .timesheet-filter-actions { grid-column: auto; }
  .timesheet-table-scroll { overflow: auto; }
  .timesheet-review-table { min-width: 980px; }
  .timesheet-review-table thead { display: table-header-group; }
  .timesheet-review-table tr { display: table-row; margin: 0; border: 0; box-shadow: none; }
  .timesheet-review-table td { display: table-cell; }
  .timesheet-review-table td::before { content: none; }
  .timesheet-detail-facts, .timesheet-inline-correction, .actual-worker-grid, .shift-note-entry { grid-template-columns: 1fr; }
  .timesheet-row-detail { padding-left: 14px; }
}

/* Invoice register */
.invoice-list-wide { width: 100%; max-width: none; min-width: 0; }
.invoice-filterbar { display: grid; grid-template-columns: minmax(190px,1.1fr) 155px 155px 150px minmax(170px,.9fr) auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 8px 20px rgba(55,102,86,.06); }
.invoice-search-field { min-width: 0; }
.invoice-summary-grid { display: grid; grid-template-columns: repeat(4,minmax(150px,1fr)); gap: 12px; }
.invoice-summary-card { padding: 13px 15px; min-height: 92px; border: 1px solid var(--line); border-left: 4px solid var(--disha-mint); border-radius: 10px; background: #fff; display: grid; align-content: center; gap: 4px; box-shadow: 0 8px 20px rgba(55,102,86,.06); }
.invoice-summary-card span { color: var(--muted); font-size: .76rem; font-weight: 800; }
.invoice-summary-card strong { color: var(--ink); font-size: 1.3rem; }
.invoice-summary-card small { color: var(--muted); font-size: .75rem; }
.invoice-table-panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 8px 20px rgba(55,102,86,.06); }
.invoice-table-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.invoice-table-heading h2 { margin: 0; font-size: 1rem; }
.invoice-table-heading p { margin: 3px 0 0; color: var(--muted); font-size: .78rem; }
.invoice-table-scroll { margin: 0; border: 0; border-radius: 0; max-height: calc(100vh - 390px); overflow: auto; }
.invoice-table-scroll table { min-width: 900px; }
.invoice-table-scroll thead { position: sticky; top: 0; z-index: 2; }
.invoice-table-scroll th { background: #fbfdfc; }
.inline-warning { margin: 0; padding: 9px 12px; border: 1px solid #f0c87a; border-radius: 8px; background: #fff8e8; color: #754d00; }

@media (max-width: 1150px) {
  .invoice-filterbar { grid-template-columns: repeat(3,minmax(150px,1fr)); }
  .invoice-summary-grid { grid-template-columns: repeat(2,minmax(150px,1fr)); }
}
@media (max-width: 700px) {
  .invoice-filterbar, .invoice-summary-grid { grid-template-columns: 1fr; }
  .invoice-table-heading { align-items: flex-start; flex-direction: column; }
}

/* Shared fortnight navigation for operational finance/review pages */
.fortnight-nav-field { min-width: max-content; }
.fortnight-nav-field > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: .74rem; font-weight: 800; }
.fortnight-nav { display: inline-flex; flex-wrap: nowrap; gap: 5px; }
.fortnight-nav .btn { min-height: 36px; padding: 6px 10px; white-space: nowrap; }
.timesheet-filterbar { grid-template-columns: minmax(180px,1fr) auto 155px 155px minmax(280px,1.2fr) auto; }
.invoice-filterbar { grid-template-columns: minmax(180px,1fr) auto 150px 150px 140px minmax(160px,.9fr) auto; }
.code-allocation-wide .roster-filterbar { grid-template-columns: auto 145px 145px minmax(170px,1fr) minmax(150px,1fr) minmax(145px,.8fr) auto auto; }

@media (max-width: 1280px) {
  .timesheet-filterbar { grid-template-columns: repeat(3,minmax(160px,1fr)); }
  .fortnight-nav-field { min-width: 0; }
}
@media (max-width: 1150px) {
  .invoice-filterbar, .code-allocation-wide .roster-filterbar { grid-template-columns: repeat(3,minmax(150px,1fr)); }
}
@media (max-width: 700px) {
  .fortnight-nav { flex-wrap: wrap; }
  .invoice-filterbar, .code-allocation-wide .roster-filterbar { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .timesheet-filterbar { grid-template-columns: 1fr; }
  .fortnight-nav-field { min-width: 0; }
  .fortnight-nav { display: flex; width: 100%; }
  .fortnight-nav .btn { flex: 1 1 auto; }
}

/* Timesheet Code Allocation review-before-approval workflow */
.timesheet-code-allocation{margin:14px 0;padding:14px;border:1px solid #cfe2da;border-radius:12px;background:#fbfefd}
.timesheet-code-allocation-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.timesheet-code-allocation-head h3{margin:2px 0 0}
.timesheet-code-allocation-line{display:grid;grid-template-columns:minmax(140px,1fr) minmax(150px,.9fr) minmax(240px,1.8fr) minmax(120px,.7fr);gap:10px;align-items:center;padding:8px 0;border-top:1px solid #e3eee9;font-size:13px}
.timesheet-code-allocation-line:first-of-type{border-top:0}
@media(max-width:900px){.timesheet-code-allocation-line{grid-template-columns:1fr 1fr}.timesheet-code-allocation-head{align-items:flex-start;flex-direction:column}}

/* Invoice document: compact A4 layout based on the DISHA reference invoice. */
.invoice-print { background:#fff; color:#192b4a; max-width:1000px; margin:0 auto; padding:28px 32px; }
.invoice-void-banner { margin:0 0 10px; padding:6px 10px; border:2px solid var(--disha-coral); color:var(--disha-coral); font-weight:800; letter-spacing:.12em; text-align:center; }
.invoice-letterhead { display:flex; justify-content:space-between; align-items:flex-start; gap:24px; margin-bottom:26px; }
.invoice-letterhead h2 { margin:0 0 6px; font-size:18px; line-height:1.2; }
.invoice-letterhead p,.invoice-bank p { line-height:1.38; margin:0; font-size:11.5px; }
.invoice-logo { width:168px; height:auto; max-height:96px; object-fit:contain; flex:none; }
.invoice-information { display:grid; grid-template-columns:1.5fr 1fr; gap:28px; margin-bottom:16px; font-size:11.5px; }
.invoice-information dl { display:grid; grid-template-columns:max-content minmax(0,1fr); gap:5px 11px; margin:0; align-content:start; }
.invoice-information dt { font-weight:700; }
.invoice-information dd { margin:0; overflow-wrap:anywhere; }
.invoice-lines { width:100%; min-width:0; table-layout:fixed; border-collapse:collapse; font-size:10.5px; }
.invoice-lines th,.invoice-lines td { padding:6px 5px; vertical-align:top; white-space:normal; overflow-wrap:anywhere; border-bottom:1px solid #c6cedb; line-height:1.28; }
.invoice-lines th { background:#f0f0f0; color:#192b4a; text-align:left; font-size:10px; font-weight:700; }
.invoice-lines small { display:block; margin-top:2px; font-size:9.5px; line-height:1.2; }
.invoice-lines .numeric { text-align:right; white-space:nowrap; overflow-wrap:normal; }
.invoice-footer-grid { display:grid; grid-template-columns:minmax(0,1fr) 235px; gap:28px; align-items:end; margin-top:14px; break-inside:avoid; page-break-inside:avoid; }
.invoice-totals { width:235px; margin:0 0 0 auto; break-inside:avoid; }
.invoice-totals p { display:flex; justify-content:space-between; gap:15px; margin:6px 0; }
.invoice-amount-due { border-top:1px solid #c6cedb; padding-top:8px; font-size:15px; font-weight:700; }
.invoice-bank { break-inside:avoid; font-size:11.5px; align-self:end; }
.invoice-bank strong { display:block; margin-bottom:2px; }

@media print {
  @page { size:A4; margin:9mm 10mm; }
  html,body,.app-shell,main,[data-page-slot] { background:white!important; margin:0!important; padding:0!important; width:100%!important; max-width:none!important; min-width:0!important; display:block!important; }
  body:has(.invoice-print) .app-sidebar, body:has(.invoice-print) .app-topbar, body:has(.invoice-print) .config-banner,
  body:has(.invoice-print) .page-header, body:has(.invoice-print) [data-status], body:has(.invoice-print) main > :not(.invoice-print) { display:none!important; }
  body:has(.invoice-print) .app-workspace { display:block!important; margin:0!important; padding:0!important; width:100%!important; }
  .invoice-print { display:block!important; width:100%; max-width:none; padding:0; margin:0; border:0; box-shadow:none; }
  .invoice-letterhead { margin-bottom:18px; }
  .invoice-logo { width:150px; max-height:86px; }
  .invoice-letterhead h2 { font-size:16px; margin-bottom:4px; }
  .invoice-letterhead p,.invoice-bank p,.invoice-information { font-size:10.5px; }
  .invoice-information { gap:22px; margin-bottom:12px; }
  .invoice-information dl { gap:4px 9px; }
  .invoice-lines { font-size:9.6px; overflow:visible; }
  .invoice-lines th,.invoice-lines td { padding:4.5px 4px; line-height:1.2; }
  .invoice-lines th { font-size:9.3px; }
  .invoice-lines small { font-size:8.8px; margin-top:1px; }
  .invoice-lines thead { display:table-header-group; }
  .invoice-lines tr { break-inside:avoid; page-break-inside:avoid; }
  .invoice-letterhead,.invoice-information { break-inside:avoid; page-break-inside:avoid; }
  .invoice-footer-grid { margin-top:10px; gap:22px; }
  .invoice-totals { width:220px; }
  .invoice-totals p { margin:4px 0; }
  .invoice-amount-due { padding-top:6px; font-size:13px; }
  .invoice-bank { font-size:10.5px; }
}

/* Roster and Edit Shift interaction redesign */
.roster-period-label { min-width: 218px !important; font-weight: 800; }
.roster-nav-arrow { width: 42px; font-weight: 900; letter-spacing: -.08em; }
.roster-shift-card { padding-top: 31px; padding-right: 6px; }
.shift-card-tools { position: absolute; top: 4px; right: 4px; z-index: 3; display: flex; gap: 3px; }
.shift-card-tool, .shift-card-bin {
  position: static; width: 23px; height: 23px; min-height: 23px; padding: 3px;
  display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 5px;
  background: rgba(255,255,255,.94); color: var(--disha-deep-green); cursor: pointer; opacity: .82;
}
.shift-card-tool:hover, .shift-card-tool:focus-visible { opacity: 1; border-color: var(--disha-deep-green); background: var(--disha-mint); }
.shift-card-tool svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.shift-card-bin { background: rgba(255,255,255,.94); color: var(--danger); border-color: rgba(190,36,36,.25); }
.shift-card-bin:hover, .shift-card-bin:focus-visible { background: #fee2e2; border-color: var(--danger); }
.shift-card-grab { font-size: 1rem; line-height: 1; cursor: grab; touch-action: none; }
.shift-card-grab:active, .roster-shift-wrap.is-dragging .shift-card-grab { cursor: grabbing; }
.roster-shift-wrap.is-dragging { opacity: .58; }

.shift-form-grid.people-grid.people-stack { grid-template-columns: minmax(0, 1fr); align-items: start; }
.people-dropdown-field { position: relative; }
.people-dropdown { width: 100%; position: relative; }
.people-dropdown summary {
  min-height: 38px; display: flex; align-items: center; padding: 7px 34px 7px 10px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer;
  list-style-position: inside; font-weight: 700;
}
.people-dropdown[open] summary { border-color: var(--disha-deep-green); outline: 2px solid var(--disha-mint); }
.people-dropdown-menu {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 250px; overflow-y: auto; padding: 6px; border: 1px solid var(--line);
  border-radius: 7px; background: #fff; box-shadow: var(--shadow);
}
.people-dropdown-menu label { display: flex; align-items: center; gap: 8px; padding: 7px; border-radius: 5px; cursor: pointer; }
.people-dropdown-menu label:hover { background: var(--surface-soft); }
.people-dropdown-menu input { width: 16px; min-height: 16px; margin: 0; }
.shift-workflow-actions { position: sticky; bottom: 0; z-index: 8; padding: 10px; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); }
.section-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-heading-row h2, .section-heading-row p { margin: 0; }
.allocation-summary-list { display: grid; gap: 7px; }
.allocation-summary-row {
  display: grid; grid-template-columns: minmax(130px,1fr) minmax(150px,1fr) minmax(200px,1.4fr) minmax(130px,.8fr) minmax(120px,.7fr) auto;
  gap: 8px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft);
}
@media (max-width: 900px) {
  .roster-period-label { min-width: 170px !important; }
  .allocation-summary-row { grid-template-columns: 1fr; }
  .section-heading-row { align-items: flex-start; flex-direction: column; }
}

/* Embedded roster shift and NDIS billing editors */
.shift-editor-modal { width: min(1180px, calc(100vw - 24px)); height: min(920px, calc(100vh - 24px)); max-width: none; max-height: none; border: 0; border-radius: 10px; padding: 0; box-shadow: var(--shadow); }
.shift-editor-modal::backdrop { background: rgba(9,18,17,.52); }
.shift-editor-modal > article { height: 100%; display: grid; grid-template-rows: auto minmax(0,1fr); background: var(--surface); }
.shift-editor-modal > article > header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.shift-editor-modal h2 { margin: 0; }
.shift-editor-modal iframe { width: 100%; height: 100%; border: 0; background: var(--bg); }
body.embedded-shift-editor { min-height: 0; }
body.embedded-shift-editor .app-shell { display: block; min-height: 0; }
body.embedded-shift-editor .app-sidebar,
body.embedded-shift-editor .app-topbar,
body.embedded-shift-editor .config-banner { display: none !important; }
body.embedded-shift-editor .app-main { padding: 16px; }
body.embedded-shift-editor .page-heading { margin-bottom: 14px; }
.code-editor-dialog { width: min(940px, calc(100vw - 24px)); }
.code-editor-dialog .service-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 760px) { .shift-editor-modal { width: 100vw; height: 100vh; border-radius: 0; } .code-editor-dialog .service-grid { grid-template-columns: 1fr; } }

.dashboard-theme-picker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 320px) auto; gap: 16px; align-items: end; margin-bottom: 16px; }
.dashboard-theme-picker h2 { margin: 0 0 4px; font-size: 1rem; }
.theme-swatch-row { display: flex; gap: 4px; align-items: center; }
.theme-swatch-row span { width: 24px; height: 24px; border: 1px solid rgba(15,23,42,.16); border-radius: 999px; }
@media (max-width: 720px) { .dashboard-theme-picker { grid-template-columns: 1fr; gap: 10px; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
/* Restore the original roster board proportions while retaining responsive scrolling and actions. */
.roster-wide { height: auto; min-height: 0; display: block; overflow: visible; }
.roster-wide [data-roster], .roster-board-shell, .roster-wide [data-board] { display: block; flex: none; min-height: 0; }
.roster-filterbar { grid-template-columns: auto repeat(5, minmax(140px, 1fr)) auto auto; gap: 10px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow); }
.roster-filterbar .field { gap: 6px; font-size: .88rem; line-height: normal; }
.roster-filterbar input, .roster-filterbar select { min-height: 42px; height: auto; padding: 9px 10px; font-size: 1rem; border-radius: 7px; }
.roster-filterbar .btn { min-height: 38px; padding: 8px 12px; font-size: 1rem; border-radius: 7px; }
.roster-kpis { gap: 14px; padding: 8px 2px; font-size: 1rem; line-height: normal; }
.board-corner, .board-date { top: 78px; }
.board-corner { min-height: 76px; padding: 12px; font-size: 1rem; display: block; background: var(--surface); }
.board-date { min-height: 76px; padding: 10px; gap: 3px; align-content: normal; }
.board-date strong { font-size: .92rem; line-height: normal; }
.board-date span { font-size: .78rem; line-height: normal; }
.board-date small { font-size: .78rem; line-height: normal; }
.board-participant { width: 180px; min-height: 128px; padding: 12px; gap: 4px; box-shadow: 4px 0 8px rgba(55,102,86,.06); }
.board-participant strong { font-size: .94rem; line-height: normal; }
.board-cell { min-height: 128px; padding: 8px; gap: 8px; }
.roster-shift-card { min-height: 108px; padding: 13px; gap: 8px; border-left-width: 4px; border-radius: 8px; line-height: normal; }
.roster-shift-card strong, .roster-shift-card .card-worker { font-size: .86rem; line-height: normal; }
.roster-shift-card span, .roster-shift-card .card-time, .roster-shift-card .card-classification { font-size: .78rem; line-height: normal; }
.roster-shift-card .service-code { font-size: .78rem; line-height: normal; }
.roster-shift-card .card-status { font-size: .7rem; line-height: normal; }
@media (max-width: 1180px) { .roster-filterbar { grid-template-columns: repeat(3, minmax(150px, 1fr)); } .board-participant { width: 180px; } }
@media (max-width: 760px) { .roster-filterbar { grid-template-columns: repeat(2, minmax(0, 1fr)); } .roster-range { grid-column: 1 / -1; } }
.dashboard-theme-picker { grid-template-columns: minmax(0, 1fr) repeat(2, minmax(180px, 240px)); }
@media (max-width: 900px) { .dashboard-theme-picker { grid-template-columns: 1fr 1fr; } }
/* Fluid full-screen shell: fits laptop viewports and expands on larger monitors. */
.app-shell { grid-template-columns: clamp(220px, 17vw, 280px) minmax(0, 1fr); min-height: 100dvh; }
.app-main { min-height: calc(100dvh - 78px); padding: clamp(14px, 1.5vw, 24px); }
.app-topbar { padding-inline: clamp(14px, 1.7vw, 28px); }
.roster-wide { min-height: calc(100dvh - 126px); }
.roster-wide .fortnight-board-wrap { height: calc(100dvh - 300px); max-height: calc(100dvh - 300px); }
@media (min-width: 1800px) { .app-main { padding: clamp(24px, 2vw, 40px); } .roster-wide .fortnight-board-wrap { height: calc(100dvh - 270px); max-height: calc(100dvh - 270px); } }
@media (max-width: 1400px) { .app-sidebar { padding-inline: 10px; } .app-main { padding: 14px; } .roster-wide .fortnight-board-wrap { height: calc(100dvh - 290px); max-height: calc(100dvh - 290px); } }
@media (max-width: 900px) { .app-shell { grid-template-columns: 1fr; } .app-main { min-height: calc(100dvh - 64px); } .roster-wide { min-height: 0; } .roster-wide .fortnight-board-wrap { height: auto; max-height: none; } }

/* Keep the roster board bounded inside the viewport; the board owns scrolling. */
.app-main.roster-wide { height: calc(100dvh - 78px); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.roster-wide [data-roster], .roster-board-shell, .roster-wide [data-board] { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; }
.roster-wide .fortnight-board-wrap { flex: 1 1 0; height: auto; max-height: none; min-height: 0; overflow-x: scroll; overflow-y: auto; }
.roster-wide .board-corner, .roster-wide .board-date { top: 0; }

/* Final compact production shell and operational views. */
@media screen {
  html { background: var(--bg); }
  body { line-height: 1.35; background: var(--bg); }
  .app-shell { grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }
  .app-sidebar {
    position: sticky; top: 0; height: 100dvh; padding: 12px 10px;
    display: flex; flex-direction: column; overflow-y: auto;
    color: var(--nav-ink); background: linear-gradient(180deg, var(--disha-sidebar-top), var(--brand-dark));
    border-right: 1px solid rgba(255,255,255,.08); box-shadow: 3px 0 18px rgba(10,38,61,.1);
  }
  .brand { gap: 10px; min-height: 56px; padding: 6px 8px 14px; color: var(--nav-ink); }
  .brand > span:last-child { min-width: 0; }
  .brand strong { display: block; font-size: .98rem; letter-spacing: -.01em; }
  .brand small { color: var(--nav-muted); font-size: .64rem; line-height: 1.2; white-space: nowrap; }
  .brand-mark { width: 40px; height: 40px; flex: none; border-radius: 50%; color: #20c7aa; background: transparent; }
  .brand-mark svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 2.2; }
  .app-nav { gap: 10px; }
  .nav-section { gap: 3px; }
  .nav-label { padding: 8px 11px 2px; color: var(--nav-muted); font-size: .63rem; letter-spacing: .11em; }
  .nav-link {
    gap: 10px; min-height: 36px; padding: 7px 10px; border-radius: 6px;
    color: var(--nav-ink); font-size: .88rem; font-weight: 600;
  }
  .nav-link:hover { color: #fff; background: rgba(255,255,255,.09); text-decoration: none; }
  .nav-link.active { color: #fff; background: rgba(38,134,230,.72); box-shadow: inset 3px 0 #39bdf8; }
  .nav-link.sub-nav { min-height: 31px; margin-left: 18px; padding: 5px 9px 5px 14px; border-left: 1px solid rgba(197,220,236,.36); font-size: .8rem; }
  .nav-icon { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .sidebar-footer {
    display: grid; gap: 2px; margin-top: auto; padding: 15px 10px 5px;
    border-top: 1px solid rgba(255,255,255,.18); color: var(--nav-muted); font-size: .7rem;
  }
  .sidebar-footer strong { color: var(--nav-ink); font-size: .76rem; }

  .app-topbar {
    min-height: 60px; padding: 8px 18px; gap: 12px; background: rgba(255,255,255,.97);
    border-bottom: 1px solid var(--line); box-shadow: 0 2px 8px rgba(31,67,98,.05);
    backdrop-filter: blur(10px);
  }
  .topbar-title { min-width: 0; }
  .topbar-title .eyebrow { margin: 0; color: var(--muted); font-size: .62rem; letter-spacing: .1em; }
  #page-title, .app-topbar h1 { margin: 1px 0 0; color: var(--ink); font-size: 1.05rem; }
  .topbar-tools, .user-menu { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
  .notification-menu, .profile-menu { position: relative; }
  .notification-menu > summary, .profile-menu > summary { list-style: none; cursor: pointer; }
  .notification-menu > summary::-webkit-details-marker, .profile-menu > summary::-webkit-details-marker,
  .roster-more-filters > summary::-webkit-details-marker { display: none; }
  .notification-menu svg, .mobile-only svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .profile-menu > summary { display: flex; align-items: center; gap: 8px; color: var(--ink); }
  .profile-avatar {
    display: grid; place-items: center; width: 34px; height: 34px; flex: none;
    border-radius: 50%; color: #fff; background: #1670e8; font-size: .76rem; font-weight: 800;
  }
  .user-summary { text-align: left; }
  .user-summary strong { font-size: .8rem; }
  .user-summary span { font-size: .7rem; }
  .topbar-popover {
    position: absolute; z-index: 30; top: calc(100% + 9px); right: 0; width: 270px;
    display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px;
    color: var(--ink); background: #fff; box-shadow: 0 15px 35px rgba(24,55,82,.18);
  }
  .topbar-popover span { color: var(--muted); font-size: .78rem; }
  .topbar-popover a, .topbar-popover button {
    width: 100%; min-height: 32px; padding: 6px 8px; border: 0; border-radius: 5px;
    color: var(--brand); background: transparent; text-align: left; font-weight: 700; cursor: pointer;
  }
  .topbar-popover a:hover, .topbar-popover button:hover { background: var(--surface-soft); text-decoration: none; }

  .app-main { min-height: calc(100dvh - 60px); padding: 15px 18px; }
  .config-banner { margin: 10px 18px 0; padding: 9px 11px; font-size: .8rem; }
  .page-heading { align-items: center; gap: 12px; margin-bottom: 10px; }
  .page-heading h2 { margin: 0; color: #12345b; font-size: 1.45rem; letter-spacing: -.025em; }
  .page-heading p { margin-top: 2px; font-size: .82rem; }
  .page-actions, .actions, .button-row, .form-actions { gap: 6px; }

  .panel, .metric-card, .roster-day, .shift-card { border-radius: 8px; box-shadow: var(--shadow); }
  .panel { padding: 12px 13px; margin-bottom: 11px; }
  .panel h2 { font-size: .96rem; }
  .panel-heading { gap: 8px; margin-bottom: 8px; }
  .panel-heading > a { font-size: .76rem; font-weight: 700; }
  .grid, .dashboard-grid, .dashboard-columns { gap: 11px; }
  .dashboard-grid { margin-bottom: 12px; }
  .metric-card { min-height: 78px; padding: 12px; gap: 4px; }
  .metric-card strong { font-size: 1.35rem; }

  .toolbar, .form-grid { gap: 9px; margin-bottom: 11px; }
  form.form-grid:not(.inline-form) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  form.form-grid:not(.inline-form) > h1,
  form.form-grid:not(.inline-form) > h2,
  form.form-grid:not(.inline-form) > h3,
  form.form-grid:not(.inline-form) > .form-help,
  form.form-grid:not(.inline-form) > .form-actions,
  form.form-grid:not(.inline-form) > label:has(textarea) { grid-column: 1 / -1; }
  .field { gap: 4px; font-size: .76rem; }
  input, select, textarea { min-height: 35px; padding: 6px 8px; border-radius: 6px; font-size: .86rem; }
  textarea { min-height: 86px; }
  .btn, .button { min-height: 34px; padding: 6px 10px; border-radius: 6px; font-size: .8rem; }
  .btn.compact { min-height: 27px; padding: 4px 7px; font-size: .7rem; }
  .btn.primary, .button:not(.button-secondary) { background: #0969dc; border-color: #0969dc; }
  .btn.primary:hover, .button:not(.button-secondary):hover { background: #075abf; border-color: #075abf; }
  .btn.publish { color: #fff; background: #07835f; border-color: #07835f; }
  .btn.publish:hover { background: #056e50; }
  .icon-button { min-height: 34px; padding: 6px 8px; border-radius: 6px; }
  .status-line { min-height: 0; margin: 5px 0; font-size: .78rem; }
  .status-line:empty { display: none; }
  .badge { min-height: 21px; padding: 2px 7px; font-size: .68rem; }
  .expiry-danger { color: #a92d27; background: #fde8e6; }
  .expiry-warning { color: #a35408; background: #fff0d7; }
  .expiry-ok { color: #087454; background: #dcf7eb; }
  .table-wrap { margin-bottom: 10px; border-radius: 7px; }
  table { min-width: 680px; }
  th, td { padding: 7px 9px; font-size: .76rem; line-height: 1.3; }
  th { position: sticky; top: 0; z-index: 1; color: #3c556c; background: #eef4f8; font-size: .68rem; }
  td small { display: block; color: var(--muted); }
  .empty, .empty-state { padding: 18px; }
  .detail { padding: 6px 0; }
  .settings-dialog { padding: 16px; border: 1px solid var(--line); }
  .connection-details { grid-column: 1 / -1; padding: 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
  .connection-details summary { cursor: pointer; color: var(--brand); font-size: .78rem; font-weight: 800; }
  .connection-details .form-grid { margin: 9px 0 5px; }
  .redirect { width: min(520px, calc(100% - 32px)); margin: 12vh auto; padding: 28px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); text-align: center; }
  .redirect h1 { margin-top: 0; color: var(--brand); }

  .dashboard-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; margin-bottom: 10px; }
  .dashboard-kpi {
    min-height: 82px; display: flex; align-items: center; gap: 10px; padding: 10px 11px;
    border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff;
    box-shadow: var(--shadow);
  }
  .dashboard-kpi:hover { border-color: #9ac5ee; text-decoration: none; transform: translateY(-1px); }
  .dashboard-kpi > div { min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 7px; }
  .dashboard-kpi strong { color: #075fca; font-size: 1.35rem; line-height: 1; }
  .dashboard-kpi span:not(.kpi-icon) { font-size: .76rem; font-weight: 800; }
  .dashboard-kpi small { grid-column: 1 / -1; margin-top: 3px; color: var(--muted); font-size: .66rem; }
  .kpi-icon { width: 34px; height: 34px; flex: none; border-radius: 8px; background: #e5f1ff; box-shadow: inset 0 0 0 1px #d2e7fc; }
  .kpi-icon::after { content: ""; display: block; width: 10px; height: 10px; margin: 12px; border-radius: 50%; background: #1976e8; }
  .tone-orange .kpi-icon { background: #fff1df; box-shadow: inset 0 0 0 1px #f8dfbc; }
  .tone-orange .kpi-icon::after { background: #d86b0a; }
  .tone-orange strong { color: #b85808; }
  .tone-green .kpi-icon { background: #dcf7ec; box-shadow: inset 0 0 0 1px #c2eadb; }
  .tone-green .kpi-icon::after { background: #0b9871; }
  .tone-green strong { color: #087657; }
  .tone-purple .kpi-icon { background: #f0e9fd; box-shadow: inset 0 0 0 1px #ded0f6; }
  .tone-purple .kpi-icon::after { background: #7b54ba; }
  .tone-purple strong { color: #6941a5; }
  .tone-teal .kpi-icon { background: #dff5f6; box-shadow: inset 0 0 0 1px #c9e8ea; }
  .tone-teal .kpi-icon::after { background: #0e909d; }
  .tone-teal strong { color: #08707b; }
  .dashboard-operations-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .8fr); gap: 10px; align-items: start; }
  .dashboard-panel { min-width: 0; margin: 0; }
  .dashboard-activity { grid-column: 1 / -1; }
  .dashboard-loading { min-height: 110px; display: grid; place-items: center; color: var(--muted); }
  .compact-table { max-height: 245px; overflow: auto; margin: 0; }
  .compact-table table { min-width: 560px; }
  .compact-tabs { display: inline-flex; gap: 3px; margin-bottom: 7px; padding: 2px; border-radius: 6px; background: #edf3f8; }
  .compact-tabs .tab-button { min-height: 29px; padding: 4px 13px; border: 0; background: transparent; font-size: .72rem; }
  .compact-tabs .tab-button.active { color: #fff; background: #0969dc; }
  .finance-shortcuts { display: grid; gap: 7px; }
  .finance-shortcut {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 9px; align-items: center;
    padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #f8fbfd;
  }
  .finance-shortcut:hover { border-color: #9bc6e9; text-decoration: none; }
  .finance-shortcut span { display: grid; gap: 2px; }
  .finance-shortcut small { color: var(--muted); font-size: .68rem; }
  .finance-shortcut b { color: #087657; font-size: 1.12rem; }
  .finance-shortcut em { color: #0969dc; font-size: .7rem; font-style: normal; font-weight: 800; }
  .dashboard-list { gap: 0; }
  .upcoming-date-row { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 9px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .upcoming-date-row:last-child { border-bottom: 0; }
  .upcoming-date-row div { display: grid; gap: 1px; }
  .upcoming-date-row strong { font-size: .76rem; }
  .upcoming-date-row small { color: var(--muted); font-size: .68rem; }
  .date-chip { padding: 4px 5px; border-radius: 5px; color: #075fca; background: #e5f1ff; font-size: .68rem; font-weight: 800; text-align: center; }
  .activity-columns { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); gap: 11px; }
  .activity-list, .invoice-activity { display: grid; align-content: start; }
  .activity-list a, .activity-warning {
    display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 7px; align-items: center;
    min-height: 34px; padding: 5px 7px; border-bottom: 1px solid var(--line); color: var(--ink);
  }
  .activity-list a:hover { background: var(--surface-soft); text-decoration: none; }
  .activity-list b { color: #087657; text-align: center; }
  .activity-list .needs-attention b, .activity-warning b { color: var(--danger); }
  .activity-list span, .activity-list em { font-size: .72rem; }
  .activity-list em { color: #0969dc; font-style: normal; font-weight: 800; }
  .invoice-activity a {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center;
    min-height: 34px; padding: 5px 7px; border-bottom: 1px solid var(--line); color: var(--ink);
  }
  .invoice-activity a:hover { background: var(--surface-soft); text-decoration: none; }
  .invoice-activity a > span:first-child { display: grid; }
  .invoice-activity strong, .invoice-activity b { font-size: .74rem; }
  .invoice-activity small { color: var(--muted); font-size: .66rem; }
  .compact-empty { min-height: 96px; display: grid; place-items: center; align-content: center; gap: 3px; font-size: .74rem; }
  .compact-empty span { color: var(--muted); text-align: center; }

  .roster-wide .page-heading { flex: 0 0 auto; }
  .roster-head-counters { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .roster-head-counters > span {
    min-width: 88px; display: flex; align-items: baseline; gap: 5px; padding: 6px 8px;
    border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: #fff; font-size: .68rem;
  }
  .roster-head-counters strong { color: #0969dc; font-size: 1rem; }
  .app-main.roster-wide { height: calc(100dvh - 60px); min-height: 0; padding: 11px 14px; overflow: hidden; }
  .roster-wide [data-roster], .roster-board-shell, .roster-wide [data-board] { min-height: 0; flex: 1 1 0; }
  .roster-filterbar {
    flex: 0 0 auto; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 7px; padding: 9px; margin-bottom: 7px; border-radius: 8px; box-shadow: var(--shadow);
  }
  .roster-filterbar .field { gap: 3px; font-size: .68rem; }
  .roster-filterbar input, .roster-filterbar select { min-height: 32px; height: 32px; padding: 5px 7px; border-radius: 5px; font-size: .74rem; }
  .roster-filterbar .btn { min-height: 32px; height: 32px; padding: 5px 7px; border-radius: 5px; font-size: .74rem; }
  .roster-range { grid-column: 1 / 4; grid-row: 1; display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; gap: 4px; }
  .roster-period-label { min-width: 0 !important; white-space: nowrap; }
  .roster-nav-arrow { width: auto; letter-spacing: -.1em; }
  .roster-filterbar > label:nth-of-type(1) { grid-column: 1 / 3; grid-row: 2; }
  .roster-filterbar > label:nth-of-type(2) { grid-column: 3 / 5; grid-row: 2; }
  .roster-filterbar > label:nth-of-type(3) { grid-column: 5 / 7; grid-row: 2; }
  .roster-filterbar > label:nth-of-type(4) { grid-column: 7 / 9; grid-row: 2; }
  .roster-more-filters { position: relative; grid-column: 9 / 11; grid-row: 2; align-self: end; }
  .roster-more-filters > summary { width: 100%; list-style: none; }
  .roster-more-menu {
    position: absolute; z-index: 12; top: calc(100% + 5px); right: 0; width: 330px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 9px;
    border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: 0 14px 30px rgba(24,55,82,.16);
  }
  .roster-filter-actions { grid-column: 11 / 13; grid-row: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; align-self: end; }
  .roster-actionbar { grid-column: 4 / 13; grid-row: 1; display: flex; gap: 5px; align-items: center; justify-content: flex-end; }
  .roster-actionbar .btn { white-space: nowrap; }
  .roster-schedule-heading {
    flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 10px;
    min-height: 34px; padding: 5px 9px; border: 1px solid var(--line); border-bottom: 0;
    border-radius: 7px 7px 0 0; background: #fff;
  }
  .roster-schedule-heading > div:first-child { display: flex; align-items: baseline; gap: 8px; }
  .roster-schedule-heading strong { font-size: .82rem; }
  .roster-schedule-heading span { color: var(--muted); font-size: .66rem; }
  .roster-legend { display: flex; gap: 5px; align-items: center; color: var(--muted); font-size: .65rem; }
  .legend-dot { width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: #8294a6; }
  .legend-dot.published { background: #149b76; }
  .legend-dot.draft { background: #1675e8; }
  .legend-dot.completed { background: #7255b5; }
  .legend-dot.unassigned { background: #e57a16; }
  .roster-wide .fortnight-board-wrap {
    flex: 1 1 0; width: 100%; max-width: 100%; min-width: 0; min-height: 0;
    height: auto; max-height: none; overflow-x: auto; overflow-y: auto;
    border: 1px solid var(--line); border-radius: 0 0 7px 7px; background: #fff;
    scrollbar-gutter: stable; overscroll-behavior: contain;
  }
  .fortnight-board {
    display: grid; width: 100%; min-width: 1800px;
    grid-template-columns: 158px repeat(var(--days), minmax(116px, 1fr));
    grid-auto-rows: minmax(88px, auto); align-items: stretch; background: #fff;
  }
  .roster-wide .board-corner, .roster-wide .board-date { top: 0; min-height: 54px; }
  .board-corner {
    left: 0; z-index: 5; width: 158px; min-height: 54px; padding: 6px;
    display: grid; align-items: center; background: #eef4f8;
  }
  .board-corner label { display: grid; gap: 2px; color: var(--muted); font-size: .62rem; }
  .board-corner select { min-height: 29px; height: 29px; padding: 3px 6px; font-size: .72rem; }
  .board-date { min-height: 54px; padding: 6px; gap: 1px; align-content: center; text-align: center; background: #eef4f8; }
  .board-date strong { font-size: .7rem; line-height: 1.2; }
  .board-date span, .board-date small { font-size: .64rem; line-height: 1.2; }
  .board-participant {
    left: 0; z-index: 3; width: 158px; min-height: 88px; padding: 8px;
    align-content: center; gap: 2px; background: #fff; box-shadow: 3px 0 6px rgba(31,67,98,.05);
  }
  .board-participant strong { font-size: .75rem; line-height: 1.25; }
  .board-participant span { font-size: .65rem; }
  .board-cell { min-height: 88px; padding: 4px; gap: 4px; }
  .roster-shift-wrap { position: relative; min-width: 0; }
  .roster-shift-card {
    min-height: 79px; padding: 25px 5px 5px; gap: 2px; border-left-width: 3px;
    border-radius: 5px; line-height: 1.15; box-shadow: none;
  }
  .roster-shift-card:hover { box-shadow: 0 4px 10px rgba(31,67,98,.12); }
  .roster-shift-card strong, .roster-shift-card .card-worker { font-size: .7rem; line-height: 1.15; }
  .roster-shift-card span, .roster-shift-card .card-time,
  .roster-shift-card .card-classification, .roster-shift-card .service-code { font-size: .61rem; line-height: 1.15; }
  .roster-shift-card .card-classification { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .roster-shift-card .card-status { color: var(--muted); font-size: .58rem; font-weight: 800; }
  .shift-card-tools { top: 3px; right: 3px; gap: 2px; }
  .shift-card-tool, .shift-card-bin { width: 20px; height: 20px; min-height: 20px; padding: 2px; border-radius: 4px; }
  .shift-card-tool svg { width: 13px; height: 13px; }
  .badge-row { gap: 2px; }
  .badge-row em, .badge-row b { padding: 1px 4px; font-size: .55rem; }
  .empty-cell-add { width: 25px; height: 25px; margin: auto; font-size: .78rem; }
  .compact-details { margin: 6px 0 0; padding: 7px 9px; }
  .compact-details summary { font-size: .72rem; }

  .roster-info-dialog {
    width: min(780px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0;
    border: 0; border-radius: 9px; color: var(--ink); background: #fff; box-shadow: 0 24px 65px rgba(8,44,73,.28);
  }
  .roster-info-dialog::backdrop { background: rgba(8,32,52,.48); }
  .roster-info-dialog > article > header {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 12px 14px; border-bottom: 1px solid var(--line);
  }
  .roster-info-dialog h2 { margin: 0; font-size: 1rem; }
  .roster-info-dialog .eyebrow { margin: 0 0 2px; }
  .roster-dialog-body { max-height: calc(100dvh - 120px); padding: 12px 14px; overflow: auto; }
  .exception-list { display: grid; gap: 6px; }
  .exception-row {
    display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: center;
    padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: #fffafb;
  }
  .exception-marker { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: #fff; background: var(--danger); font-size: .7rem; font-weight: 900; }
  .exception-row > div { display: grid; gap: 2px; }
  .exception-row strong { font-size: .76rem; }
  .exception-row span { color: var(--muted); font-size: .68rem; }
  .summary-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .summary-metric { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
  .summary-metric span { color: var(--muted); font-size: .7rem; }
  .summary-metric strong { color: #075fca; font-size: 1.3rem; }

  .report-link-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  .report-link { min-height: 105px; display: grid; align-content: start; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; }
  .report-link:hover { border-color: #91bfea; text-decoration: none; box-shadow: var(--shadow); }
  .report-link span { color: var(--muted); font-size: .74rem; }
  .report-link em { margin-top: auto; color: #0969dc; font-size: .72rem; font-style: normal; font-weight: 800; }
}

@media screen and (max-width: 1380px) {
  .dashboard-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .roster-filterbar { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .roster-range, .roster-actionbar { grid-column: 1 / -1; grid-row: auto; }
  .roster-actionbar { justify-content: flex-start; }
  .roster-filterbar > label:nth-of-type(1),
  .roster-filterbar > label:nth-of-type(2),
  .roster-filterbar > label:nth-of-type(3),
  .roster-filterbar > label:nth-of-type(4),
  .roster-more-filters, .roster-filter-actions { grid-column: span 2; grid-row: auto; }
}

@media screen and (max-width: 1050px) {
  form.form-grid:not(.inline-form) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-operations-grid { grid-template-columns: 1fr; }
  .dashboard-activity { grid-column: auto; }
  .activity-columns { grid-template-columns: 1fr; }
  .report-link-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media screen and (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { position: fixed; width: 236px; z-index: 40; }
  .app-topbar { min-height: 56px; padding: 7px 12px; }
  .app-main { min-height: calc(100dvh - 56px); padding: 12px; }
  .app-main.roster-wide { height: calc(100dvh - 56px); min-height: 0; overflow: hidden; }
  .roster-wide [data-roster], .roster-board-shell, .roster-wide [data-board] { display: flex; }
  .roster-wide .fortnight-board-wrap { max-height: none; overflow-x: auto; overflow-y: auto; }
  .page-heading { align-items: flex-start; }
  .roster-head-counters { justify-content: flex-start; }
  .user-summary { display: none; }
}

@media screen and (max-width: 700px) {
  form.form-grid:not(.inline-form), .report-link-grid { grid-template-columns: 1fr; }
  form.form-grid:not(.inline-form) > * { grid-column: auto; }
  .page-heading { flex-direction: column; }
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-operations-grid { grid-template-columns: 1fr; }
  .dashboard-kpi { min-height: 74px; padding: 8px; }
  .dashboard-kpi > div { grid-template-columns: 1fr; }
  .dashboard-kpi small { grid-column: auto; }
  .kpi-icon { display: none; }
  .activity-columns { grid-template-columns: 1fr; }
  .roster-filterbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .roster-range, .roster-actionbar { grid-column: 1 / -1; }
  .roster-actionbar { overflow-x: auto; padding-bottom: 2px; }
  .roster-filterbar > label:nth-of-type(1),
  .roster-filterbar > label:nth-of-type(2),
  .roster-filterbar > label:nth-of-type(3),
  .roster-filterbar > label:nth-of-type(4),
  .roster-more-filters, .roster-filter-actions { grid-column: span 1; }
  .roster-more-menu { position: fixed; inset: 80px 12px auto; width: auto; }
  .roster-legend { display: none; }
  .summary-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exception-row { grid-template-columns: 24px minmax(0, 1fr); }
  .exception-row .btn { grid-column: 2; justify-self: start; }

  .table-wrap { border: 1px solid var(--line); background: #fff; overflow: auto; }
  table { min-width: 680px; }
  thead { display: table-header-group; }
  tr { display: table-row; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  td { display: table-cell; grid-template-columns: none; gap: 0; }
  td::before { content: none; }
  td.actions { display: table-cell; }
}

@media screen and (max-width: 430px) {
  .dashboard-kpis { grid-template-columns: 1fr; }
  .roster-head-counters > span { min-width: calc(50% - 4px); }
  .profile-avatar { width: 31px; height: 31px; }
  .topbar-title .eyebrow { display: none; }
  .app-main { padding: 9px; }
}
