:root {
  --bg: #eef2f6;
  --bg-soft: #f7f9fc;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #111827;
  --muted: #65758b;
  --muted-strong: #41536a;
  --primary: #12385b;
  --primary-strong: #0b2742;
  --primary-soft: #e9f1fb;
  --accent: #0f766e;
  --accent-soft: #e6f6f3;
  --warning: #b7791f;
  --warning-soft: #fff7e6;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --border: #d9e2ec;
  --border-strong: #c7d3e0;
  --shadow: 0 18px 42px rgba(15, 39, 66, 0.12);
  --shadow-soft: 0 8px 24px rgba(15, 39, 66, 0.08);
  --radius: 8px;
  --font-display: Bahnschrift, "Aptos Display", "Segoe UI Variable Display", "Segoe UI", sans-serif;
  --font-body: Inter, "Aptos", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-data: "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace;

  /* Calendar design system — shared scale (Team Schedule + Schedule Management).
     See docs/calendar-design-system.md. */
  --radius-sm: 6px;
  --radius-lg: 12px;
  --fs-title: 26px;      /* page title */
  --fs-subtitle: 13px;   /* page subtitle */
  --fs-section: 17px;    /* section heading */
  --fs-body: 14px;       /* body */
  --fs-secondary: 12.5px;/* secondary text */
  --fs-label: 12.5px;    /* form label (medium weight) */
  --fs-time: 11.5px;     /* calendar time labels — never below ~11px */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --ctl-h: 38px;         /* standard control */
  --ctl-h-compact: 34px; /* compact toolbar control */
  --ctl-h-touch: 44px;   /* touch target on mobile */
  --control-height: 40px;
  --control-height-compact: 36px;
  --control-height-touch: 44px;
  --control-radius: 7px;
  --control-pad-x: 11px;
  --control-pad-y: 8px;
  --checkbox-size: 18px;
  --radio-size: 18px;
  --checkbox-hit: 36px;
  --field-gap: 16px;
  --field-label-gap: 7px;
  --section-gap: 28px;
  --drawer-padding: 22px;
  --modal-padding: 22px;
  --label-color: var(--muted-strong);
  --control-border: var(--border-strong);
  --control-disabled-bg: #eef2f7;
  --focus-ring: 0 0 0 3px rgba(79, 139, 214, 0.2);
  --error-color: var(--danger);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  color-scheme: light;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 39, 66, 0.04), rgba(15, 39, 66, 0) 360px),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  text-wrap: balance;
}

h1[id],
h2[id],
h3[id],
h4[id] {
  scroll-margin-top: 20px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 200;
  padding: 10px 14px;
  border-radius: var(--control-radius);
  background: #ffffff;
  color: var(--primary-strong);
  box-shadow: var(--shadow);
  font-weight: 800;
  text-decoration: none;
  transform: translate(-50%, calc(-100% - 20px));
  transition: transform 140ms ease;
}

.skip-link:focus {
  transform: translate(-50%, 0);
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: -1;
  height: 250px;
  background-color: var(--primary-strong);
  background-image:
    linear-gradient(110deg, rgba(99, 179, 237, 0.14) 1px, transparent 1px),
    linear-gradient(20deg, rgba(45, 212, 191, 0.1) 1px, transparent 1px),
    repeating-linear-gradient(90deg, transparent 0 58px, rgba(255, 255, 255, 0.045) 58px 59px);
  background-size: 120px 120px, 180px 180px, 100% 100%;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 56px;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
  color: #ffffff;
}

.app-header h1,
.app-header p,
h2,
h3,
p {
  margin: 0;
}

.app-header h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.65rem;
  font-weight: 750;
  letter-spacing: 0;
}

.app-header h1::before {
  content: "";
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background:
    linear-gradient(135deg, #28d3b3 0 42%, transparent 42%),
    linear-gradient(315deg, #8bb8ff 0 42%, #ffffff 42%);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
}

#status-line {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

#app-nav:empty {
  display: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
  color: var(--primary-strong);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.13);
}

.card {
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

h2 {
  margin-bottom: 4px;
  color: #172033;
  font-size: 1.25rem;
  font-weight: 760;
  letter-spacing: 0;
}

h3 {
  margin: 26px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: #1f2a3d;
  font-size: 1rem;
  font-weight: 760;
  letter-spacing: 0;
}

.subtle {
  color: var(--muted);
  font-size: 0.92rem;
}

.user-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.avatar {
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: var(--field-label-gap);
  min-width: 0;
  color: var(--label-color);
  font-size: var(--fs-label);
  font-weight: 700;
  line-height: 1.25;
}

input:not([type='checkbox']):not([type='radio']),
select,
textarea {
  width: 100%;
  min-height: var(--control-height);
  padding: var(--control-pad-y) var(--control-pad-x);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 0.93rem;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

select:not([multiple]) {
  appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted-strong) 50%),
    linear-gradient(135deg, var(--muted-strong) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

select[multiple] {
  min-height: 96px;
  padding-right: var(--control-pad-x);
}

input[type='color'] {
  min-width: 54px;
  padding: 5px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:not([type='checkbox']):not([type='radio']):focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: #4f8bd6;
  box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--control-disabled-bg);
  color: var(--muted);
  cursor: not-allowed;
}

input[type='checkbox'],
input[type='radio'] {
  appearance: none;
  display: inline-grid;
  flex: 0 0 var(--checkbox-size);
  place-content: center;
  width: var(--checkbox-size);
  height: var(--checkbox-size);
  min-width: var(--checkbox-size);
  min-height: var(--checkbox-size);
  margin: 0;
  border: 1px solid var(--control-border);
  background: #fff;
  color: #fff;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

input[type='checkbox'] {
  border-radius: 5px;
}

input[type='radio'] {
  border-radius: 999px;
}

input[type='checkbox']::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0);
  transform-origin: center;
  background: currentColor;
  clip-path: polygon(14% 44%, 0 58%, 38% 96%, 100% 24%, 86% 10%, 37% 68%);
  transition: transform 120ms ease;
}

input[type='radio']::before {
  content: "";
  width: 8px;
  height: 8px;
  transform: scale(0);
  border-radius: 999px;
  background: currentColor;
  transition: transform 120ms ease;
}

input[type='checkbox']:checked,
input[type='radio']:checked {
  border-color: var(--primary);
  background: var(--primary);
}

input[type='checkbox']:checked::before,
input[type='radio']:checked::before {
  transform: scale(1);
}

input[type='checkbox']:hover,
input[type='radio']:hover {
  border-color: var(--primary);
}

input[type='checkbox']:focus-visible,
input[type='radio']:focus-visible {
  outline: 3px solid rgba(79, 139, 214, 0.35);
  outline-offset: 2px;
}

input[type='checkbox']:disabled,
input[type='radio']:disabled {
  background: var(--control-disabled-bg);
  border-color: var(--border);
  cursor: not-allowed;
}

input[type='checkbox']:disabled::before,
input[type='radio']:disabled::before {
  color: var(--muted);
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-top: 12px;
}

.align-end {
  align-self: end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 740;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.button.compact {
  min-height: var(--control-height-compact);
  padding-inline: 11px;
  font-size: var(--fs-secondary);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--primary);
  box-shadow: none;
}

.button.ghost:hover {
  background: var(--primary-soft);
  box-shadow: none;
}

.button.icon {
  width: var(--control-height);
  min-width: var(--control-height);
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.button:hover {
  background: var(--primary-strong);
  box-shadow: 0 10px 22px rgba(18, 56, 91, 0.18);
  transform: translateY(-1px);
}

.button.secondary {
  border-color: var(--border-strong);
  background: #ffffff;
  color: var(--primary);
}

.button.secondary:hover {
  background: var(--primary-soft);
  box-shadow: none;
}

.button.danger {
  background: var(--danger);
}

.button.danger:hover {
  background: #8f1d15;
  box-shadow: 0 10px 22px rgba(180, 35, 24, 0.18);
}

.button[disabled] {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.user-row .button.secondary {
  margin-left: auto;
}

#home-card .inline-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

#home-card .button {
  min-height: 52px;
  justify-content: flex-start;
  background: var(--surface-muted);
  color: var(--primary);
  border-color: var(--border);
}

#home-card .button:hover {
  background: var(--primary-soft);
}

.clock-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 22px;
  align-items: stretch;
}

.clock-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.clock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.clock-actions .button {
  min-width: 132px;
}

.clock-display {
  display: flex;
  min-height: 190px;
  flex-direction: column;
  justify-content: center;
  padding: 22px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.18), rgba(15, 118, 110, 0)),
    var(--primary-strong);
  color: #ffffff;
}

.clock-time {
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  font-weight: 780;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.clock-date {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.98rem;
  font-weight: 700;
}

.clock-zone {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.85rem;
}

.state {
  display: grid;
  gap: 2px;
  margin-top: 20px;
  padding: 14px 16px;
  border-left: 4px solid var(--warning);
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: #5f3e07;
}

.state.state-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #0c4f49;
}

.state span,
.entry-time-grid span,
.summary-tile span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.state strong {
  color: inherit;
  font-size: 1.02rem;
}

.state small {
  color: currentColor;
  opacity: 0.78;
}

.clock-location-state {
  margin-top: 12px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin: 14px 0 18px;
}

.filter-row label {
  min-width: 150px;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 18px;
}

.summary-tile {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.summary-tile strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
}

.report-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  font-size: 0.9rem;
}

.report-table th,
.report-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.report-table th {
  background: #f1f5f9;
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.report-table tr:last-child td {
  border-bottom: 0;
}

.report-table tbody tr:hover {
  background: #fbfdff;
}

.empty-cell,
.empty-row {
  color: var(--muted);
  font-style: normal;
}

.entries-list {
  display: grid;
  gap: 0;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #ffffff;
}

.entries-list li {
  padding: 14px;
  border-top: 1px solid var(--border);
}

.entries-list li:first-child {
  border-top: 0;
}

.entries-list .empty-row {
  background: var(--surface-muted);
}

.entry-item,
.queue-item {
  display: grid;
  gap: 12px;
}

.entry-main {
  display: flex;
  gap: 14px;
  align-items: start;
  justify-content: space-between;
}

.entry-title {
  color: var(--text);
  font-weight: 760;
}

.entry-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.entry-time-grid,
.entry-location-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.entry-time-grid > div {
  display: grid;
  gap: 2px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.entry-time-grid.compact > div {
  padding: 10px;
}

.entry-time-grid strong {
  color: var(--text);
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
}

.entry-time-grid small {
  color: var(--muted);
  font-size: 0.8rem;
}

.location-row {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.location-label {
  color: var(--muted-strong);
  font-weight: 740;
}

.location-row a {
  color: var(--primary);
  font-weight: 740;
  text-decoration: none;
}

.location-row a:hover {
  text-decoration: underline;
}

.location-accuracy,
.location-empty {
  color: var(--muted);
}

.status-pill,
.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  text-transform: capitalize;
  white-space: nowrap;
  gap: 5px;
}
.pill-swatch,
.color-swatch {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

.status-pill.pending {
  background: var(--warning-soft);
  color: #8a5a11;
}

.status-pill.approved {
  background: var(--accent-soft);
  color: #0b5d55;
}

.status-pill.rejected {
  background: var(--danger-soft);
  color: var(--danger);
}

.role-pill {
  background: var(--primary-soft);
  color: var(--primary);
}

.pill-group {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 14px;
}

.role-pill.group-pill {
  background: var(--warning-soft);
  color: #8a5a11;
}

/* Coverage dashboard */
.cov-graph {
  width: 100%;
  overflow-x: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 6px;
}
.cov-tooltip {
  position: fixed;
  top: 76px;
  right: 18px;
  z-index: 50;
  max-width: 260px;
  background: #111827;
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.35;
  padding: 8px 10px;
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.checkbox-label {
  display: inline-flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 9px;
  min-height: var(--checkbox-hit);
  padding: 7px 0;
  color: var(--label-color);
  font-size: var(--fs-label);
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
}

.checkbox-label > input[type='checkbox'],
.checkbox-label > input[type='radio'] {
  margin-top: 1px;
}
.table-scroll {
  overflow-x: auto;
}

/* Dashboard cards */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 8px;
}
.dash-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 140ms ease, transform 140ms ease;
}
.dash-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.dash-card.ok {
  border-left-color: var(--accent);
}
.dash-card.warn {
  border-left-color: var(--warning);
}
.dash-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted-strong);
}
.dash-value {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
}
.dash-sub {
  font-size: 0.8rem;
  color: var(--muted);
}
.dash-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.dash-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.dash-section-head h3 {
  margin: 0 0 2px;
  font-size: 1rem;
}
.dash-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.dash-mini {
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
.dash-mini.ok {
  border-left-color: var(--accent);
}
.dash-mini.warn {
  border-left-color: var(--warning);
}
.dash-mini span {
  display: block;
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 700;
}
.dash-mini strong {
  font-size: 1.35rem;
}
.dash-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.dash-status-grid h4 {
  margin: 0 0 8px;
  font-size: 0.92rem;
}
.dash-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.dash-row,
.dash-empty {
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}
.dash-row.warn,
.dash-row.caution {
  border-left-color: var(--warning);
}
.dash-row div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.dash-row strong {
  font-size: 0.9rem;
}
.dash-row span,
.dash-row small,
.dash-empty {
  color: var(--muted);
  font-size: 0.78rem;
}
.dash-empty {
  border-left-color: var(--accent);
}
.escalation-list {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.dash-row.escalation {
  position: relative;
  display: grid;
  gap: 8px;
  overflow: hidden;
}
.escalation-color-rail,
.agenda-color-rail {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  height: 100%;
  border-radius: 0;
}
.esc-head,
.esc-assignment {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash-row .esc-head,
.dash-row .esc-assignment {
  display: flex;
}
.esc-head {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

/* Configurable management dashboard */
body[data-page="dashboard"].with-sidebar .container {
  padding-left: 24px;
  padding-right: 24px;
}
body[data-page="dashboard"] #dashboard-card.card {
  width: min(100%, 1680px);
  margin-inline: auto;
  padding: 24px;
}
.dashboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
  margin: 18px 0 22px;
}
.widget-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}
.dashboard-widget {
  display: flex;
  flex-direction: column;
  grid-column: span 4;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 39, 66, 0.04);
}
.dashboard-widget[data-widget-width="1"] { grid-column: span 1; }
.dashboard-widget[data-widget-width="2"] { grid-column: span 2; }
.dashboard-widget[data-widget-width="3"] { grid-column: span 3; }
.dashboard-widget[data-widget-width="4"] { grid-column: span 4; }
.dashboard-widget[data-widget-width="5"] { grid-column: span 5; }
.dashboard-widget[data-widget-width="6"] { grid-column: span 6; }
.dashboard-widget[data-widget-width="7"] { grid-column: span 7; }
.dashboard-widget[data-widget-width="8"] { grid-column: span 8; }
.dashboard-widget[data-widget-width="9"] { grid-column: span 9; }
.dashboard-widget[data-widget-width="10"] { grid-column: span 10; }
.dashboard-widget[data-widget-width="11"] { grid-column: span 11; }
.dashboard-widget[data-widget-width="12"] { grid-column: span 12; }
.dashboard-widget.loading {
  border-color: #9ebbe4;
}
.dashboard-widget.error {
  border-color: var(--danger);
}
.widget-head,
.widget-meta,
.widget-foot {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
}
.widget-head {
  min-height: 52px;
}
.widget-head > div:first-child {
  min-width: 0;
}
.widget-head h3 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 1rem;
  line-height: 1.25;
}
.widget-head p,
.widget-meta,
.widget-empty,
.widget-state {
  color: var(--muted);
  font-size: 0.82rem;
}
.widget-actions {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}
.widget-meta {
  flex-wrap: wrap;
  justify-content: flex-start;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.widget-body {
  display: grid;
  gap: 12px;
  align-content: start;
  flex: 1 1 auto;
  min-width: 0;
}
.widget-state {
  display: grid;
  min-height: 84px;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}
.widget-state.error {
  color: var(--danger);
  border-color: var(--danger);
  background: #fff5f5;
}
.widget-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.widget-metric {
  display: grid;
  gap: 4px;
  align-content: center;
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.widget-metric.ok {
  border-left-color: var(--accent);
}
.widget-metric.warning,
.widget-metric.warn {
  border-left-color: var(--warning);
}
.widget-metric.critical {
  border-left-color: var(--danger);
}
.widget-metric span {
  color: var(--muted-strong);
  font-size: 0.74rem;
  font-weight: 760;
}
.widget-metric strong {
  font-size: 1.25rem;
}
.widget-item-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.widget-item-list li {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.widget-item-list li.warning {
  border-left-color: var(--warning);
}
.widget-item-list li.critical {
  border-left-color: var(--danger);
}
.widget-item-list li div {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}
.widget-item-list small {
  color: var(--muted);
}
.widget-config {
  min-width: 0;
}
.widget-config summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 760;
}
.widget-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.widget-config-grid label,
.widget-foot label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}
.widget-foot {
  align-items: flex-end;
  margin-top: auto;
}
@media (max-width: 1100px) and (min-width: 601px) {
  .widget-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
  .dashboard-widget {
    grid-column: span 1;
  }
  .dashboard-widget[data-widget-width="12"],
  .dashboard-widget[data-widget-width="8"],
  .dashboard-widget[data-widget-width="6"] {
    grid-column: 1 / -1;
  }
}

/* Side panel (right drawer; full-screen sheet on mobile) */
.app-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(480px, 94vw);
  height: 100vh;
  overflow: hidden;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 42px rgba(15, 39, 66, 0.16);
  transform: translateX(100%);
  transition: transform 180ms ease;
}
.app-panel.open {
  transform: translateX(0);
}
.app-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--drawer-padding);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.app-panel-head h2,
.app-panel-head h3 {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.1rem;
}
.app-panel-body {
  min-height: 0;
  overflow-y: auto;
  padding: var(--drawer-padding);
}
.app-panel-body > h4 {
  margin-top: var(--section-gap);
  padding-top: var(--section-gap);
  border-top: 1px solid var(--border);
}
.app-panel-body > h4:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* Toast */
#app-toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.app-toast-item {
  padding: 10px 14px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.app-toast-item.error {
  background: var(--danger);
}
.app-toast-item.success {
  background: var(--accent);
}
.app-toast-item.warn {
  background: #b45309;
}

/* Badge hierarchy: one category color per card; status via border/icon */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--surface-muted);
  color: var(--muted-strong);
}

/* Team schedule */
.ts-toolbar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.ts-nav,
.ts-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.inline-field {
  flex-direction: row;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-label);
  white-space: nowrap;
}
.inline-field select,
.inline-field input:not([type='checkbox']):not([type='radio']) {
  min-height: var(--control-height-compact);
  width: auto;
  padding-block: 6px;
}
.ts-cal {
  display: grid;
  gap: 6px;
}
.ts-cal.week {
  grid-template-columns: repeat(7, 1fr);
}
.ts-cal.day {
  grid-template-columns: 1fr;
}
.ts-col {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 140px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ts-col-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.ts-col-head strong {
  font-size: 1rem;
  color: var(--text);
}
.ts-gap {
  margin-left: auto;
  color: var(--warning);
  font-weight: 700;
}
.ts-shift {
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  background: var(--surface);
  font-size: 0.8rem;
}
.ts-shift:hover {
  box-shadow: var(--shadow);
}
.ts-shift-time {
  font-weight: 800;
}
.ts-shift-name {
  font-weight: 600;
}
.ts-shift-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.72rem;
  color: var(--muted-strong);
  margin-top: 2px;
}
/* status expressed via border style + badge (not fill) */
.ts-shift.st-draft {
  border-style: dashed;
}
.ts-shift.st-open {
  border-style: dotted;
}
.ts-shift.st-cancelled {
  opacity: 0.55;
  text-decoration: line-through;
}
.badge.st-confirmed { background: var(--accent-soft); color: #0b5d55; }
.badge.st-draft { background: var(--warning-soft); color: #8a5a11; }
.badge.st-open { background: var(--primary-soft); color: var(--primary); }
.badge.st-cancelled { background: #eef1f5; color: var(--muted); }

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
}
.kv span {
  color: var(--muted);
}

/* Requests tabs */
.req-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.req-tab-btn {
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.req-tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.trip-head {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  margin: 12px 0 16px;
}
.muted {
  color: var(--muted);
}
.trip-form {
  margin: 14px 0 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: var(--field-gap);
}
.form-grid label {
  display: grid;
  gap: var(--field-label-gap);
  color: var(--label-color);
  font-weight: 740;
}
.form-grid label:has(input[type='checkbox']) {
  display: inline-flex;
  flex-direction: row;
  align-items: flex-start;
  min-height: var(--checkbox-hit);
  gap: 9px;
}
.form-grid .wide {
  grid-column: 1 / -1;
}
.trip-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 18px;
  align-items: start;
}
.trip-review {
  position: sticky;
  top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.trip-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.trip-metrics span {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 760;
}
.entries-list.compact li {
  padding: 10px;
}
.trip-nominate {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.trip-nominate input {
  max-width: 160px;
}
.person-row {
  cursor: pointer;
}
.person-row:hover {
  box-shadow: var(--shadow);
}

.people-table-wrap {
  margin-top: 14px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
}
.people-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}
.people-table th,
.people-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 0.9rem;
}
.people-table th {
  background: var(--surface-muted);
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.people-table tbody tr:last-child td {
  border-bottom: 0;
}
.people-table .person-row:hover,
.people-table .person-row:focus-visible {
  background: #fbfdff;
}
.app-panel.people-detail-panel {
  width: clamp(640px, 52vw, 900px);
}
.people-detail-panel .app-panel-body {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 0;
}
.people-detail-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px var(--drawer-padding) 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.people-title-block {
  min-width: 0;
}
.people-title-block h2 {
  margin: 0;
  font-size: 1.28rem;
}
.people-title-block p {
  margin-top: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.people-header-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.people-action-menu {
  position: relative;
  flex: 0 0 auto;
}
.people-action-menu summary {
  list-style: none;
}
.people-action-menu summary::-webkit-details-marker {
  display: none;
}
.people-action-menu[open] {
  z-index: 2;
}
.people-action-menu[open]::after {
  content: "";
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 220px;
  height: 1px;
}
.people-action-menu button {
  display: flex;
  width: 220px;
  min-height: 38px;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-bottom: 0;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.people-action-menu button:first-of-type {
  margin-top: 6px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.people-action-menu button:last-of-type {
  border-bottom: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
}
.people-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 var(--drawer-padding) 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.people-tab {
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 760;
  white-space: nowrap;
}
.people-tab.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
}
.people-tab-panel {
  min-height: 0;
  overflow-y: auto;
  padding: 0 var(--drawer-padding) 92px;
}
.people-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.people-section {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px 0;
}
.people-section h4 {
  margin: 0;
  color: #1f2a3d;
  font-size: 1rem;
}
.detail-list {
  display: grid;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.detail-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.42fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.detail-row:last-child {
  border-bottom: 0;
}
.detail-row span {
  color: var(--muted);
  font-weight: 700;
}
.detail-row strong {
  min-width: 0;
  color: var(--text);
  font-weight: 650;
  overflow-wrap: anywhere;
}
.identifier-detail {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}
.identifier-detail summary {
  cursor: pointer;
  font-weight: 760;
}
.people-form-grid,
.role-editor-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--field-gap);
  align-items: end;
}
.role-editor {
  display: grid;
  gap: 14px;
}
.role-grid .role-option {
  align-items: start;
  border-color: var(--border);
  background: #fff;
}
.role-option .checkbox-text {
  display: grid;
  gap: 3px;
}
.role-option small,
.access-preview-note,
.permission-list small,
.scope-list span,
.activity-list span,
.danger-action p {
  color: var(--muted);
  font-size: 0.83rem;
}
.warning-banner {
  padding: 11px 12px;
  border: 1px solid #f0c36a;
  border-left: 4px solid var(--warning);
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: #644106;
  font-weight: 700;
}
.section-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.permission-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.permission-group + .permission-group {
  margin-top: 8px;
}
.permission-group summary {
  display: flex;
  justify-content: space-between;
  padding: 11px 12px;
  cursor: pointer;
  font-weight: 760;
}
.permission-list,
.scope-list,
.activity-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.permission-list li,
.scope-list li,
.activity-list li {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.app-panel.activity-detail-panel {
  width: clamp(640px, 50vw, 880px);
}
.activity-shell {
  display: grid;
  gap: 14px;
}
.activity-toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto auto;
  gap: 10px;
  align-items: end;
}
.activity-toolbar label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}
.activity-toolbar input,
.activity-toolbar select {
  min-width: 0;
}
.activity-result-line {
  color: var(--muted);
  font-size: 0.86rem;
}
.activity-timeline {
  display: grid;
  gap: 0;
}
.activity-day {
  margin: 14px 0 8px;
  color: var(--text);
  font-size: 0.95rem;
}
.activity-event {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.activity-time {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
  white-space: nowrap;
}
.activity-card {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.activity-event-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.activity-action {
  font-weight: 780;
}
.activity-summary {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.activity-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.activity-links a:not(.button) {
  color: var(--accent-700);
  font-size: 0.86rem;
  font-weight: 700;
}
.people-detail-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 12px var(--drawer-padding);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -10px 28px rgba(15, 39, 66, 0.08);
}
.people-save-state {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}
.danger-zone {
  gap: 14px;
}
.danger-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.danger-action.hard-delete {
  border-color: #efaaa4;
  background: var(--danger-soft);
}
.people-loading {
  padding: 24px;
  color: var(--muted);
}

/* Notification bell */
.notif-bell {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}
.notif-ico {
  width: 19px;
  height: 19px;
}
.notif-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}
.notification-panel {
  width: min(520px, 94vw);
}
.notif-drawer {
  display: grid;
  gap: 14px;
}
.notif-summary,
.notif-actions,
.notif-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.notif-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}
.notif-filter {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.notif-filter.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-soft);
}
.notif-group {
  display: grid;
  gap: 8px;
}
.notif-group h4 {
  margin: 4px 0 0;
}

/* Global search / command palette */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(12vh, 96px) 18px 24px;
  background: rgba(9, 18, 30, 0.46);
}
.cmdk-overlay.hidden {
  display: none;
}
.cmdk-dialog {
  width: min(760px, 100%);
  overflow: hidden;
  border: 1px solid rgba(143, 157, 179, 0.28);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(5, 14, 25, 0.34);
}
.cmdk-search-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.cmdk-search-row .nav-ico {
  color: var(--muted);
}
.cmdk-search-row input {
  min-width: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 1rem;
  font-weight: 700;
}
.cmdk-search-row input:focus-visible {
  outline: 3px solid rgba(79, 139, 214, 0.45);
  outline-offset: 3px;
}
.cmdk-search-row kbd {
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}
.cmdk-status {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
}
.cmdk-results {
  max-height: min(62vh, 620px);
  overflow-y: auto;
  padding: 8px;
}
.cmdk-group + .cmdk-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.cmdk-group h3 {
  margin: 4px 8px 6px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0;
  text-transform: uppercase;
}
.cmdk-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.cmdk-item:hover,
.cmdk-item.active {
  background: #eef6ff;
}
.cmdk-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #e8f0f7;
  color: var(--primary);
}
.cmdk-item-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.cmdk-item-copy strong,
.cmdk-item-copy small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmdk-item-copy small,
.cmdk-item-meta {
  color: var(--muted);
  font-size: 0.8rem;
}
.cmdk-item-meta {
  justify-self: end;
}
.cmdk-empty {
  padding: 24px 14px;
  color: var(--muted);
  text-align: center;
}
.notif-link {
  color: inherit;
  text-decoration: none;
}
.notif-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.88rem;
}
.notif-icon-wrap {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #edf6ff;
  color: var(--primary);
}
.notif-item.unread {
  border-color: rgba(37, 99, 235, 0.35);
  background: #f8fbff;
  box-shadow: inset 3px 0 0 var(--primary);
}
.notif-item.high .notif-icon-wrap,
.notif-item.critical .notif-icon-wrap {
  background: var(--danger-soft);
  color: var(--danger);
}
.notif-copy {
  min-width: 0;
}
.notif-title-row strong,
.notif-copy p {
  overflow-wrap: anywhere;
}
.notif-title-row time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
}
.notif-copy p {
  margin-top: 3px;
  color: var(--text);
}
.notif-item small {
  color: var(--muted);
}
.swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  vertical-align: middle;
  border: 1px solid var(--border-strong);
}
.perm-cell { text-align: center; }
.role-create-actions { margin-bottom: 8px; }
.role-compare-actions { margin: 8px 0; }
.access-preview-card { margin: 12px 0; }
.about-summary { margin-top: 14px; }

/* Bulk shift-entry grid */
.grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.grid-table th,
.grid-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.grid-table select,
.grid-table input {
  min-height: 34px;
  padding: 4px 6px;
  font-size: 0.82rem;
}
.grid-table select {
  min-width: 84px;
}
.grid-table input[type="date"] {
  min-width: 130px;
}
.grid-table input[type="time"] {
  min-width: 96px;
}
.grid-del {
  min-height: 32px;
  padding: 4px 8px;
}
.grid-check {
  text-align: center;
}
.chk {
  font-weight: 800;
  cursor: help;
}
.chk.ok {
  color: var(--accent);
}
.chk.warn {
  color: var(--warning);
}
.chk.err {
  color: var(--danger);
}

.chk-inline {
  display: inline-grid;
  grid-template-columns: var(--checkbox-size) minmax(0, 1fr);
  flex-direction: row;
  align-items: start;
  gap: 9px;
  min-height: var(--checkbox-hit);
  margin: 0;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.25;
  cursor: pointer;
}
.chk-inline:hover {
  background: var(--surface-muted);
  border-color: var(--border);
}
.chk-inline input[type='checkbox'],
.chk-inline input[type='radio'] {
  margin-top: 0;
}
.field-block {
  margin: var(--field-gap) 0;
}
.field-label {
  display: block;
  font-size: var(--fs-label);
  font-weight: 700;
  color: var(--label-color);
  margin-bottom: var(--field-label-gap);
}
.field-help,
.field-error {
  margin-top: 5px;
  font-size: var(--fs-secondary);
}
.field-help {
  color: var(--muted);
}
.field-error {
  color: var(--error-color);
  font-weight: 700;
}
.form-section {
  display: grid;
  gap: var(--field-gap);
  margin-top: var(--section-gap);
  padding-top: var(--section-gap);
  border-top: 1px solid var(--border);
}
.form-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.form-section h4,
.app-panel-body h4 {
  margin: 0 0 2px;
  color: #1f2a3d;
  font-size: var(--fs-section);
  font-weight: 760;
  letter-spacing: 0;
}
.form-section > .subtle {
  margin-top: -8px;
}
.account-settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--section-gap);
}
@media (min-width: 1100px) {
  .account-settings-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
  .account-settings-layout .form-section {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
}
.profile-shell {
  display: grid;
  gap: 16px;
}
.profile-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.profile-identity {
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 0;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
}
.profile-avatar-img,
.profile-avatar-fallback {
  width: 100%;
  height: 100%;
}
.profile-avatar-img {
  display: block;
  object-fit: cover;
}
.profile-avatar-fallback {
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: 1.35rem;
  font-weight: 820;
}
.profile-identity h2 {
  margin: 0;
  font-size: 1.5rem;
}
.profile-identity p {
  margin: 4px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.profile-tabs {
  padding-inline: 0;
}
.profile-tab-panel {
  min-width: 0;
}
.profile-tab-grid,
.profile-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.profile-form-grid.one-col {
  grid-template-columns: 1fr;
}
.profile-wide {
  grid-column: 1 / -1;
}
.profile-section {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.profile-section h3 {
  margin: 0;
  color: #1f2a3d;
  font-size: var(--fs-section);
}
.profile-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.profile-list li {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.profile-list li div {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
}
.profile-list strong,
.profile-list span,
.profile-list small {
  min-width: 0;
  overflow-wrap: anywhere;
}
.profile-list span,
.profile-list small,
.profile-activity-list small {
  color: var(--muted);
  font-size: 0.84rem;
}
.profile-save-footer {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin: 8px calc(var(--card-padding) * -1) calc(var(--card-padding) * -1);
  padding: 12px var(--card-padding);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -10px 28px rgba(15, 39, 66, 0.08);
}
.profile-save-footer span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}
.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--field-gap);
  align-items: start;
}
.field-row > .field-block {
  margin: 0;
}
.field-row .field-compact {
  max-width: 160px;
}
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 8px 10px;
  align-items: start;
}
.checkbox-grid.one-col {
  grid-template-columns: 1fr;
}
.checkbox-item {
  display: grid;
  grid-template-columns: var(--checkbox-size) minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  min-height: var(--checkbox-hit);
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.25;
  cursor: pointer;
}
.checkbox-item:hover {
  background: var(--surface-muted);
  border-color: var(--border);
}
.checkbox-item.one-line {
  align-items: center;
}
.checkbox-item input[type='checkbox'],
.checkbox-item input[type='radio'] {
  margin-top: 0;
}
.checkbox-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
.checkbox-desc {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--fs-secondary);
  font-weight: 500;
}

/* Config lists (admin) */
.cfg-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
}
.cfg-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  background: var(--surface);
}
.cfg-title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cfg-ctrls {
  display: flex;
  gap: 4px;
  align-items: center;
}
.cfg-ctrls .button {
  min-height: 32px;
  padding: 4px 9px;
}

.app-footer {
  max-width: min(1180px, calc(100% - 32px));
  margin: 24px auto 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}
.app-footer a {
  color: var(--primary);
}
.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;
}

/* ===== Left sidebar app shell ===== */
.app-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 236px; z-index: 40;
  display: flex; flex-direction: column;
  background: #0f1b2d; color: #cfd8e6;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 800; color: #fff; }
.side-logo { display: inline-flex; width: 30px; height: 30px; border-radius: 8px; align-items: center; justify-content: center; background: linear-gradient(135deg, #28d3b3, #8bb8ff); color: #0f1b2d; font-size: 1rem; }
.side-name { font-size: 1.05rem; }
.side-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 10px 8px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #d5e1f0;
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}
.side-search:hover,
.side-search:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.side-search kbd {
  margin-left: auto;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  color: #e6edf7;
  font-size: 0.68rem;
  font-weight: 800;
}
.side-nav { flex: 1; overflow-y: auto; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px; color: #b6c2d4; text-decoration: none; font-size: 0.9rem; font-weight: 600; border: 0; background: transparent; cursor: pointer; width: 100%; text-align: left; }
.side-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.side-link.active { background: var(--primary); color: #fff; }
.nav-ico { width: 19px; height: 19px; flex-shrink: 0; }
.side-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.66rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.side-parent { justify-content: flex-start; }
.side-caret { margin-left: auto; transition: transform 140ms; }
.side-parent.open .side-caret { transform: rotate(180deg); }
.side-sub { display: flex; flex-direction: column; margin: 2px 0 4px 30px; gap: 1px; }
.side-sublink { padding: 6px 10px; border-radius: 6px; color: #9fb0c6; text-decoration: none; font-size: 0.82rem; }
.side-sublink:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.side-sublink.active { color: #fff; background: rgba(255, 255, 255, 0.09); }
.side-subsection { display: grid; gap: 1px; }
.side-subparent { display: block; font-weight: 750; color: #d5e1f0; }
.side-subchildren { display: grid; gap: 1px; margin-left: 10px; padding-left: 8px; border-left: 1px solid rgba(255, 255, 255, 0.08); }
.side-subchild { display: block; font-size: 0.78rem; color: #91a4bc; }
.side-foot { position: relative; border-top: 1px solid rgba(255, 255, 255, 0.07); padding: 12px; }
.side-user {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.side-user:hover,
.side-user[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.06);
}
.side-avatar { width: 32px; height: 32px; border-radius: 50%; background: #2a3b52; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 800; }
.side-user-meta { display: flex; flex-direction: column; min-width: 0; }
.side-user-meta strong { color: #fff; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-meta small { color: #8496ad; font-size: 0.72rem; }
.side-user-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% - 8px);
  z-index: 65;
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: #17263b;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
}
.side-user-menu a,
.side-user-menu button {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #dbe6f4;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.side-user-menu a:hover,
.side-user-menu button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}
/* Persistent nav toggle — fixed, OUTSIDE the sidebar, reachable at every size
   and in every state, so a collapsed rail or stale saved state can never hide
   the only way to reopen navigation. */
.nav-toggle { position: fixed; top: 12px; left: 12px; z-index: 60; width: 40px; height: 40px; border: 0; border-radius: 9px; background: var(--primary); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); }
.nav-toggle:hover { filter: brightness(1.1); }
.nav-toggle:focus-visible { outline: 3px solid #8bb8ff; outline-offset: 2px; }
.nav-toggle-bars { position: relative; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ''; position: absolute; left: 0; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }

/* Drawer backdrop (mobile only). */
.nav-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(6, 12, 22, 0.5); opacity: 0; visibility: hidden; transition: opacity 180ms ease; }
body.nav-open .nav-backdrop { opacity: 1; visibility: visible; }

/* Drawer close button (shown on mobile only). */
.side-close { display: none; margin-left: auto; width: 30px; height: 30px; border: 0; border-radius: 7px; background: rgba(255, 255, 255, 0.08); color: #cfd8e6; font-size: 0.9rem; cursor: pointer; }
.side-close:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.side-close:focus-visible { outline: 2px solid #8bb8ff; outline-offset: 2px; }
.side-link:focus-visible, .side-sublink:focus-visible, .side-user:focus-visible, .side-user-menu a:focus-visible, .side-user-menu button:focus-visible { outline: 2px solid #8bb8ff; outline-offset: -2px; }

/* Room at the top of the rail for the fixed toggle (desktop). */
.side-brand { padding-top: 58px; }

.app-sidebar { transition: width 160ms ease, transform 200ms ease; }
body.with-sidebar .container { margin-left: 236px; width: auto; max-width: none; padding-left: 22px; padding-right: 22px; transition: margin-left 160ms ease; }

/* With the sidebar, the page header is dark-on-white (no dark banner). */
body.with-sidebar::before { display: none; }
body.with-sidebar .app-header { color: var(--text); }
body.with-sidebar .app-header h1 { color: #172033; }
body.with-sidebar #status-line { color: var(--muted); }
body.with-sidebar .notif-bell { background: #fff; border: 1px solid var(--border-strong); color: var(--primary); }
body.with-sidebar .main-nav { background: transparent; border: 0; padding: 0; backdrop-filter: none; }
body.with-sidebar .app-header { grid-template-columns: 1fr auto; align-items: center; }

/* Desktop collapse: icon-only rail (labels hidden, tooltips via title=). */
@media (min-width: 901px) {
  body.with-sidebar.nav-collapsed .app-sidebar { width: 62px; }
  body.with-sidebar.nav-collapsed .side-name,
  body.with-sidebar.nav-collapsed .side-label,
  body.with-sidebar.nav-collapsed .side-caret,
  body.with-sidebar.nav-collapsed .side-user-meta,
  body.with-sidebar.nav-collapsed .side-search kbd { display: none; }
  body.with-sidebar.nav-collapsed .container { margin-left: 62px; }
  body.with-sidebar.nav-collapsed .side-link { justify-content: center; }
  body.with-sidebar.nav-collapsed .side-search { justify-content: center; margin-inline: 10px; }
  body.with-sidebar.nav-collapsed .side-brand { justify-content: center; }
  /* Administration submenu becomes a hover/focus flyout so its child routes stay
     reachable (and the current page stays indicated) while collapsed. */
  body.with-sidebar.nav-collapsed .side-nav { overflow: visible; }
  body.with-sidebar.nav-collapsed .side-sub {
    position: absolute;
    left: 58px;
    margin: 0;
    min-width: 210px;
    padding: 6px;
    background: #12233b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: none;
    z-index: 70;
  }
  body.with-sidebar.nav-collapsed .side-parent:hover + .side-sub,
  body.with-sidebar.nav-collapsed .side-parent:focus + .side-sub,
  body.with-sidebar.nav-collapsed .side-sub:hover,
  body.with-sidebar.nav-collapsed .side-sub:focus-within { display: flex; }
}

/* Tablet / mobile: off-canvas drawer opened by the header toggle. Full labels
   are always shown in the drawer regardless of the desktop collapse preference. */
@media (max-width: 900px) {
  .app-sidebar { transform: translateX(-100%); width: 264px; box-shadow: 2px 0 18px rgba(0, 0, 0, 0.35); }
  body.nav-open .app-sidebar { transform: translateX(0); }
  body.with-sidebar .container { margin-left: 0; padding-left: 12px; padding-right: 12px; }
  body.with-sidebar .app-header { padding-left: 52px; }
  body.nav-open .nav-toggle { display: none; }
  .side-brand { padding-top: 16px; }
  .side-close { display: inline-flex; align-items: center; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar, body.with-sidebar .container, .nav-backdrop { transition: none; }
}

/* ===== Team Schedule redesign ===== */
.container.wide { width: min(1440px, calc(100% - 32px)); }
.card.sched { padding: 16px 18px; }
body.with-sidebar #reports-card.card,
body.with-sidebar .card.sched {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.sched-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.sched-title h2 { margin: 0; }
.sched-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sched-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 8px; }
.sched-period { display: flex; gap: 6px; align-items: center; }
.sched-range { font-weight: 800; margin-left: 6px; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg-btn { min-height: 34px; padding: 6px 12px; border: 0; border-right: 1px solid var(--border); background: #fff; color: var(--primary); font: inherit; font-weight: 700; font-size: 0.82rem; cursor: pointer; }
.seg-btn:last-child { border-right: 0; }
.seg-btn.active { background: var(--primary); color: #fff; }
.sched-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--border); }
.sched-advanced { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; background: var(--surface-muted); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; }
.sched-legend { padding: 6px 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.68rem; font-weight: 800; align-items: center; justify-content: center; }
.sched-body { display: flex; gap: 12px; align-items: flex-start; }
.sched-cal { flex: 1; min-width: 0; }
.sched-panel { width: 320px; flex-shrink: 0; border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--surface); max-height: 78vh; overflow-y: auto; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.panel-head h3 { margin: 0; padding: 0; border: 0; }

/* time grid */
.tg-scroll { --cal-time-col: 62px; --cal-header-h: 52px; --cal-slot-px: 30px; display: flex; max-height: 74vh; overflow: auto; scrollbar-gutter: stable; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.tg-scroll.cal-density-compact.cal-step-15 { --cal-slot-px: 13px; }
.tg-scroll.cal-density-compact.cal-step-30 { --cal-slot-px: 26px; }
.tg-scroll.cal-density-compact.cal-step-60 { --cal-slot-px: 52px; }
.tg-scroll.cal-density-comfortable.cal-step-15 { --cal-slot-px: 15px; }
.tg-scroll.cal-density-comfortable.cal-step-30 { --cal-slot-px: 30px; }
.tg-scroll.cal-density-comfortable.cal-step-60 { --cal-slot-px: 60px; }
.tg-scroll.cal-density-spacious.cal-step-15 { --cal-slot-px: 17px; }
.tg-scroll.cal-density-spacious.cal-step-30 { --cal-slot-px: 34px; }
.tg-scroll.cal-density-spacious.cal-step-60 { --cal-slot-px: 68px; }
.tg-scroll.cal-view-hour.cal-density-compact.cal-step-15 { --cal-slot-px: 18px; }
.tg-scroll.cal-view-hour.cal-density-compact.cal-step-30 { --cal-slot-px: 36px; }
.tg-scroll.cal-view-hour.cal-density-compact.cal-step-60 { --cal-slot-px: 72px; }
.tg-scroll.cal-view-hour.cal-density-comfortable.cal-step-15 { --cal-slot-px: 21px; }
.tg-scroll.cal-view-hour.cal-density-comfortable.cal-step-30 { --cal-slot-px: 42px; }
.tg-scroll.cal-view-hour.cal-density-comfortable.cal-step-60 { --cal-slot-px: 84px; }
.tg-scroll.cal-view-hour.cal-density-spacious.cal-step-15 { --cal-slot-px: 24px; }
.tg-scroll.cal-view-hour.cal-density-spacious.cal-step-30 { --cal-slot-px: 48px; }
.tg-scroll.cal-view-hour.cal-density-spacious.cal-step-60 { --cal-slot-px: 96px; }
.tg-gutter { position: sticky; left: 0; z-index: 3; background: #fff; border-right: 1px solid var(--border); }
.gutter-head { width: var(--cal-time-col, 62px); }
.tg-gutter-body,
.tg-col-body {
  background-image: linear-gradient(to bottom, rgba(148, 163, 184, 0.14) 1px, transparent 1px);
  background-size: 100% var(--cal-slot-px, 30px);
}
.tg-hour { position: relative; height: var(--cal-slot-px, 30px); box-sizing: border-box; }
.tg-hour span { position: absolute; top: -7px; right: 6px; font-size: var(--fs-time); color: var(--muted); background: #fff; padding: 0 2px; }
.tg-cols { display: grid; flex: 1; }
.tg-cols.week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.tg-cols.day, .tg-cols.half, .tg-cols.hour { grid-template-columns: 1fr; }
.tg-col { border-right: 1px solid var(--border); min-width: 0; }
.tg-col-head, .gutter-head { position: sticky; top: 0; z-index: 2; height: var(--cal-header-h, 52px); background: #fff; border-bottom: 1px solid var(--border); padding: 4px 6px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.tg-col-head.cov-critical { border-top: 3px solid var(--danger); }
.tg-col-head.cov-understaffed { border-top: 3px solid var(--warning); }
.tg-col-head.cov-adequate { border-top: 3px solid var(--accent); }
.tg-col-head.cov-overstaffed { border-top: 3px solid var(--primary); }
.tg-col-body { position: relative; display: block; box-sizing: border-box; overflow: visible; }
.tg-now { stroke: #dc2626; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.tg-now-dot { fill: #dc2626; }
.tg-event-frame { overflow: visible; }
.tg-shift { position: relative; width: calc(100% - 10px); height: 100%; margin: 0 5px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); padding: 2px 5px 2px 8px; font-size: 0.72rem; overflow: hidden; cursor: pointer; box-sizing: border-box; }
.tg-shift-color { position: absolute; inset: 0 auto 0 0; width: 3px; height: 100%; }
.tg-shift:hover { box-shadow: var(--shadow); z-index: 4; }
.tg-shift.st-draft { border-style: dashed; background: repeating-linear-gradient(45deg, #fff, #fff 6px, #fafbfc 6px, #fafbfc 12px); }
.tg-shift.st-open { border-style: dotted; }
.tg-shift.st-cancelled { opacity: 0.5; text-decoration: line-through; }
.tg-shift-time { font-weight: 800; }
.tg-shift-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-shift-meta { display: flex; gap: 3px; flex-wrap: wrap; color: var(--muted-strong); }
.cov-badge { font-size: 0.66rem; font-weight: 800; padding: 1px 5px; border-radius: 5px; }
.cov-badge.critical { background: var(--danger-soft); color: var(--danger); }
.cov-badge.understaffed { background: var(--warning-soft); color: #8a5a11; }
.cov-badge.adequate { background: var(--accent-soft); color: #0b5d55; }
.cov-badge.overstaffed { background: var(--primary-soft); color: var(--primary); }
.badge.oncall { background: #fde8e8; color: #b42318; }
.badge.crit { background: var(--danger); color: #fff; }

/* month */
.mo-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mo-dow { text-align: center; font-size: 0.72rem; font-weight: 700; color: var(--muted); padding: 3px 0; }
.mo-cell { min-height: 92px; border: 1px solid var(--border); border-radius: 8px; padding: 5px 6px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.mo-cell:hover { box-shadow: var(--shadow); }
.mo-cell.is-other { opacity: 0.5; }
.mo-cell.cov-critical { border-top: 3px solid var(--danger); }
.mo-cell.cov-understaffed { border-top: 3px solid var(--warning); }
.mo-cell.cov-adequate { border-top: 3px solid var(--accent); }
.mo-cell.cov-overstaffed { border-top: 3px solid var(--primary); }
.mo-num { font-size: 0.78rem; font-weight: 700; }
.mo-stat { font-size: 0.78rem; }
.mo-tags { display: flex; gap: 3px; flex-wrap: wrap; margin-top: auto; }

/* year heatmap */
.yr-summary { font-weight: 700; margin-bottom: 10px; }
.yr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.yr-month { border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.yr-mname { font-weight: 800; font-size: 0.82rem; margin-bottom: 6px; cursor: pointer; }
.yr-cells { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.yr-cell { aspect-ratio: 1; border-radius: 2px; background: #eef1f5; cursor: pointer; }
.yr-cell.pad { background: transparent; cursor: default; }
.yr-cell.cov-critical { background: var(--danger); }
.yr-cell.cov-understaffed { background: var(--warning); }
.yr-cell.cov-adequate { background: var(--accent); }
.yr-cell.cov-overstaffed { background: var(--primary); }
.gap-row { display: flex; gap: 8px; align-items: center; cursor: pointer; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.gap-row.critical strong { color: var(--danger); }

/* day-header warning */
.tg-head-row { display: flex; align-items: center; gap: 5px; }
.tg-dow { color: var(--muted); font-size: 0.72rem; }
.tg-warn { color: var(--danger); font-weight: 800; font-size: 0.72rem; }

/* rich coverage panel */
.cs-sub { color: var(--muted); font-size: 0.78rem; margin-bottom: 8px; }
.cs-list { display: flex; flex-direction: column; }
.cs-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.cs-row span { color: var(--muted-strong); }
.cs-row.over strong { color: var(--primary); }
.cs-row.ok strong { color: var(--accent); }
.cs-row.warn strong { color: var(--warning); }
.cs-row.crit strong { color: var(--danger); }
.cs-btn { width: 100%; margin: 10px 0; justify-content: center; }
.sched-panel h4 { margin: 14px 0 8px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 0.85rem; }
.cs-chart { background: #fff; }
.cs-legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.7rem; color: var(--muted-strong); margin-top: 4px; }
.cs-leg { display: inline-flex; align-items: center; gap: 4px; }
.cs-dot { width: 9px; height: 9px; border-radius: 2px; }
.cs-line { width: 12px; height: 2px; background: #111827; }
.cs-gaps { list-style: none; padding: 0; margin: 0; }
.cs-gap { display: flex; gap: 8px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.cs-gap:hover { background: var(--surface-muted); }
.cs-gap .cs-sev { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.cs-gap.critical .cs-sev { background: var(--danger); }
.cs-gap.understaffed .cs-sev { background: var(--warning); }
.cs-gap strong { font-size: 0.8rem; display: block; }
.cs-gap small { color: var(--muted); font-size: 0.74rem; }
.cs-open { font-size: 0.85rem; }
.cs-open strong { font-size: 1.3rem; }

@media (max-width: 1000px) {
  .sched-body { flex-wrap: wrap; }
  .sched-panel { width: 100%; flex-shrink: 1; max-height: none; }
  .activity-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .tg-cols.week { grid-template-columns: repeat(7, minmax(90px, 1fr)); }
  .yr-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* My Schedule hero */
.ms-next {
  margin: 4px 0 12px;
}
.ms-next-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
}
.ms-next-inner.on {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}
.ms-next-inner span {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}
.ms-next-inner strong {
  font-size: 1.15rem;
}
.my-schedule-upcoming .dash-section-head {
  align-items: center;
}
.ms-week-actions {
  justify-content: flex-end;
}
.my-week-calendar {
  min-width: 0;
}
.my-week-calendar .ms-week-scroll {
  height: min(690px, calc(100vh - 260px));
  min-height: 500px;
}
.my-week-calendar .tg-cols.week {
  min-width: 780px;
}
.my-week-calendar .tg-col-head {
  gap: 0;
}
.my-shift-card {
  cursor: pointer;
}
.my-shift-card .tg-shift-meta {
  margin-top: 2px;
}

@media (max-width: 900px) {
  .ts-cal.week {
    grid-template-columns: 1fr;
  }
  .my-schedule-upcoming .dash-section-head {
    align-items: stretch;
  }
  .my-schedule-upcoming .dash-section-head,
  .my-schedule-upcoming .ms-week-actions {
    flex-direction: column;
  }
  .my-schedule-upcoming .ms-week-actions .button {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .cmdk-overlay {
    padding: 10px;
  }
  .cmdk-dialog {
    width: 100%;
    max-height: calc(100dvh - 20px);
  }
  .cmdk-results {
    max-height: calc(100dvh - 132px);
  }
  .cmdk-item {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .cmdk-item-meta {
    grid-column: 2;
    justify-self: start;
  }
  .app-panel {
    width: 100vw;
    height: 100dvh;
  }
  .app-panel.people-detail-panel {
    width: 100vw;
    max-width: none;
  }
  .app-panel.activity-detail-panel {
    width: 100vw;
    max-width: none;
  }
  .app-panel-head,
  .app-panel-body {
    padding-inline: 18px;
  }
  .people-detail-panel .app-panel-body {
    padding-inline: 0;
  }
  .people-detail-header {
    position: sticky;
    top: 0;
    z-index: 1;
    flex-direction: column;
    padding-inline: 18px;
  }
  .people-tabs {
    padding-inline: 18px;
  }
  .people-tab-panel {
    padding-inline: 18px;
  }
  .people-detail-footer {
    padding-inline: 18px;
  }
  .people-two-col,
  .profile-tab-grid,
  .profile-form-grid,
  .people-form-grid,
  .role-editor-tools,
  .danger-action {
    grid-template-columns: 1fr;
  }
  .detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .people-detail-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .people-detail-footer .inline-actions,
  .people-detail-footer .button {
    width: 100%;
  }
  .profile-header,
  .profile-identity,
  .profile-save-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .profile-list li div {
    flex-direction: column;
    gap: 2px;
  }
  .profile-save-footer .inline-actions,
  .profile-save-footer .button {
    width: 100%;
  }
  .widget-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .dashboard-widget {
    grid-column: 1 / -1;
    padding: 16px;
  }
  body[data-page="dashboard"] #dashboard-card.card {
    padding: 16px;
  }
  .widget-head,
  .widget-meta,
  .widget-foot,
  .widget-item-list li div,
  .dashboard-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .widget-actions {
    flex-wrap: wrap;
  }
  .widget-config-grid {
    grid-template-columns: 1fr;
  }
  .widget-summary-grid {
    grid-template-columns: 1fr;
  }
  .activity-toolbar {
    grid-template-columns: 1fr;
  }
  .activity-event {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .activity-event-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .my-week-calendar .ms-week-scroll {
    height: 560px;
    min-height: 440px;
  }
  .my-week-calendar .tg-cols.week {
    min-width: 700px;
  }
  .container.wide { width: min(100% - 20px, 1440px); }
  .sched-head,
  .sched-toolbar,
  .sched-filters,
  .sched-advanced {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .sched-actions,
  .sched-period,
  .sched-filters {
    width: 100%;
  }
  .sched-actions,
  .sched-period {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sched-actions .button,
  .sched-period .button,
  .sched-filters .button,
  .sched-filters .inline-field,
  .sched-advanced .inline-field {
    width: 100%;
    min-width: 0;
  }
  .sched-range {
    grid-column: 1 / -1;
    margin-left: 0;
    min-height: 22px;
  }
  .segmented {
    width: 100%;
    overflow-x: auto;
  }
  .seg-btn {
    flex: 1 0 auto;
    min-width: 58px;
  }
  .inline-field select {
    width: 100%;
    min-width: 0;
  }
  .tg-scroll {
    max-width: 100%;
  }
}

@media (min-width: 601px) and (max-width: 1000px) {
  .app-panel.people-detail-panel {
    width: min(85vw, 820px);
  }
  .people-two-col {
    grid-template-columns: 1fr;
  }
}

/* Published Team Schedule polish */
.sched-title h2 {
  font-size: 1.65rem;
  line-height: 1.15;
}
.sched-actions .button,
.sched-actions a.button,
.sched-period .button,
.sched-filters .button,
.sched-advanced .button,
.seg-btn,
.inline-field select,
.inline-field input {
  min-height: var(--control-height-compact);
}
.sched-head {
  margin-bottom: 16px;
}
.sched-toolbar {
  margin: 0 0 14px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--border);
}
.sched-filters {
  border-top: 0;
  padding: 0 0 10px;
}
.sched-advanced {
  margin: 0 0 12px;
  border: 1px solid var(--border);
  background: #fff;
}
.sched-legend {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}
.sched-body {
  gap: 16px;
  align-items: stretch;
}
.sched-cal {
  min-height: min(760px, calc(100vh - 260px));
}
.sched-panel {
  width: clamp(300px, 24vw, 360px);
  max-height: calc(100vh - 230px);
  border-radius: 8px;
  box-shadow: none;
}
.mobile-only {
  display: none;
}
.inline-field input {
  width: 150px;
  padding: 6px 9px;
}
.segmented {
  border-radius: 7px;
}
.seg-btn:hover {
  background: var(--primary-soft);
}
.seg-btn.active:hover {
  background: var(--primary);
}
.tg-scroll {
  position: relative;
  height: calc(100vh - 275px);
  min-height: 560px;
  max-height: none;
  border-radius: 8px;
  scrollbar-gutter: stable;
}
.tg-gutter {
  box-shadow: 1px 0 0 var(--border);
}
.gutter-head {
  width: var(--cal-time-col, 62px);
}
.tg-hour {
  height: var(--cal-slot-px, 30px);
  border-bottom: 0;
}
.tg-hour span {
  font-size: 0.72rem;
}
.tg-cols.week {
  min-width: 860px;
}
.tg-col:last-child {
  border-right: 0;
}
.tg-col.is-today .tg-col-head {
  background: #f8fbff;
}
.tg-col-head,
.gutter-head {
  height: var(--cal-header-h, 52px);
  padding: 6px 8px;
}
.tg-col-body {
  background-image: linear-gradient(to bottom, rgba(148, 163, 184, 0.14) 1px, transparent 1px);
  background-size: 100% var(--cal-slot-px, 30px);
}
.tg-now {
  stroke: #ef4444;
}
.tg-shift {
  border-radius: 6px;
  padding: 4px 7px 4px 10px;
  font-size: 0.78rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.tg-shift:hover,
.tg-shift:focus-visible,
.agenda-shift:hover,
.agenda-shift:focus-visible,
.mo-cell:hover,
.mo-cell:focus-visible {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
  outline: 2px solid rgba(37, 99, 235, 0.25);
  outline-offset: 1px;
  z-index: 5;
}
.tg-shift.is-selected,
.agenda-shift.is-selected {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.tg-shift-meta {
  align-items: center;
}
.tg-shift-meta span:not(.badge) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cov-badge.none {
  background: #f1f5f9;
  color: #64748b;
}
.sched-empty-overlay {
  position: absolute;
  left: 72px;
  right: 16px;
  top: 82px;
  z-index: 4;
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted-strong);
  text-align: center;
  font-weight: 700;
}
.cal-empty {
  position: absolute;
  left: 72px;
  right: 16px;
  top: 82px;
  z-index: 4;
  padding: var(--sp-4) var(--sp-5);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted-strong);
  text-align: center;
}
.cal-empty p { margin: 0 0 var(--sp-2); font-weight: 600; font-size: var(--fs-body); }
.cal-empty p:last-child { margin-bottom: 0; }
.cal-debug {
  position: sticky;
  left: calc(var(--cal-time-col, 62px) + 8px);
  bottom: 8px;
  z-index: 20;
  width: max-content;
  max-width: calc(100% - var(--cal-time-col, 62px) - 24px);
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-size: 0.72rem;
  pointer-events: none;
}

.sched-skeleton, .cal-skeleton {
  min-height: min(760px, calc(100vh - 260px));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}
.sched-skeleton span, .cal-skeleton span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 14px;
}
.sched-skeleton div, .cal-skeleton div {
  height: 72px;
  margin: 10px 0;
  border-radius: 8px;
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 45%, #f8fafc 100%);
  background-size: 240% 100%;
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}
@keyframes skeleton-sweep {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
.mo-grid {
  gap: 6px;
}
.mo-cell {
  min-height: 112px;
  border-radius: 7px;
  background: #fff;
}
.mo-stat {
  display: grid;
  gap: 2px;
}
.mo-stat span {
  color: var(--muted);
  font-size: 0.72rem;
}
.yr-summary {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.yr-month {
  background: #fff;
  border-radius: 8px;
}
.yr-mname {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0 0 6px;
  text-align: left;
  color: var(--text);
}
.yr-cell:focus-visible,
.yr-mname:focus-visible,
.cs-gap:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.agenda-scroll {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 275px);
  min-height: 520px;
  overflow: auto;
}
.agenda-day {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.agenda-day.is-today {
  border-color: rgba(37, 99, 235, 0.35);
}
.agenda-day header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.agenda-day header div {
  display: flex;
  flex-direction: column;
}
.agenda-day header span {
  color: var(--muted);
  font-size: 0.78rem;
}
.agenda-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}
.agenda-shift {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  overflow: hidden;
  border-radius: 7px;
  padding: 9px 10px;
  background: #fff;
  cursor: pointer;
}
.agenda-shift div {
  min-width: 0;
}
.agenda-shift span,
.agenda-shift small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agenda-shift small {
  color: var(--muted);
}
.agenda-empty {
  padding: 12px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 7px;
  text-align: center;
}

@media (max-width: 1000px) {
  .mobile-only {
    display: inline-flex;
  }
  .sched-cal,
  .tg-scroll,
  .agenda-scroll,
  .sched-skeleton {
    min-height: 540px;
    height: calc(100vh - 300px);
  }
  .sched-panel {
    width: 100%;
    max-height: 70vh;
  }
}

@media (max-width: 700px) {
  .sched-cal,
  .tg-scroll,
  .agenda-scroll,
  .sched-skeleton {
    min-height: 480px;
    height: calc(100vh - 340px);
  }
  .tg-cols.week {
    min-width: 720px;
  }
  .agenda-shift {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .mo-grid {
    grid-template-columns: repeat(7, minmax(40px, 1fr));
    gap: 3px;
  }
  .mo-cell {
    min-height: 86px;
    padding: 5px;
  }
  .mo-tags .badge {
    font-size: 0.62rem;
    padding: 1px 5px;
  }
}

/* ===== Schedule Management workspace ===== */
.schedule-management {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sm-head,
.sm-toolbar,
.sm-filterbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.sm-head h2 {
  margin: 0;
  font-size: 1.65rem;
}
.sm-head-actions,
.sm-filterbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sm-toolbar {
  padding: 10px 0 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.sm-filterbar {
  justify-content: flex-start;
}
.sm-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 310px) minmax(0, 1fr) minmax(300px, 360px);
  gap: 14px;
  align-items: stretch;
  min-height: calc(100vh - 275px);
}
.sm-side {
  min-height: 0;
  max-height: calc(100vh - 275px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}
.sm-calendar {
  min-width: 0;
  min-height: calc(100vh - 275px);
}
.sm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 8px;
}
.sm-panel-head h3 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 0.95rem;
}
.sm-search {
  width: 100%;
  min-height: 38px;
  margin-bottom: 8px;
}
.sm-employee-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 8px;
  margin-bottom: 10px;
  font-size: 0.76rem;
  color: var(--muted-strong);
}
.sm-employee-list,
.sm-open-list {
  display: grid;
  gap: 8px;
}
.sm-employee,
.sm-open-item,
.sm-list-shift {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  padding: 8px 9px;
  text-align: left;
}
.sm-employee {
  cursor: grab;
}
.sm-employee:hover,
.sm-open-item:hover,
.sm-list-shift:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
}
.sm-employee span,
.sm-employee small,
.sm-open-item span,
.sm-list-shift span,
.sm-list-shift small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sm-emp-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.74rem;
  color: var(--muted-strong);
}
/* Keep the time grid scrollable at every breakpoint, including zoomed layouts. */
.sm-edit-scroll {
  height: 65vh;
  height: clamp(280px, 65dvh, 760px);
  min-height: 0;
  max-height: none;
}
.sm-slot {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  cursor: crosshair;
}
.sm-slot-frame { overflow: visible; }
.sm-slot:hover,
.sm-slot:focus-visible {
  background: rgba(37, 99, 235, 0.08);
  outline: 1px solid rgba(37, 99, 235, 0.25);
}
.sm-shift {
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.sm-shift[draggable="true"] {
  cursor: grab;
}
.sm-resize-handle {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 2px;
  height: 5px;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.28);
  cursor: ns-resize;
}
.sm-resize-handle:hover {
  background: var(--primary);
}
.sm-shift.is-resizing-longer { box-shadow: inset 0 -4px 0 var(--accent); }
.sm-shift.is-resizing-shorter { box-shadow: inset 0 4px 0 var(--warning); }
.sm-shift.draft-new {
  border-style: dashed;
  background: repeating-linear-gradient(45deg, #fff, #fff 7px, #f8fafc 7px, #f8fafc 14px);
}
.sm-shift.draft-modified {
  border-style: dashed;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.45);
}
.sm-shift.draft-delete {
  opacity: 0.55;
  text-decoration: line-through;
}
.sm-shift.published {
  background: #fff;
}
.sm-shift.published-open,
.sm-list-shift.published-open {
  border-style: dotted;
}
.sm-shift.cancelled,
.sm-list-shift.cancelled {
  opacity: 0.55;
}
.sm-list-view {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 275px);
  overflow: auto;
}
.sm-list-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}
.sm-list-group h3 {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  font-size: 0.95rem;
}
.sm-list-shift {
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: 6px;
}
.sm-details {
  font-size: 0.85rem;
}
.sm-details ul {
  margin: 6px 0;
  padding-left: 18px;
}
.sm-builder {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.sm-builder.is-collapsed {
  padding-bottom: 10px;
}
.sm-builder-head,
.sm-builder-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.sm-builder-head h3,
.sm-builder-card h4,
.sm-recurrence h4 {
  margin: 0;
  padding: 0;
  border: 0;
}
.sm-builder-body {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(420px, 1.45fr) minmax(280px, 0.9fr);
  gap: 14px;
  align-items: start;
  margin-top: 12px;
}
.sm-builder-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
  min-width: 0;
}
.sm-builder-card .form-grid {
  margin-top: 10px;
}
.sm-advanced {
  margin-top: 12px;
}
.sm-advanced summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--primary);
}
.sm-template-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.sm-template-actions input {
  flex: 1 1 180px;
}
.sm-recurrence {
  margin-top: 14px;
}
.sm-date-options,
.sm-weekday-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
}
.sm-weekday-picker {
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  padding: 8px 10px;
}
.sm-weekday-picker legend {
  padding: 0 4px;
  color: var(--muted-strong);
  font-size: var(--fs-label);
  font-weight: 700;
}
.sm-weekday-picker label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
}
.sm-builder-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.sm-builder-filters .checkbox-label {
  min-height: 34px;
}
.sm-quick-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.sm-employee-table {
  display: grid;
  gap: 6px;
  max-height: 410px;
  overflow: auto;
  padding-right: 2px;
}
.sm-employee-row {
  display: grid;
  grid-template-columns: var(--checkbox-size) minmax(150px, 1.2fr) minmax(170px, 1.25fr) minmax(110px, 0.85fr) minmax(110px, 0.85fr) minmax(95px, 0.75fr) minmax(90px, 0.7fr) minmax(150px, 1.15fr) minmax(110px, 0.85fr) minmax(88px, 0.65fr) minmax(130px, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  padding: 7px 8px;
  font-size: 0.8rem;
}
.sm-employee-row-head {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 34px;
  background: #f8fafc;
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
.sm-employee-row:hover {
  border-color: var(--border-strong);
}
.sm-employee-row input {
  align-self: center;
}
.sm-employee-row strong,
.sm-employee-row small,
.sm-employee-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sm-employee-row small {
  display: block;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sm-selected-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  min-height: 28px;
  padding: 4px 9px;
  cursor: pointer;
}
.chip-button:hover {
  border-color: var(--primary);
}
.sm-preview-counts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.sm-preview-counts span {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  padding: 8px;
  color: var(--muted-strong);
}
.sm-preview-counts strong {
  display: block;
  color: var(--text);
  font-size: 1.1rem;
}
.sm-validation-list {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  max-height: 260px;
  overflow: auto;
}
.sm-validation-list li {
  display: grid;
  gap: 2px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 7px;
  background: #fff;
  padding: 7px 9px;
}
.sm-validation-list li.warn {
  border-left-color: var(--warning);
}
.sm-validation-list li.crit {
  border-left-color: var(--danger);
}
.sm-validation-list em {
  font-style: normal;
  font-weight: 800;
}
.sm-validation-list small {
  color: var(--muted-strong);
}
.sm-builder-actions {
  margin-top: 12px;
  justify-content: flex-end;
}
.rotations-view {
  display: grid;
  gap: 14px;
  min-height: calc(100vh - 275px);
}
.rotations-head,
.rotation-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.rotations-head h3 {
  margin: 0;
  padding: 0;
  border: 0;
}
.rotations-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.rotation-list,
.rotation-preview,
.rotation-editor {
  min-width: 0;
}
.rotation-list {
  display: grid;
  gap: 10px;
}
.rotation-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.rotation-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent);
}
.rotation-card h4,
.rotation-card p {
  margin: 0;
}
.rotation-card small {
  color: var(--muted);
}
.rotation-summary {
  justify-content: flex-start;
  margin-bottom: 12px;
}
.rotation-summary span {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  padding: 8px 10px;
  color: var(--muted-strong);
}
.rotation-summary strong {
  color: var(--text);
}
.rotation-order {
  display: grid;
  gap: 6px;
  margin: 8px 0 12px;
  padding-left: 20px;
}
.rotation-order li {
  min-width: 0;
}
.rotation-order:not(.readonly) li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  padding: 8px 10px;
}
.rotation-order small {
  display: block;
  color: var(--muted);
}
.rotation-user-results {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  margin-top: 8px;
}
.rotation-user-results .button {
  display: inline-grid;
  justify-items: start;
  line-height: 1.2;
}
.rotation-user-results small {
  color: var(--muted);
}
.rotation-preview-table {
  max-height: calc(100vh - 390px);
  overflow: auto;
}
.rotation-preview-table table {
  width: 100%;
  border-collapse: collapse;
}
.rotation-preview-table th,
.rotation-preview-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}
.rotation-preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
}
.rotation-preview-table .has-conflict td {
  background: #fff7ed;
}
.rotation-editor {
  display: grid;
  gap: 16px;
}
.rotation-editor section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.rotation-editor h4 {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}
.rotation-settings-panel .form-grid {
  margin-bottom: 12px;
}

@media (max-width: 1180px) {
  .sm-workspace {
    grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  }
  .sm-right {
    grid-column: 1 / -1;
    max-height: none;
  }
  .sm-builder-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .rotations-grid {
    grid-template-columns: 1fr;
  }
  .rotation-preview-table {
    max-height: none;
  }
}

@media (max-width: 820px) {
  .sm-workspace {
    grid-template-columns: 1fr;
  }
  .sm-side,
  .sm-calendar,
  .sm-list-view {
    max-height: none;
    min-height: auto;
    height: auto;
  }
  .sm-list-shift {
    grid-template-columns: 1fr;
  }
  .sm-employee-filters {
    grid-template-columns: 1fr;
  }
  .sm-builder {
    padding: 10px;
  }
  .sm-builder-filters,
  .sm-employee-row,
  .sm-preview-counts {
    grid-template-columns: 1fr;
  }
  .sm-employee-row-head {
    display: none;
  }
  .sm-employee-table {
    max-height: none;
  }
  .sm-builder-actions .button {
    width: 100%;
  }
  .rotations-view {
    min-height: auto;
  }
  .rotation-order:not(.readonly) li,
  .rotation-card {
    align-items: stretch;
  }
  .rotation-order:not(.readonly) li {
    flex-direction: column;
  }
  .rotation-preview-table {
    overflow-x: auto;
  }
}

/* Calendar */
.cal-toolbar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.cal-nav,
.cal-views {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.cal-title {
  font-weight: 800;
  margin-left: 4px;
}
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-col {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  min-height: 130px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cal-col-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.72rem;
  color: #6b7280;
}
.cal-col-head strong {
  font-size: 1.1rem;
  color: inherit;
}
.cal-col-head.is-today strong {
  color: var(--primary);
}
.cal-empty {
  text-align: center;
  color: #9ca3af;
  font-size: 0.8rem;
}
.cal-shift {
  background: var(--primary-soft);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-shift-time {
  font-weight: 800;
}
.cal-shift-name {
  font-weight: 600;
}
.cal-shift-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.72rem;
  color: #4b5563;
}
.cal-gcal {
  font-size: 0.72rem;
  margin-top: 2px;
  font-weight: 700;
}
.cal-month {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-month-dow {
  text-align: center;
  font-size: 0.72rem;
  color: #6b7280;
  font-weight: 700;
  padding: 2px 0;
}
.cal-cell {
  min-height: 96px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-cell.is-other {
  opacity: 0.45;
}
.cal-cell.is-today {
  box-shadow: 0 0 0 2px var(--primary) inset;
}
.cal-cell-num {
  font-size: 0.75rem;
  font-weight: 700;
  align-self: flex-end;
}
.cal-chip {
  font-size: 0.68rem;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 5px;
  padding: 1px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-more {
  font-size: 0.66rem;
  color: #6b7280;
}

/* Shift editor grid */
.shift-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 12px;
}
.shift-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.shift-enable {
  display: inline-flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 210px;
  min-height: var(--checkbox-hit);
  padding: 7px 0;
  color: var(--label-color);
  font-size: var(--fs-label);
  font-weight: 700;
  line-height: 1.25;
}
.shift-sep {
  color: #6b7280;
}

@media (max-width: 900px) {
  .cal-week {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .app-header,
  .clock-layout {
    grid-template-columns: 1fr;
  }

  .main-nav {
    justify-content: flex-start;
  }

  #home-card .inline-actions,
  .report-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .container {
    width: min(100% - 24px, 1180px);
    padding-top: 16px;
  }

  .card {
    padding: 16px;
  }

  .user-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .user-row .button.secondary {
    grid-column: 1 / -1;
    width: 100%;
    margin-left: 0;
  }

  .grid-2,
  .field-row,
  .entry-time-grid,
  .entry-location-grid,
  #home-card .inline-actions,
  .report-summary {
    grid-template-columns: 1fr;
  }

  .field-row .field-compact {
    max-width: none;
  }

  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-link {
    justify-content: center;
  }

  .clock-actions .button,
  .clock-actions {
    width: 100%;
  }

  .report-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

.card.nested {
  background: #f9fafb;
  box-shadow: none;
  border: 1px solid #e5e7eb;
  margin: 8px 0 14px;
}

/* Accessibility: visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible,
.button:focus-visible,
.ts-shift:focus-visible,
.person-row:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid #4f8bd6;
  outline-offset: 2px;
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* Larger touch targets + agenda-friendly cards on small screens */
@media (max-width: 600px) {
  .button,
  .req-tab-btn,
  .nav-link {
    min-height: 44px;
  }
  .ts-shift {
    padding: 10px 12px;
  }
  .ts-col {
    min-height: auto;
  }
  .main-nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }
  .ts-toolbar,
  .filter-row {
    gap: 8px;
  }
}

/* Sidebar tenant logo (replaces the default glyph when an org sets a logo URL) */
.side-logo-img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; background: #fff; }

/* Administration route page header (replaces the old top-tab bar) */
.admin-page-head { margin-bottom: var(--sp-5); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border); }
.admin-page-head h2 { margin: 2px 0 4px; font-size: var(--fs-title); }
.admin-page-head .subtle { font-size: var(--fs-subtitle); margin: 0; }
.admin-breadcrumb { margin: 0 0 2px; font-size: var(--fs-secondary); color: var(--muted); }
.admin-breadcrumb a { color: var(--muted); text-decoration: none; }
.admin-breadcrumb a:hover { color: var(--primary); text-decoration: underline; }
.admin-local-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 12px; }
.admin-local-nav a { display: inline-flex; align-items: center; min-height: 32px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--muted); text-decoration: none; font-size: var(--fs-secondary); font-weight: 650; }
.admin-local-nav a:hover { border-color: var(--primary); color: var(--primary); }
.admin-local-nav a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.admin-child-head { margin-top: 6px; }
.admin-child-head h3 { margin: 0 0 2px; font-size: var(--fs-section); }
.card-lite { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-soft, #f8fafc); padding: 12px; }
.card-lite h4 { margin-top: 0; }

/* Admin → Organization (branding + feature flags) */
.org-form { display: grid; gap: 10px; max-width: 520px; margin-bottom: 18px; }
.org-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.85rem; }
.org-form input { font: inherit; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; }
.org-form input[type="color"] { padding: 2px; height: 38px; }
.org-flags { display: grid; gap: 8px; max-width: 520px; margin-bottom: 14px; }
.flag-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.flag-row input { margin-top: 3px; }
.flag-meta { display: flex; flex-direction: column; }
.flag-meta small { color: var(--muted, #64748b); }

/* Product-quality pass: operations-console hierarchy, modal containment, and dashboard focus mode. */
.page-eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-family: var(--font-data);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.page-title-row h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2vw, 2.1rem);
  line-height: 1.1;
}

.page-title-row .subtle {
  max-width: 62ch;
  margin-top: 7px;
  text-wrap: pretty;
}

.app-panel {
  height: 100dvh;
  visibility: hidden;
  pointer-events: none;
  overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom);
  transition: transform 180ms ease, visibility 0s linear 180ms;
}

.app-panel.open {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.app-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  visibility: hidden;
  border: 0;
  background: rgba(6, 12, 22, 0.46);
  opacity: 0;
  cursor: default;
  transition: opacity 180ms ease, visibility 0s linear 180ms;
}

.app-panel-backdrop.open {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}

.app-panel-body,
.cmdk-dialog,
.cmdk-results,
.side-nav {
  overscroll-behavior: contain;
}

body.modal-open {
  overflow: hidden;
}

body.nav-open {
  overflow: hidden;
}

main:focus-visible {
  outline: 3px solid #4f8bd6;
  outline-offset: 4px;
}

.app-panel-head {
  padding-top: max(16px, env(safe-area-inset-top));
}

.cmdk-overlay {
  padding-right: max(18px, env(safe-area-inset-right));
  padding-left: max(18px, env(safe-area-inset-left));
}

.cmdk-item {
  text-decoration: none;
}

.dashboard-view-actions,
.dashboard-customizer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
}

.operations-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: var(--control-height);
  color: var(--muted-strong);
  font-family: var(--font-data);
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.operations-live > span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.dashboard-customizer {
  display: grid;
  grid-template-columns: minmax(150px, 0.35fr) minmax(420px, 1fr);
  gap: var(--sp-4) var(--sp-6);
  margin: 0 0 var(--sp-5);
  padding: var(--sp-4);
  border: 1px solid #b8c8d8;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: #f4f7fa;
}

.dashboard-customizer h3 {
  margin: 0;
  padding: 0;
  border: 0;
}

.dashboard-toolbar {
  margin: 0;
}

.dashboard-customizer-actions {
  grid-column: 1 / -1;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

.dashboard-customizer-actions #dashboard-save-state {
  margin-right: auto;
}

.dashboard-error,
.dashboard-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 112px;
  padding: var(--sp-4) var(--sp-5);
  border: 1px dashed var(--border-strong);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
}

.dashboard-error {
  border-left-color: var(--danger);
}

.dashboard-error p,
.dashboard-empty p {
  margin-top: 3px;
  color: var(--muted);
}

.dashboard-widget {
  position: relative;
  overflow: hidden;
  border-top: 3px solid var(--primary);
  box-shadow: var(--shadow-soft);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.dashboard-widget::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 54px;
  height: 3px;
  background: var(--accent);
}

.dashboard-widget:hover {
  border-color: var(--border-strong);
  border-top-color: var(--primary);
  box-shadow: 0 12px 30px rgba(15, 39, 66, 0.11);
}

.dashboard-customizing .dashboard-widget {
  cursor: grab;
}

.dashboard-widget.is-dragging {
  cursor: grabbing;
  user-select: none;
  opacity: 0.64;
  transform: scale(0.99);
}

.icon-button {
  display: inline-grid;
  width: 34px;
  min-width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--primary);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.icon-button.danger {
  color: var(--danger);
}

.widget-meta,
.widget-metric strong,
.summary-tile strong,
.clock-time,
td[data-number] {
  font-variant-numeric: tabular-nums;
}

.widget-meta {
  font-family: var(--font-data);
  font-size: 0.7rem;
  letter-spacing: 0.01em;
}

.widget-state.error {
  gap: var(--sp-2);
  padding: var(--sp-4);
  text-align: center;
}

.widget-skeleton {
  display: grid;
  align-content: center;
  justify-items: stretch;
  gap: 10px;
  padding: var(--sp-4);
}

.widget-skeleton span {
  width: 100%;
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, #e8edf3 25%, #f7f9fc 50%, #e8edf3 75%);
  background-size: 200% 100%;
  animation: dashboard-skeleton 1.25s ease-in-out infinite;
}

.widget-skeleton span:nth-child(2) { width: 72%; }
.widget-skeleton span:nth-child(3) { width: 46%; }

@keyframes dashboard-skeleton {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

body[data-page="dashboard"].with-sidebar #dashboard-card.card {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

@media (max-width: 760px) {
  .page-title-row,
  .dashboard-error,
  .dashboard-empty {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-view-actions,
  .dashboard-customizer-actions {
    justify-content: stretch;
  }

  .dashboard-view-actions .button,
  .dashboard-customizer-actions .button,
  .dashboard-empty .button,
  .dashboard-error .button {
    width: 100%;
  }

  .dashboard-customizer {
    grid-template-columns: 1fr;
  }

  .dashboard-customizer-actions {
    grid-column: 1;
  }

  body.with-sidebar .app-header h1 {
    gap: 8px;
    font-size: 1.18rem;
    white-space: nowrap;
  }

  body.with-sidebar .app-header h1::before {
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
  }

  .widget-head {
    align-items: flex-start;
    flex-direction: row;
  }

  .widget-item-list li div {
    align-items: flex-start;
    flex-direction: row;
  }

  .widget-item-list li strong {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  .widget-skeleton span {
    animation: none;
    background: #e8edf3;
  }
}

/* Config deletion UI */
.del-bar { margin: 8px 0 4px; }
.del-refs { list-style: none; padding: 0; margin: 6px 0 14px; display: grid; gap: 4px; }
.del-refs li { display: flex; align-items: center; gap: 8px; }
.del-kind { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; }
.del-kind.hard { background: #fee2e2; color: #b91c1c; }
.del-kind.assoc { background: #e0e7ff; color: #3730a3; }
.del-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.del-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.del-list li span:first-child { display: flex; flex-direction: column; }
.del-list small { color: var(--muted, #64748b); }
.del-actions { display: flex; gap: 6px; }

/* Administration → Security */
.security-section {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}
.security-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.security-section-head h3 {
  margin: 0;
  padding: 0;
  border: 0;
}
.security-runtime {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.security-secret {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--warning);
  border-radius: 8px;
  background: var(--warning-soft);
}
.security-secret textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
/* S3 backup administration uses the existing form and button palette. */
.backup-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-block: 1rem; }
.backup-fields label { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.backup-fields label:last-child:nth-child(odd) { grid-column: 1 / -1; }
.backup-fields input { width: 100%; box-sizing: border-box; }
.backup-check { display: flex; flex-direction: row; align-items: flex-start; gap: .5rem; margin-block: .75rem; }
.backup-check input { width: auto; flex-shrink: 0; margin-top: .25rem; }
#backup-form fieldset { min-width: 0; margin-block: 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); }
#backup-form legend { font-weight: 700; }
#backup-form input[name="hourUtc"] { width: 6rem; }
.backup-table-wrap { overflow-x: auto; }
.backup-history-table { width: 100%; border-collapse: collapse; text-align: left; }
.backup-history-table th, .backup-history-table td { padding: .75rem; vertical-align: top; border-bottom: 1px solid var(--border); }
.backup-history-table td { min-width: 100px; }
.backup-object-key { overflow-wrap: anywhere; max-width: 34rem; }
.backup-recovery { margin-top: 1.5rem; }
.backup-recovery code { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .backup-fields { grid-template-columns: minmax(0, 1fr); }
}

/* Authoring tools use the available width; optional panels never reserve empty columns. */
.sm-workspace { grid-template-columns: minmax(0, 1fr); }
.sm-workspace:has(.sm-left:not(.hidden)) { grid-template-columns: minmax(200px, 240px) minmax(0, 1fr); }
.sm-workspace:has(.sm-right:not(.hidden)) { grid-template-columns: minmax(0, 1fr) minmax(260px, 310px); }
.sm-workspace:has(.sm-left:not(.hidden)):has(.sm-right:not(.hidden)) { grid-template-columns: minmax(190px, 220px) minmax(0, 1fr) minmax(250px, 290px); }
.sm-right { grid-column: auto; }
.sm-builder-body { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.sm-builder-card .form-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.sm-builder input, .sm-builder select, .sm-builder textarea, .security-section input, .security-section select { min-width: 0; max-width: 100%; width: 100%; box-sizing: border-box; }
.sm-builder input[type=checkbox], .sm-builder input[type=radio] { width: auto; }
.sm-builder label, .security-section label, .form-grid > * { min-width: 0; }
.sm-template-actions, .sm-date-range, .sm-builder-filters { min-width: 0; }
.sm-filterbar .inline-field { min-width: 0; max-width: 100%; }
.sm-filterbar select { max-width: 100%; }
.queue-item [role=alert], [data-queue-feedback] { padding: 0.75rem; overflow-wrap: anywhere; }
@media (max-width: 820px) {
  .sm-workspace, .sm-workspace:has(.sm-left:not(.hidden)), .sm-workspace:has(.sm-right:not(.hidden)), .sm-workspace:has(.sm-left:not(.hidden)):has(.sm-right:not(.hidden)) { grid-template-columns: minmax(0, 1fr); }
  .sm-right { grid-row: 1; }
  .sm-filterbar, .sm-toolbar, .sm-head-actions, .security-section, .security-runtime { min-width: 0; max-width: 100%; }
  .sm-filterbar .inline-field { flex: 1 1 130px; }
  .sm-builder-card .form-grid, .security-section .form-grid, .sm-date-range { grid-template-columns: minmax(0, 1fr); }
  .sm-head-actions .button, .req-tab-btn { min-height: 44px; }
  .sm-list-shift { min-width: 0; overflow-wrap: anywhere; }
  .security-runtime { flex-wrap: wrap; overflow-wrap: anywhere; }
  .security-section .kv { grid-template-columns: minmax(0, 1fr); }
}
/* The shared account menu already provides identity, settings, and sign-out. */
body[data-page="clock"] #session-card { display: none; }
.backup-fields dl { margin: 0; }
.backup-fields dt { margin-top: 0.75rem; font-weight: 600; }
.backup-fields dd { margin: 0.25rem 0 0; overflow-wrap: anywhere; }
#sm-views { max-width: 100%; flex-wrap: wrap; }
.sm-filterbar .inline-field { display: flex; flex-direction: column; align-items: stretch; white-space: normal; }
.sm-filterbar .inline-field select { width: 100%; min-width: 0; }
.sm-builder-card .form-grid { align-items: start; }
.sm-builder .sm-employee-row { grid-template-columns: var(--checkbox-size) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
.sm-builder .sm-employee-row span, .sm-builder .sm-employee-row strong, .sm-builder .sm-employee-row small { white-space: normal; overflow-wrap: anywhere; overflow: visible; }
.sm-builder .sm-employee-row small { display: block; margin-top: 0.25rem; }
@media (max-width: 1600px) and (min-width: 821px) {
  .sm-builder-body { grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.4fr); }
  .sm-builder-body > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .sm-builder .sm-employee-row { grid-template-columns: var(--checkbox-size) minmax(0, 1fr); }
  .sm-builder .sm-employee-row > span { grid-column: 2; }
  .sm-builder .sm-employee-row-head { display: none; }
}
