﻿* {
  box-sizing: border-box;
}
:root {
  --ink: #1c2633;
  --muted: #788394;
  --line: #e7ebf0;
  --teal: #0d918b;
  --teal-dark: #08716d;
  --soft: #f6f8fa;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: #f8fafb;
  color: var(--ink);
  font-family: "Estedad", Tahoma, sans-serif;
  font-size: 12px;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.server-status {
  font-size: 9px;
  color: #347d68;
  border: 1px solid #90ccb9;
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}
.server-status[data-status="saving"] {
  color: #916d22;
  border-color: #d9bd7b;
}
.server-status[data-status="error"] {
  color: #b24444;
  border-color: #dfa0a0;
}
html[data-theme="dark"] .server-status {
  background: #ffffff0a;
}
button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}
input,
select {
  border: 1px solid #dce3e9;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px;
  min-width: 0;
}
input:focus,
select:focus {
  outline: 2px solid #0d918b40;
  border-color: var(--teal);
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: 25px;
}
h2 {
  font-size: 14px;
}
p,
.muted {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.9;
}
.primary-button,
.secondary-button {
  padding: 10px 14px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
}
.primary-button {
  background: var(--teal);
  color: #fff;
}
.primary-button:hover {
  background: var(--teal-dark);
}
.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: #586878;
}
.secondary-button:hover {
  background: #eff8f6;
}
.auth-screen {
  position: fixed;
  inset: 0;
  background: #eef8f6;
  display: grid;
  place-items: center;
  z-index: 100;
}
.auth-card {
  width: min(390px, calc(100% - 32px));
  padding: 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 50px #236f6818;
}
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--teal);
  border-radius: 10px;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}
.auth-card > .brand-mark {
  margin: 0 auto 20px;
}
.auth-card h1,
.auth-card > p {
  text-align: center;
}
.auth-card > p {
  margin: 8px 0 20px;
}
.auth-card label {
  display: block;
  margin: 14px 0;
  font-size: 11px;
  color: #607080;
}
.auth-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
}
.auth-submit {
  width: 100%;
  margin: 10px 0;
}
.auth-card > small {
  display: block;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.9;
}
.form-message {
  color: #ba4c42;
  font-size: 11px;
  min-height: 0;
}
.form-message:empty {
  display: none;
}
.app-shell {
  min-height: 100vh;
  padding-right: 64px;
}
.sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  width: 64px;
  background: white;
  border-left: 1px solid var(--line);
  padding: 14px 10px;
  z-index: 30;
  transition: width 0.16s ease;
  overflow: hidden;
}
.sidebar.is-open {
  width: 246px;
  box-shadow: -8px 0 24px #243c4610;
}
.menu-toggle {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #e8f7f5;
  color: var(--teal);
  border-radius: 8px;
  font-size: 24px;
}
.sidebar-content {
  width: 224px;
  padding-top: 24px;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 5px 24px;
}
.brand-row strong {
  font-size: 22px;
}
.brand-row span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.hospital-switcher {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.hospital-switcher b {
  font-size: 11px;
}
.hospital-switcher small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-top: 4px;
}
.hospital-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #45c69b;
  box-shadow: 0 0 0 4px #e3f7ef;
}
.main-nav {
  display: grid;
  gap: 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  text-align: right;
  background: transparent;
  color: #738090;
  border-radius: 8px;
}
.nav-item > span {
  font-size: 20px;
}
.nav-item.active {
  background: #e8f7f5;
  color: var(--teal);
  font-weight: 700;
}
.main-content {
  padding: 0 32px 32px;
  min-width: 0;
}
.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.topbar > strong {
  font-size: 12px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.date-chip {
  font-size: 10px;
  color: var(--muted);
}
.logged-user {
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar {
  background: #f4ded6;
  color: #ad5c47;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 700;
}
.logged-user b {
  font-size: 11px;
}
.logged-user small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-top: 3px;
}
.logout-button {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #687485;
  font-size: 11px;
  white-space: nowrap;
}
.logout-button:hover {
  color: #c45f50;
  border-color: #eac3bc;
}
.view {
  display: none;
  padding-top: 26px;
}
.view.active-view {
  display: block;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}
.page-heading p {
  margin-top: 6px;
}
.heading-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  padding: 15px 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.stat-card > span {
  font-size: 10px;
  color: var(--muted);
}
.stat-card strong {
  display: block;
  font-size: 26px;
  margin: 6px 0;
}
.stat-card small {
  font-size: 9px;
  color: var(--muted);
}
.calendar-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 12px;
}
.calendar-controls label {
  display: flex;
  gap: 6px;
  align-items: center;
  color: #647484;
  font-size: 10px;
}
.calendar-controls select {
  font-size: 11px;
  padding: 7px 9px;
}
.calendar-controls .week-select {
  min-width: 160px;
}
.calendar-controls .week-arrow {
  width: 30px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--teal);
  font-size: 20px;
}
.calendar-range {
  margin-right: auto;
  color: var(--muted);
  font-size: 10px;
}
.schedule-card,
.settings-card,
.leave-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.schedule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.schedule-head p {
  margin-top: 5px;
}
.segmented {
  display: flex;
  gap: 4px;
  background: #f3f6f8;
  border-radius: 7px;
  padding: 4px;
  flex-shrink: 0;
}
.segmented button {
  border-radius: 5px;
  background: transparent;
  color: #758494;
  padding: 8px 10px;
  font-size: 10px;
}
.segmented button.active {
  background: #fff;
  box-shadow: 0 1px 5px #0000000d;
  color: var(--teal);
  font-weight: 700;
}
.legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  padding: 11px 18px;
  font-size: 10px;
  color: #778697;
}
.legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
}
.legend-dot.leave {
  background: #e68f86;
}
.legend-dot.proposal {
  border: 1px dashed var(--teal);
  background: #ecf9f6;
}
.table-wrap {
  overflow-x: auto;
}
.schedule-table,
.nurse-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.schedule-table th,
.schedule-table td,
.nurse-table th,
.nurse-table td {
  border-left: 1px solid #e7ecf0;
  border-bottom: 1px solid #edf0f3;
  text-align: center;
  font-size: 10px;
  padding: 3px 5px;
  height: 39px;
}
.schedule-table thead th,
.nurse-table thead th {
  height: 48px;
  background: #fafcfd;
  font-weight: 500;
}
.schedule-table th:first-child,
.nurse-table th:first-child {
  width: 160px;
  text-align: right;
  padding-right: 12px;
}
.schedule-table tbody th,
.nurse-table tbody th {
  background: white;
  font-weight: 600;
  position: sticky;
  right: 0;
  z-index: 1;
  border-left: 1px solid #e7ecf0;
}
.day-name {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 3px;
}
.day-number {
  font-size: 11px;
}
.day-number.today {
  background: #dff5f1;
  color: var(--teal);
  padding: 3px 6px;
  border-radius: 4px;
}
.nurse-name {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.nurse-avatar {
  width: 23px;
  height: 23px;
  background: #e8f7f5;
  color: var(--teal);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 9px;
  flex-shrink: 0;
}
.cell-stack {
  display: grid;
  grid-template-columns: repeat(var(--shift-count), 32px);
  gap: 3px;
  justify-content: center;
}
.subcell {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 1px;
  border: 1px solid #dfe5e9;
  border-top: 3px solid var(--shift-color);
  border-radius: 4px;
  background: #f7f9fb;
  color: #7b8792;
  font-size: 8px;
  overflow: hidden;
  line-height: 1.2;
}
.subcell:hover {
  outline: 2px solid var(--shift-color);
  outline-offset: -2px;
}
.subcell.selected {
  background: var(--shift-color);
  color: var(--shift-ink);
  border-color: var(--shift-color);
  font-weight: 700;
}
.subcell.proposed {
  border: 2px dashed var(--shift-color);
  background: var(--shift-tint);
  color: #344853;
}
.subcell.selected.proposed {
  background: var(--shift-color);
  color: var(--shift-ink);
  outline: 1px dashed #354654;
  outline-offset: -3px;
}
.subcell.leave-request {
  background: #fff0ed;
  border: 1px dashed #d98075;
  color: #aa5146;
  font-size: 7px;
}
.lead-star {
  position: absolute;
  top: 0;
  right: 1px;
  font-size: 9px;
  line-height: 1;
}
.subcell.is-lead {
  box-shadow: inset 0 0 0 1px #344853;
}
.subcell.is-lead .shift-label {
  display: block;
  padding-top: 5px;
}
.schedule-table tfoot th,
.schedule-table tfoot td {
  background: #fafcfd;
  height: 34px;
}
.coverage {
  display: grid;
  place-items: center;
  font-size: 9px;
  min-height: 24px;
  color: #208866;
  border-radius: 4px;
  background: #edf8f3;
}
.coverage.shortage {
  color: #b56826;
  background: #fff3e7;
}
.table-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  font-size: 9px;
  color: var(--muted);
  flex-wrap: wrap;
}
.status-pill {
  display: inline-block;
  border-radius: 6px;
  background: #e9f8f2;
  color: #239875;
  padding: 8px 12px;
  font-size: 10px;
  white-space: nowrap;
}
.status-pill.closed {
  background: #fff0ed;
  color: #bc6055;
}
.leave-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}
.leave-panel p {
  margin-top: 6px;
}
.settings-card {
  padding: 20px;
  margin-bottom: 18px;
}
.settings-card-head {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 14px;
}
.settings-card-head p {
  margin-top: 5px;
}
.count-badge {
  align-self: flex-start;
  background: #e8f7f5;
  color: var(--teal);
  font-size: 10px;
  padding: 6px 9px;
  border-radius: 5px;
  white-space: nowrap;
}
.start-card form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: 14px 0 8px;
}
.start-card label {
  display: grid;
  gap: 6px;
  color: #667687;
  font-size: 10px;
}
.start-card input {
  width: 180px;
}
.shift-row {
  display: grid;
  grid-template-columns:
    minmax(120px, 1.2fr) minmax(170px, 1.4fr) minmax(100px, 0.7fr)
    70px auto;
  gap: 12px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding: 16px 0;
}
.shift-row label {
  display: grid;
  gap: 6px;
  color: #667687;
  font-size: 10px;
}
.shift-row input {
  width: 100%;
  height: 36px;
}
.shift-row input[type="color"] {
  padding: 3px;
  cursor: pointer;
}
.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  height: 36px;
}
.row-actions button {
  height: 36px;
  padding: 8px 10px;
}
.delete-shift {
  color: #b85d52;
  background: #fff2ef;
  border-radius: 6px;
}
.shift-error {
  grid-column: 1/-1;
}
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translate(-50%, 75px);
  opacity: 0;
  background: #26343c;
  color: white;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.8;
  max-width: calc(100% - 32px);
  transition: 0.2s;
  z-index: 110;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (max-width: 1000px) {
  .main-content {
    padding: 0 20px 24px;
  }
  .page-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .date-chip {
    display: none;
  }
  .shift-row {
    grid-template-columns: 1fr 1.3fr 100px 60px;
  }
  .row-actions {
    grid-column: 1/-1;
  }
  .schedule-head {
    flex-wrap: wrap;
  }
  .calendar-range {
    width: 100%;
    margin: 0;
  }
}
@media (max-width: 650px) {
  .app-shell {
    padding-right: 52px;
  }
  .sidebar {
    width: 52px;
    padding: 12px 6px;
  }
  .menu-toggle {
    width: 38px;
    height: 38px;
  }
  .sidebar.is-open {
    width: 242px;
  }
  .main-content {
    padding: 0 12px 22px;
  }
  .topbar {
    min-height: 76px;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 0;
  }
  .topbar > strong {
    font-size: 10px;
  }
  .top-actions {
    gap: 8px;
    margin-right: auto;
  }
  .avatar {
    display: none;
  }
  .logged-user b {
    font-size: 10px;
  }
  .logged-user small {
    font-size: 8px;
  }
  .logout-button {
    padding: 7px;
    font-size: 10px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .stat-card {
    padding: 12px;
  }
  .stat-card strong {
    font-size: 23px;
  }
  .stat-card > span {
    font-size: 9px;
  }
  h1 {
    font-size: 21px;
  }
  .heading-actions {
    gap: 5px;
  }
  .heading-actions button {
    padding: 9px;
    font-size: 10px;
  }
  .calendar-controls {
    gap: 7px;
  }
  .calendar-controls label {
    gap: 4px;
  }
  .calendar-controls select {
    max-width: 170px;
  }
  .calendar-controls .week-select {
    min-width: 140px;
  }
  .schedule-head,
  .leave-panel {
    padding: 12px;
    flex-wrap: wrap;
  }
  .segmented {
    flex-wrap: wrap;
  }
  .legend {
    padding: 10px 12px;
    gap: 10px;
  }
  .settings-card {
    padding: 14px;
  }
  .shift-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .row-actions {
    grid-column: auto;
  }
  .start-card form {
    flex-wrap: wrap;
  }
  .table-footer {
    padding: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
* {
    transition: none !important;
  }
}

.app-shell {
  transition: padding-right 0.16s ease;
}
.app-shell.menu-pinned {
  padding-right: 246px;
}
.sidebar {
  overflow-y: auto;
}
.sidebar-content {
  padding-bottom: 20px;
}
.nav-count {
  margin-right: auto;
  font-size: 9px !important;
  background: #d6f0e9;
  border-radius: 10px;
  padding: 1px 6px;
}
.schedule-table th:first-child,
.nurse-table th:first-child {
  width: 230px;
}
.nurse-name {
  gap: 5px;
}
.name-text {
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.experience {
  font-size: 8px;
  color: #6b7d8d;
  margin-right: auto;
  white-space: nowrap;
}
.warning-badge {
  color: #b57314;
  background: #fff1cc;
  border-radius: 4px;
  padding: 2px;
  cursor: help;
  font-size: 13px;
}
.day-number small {
  font-size: 8px;
  color: var(--muted);
}
.minimum-hint {
  display: block;
  font-size: 8px;
  line-height: 1.6;
  margin-top: 5px;
  color: var(--muted);
  font-weight: 400;
}
.minimum-cell {
  display: grid;
  gap: 4px;
}
.daily-minimum {
  width: 32px;
  height: 27px;
  padding: 3px 1px;
  text-align: center;
  font-size: 10px;
  appearance: textfield;
  -moz-appearance: textfield;
}
.daily-minimum::-webkit-inner-spin-button,
.daily-minimum::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.daily-minimum.overridden {
  border-color: var(--teal);
  background: #eaf8f4;
}
.schedule-table tfoot td {
  padding: 7px 5px;
}

.calendar-controls {
  align-items: flex-end;
}
.calendar-controls label {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.calendar-controls .week-arrow {
  height: 34px;
}
.sidebar-user {
  display: grid;
  gap: 5px;
  font-size: 11px;
}
.sidebar-user small {
  color: var(--muted);
}
.sidebar-content {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 70px);
}
.sidebar-logout {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-identity {
  display: grid;
  gap: 5px;
  font-size: 11px;
}
.sidebar-identity small {
  color: var(--muted);
}
.sidebar-logout button {
  flex-shrink: 0;
}
.nav-parent {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px 7px;
  font-weight: 700;
  color: var(--ink);
}
.nav-child {
  padding-right: 42px !important;
  font-size: 12px;
}
.nurse-schedule-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.schedule-head {
  flex-wrap: wrap;
  gap: 16px;
}
.admin-table-actions {
  margin-bottom: 16px;
}
.danger-button {
  color: #b94845;
  border-color: #e9c7c4;
}
.hours-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 12px;
  color: #42667a;
}
.inactive-nurse .nurse-name {
  color: var(--muted);
}
.inactive-nurse {
  background: #fafafa;
}
.profile-form > label.checkbox-line {
  display: flex;
  align-items: center;
}
.profile-form .checkbox-line input {
  width: 16px;
  height: 16px;
}
.swap-inbox {
  margin-top: 28px;
}
.swap-inbox > h2 {
  margin-bottom: 14px;
}
.modal-open {
  overflow: hidden;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #10283970;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 530px;
  max-height: 90dvh;
  overflow: auto;
  box-shadow: 0 20px 80px #10283930;
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: #f0f5f6;
  color: var(--ink);
  font-size: 24px;
}
.modal-card p {
  line-height: 1.9;
}
.modal-card #swap-target-label {
  margin-bottom: 18px;
}
.modal-card #shift-details {
  padding: 12px;
  background: #f4f8f9;
  border-radius: 8px;
}
.modal-card #swap-unavailable {
  margin-top: 12px;
}
.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  margin: 12px 0;
  cursor: pointer;
}
.checkbox-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}
.shift-row {
  grid-template-columns: minmax(100px, 1fr) minmax(150px, 1.2fr) 100px 60px 75px auto;
}
.shift-row select {
  height: 36px;
  padding: 5px;
}
.profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.profile-form > label,
.inline-form > label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  color: #657789;
}
.profile-form input,
.profile-form select {
  width: 100%;
}
.profile-form small {
  font-size: 9px;
  color: var(--muted);
}
.profile-form input[readonly] {
  background: #f4f6f8;
  color: #8895a0;
}
.full-width {
  grid-column: 1/-1;
}
.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.inline-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin: 15px 0;
}
.inline-form input {
  width: 220px;
}
.group-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.group-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eef8f5;
  border: 1px solid #d3eae3;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 11px;
}
.group-chip small {
  color: var(--muted);
}
.group-chip button {
  background: transparent;
  color: #a26459;
  font-size: 18px;
}
.group-picker {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
}
.group-picker legend {
  color: #687b8c;
  font-size: 11px;
}
.group-picker .checkbox-line {
  margin: 0;
}
.users-list {
  margin-top: 12px;
}
.user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.user-row:first-child {
  border-top: 0;
}
.user-row strong {
  font-size: 12px;
}
.user-row small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin: 4px 0;
}
.user-row > button {
  margin-right: auto;
}
.user-groups {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
textarea {
  font: inherit;
  resize: vertical;
  min-height: 80px;
  width: 100%;
  border: 1px solid #dce3e9;
  border-radius: 7px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
}
textarea:focus {
  outline: 2px solid #0d918b40;
  border-color: var(--teal);
}
.card-list {
  display: grid;
  gap: 14px;
}
.message-card,
.request-card,
.empty-state {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}
.message-card.unread {
  border-right: 4px solid var(--teal);
}
.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.card-heading small {
  font-size: 9px;
  color: var(--muted);
}
.message-body {
  white-space: pre-wrap;
  color: #405567;
  font-size: 12px;
  line-height: 2;
  margin: 12px 0;
  overflow-wrap: anywhere;
}
.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 35px;
}
.request-status {
  font-size: 10px;
  background: #f2f5f8;
  border-radius: 6px;
  padding: 6px 9px;
  color: #6c7c8c;
}
.request-status.completed {
  background: #e8f8ef;
  color: #27836a;
}
.request-status.pending-admin,
.request-status.pending-peer {
  background: #fff4df;
  color: #996920;
}
.request-status.invalid,
.request-status.rejected-peer,
.request-status.rejected-admin {
  background: #fff0ed;
  color: #ba685a;
}
.swap-slots {
  display: grid;
  gap: 6px;
  padding: 12px;
  background: #f8fafb;
  border-radius: 7px;
  margin: 12px 0;
}
.swap-slots p {
  color: #5b7081;
}
@media (max-width: 1100px) {
  .shift-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .shift-row .row-actions {
    grid-column: 1/-1;
  }
  .menu-pinned .page-heading,
  .menu-pinned .schedule-head {
    flex-wrap: wrap;
  }
  .menu-pinned .segmented {
    flex-wrap: wrap;
    flex-shrink: 1;
  }
}
@media (max-width: 650px) {
  .app-shell.menu-pinned {
    padding-right: 242px;
  }
  .menu-pinned .main-content {
    min-width: 280px;
  }
  .schedule-table tbody th,
  .nurse-table tbody th {
    position: static;
  }
  .profile-form {
    grid-template-columns: minmax(0, 1fr);
  }
  .user-row {
    flex-wrap: wrap;
  }
  .user-row > button {
    margin-right: 0;
  }
  .user-groups {
    width: 100%;
  }
  .group-picker {
    flex-direction: column;
  }
  .card-heading h2 {
    font-size: 12px;
  }
  .message-card,
  .request-card {
    padding: 14px;
  }
  .shift-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .profile-form select {
    font-size: 10px;
  }
  .calendar-controls .week-select {
    min-width: 190px;
    max-width: 230px;
  }
}

/* Calendar workspace, compact navigation, and responsive data tables. */
.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
.header-user {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}
.header-user .logged-user {
  min-width: 0;
}
.header-user b {
  overflow-wrap: anywhere;
}
.topbar #hospital-title {
  text-align: center;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.topbar #today-label {
  display: block;
  justify-self: end;
  white-space: nowrap;
}
.topbar .logout-button {
  flex-shrink: 0;
}
.main-content {
  min-width: 0;
}
.view {
  min-width: 0;
}
#admin-view > .schedule-card {
  margin-top: 20px;
}
.schedule-card > .calendar-controls {
  padding: 0 20px;
}
.schedule-tools {
  padding-top: 12px;
  padding-bottom: 12px;
}
.schedule-tools p {
  flex: 1;
  min-width: 180px;
}
.heading-actions {
  flex-wrap: wrap;
}
.main-nav {
  gap: 3px;
}
.main-nav .nav-item,
.main-nav .nav-parent {
  min-height: 38px;
  height: auto;
  margin: 0;
  padding: 9px 14px;
}
.nav-parent {
  font: inherit;
  width: 100%;
  background: transparent;
  text-align: right;
  cursor: pointer;
  border-radius: 8px;
  font-size: 12px;
}
.nav-parent > span {
  margin-right: auto;
}
.nav-parent[aria-expanded="true"] > span {
  transform: rotate(180deg);
}
.nav-child {
  padding-right: 34px !important;
}
.brand-row {
  padding-bottom: 12px;
}
.data-table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 760px;
}
.data-table th {
  background: #f5f9fa;
  color: #597181;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}
.data-table th,
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.data-table tr.user-row {
  display: table-row;
}
.data-table td small {
  display: block;
}
.data-table td[dir="ltr"] {
  max-width: 150px;
  overflow-wrap: anywhere;
}
.requests-table {
  min-width: 960px;
}
.requests-table td {
  min-width: 120px;
  line-height: 1.8;
}
.request-status {
  display: inline-block;
}
.requests-table .form-actions {
  margin-bottom: 0;
}
.experience-cell {
  text-align: center;
  color: #627989;
  font-weight: 600;
  background: #fafcfd;
}
.profile-form > * {
  min-width: 0;
}
.profile-form input,
.profile-form select {
  min-width: 0;
}
.settings-card {
  min-width: 0;
}
.inline-form label {
  max-width: 100%;
}
.inline-form input {
  max-width: 100%;
}
#swap-selection {
  margin: 12px 20px;
  padding: 12px;
  background: #fff5dd;
  border: 1px solid #efdbac;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  line-height: 1.8;
}
#swap-selection button {
  flex-shrink: 0;
}
.swap-picked {
  outline: 2px solid #d49b24;
}
.urgent-badge {
  display: inline-block;
  background: #fff0ee;
  color: #b3332d;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
}
#urgent-dialog {
  padding: 0;
  border: 0;
  border-radius: 14px;
  max-width: min(530px, calc(100vw - 24px));
  max-height: 90dvh;
  width: 530px;
}
#urgent-dialog::backdrop {
  background: #102839a0;
}
#urgent-dialog .modal-card {
  max-height: 90dvh;
}
#urgent-dialog h2 {
  margin-top: 12px;
  overflow-wrap: anywhere;
}
.message-card,
.request-card {
  min-width: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 900px) {
  .topbar {
    gap: 8px;
  }
  .header-user {
    gap: 6px;
  }
  .header-user .avatar {
    display: none;
  }
  .topbar #hospital-title {
    font-size: 12px;
  }
  .topbar #today-label {
    font-size: 10px;
  }
  .schedule-head {
    align-items: flex-start;
  }
  .shift-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .shift-row > * {
    min-width: 0;
  }
  .shift-row input {
    width: 100%;
  }
  .heading-actions button {
    white-space: normal;
  }
}
@media (max-width: 650px) {
  .app-shell.menu-pinned {
    padding-right: 52px;
  }
  .menu-pinned .main-content {
    min-width: 0;
  }
  .topbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    row-gap: 10px;
  }
  .topbar .header-user {
    grid-column: 1/-1;
    justify-content: flex-start;
  }
  .topbar #hospital-title {
    text-align: right;
  }
  .topbar #today-label {
    display: block;
    justify-self: end;
  }
  .header-user .logged-user b {
    font-size: 12px;
  }
  .sidebar-content {
    width: 224px;
  }
  .schedule-head {
    padding: 12px;
  }
  .schedule-card > .calendar-controls {
    padding: 0 12px;
  }
  .calendar-controls {
    gap: 8px;
  }
  .calendar-controls .week-select {
    min-width: 150px;
    max-width: 190px;
  }
  .nurse-schedule-actions {
    width: 100%;
  }
  .data-table th,
  .data-table td {
    padding: 10px;
  }
  .page-heading {
    flex-wrap: wrap;
    gap: 12px;
  }
  .page-heading > div {
    min-width: 0;
  }
  .profile-form {
    gap: 12px;
  }
  .inline-form {
    align-items: stretch;
  }
  .inline-form > label {
    flex: 1 1 180px;
  }
  .inline-form input {
    width: 100%;
  }
  .form-actions button {
    max-width: 100%;
  }
  .modal-card {
    padding: 18px;
  }
  .modal-backdrop {
    padding: 12px;
  }
  .settings-card-head {
    flex-wrap: wrap;
    gap: 12px;
  }
  #swap-selection {
    margin: 12px;
    flex-wrap: wrap;
  }
  .main-content .topbar {
    min-height: 104px;
  }
  .logged-user small {
    display: none;
  }
}
#requests-nav-label {
  font-size: 12px;
}
.main-nav .nav-parent {
  font-size: 12px;
}
.data-table-wrap,
.table-wrap {
  overscroll-behavior-x: contain;
}

/* Compact controls and the single-row schedule toolbar. */
.topbar .header-user {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}
.topbar #hospital-title {
  grid-column: 2;
  grid-row: 1;
}
.topbar #today-label {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}
#theme-toggle {
  padding: 6px;
  width: 30px;
  height: 30px;
  font-size: 17px;
  flex-shrink: 0;
}
.admin-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
.admin-toolbar > * {
  flex-shrink: 0;
}
.admin-toolbar .calendar-controls {
  margin: 0;
  padding: 0;
  flex-wrap: nowrap;
  gap: 6px;
}
.admin-toolbar .heading-actions {
  flex-wrap: nowrap;
  gap: 5px;
}
.admin-toolbar button {
  font-size: 10px;
  padding: 8px;
}
.admin-toolbar .week-arrow {
  width: 25px;
  padding: 0;
}
.admin-toolbar .segmented {
  gap: 2px;
}
.admin-toolbar .segmented button {
  padding: 8px 6px;
}
.calendar-controls .week-select {
  min-width: 0 !important;
  max-width: 280px;
}
.calendar-controls select {
  min-width: 0 !important;
}
.profile-form,
.inline-form,
.shift-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.profile-form > label,
.inline-form > label,
.shift-row > label {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  max-width: 100%;
  margin: 0;
}
.profile-form > .full-width {
  flex-basis: auto;
}
.profile-form > label.checkbox-line {
  flex-direction: row;
  align-items: center;
}
.profile-form .group-picker {
  flex-basis: 100%;
}
.profile-form > .form-message {
  flex-basis: 100%;
}
.profile-form textarea {
  width: 280px;
  max-width: 100%;
}
.profile-form input,
.profile-form select,
.inline-form input,
.shift-row input,
.shift-row select {
  max-width: 100%;
  min-width: 0;
}
.profile-form .checkbox-line input {
  width: 16px !important;
}
.row-actions {
  display: flex;
  gap: 6px;
}
.shift-row {
  padding: 12px 0;
}
.settings-card {
  width: fit-content;
  max-width: 100%;
  padding: 16px;
}
.settings-card > p {
  max-width: 54ch;
  margin-top: 10px;
}
.settings-card .settings-card-head p {
  max-width: 62ch;
}
.settings-card form {
  margin-top: 12px;
}
.settings-card #users-list {
  max-width: 100%;
}
#users-view > .settings-card:has(#users-list) {
  width: 100%;
}
.settings-card:has(#shift-list) {
  width: fit-content;
}
.shift-row input[type="color"] {
  width: 38px;
  height: 32px;
}
.start-card form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}
.start-card form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.context-menu {
  position: fixed;
  z-index: 1100;
  min-width: 160px;
  background: white;
  border: 1px solid var(--line);
  padding: 5px;
  border-radius: 8px;
  box-shadow: 0 8px 28px #10283930;
}
.context-menu button {
  display: block;
  width: 100%;
  padding: 10px;
  text-align: right;
  background: transparent;
  color: var(--ink);
  border-radius: 5px;
}
.context-menu button:hover,
.context-menu button:focus {
  background: #e8f7f5;
}
.leave-approved {
  border-style: solid !important;
  background: #d98075 !important;
  color: #fff !important;
  box-shadow: none !important;
}
@media (max-width: 650px) {
  .topbar {
    grid-template-columns: minmax(100px, 1fr) minmax(0, 1.7fr);
  }
  .topbar .header-user {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .topbar #today-label {
    grid-column: 1;
    grid-row: 1;
    white-space: normal;
    font-size: 9px;
  }
  .topbar #hospital-title {
    grid-column: 1/-1;
    grid-row: 2;
    text-align: center;
  }
  .topbar .logged-user b {
    font-size: 10px;
  }
  .header-user .logout-button {
    padding: 5px;
    font-size: 9px;
  }
  .admin-toolbar {
    flex-wrap: wrap;
    overflow: visible;
    align-items: flex-end;
  }
  .admin-toolbar > * {
    max-width: 100%;
    flex-shrink: 1;
  }
  .admin-toolbar .calendar-controls,
  .admin-toolbar .heading-actions,
  .admin-toolbar .segmented {
    flex-wrap: wrap;
  }
  .admin-toolbar .calendar-controls {
    width: 100%;
  }
  .settings-card {
    padding: 12px;
  }
  .profile-form,
  .inline-form,
  .shift-row {
    gap: 10px;
  }
  .profile-form .full-width {
    max-width: 100%;
  }
  .settings-card .inline-form > label {
    flex: none;
  }
  .profile-form textarea {
    max-width: 100%;
    width: 240px;
  }
  .modal-card .profile-form {
    display: flex;
  }
  .modal-card .profile-form > .full-width {
    flex-basis: 100%;
  }
  .auth-screen {
    overflow: auto;
    padding: 16px 0;
  }
}
/* Both themes preserve configured shift colors and distinct request states. */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e2e9f1;
  --muted: #a0afc2;
  --line: #334154;
  --teal: #219f98;
  --teal-dark: #167e78;
  --soft: #1b2635;
}
html[data-theme="dark"] body {
  background: #111923;
  color: var(--ink);
}
html[data-theme="dark"]
  :is(.sidebar, .schedule-card, .settings-card, .auth-card, .message-card, .request-card, .empty-state, .modal-card, .context-menu, .data-table-wrap) {
  background: #1b2635;
  border-color: var(--line);
  color: var(--ink);
}
html[data-theme="dark"]
  :is(input, select, textarea, .secondary-button, .logout-button, .modal-close) {
  background: #222f40;
  color: var(--ink);
  border-color: #46566b;
}
html[data-theme="dark"] :is(.schedule-table, .nurse-table) :is(th, td) {
  border-color: var(--line);
}
html[data-theme="dark"] :is(.schedule-table, .nurse-table) thead th,
html[data-theme="dark"] .data-table th {
  background: #243244;
  color: #c1cfdf;
}
html[data-theme="dark"] :is(.schedule-table, .nurse-table) tbody th {
  background: #1b2635;
  color: var(--ink);
}
html[data-theme="dark"]
  :is(.segmented, .swap-slots, .experience-cell, .inactive-nurse, .profile-form
    input[readonly]) {
  background: #202d3e;
  color: #b9c8d9;
}
html[data-theme="dark"]
  :is(.segmented
    button.active, .nav-item.active, .menu-toggle, .nurse-avatar, .group-chip, .context-menu
    button:hover, .context-menu button:focus) {
  background: #183f42;
  color: #9ae3d3;
}
html[data-theme="dark"]
  :is(.nav-item, .segmented button, .hours-cell, .experience-cell, .profile-form
    > label, .inline-form > label, .calendar-controls label, .data-table td) {
  color: #bdccdd;
}
html[data-theme="dark"] .subcell:not(.selected):not(.leave-request) {
  background: #263446;
  color: #bdccdd;
  border-color: #526478;
}
html[data-theme="dark"] .subcell.proposed:not(.selected) {
  background: #183f42;
  border-color: #59bbad;
  color: #a6eedb;
}
html[data-theme="dark"] .subcell.leave-request {
  background: #482b34;
  border-color: #df8c91;
  color: #ffd0d3;
}
html[data-theme="dark"] .subcell.selected {
  background: var(--shift-color);
  color: var(--shift-ink);
}
html[data-theme="dark"] :is(.coverage, .request-status, .count-badge) {
  background: #26384b;
  color: #c2d3e6;
}
html[data-theme="dark"]
  :is(.shortage, .urgent-badge, .request-status.invalid, .request-status.rejected-peer, .request-status.rejected-admin) {
  background: #492f35;
  color: #ffb4b7;
}
html[data-theme="dark"]
  :is(.request-status.pending-peer, .request-status.pending-admin, .warning-badge) {
  background: #493e25;
  color: #f3d793;
}
html[data-theme="dark"] .request-status.completed {
  background: #1b4438;
  color: #a8e9c8;
}
html[data-theme="dark"] :is(.message-body, .swap-slots p) {
  color: #c6d4e4;
}
html[data-theme="dark"] .auth-screen {
  background: #111923;
}
html[data-theme="dark"] #swap-selection {
  background: #403820;
  border-color: #79683d;
  color: #e9d89f;
}
html[data-theme="dark"] :is(.daily-minimum.overridden, .day-number.today) {
  background: #183f42;
  color: #9ae3d3;
}
html[data-theme="dark"] .danger-button,
html[data-theme="dark"] .form-message {
  color: #ffaaa9;
}
html[data-theme="dark"] .calendar-controls .week-arrow {
  background: #222f40;
  border-color: var(--line);
  color: #a3e5d6;
}
html[data-theme="dark"] .modal-card #shift-details {
  background: #263446;
}

/* Shared control rhythm and responsive settings cards. */
:root {
  --control-height: 34px;
}
button,
input:not([type="checkbox"]):not([type="radio"]),
select {
  height: var(--control-height);
  min-height: var(--control-height);
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
input[type="checkbox"],
input[type="radio"] {
  height: 16px;
  min-height: 16px;
}
textarea {
  height: auto;
}
.primary-button,
.secondary-button,
.logout-button {
  padding: 0 11px;
}
.header-user #theme-toggle,
.header-user .logout-button {
  height: var(--control-height);
  min-height: var(--control-height);
}
.header-user #theme-toggle {
  width: var(--control-height);
}
.calendar-controls .week-arrow {
  height: var(--control-height);
}
.shift-row input[type="color"] {
  height: var(--control-height);
}
.subcell {
  height: 32px;
  min-height: 32px;
}
.main-nav .nav-item,
.main-nav .nav-parent {
  height: 30px;
  min-height: 30px;
  padding: 5px 12px;
  justify-content: flex-start;
  line-height: 1.4;
}
.main-nav {
  gap: 2px;
}
.main-nav .nav-item > span {
  font-size: 12px;
}
.main-nav .nav-parent {
  font-weight: 600;
}
.nurse-schedule-actions {
  align-items: flex-end;
  gap: 8px;
}
.nurse-schedule-actions .calendar-controls {
  margin: 0;
  padding: 0;
  gap: 6px;
}
.nurse-schedule-actions .segmented {
  padding: 0;
  background: transparent;
}
.nurse-schedule-actions .segmented button {
  height: var(--control-height);
}
#settings-view.active-view {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
#settings-view > .page-heading {
  grid-column: 1/-1;
  margin: 0;
}
#settings-view > .settings-card {
  width: 100%;
  height: 100%;
  margin: 0;
  min-width: 0;
}
#settings-view > .settings-card:last-child {
  grid-column: 1/-1;
}
#settings-view .settings-card-head {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
#settings-view .settings-card-head > div {
  margin-left: auto;
}
.data-table td[dir="ltr"],
.data-table th:first-child,
.data-table th:nth-child(7) {
  text-align: center;
}
.data-table .user-row td:last-child {
  min-width: 270px;
}
.data-table .user-row td:last-child button {
  margin: 3px;
}
.data-table th:last-child,
.data-table td:last-child {
  text-align: center;
}
.user-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
.user-actions button { margin: 0 !important; }
.requests-table [data-swap-action="accept"],
.requests-table [data-swap-action="approve"] {
  background: #228761;
  color: white;
}
.requests-table [data-swap-action="reject"],
.requests-table [data-swap-action="admin-reject"] {
  background: #ba484b;
  color: white;
  border-color: #ba484b;
}
dialog {
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  max-width: calc(100vw - 24px);
  max-height: 90dvh;
}
dialog::backdrop {
  background: #10283990;
}
dialog .modal-card {
  width: min(530px, calc(100vw - 24px));
  max-height: 88dvh;
}
dialog h2 {
  margin-bottom: 12px;
}
dialog .form-actions {
  margin-top: 16px;
}
#confirm-body {
  white-space: pre-wrap;
}
#auto-shifts {
  max-width: 100%;
}
#auto-shifts .checkbox-line {
  display: flex;
  flex-direction: row;
  align-items: center;
}
#auto-form > .full-width {
  flex-basis: 100%;
}
#password-form > label {
  max-width: 100%;
}
#password-form input {
  width: 200px;
  max-width: 100%;
}
.auth-submit {
  display: flex;
  width: 100%;
}
@media (min-width: 1500px) {
  #settings-view.active-view {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  #settings-view > .settings-card:last-child {
    grid-column: span 2;
  }
}
@media (max-width: 700px) {
  #settings-view.active-view {
    grid-template-columns: minmax(0, 1fr);
  }
  #settings-view > .settings-card:last-child {
    grid-column: auto;
  }
  .nurse-schedule-actions {
    flex-wrap: wrap;
  }
  .nurse-schedule-actions .calendar-controls {
    width: 100%;
  }
  .menu-toggle {
    height: 38px;
    min-height: 38px;
  }
  .nurse-schedule-actions button {
    font-size: 10px;
  }
  .data-table .user-row td:last-child {
    min-width: 270px;
  }
}
html[data-theme="dark"] .shift-row label {
  color: #bdccdd;
}
html[data-theme="dark"] .delete-shift {
  background: #492f35;
  color: #ffb4b7;
}

/* Section-aware profiles, inbox tables and current-day navigation. */
label {
  text-align: center;
}
.profile-form > label,
.inline-form > label,
.shift-row > label,
.start-card form label {
  align-items: center;
}
.calendar-controls label {
  align-items: center;
  text-align: center;
}
.checkbox-line {
  justify-content: center;
}
.search-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin: 12px 0;
}
.search-field input {
  width: 250px;
  max-width: 100%;
}
.main-nav .nav-parent {
  font-weight: 400;
  justify-content: space-between;
}
.nav-parent:after {
  content: "";
  font-size: 19px;
  transform: rotate(-90deg);
  transition: transform 0.15s;
}
.nav-parent[aria-expanded="true"]:after {
  transform: rotate(90deg);
}
.schedule-table .current-day,
.nurse-table .current-day {
  background: #e5f6f0;
  box-shadow: inset 2px 0 #38a58e, inset -2px 0 #38a58e;
}
.schedule-table thead th:has(.today),
.nurse-table thead th:has(.today) {
  background: #c8ebe0;
  color: #135e4c;
}
.messages-table {
  min-width: 620px;
}
.messages-table tr[data-message-id] {
  cursor: pointer;
}
.messages-table tr.unread {
  background: #e6f5f1;
  font-weight: 600;
}
.messages-table .message-open {
  background: transparent;
  color: inherit;
  text-align: right;
  justify-content: flex-start;
  white-space: normal;
  height: auto;
  min-height: 34px;
}
.messages-table th:last-child {
  text-align: center;
}
.messages-table td:last-child {
  text-align: center;
}
.messages-table td {
  max-width: 380px;
  overflow-wrap: anywhere;
}
.messages-table td:nth-child(3) {
  white-space: nowrap;
}
#message-dialog .message-body {
  margin: 16px 0;
}
#password-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
}
#password-form .full-width {
  grid-column: 1/-1;
}
#password-form input {
  width: 100%;
  max-width: 100%;
}
#password-form > label {
  width: 100%;
  display: grid;
  text-align: center;
}
#password-form .form-actions {
  justify-content: center;
  margin-top: 6px;
}
#confirm-dialog .modal-card {
  padding: 24px;
}
#confirm-body {
  font-size: 13px;
  line-height: 2.2;
  margin: 10px 0 20px;
}
#confirm-dialog .form-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}
#confirm-dialog button {
  min-width: 100px;
}
#department-controls {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}
.schedule-head:has(#department-title) {
  align-items: center;
}
.data-table td[dir="ltr"] {
  max-width: 150px;
  word-break: break-word;
}
html[data-theme="dark"] .messages-table tr.unread {
  background: #1d4144;
  color: #c0f3e7;
}
html[data-theme="dark"] .schedule-table .current-day,
html[data-theme="dark"] .nurse-table .current-day {
  background: #173b38;
  box-shadow: inset 2px 0 #52bba4, inset -2px 0 #52bba4;
}
html[data-theme="dark"] .schedule-table thead th:has(.today),
html[data-theme="dark"] .nurse-table thead th:has(.today) {
  background: #205b50;
  color: #c5f7ea;
}
@media (max-width: 650px) {
  #password-form {
    grid-template-columns: minmax(0, 1fr);
  }
  #confirm-dialog .modal-card {
    padding: 18px;
  }
  #confirm-body {
    font-size: 12px;
  }
  .search-field {
    max-width: 100%;
  }
  .search-field input {
    max-width: 100%;
  }
  .messages-table {
    min-width: 580px;
  }
  .schedule-head:has(#department-title) {
    flex-wrap: wrap;
  }
  .profile-form > label {
    max-width: 100%;
  }
}

/* Aligned workspace actions, editable shift rows and inline validation. */
.admin-toolbar {
  align-items: flex-end;
}
.admin-toolbar .segmented {
  padding: 0;
  background: transparent;
  align-items: flex-end;
}
.admin-toolbar .segmented button,
.admin-toolbar .heading-actions button,
.admin-toolbar #department-select {
  height: var(--control-height);
  min-height: var(--control-height);
  margin: 0;
}
.admin-toolbar #department-controls {
  margin: 0;
}
.data-table th:last-child {
  text-align: center;
}
.users-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.users-toolbar .search-field {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin: 0;
}
.users-toolbar #users-search {
  width: 220px;
  max-width: 100%;
}
.settings-card :is(.profile-form, .inline-form, .start-card form) {
  gap: 6px;
  justify-content: flex-start;
  align-items: flex-end;
}
.settings-card
  .profile-form
  > .full-width:not(.group-picker):not(.form-message):not(.validation-summary) {
  flex-basis: auto;
}
.profile-form .form-actions {
  margin: 0;
  align-self: flex-end;
}
.profile-form .form-actions button {
  height: var(--control-height);
}
.profile-form .form-actions.full-width {
  align-items: center;
}
.settings-card:has(#swap-approval-required) label,
.settings-card:has(#swap-approval-required) p {
  text-align: right;
  justify-content: flex-start;
}
.shift-config-table {
  min-width: 590px;
}
.shift-config-table th,
.shift-config-table td {
  text-align: center;
}
.shift-config-table .shift-row {
  border: 0;
  margin: 0;
  padding: 8px;
  justify-content: flex-start;
}
.shift-color-sample {
  display: inline-block;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--line);
}
#shift-list .row-actions,
#shift-list .row-actions button {
  height: var(--control-height);
}
#shift-list input {
  height: var(--control-height);
}
#message-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(140px, 1.4fr) minmax(
      90px,
      0.7fr
    );
  gap: 10px;
  align-items: start;
}
#message-form > label {
  width: 100%;
}
#message-form input,
#message-form select {
  width: 100% !important;
  max-width: 100%;
}
#message-form > .full-width {
  grid-column: 1/-1;
}
#message-form textarea {
  width: 100%;
  min-height: 130px;
}
#message-compose-card {
  width: min(780px, 100%);
}
#password-form {
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  gap: 14px;
}
#password-form > label {
  width: 100%;
}
#password-form input {
  width: 100% !important;
  min-width: 0;
  height: 40px;
}
#password-dialog .modal-card {
  width: min(460px, calc(100vw - 24px));
}
.main-nav .nav-parent:after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin: 0 5px 4px;
}
.main-nav .nav-parent[aria-expanded="true"]:after {
  transform: rotate(225deg);
  margin-top: 6px;
}
.main-nav .nav-program > div,
.main-nav #management-links {
  position: relative;
  margin-right: 15px;
  border-right: 1px solid var(--line);
  padding-right: 10px;
}
.main-nav .nav-child {
  position: relative;
  padding-right: 12px !important;
}
.main-nav .nav-child:before {
  content: "";
  position: absolute;
  right: -11px;
  top: 50%;
  width: 18px;
  border-top: 1px solid var(--line);
}
.validation-summary {
  flex-basis: 100%;
  grid-column: 1/-1;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #eab9b9;
  border-radius: 7px;
  background: #fff2f1;
  text-align: right;
}
.validation-summary:empty {
  display: none;
}
.validation-summary p {
  color: #a93c3c;
  margin: 2px 0;
}
[aria-invalid="true"] {
  border-color: #bd4c4c !important;
  box-shadow: 0 0 0 2px #bd4c4c18;
}
html[data-theme="dark"] .schedule-table tfoot th,
html[data-theme="dark"] .schedule-table tfoot td {
  background: #202d3e;
  color: #c4d1e1;
  border-color: var(--line);
}
html[data-theme="dark"] .validation-summary {
  background: #402930;
  border-color: #82515b;
}
html[data-theme="dark"] .validation-summary p {
  color: #ffb8b8;
}
@media (max-width: 650px) {
  .users-toolbar {
    align-items: center;
  }
  .users-toolbar .search-field {
    max-width: 100%;
    flex-wrap: wrap;
  }
  .users-toolbar #users-search {
    width: 190px;
    max-width: 100%;
  }
  #message-form {
    grid-template-columns: minmax(0, 1fr);
  }
  #message-form > label {
    grid-column: 1/-1;
  }
  #message-form textarea {
    min-height: 120px;
  }
  .admin-toolbar #department-controls {
    max-width: 100%;
  }
  .admin-toolbar .segmented {
    gap: 4px;
  }
  #password-form input {
    max-width: 100%;
  }
  .settings-card .profile-form .full-width {
    max-width: 100%;
  }
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

/* Calendar names, classic summaries and shared modal layouts. */
.schedule-table th:first-child,
.nurse-table th:first-child {
  width: var(--name-column-width, 230px);
}
.nurse-name .name-text {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}
.classic-table tbody .cell-stack {
  display: none;
}
.classic-table tbody .classic-expanded .cell-stack {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 4px;
}
.classic-cell {
  width: 100%;
  height: auto;
  min-height: 32px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  padding: 4px;
}
.classic-proposal {
  border: 1px dashed currentColor;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 10px;
}
.subcell.leave-approved .shift-label {
  font-size: 8px;
  white-space: normal;
  line-height: 1.3;
}
.classic-rule {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
#classic-form {
  margin-top: 12px;
}
#classic-shifts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#message-links {
  position: relative;
  margin-right: 15px;
  border-right: 1px solid var(--line);
  padding-right: 10px;
}
#shift-dialog .modal-card {
  width: min(560px, calc(100vw - 24px));
}
#shift-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
#shift-editor label {
  width: 100%;
}
#shift-editor input,
#shift-editor select {
  width: 100% !important;
  min-width: 0;
}
#shift-editor .full-width {
  grid-column: 1/-1;
}
#date-dialog .modal-card {
  width: min(360px, calc(100vw - 24px));
  padding: 18px;
}
.picker-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 12px 0;
}
.picker-controls label {
  display: flex;
  flex-direction: column;
  text-align: center;
  gap: 4px;
}
#picker-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  text-align: center;
  margin-bottom: 14px;
}
#picker-days button {
  padding: 0;
  min-width: 0;
  width: 100%;
  height: 34px;
}
#picker-days .selected-date {
  background: var(--teal, #0e9390);
  color: white;
}
#request-note-dialog .modal-card {
  width: min(480px, calc(100vw - 24px));
}
@media (max-width: 480px) {
  #shift-editor {
    grid-template-columns: minmax(0, 1fr);
  }
  .classic-rule {
    flex-wrap: wrap;
  }
}

/* Connection indicator, compact classic cells and unobstructed navigation. */
.connection-status {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  width: fit-content;
  margin: 9px 16px 12px;
  padding: 0;
  border: 0;
  color: var(--muted);
  font-size: 10px;
}
.connection-status::before {
  content: "وضعیت اتصال:";
}
.connection-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cf3f48;
  box-shadow: 0 0 0 4px #cf3f4818;
}
.connection-status[data-status="online"] .connection-dot {
  background: #20a464;
  box-shadow: 0 0 0 4px #20a46420;
  animation: connection-pulse 1.45s ease-out infinite;
}
.connection-status[data-status="online"] [data-status-label] {
  color: #16804c;
}
.connection-status[data-status="offline"] [data-status-label] {
  color: #b52f3a;
}
@keyframes connection-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px #20a46422;
  }
  50% {
    box-shadow: 0 0 0 7px #20a46400;
  }
}
.topbar #today-label,
.topbar .logged-user b {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}
.day-number.today {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  line-height: 1.35;
  vertical-align: top;
}
.classic-input {
  min-width: 12px !important;
  height: 24px !important;
  min-height: 24px !important;
  padding: 0 1px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.classic-input:not([readonly]):focus {
  outline: 0;
  box-shadow: inset 0 -1px var(--teal) !important;
}
.classic-input.has-value {
  border-radius: 4px !important;
  background: color-mix(in srgb, var(--teal) 18%, transparent) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--teal) 45%, transparent) !important;
  padding-inline: 4px !important;
}
.classic-input.classic-leave,
.classic-input.classic-proposal {
  border: 0 !important;
  background: transparent !important;
}
.classic-input.classic-unavailable { color: #8b54a4 !important; }
.classic-table tfoot .coverage,
.classic-table tfoot .daily-minimum {
  box-sizing: border-box;
  width: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  border-radius: 5px !important;
}
.classic-table tfoot .coverage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.monthly-hours-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: min(100%, 390px);
}
.leave-settings-fields {
  display: grid;
  gap: 8px;
}
.monthly-hours-form > label,
.leave-settings-fields > label {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 90px;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: right;
}
.monthly-hours-form input {
  width: 90px !important;
  text-align: center;
}
.monthly-hours-form > button {
  align-self: flex-end;
}
dialog[open] .modal-card,
.modal-backdrop:not([hidden]) .modal-card {
  border: 1px solid #bac8d4;
  box-shadow: 0 24px 70px #172d3d38, 0 3px 12px #172d3d20;
}
dialog::backdrop {
  background: #102839b5;
}
.app-shell {
  padding-right: 0;
}
.sidebar:not(.is-open) {
  width: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}
.sidebar .menu-toggle {
  position: fixed;
  top: 18px;
  right: 16px;
  z-index: 32;
  pointer-events: auto;
}
.sidebar.is-open {
  width: 246px;
  padding: 14px 10px;
  pointer-events: auto;
  background: #fff;
  border-left: 1px solid var(--line);
}
.sidebar.is-open .sidebar-content {
  padding-top: 62px;
}
.app-shell.menu-pinned {
  padding-right: 246px;
}
.topbar {
  padding-right: 64px;
}
html[data-theme="dark"] .sidebar.is-open {
  background: #1b2635;
}
html[data-theme="dark"] dialog[open] .modal-card,
html[data-theme="dark"] .modal-backdrop:not([hidden]) .modal-card {
  border-color: #5a6d83;
  box-shadow: 0 26px 75px #000a, 0 3px 14px #0008;
}
@media (max-width: 650px) {
  .app-shell,
  .app-shell.menu-pinned {
    padding-right: 0;
  }
  .sidebar.is-open {
    width: min(246px, calc(100vw - 36px));
  }
  .topbar {
    padding-right: 58px;
  }
  .topbar #today-label,
  .topbar .logged-user b {
    font-size: 11px;
  }
  .monthly-hours-form > label,
  .leave-settings-fields > label {
    grid-template-columns: minmax(0, 1fr) 82px;
  }
  .monthly-hours-form input {
    width: 82px !important;
  }
  button,
  [role="button"] {
    touch-action: manipulation;
  }
}

/* Compact editable classic cells and the leave ledger use domain-specific UI. */
.classic-table {
  table-layout: fixed;
  max-width: none;
}
.classic-table tbody .cell-stack,
.classic-table tbody .classic-expanded .cell-stack {
  display: none;
}
.classic-table tbody .shift-cell {
  padding: 3px !important;
  text-align: center;
  white-space: nowrap;
}
.classic-input {
  display: inline-block;
  min-width: 26px !important;
  max-width: 100%;
  height: 28px !important;
  min-height: 28px !important;
  padding: 2px 6px !important;
  text-align: center;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  vertical-align: middle;
}
.classic-input[readonly] {
  cursor: default;
}
.classic-input:not([readonly]) {
  cursor: text;
}
.classic-input[aria-invalid="true"] {
  border-color: #d35252;
  outline: 1px solid #d35252;
}
.classic-input.classic-proposal {
  border-style: dashed;
}
.classic-input.classic-leave {
  border-color: #cf9296;
  background: #d86c7012;
}
.classic-status-dot {
  font-size: 10px;
  padding: 0 2px;
  color: var(--muted);
}
.classic-table tfoot .cell-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.classic-table tfoot .minimum-cell {
  display: flex;
  gap: 3px;
  align-items: center;
}
.classic-table tfoot .coverage {
  font-size: 8px;
  min-width: 0;
  padding: 2px;
}
.classic-table tfoot .coverage {
  width: 20px;
  max-width: 20px;
  font-size: 7px;
  padding: 1px;
}
.classic-table tfoot .minimum-cell {
  gap: 2px;
}
.classic-table tfoot td {
  padding: 3px 2px !important;
}
.classic-table tfoot .daily-minimum {
  width: 24px !important;
  min-width: 0 !important;
  max-width: 24px;
  height: 24px !important;
  min-height: 24px !important;
  padding: 2px !important;
  font-size: 9px;
  border-radius: 4px;
}
.classic-table .day-name {
  font-size: 8px;
}
.classic-table .day-number {
  font-size: 9px;
}
.classic-table .day-number small {
  display: block;
  font-size: 7px;
}

/* Final alignment pass for settings, calendar footers and header navigation. */
#settings-view > .settings-card {
  height: auto;
  align-self: start;
}
#classic-settings-card .classic-rule {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 64px;
  align-items: center;
  gap: 8px;
}
#classic-settings-card .classic-rule > span {
  text-align: right;
}
#classic-settings-card .classic-rule > b {
  width: 100%;
  text-align: center;
}
#classic-settings-card .classic-rule > button {
  width: 64px;
  margin: 0;
}
.monthly-hours-form > button {
  align-self: flex-start;
}
.schedule-table:not(.classic-table) tfoot .coverage,
.schedule-table:not(.classic-table) tfoot .daily-minimum {
  box-sizing: border-box;
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 2px !important;
}
.classic-table tfoot .minimum-cell {
  box-sizing: border-box;
  width: 50px;
  min-width: 50px;
  display: grid;
  grid-template-columns: 24px 24px;
  gap: 2px;
}
.classic-table tfoot .cell-stack {
  width: 50px;
  margin-inline: auto;
}
.classic-table thead th[data-date] {
  overflow: hidden;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 29;
  background: #f8fafbf0;
  backdrop-filter: blur(10px);
  transition: transform 180ms ease, opacity 180ms ease;
}
.sidebar .menu-toggle {
  transition: transform 180ms ease, opacity 180ms ease;
}
.app-shell.header-hidden .topbar,
.app-shell.header-hidden .menu-toggle {
  transform: translateY(calc(-100% - 20px));
  opacity: 0;
  pointer-events: none;
}
.sidebar.is-open {
  top: 78px;
  padding-top: 10px;
}
.sidebar.is-open .sidebar-content {
  padding-top: 0;
}
.position-list {
  margin-top: 14px;
}
/* Extend the header background to the content edges while retaining control padding. */
.main-content {
  --header-gutter: 24px;
  padding-left: var(--header-gutter);
  padding-right: var(--header-gutter);
}
.main-content .topbar {
  margin-left: calc(-1 * var(--header-gutter));
  margin-right: calc(-1 * var(--header-gutter));
  padding-left: var(--header-gutter);
}
#settings-links {
  display: grid;
  gap: 2px;
}
#settings-links .nav-child {
  width: 100%;
  text-align: right;
  justify-content: flex-start;
}
@media (max-width: 650px) {
  .main-content { --header-gutter: 12px; }
  .main-content .topbar { padding-left: var(--header-gutter); }
}
.header-date {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.header-date .connection-status {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 9px;
}
.sidebar.is-open {
  top: 0;
  z-index: 50;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sidebar.is-open .sidebar-content {
  padding-top: 60px;
}
.sidebar .menu-toggle {
  z-index: 51;
}
#settings-links {
  margin-right: 15px;
  border-right: 1px solid var(--line);
  padding-right: 10px;
}
.schedule-table thead th:first-child,
.nurse-table thead th:first-child {
  position: sticky;
  right: 0;
  z-index: 3;
}
:is(.schedule-table, .nurse-table) tbody tr:has(.nurse-name:hover) > :is(th, td) {
  box-shadow: inset 0 0 0 999px #159c9626;
}
@media (max-width: 650px) {
  .main-content .topbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding: 12px 52px 12px var(--header-gutter);
    min-height: 92px;
  }
  .topbar .header-date {
    grid-column: 1;
    grid-row: 1;
  }
  .topbar .header-user {
    grid-column: 2;
    grid-row: 1;
    gap: 4px;
    flex-wrap: wrap;
  }
  .topbar #hospital-title {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    font-size: 12px;
  }
  .topbar .logged-user .avatar,
  .topbar .logged-user small {
    display: none;
  }
  .sidebar.is-open {
    width: min(280px, calc(100vw - 40px));
    height: 100dvh;
  }
  .sidebar-content {
    width: 100%;
  }
  .admin-toolbar,
  .nurse-schedule-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .admin-toolbar .calendar-controls,
  .nurse-schedule-actions .calendar-controls {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }
  .calendar-controls > label,
  .calendar-controls > label select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100%;
  }
  .calendar-controls > label { grid-column: span 2; }
  .calendar-controls > label:has(.week-select) {
    grid-column: 2 / 6;
    grid-row: 2;
  }
  .calendar-controls > .week-arrow {
    width: 100%;
    align-self: end;
    grid-row: 2;
  }
  .calendar-controls > [data-week-step="-1"] { grid-column: 1; }
  .calendar-controls > [data-week-step="1"] { grid-column: 6; }
  .calendar-controls > [data-classic-toggle] {
    grid-column: 1 / -1;
    width: 100%;
  }
  .admin-toolbar .heading-actions {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 6px;
  }
  .admin-toolbar .heading-actions > button {
    flex: 1 1 40%;
    min-width: 0;
  }
  .admin-toolbar .segmented {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  .admin-toolbar .segmented > button {
    width: 100%;
    min-width: 0;
    padding-inline: 3px;
  }
}
.position-table input {
  width: min(190px, 100%) !important;
  text-align: center;
}
.position-table th,
.position-table td {
  text-align: center;
}
html[data-theme="dark"] .topbar {
  background: #111923f0;
}
.name-text[role="button"] {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
}
.name-text[role="button"]:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}
#settings-view > #classic-settings-card {
  grid-column: auto;
  align-self: start;
  min-width: 0;
}
#classic-settings-card .classic-rule {
  gap: 6px;
}
.leave-settings-fields {
  display: contents;
}
.leave-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin: 15px 0;
}
.leave-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: center;
}
.leave-balance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 20px 0;
}
.leave-balance > div {
  padding: 14px 18px;
  border-inline-end: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.leave-balance > div:nth-child(3n) { border-inline-end: 0; }
.leave-balance > div:nth-last-child(-n + 3) { border-bottom: 0; }
.leave-balance dt {
  color: var(--muted);
  font-size: 11px;
}
.leave-balance dd {
  margin: 8px 0 0;
  font-weight: 700;
  font-size: 17px;
}
#leave-view > .settings-card {
  margin-bottom: 20px;
}
.leave-history-card .data-table-wrap { border-radius: var(--radius-sm); overflow: auto; }
.leave-history-table { margin: 0; width: 100%; }
.leave-history-table .empty-table-cell {
  height: 110px;
  text-align: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.schedule-sort {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.schedule-sort:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.settings-department-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-block: 16px;
}
#shift-editor input[type="time"] {
  min-width: 120px;
  direction: ltr;
}
.shift-time-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}
#shift-editor .shift-time-fields input {
  min-width: 0;
}
/* Full-width profile rows keep each caption beside its own control. */
#profile-view > .settings-card { width: min(100%, 880px); max-width: 880px; }
#profile-form, #user-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
  width: 100%;
}
#profile-form > label:not(.checkbox-line),
#user-editor > label:not(.checkbox-line) {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  align-items: center;
  text-align: right;
  gap: 10px;
  width: 100%;
  max-width: none;
}
:is(#profile-form, #user-editor) > label :is(input, select) {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100%;
}
:is(#profile-form, #user-editor) > .full-width {
  grid-column: 1 / -1;
}
#classic-shifts {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
#classic-shifts .checkbox-line {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  text-align: right;
  align-items: center;
  width: 100%;
  gap: 8px;
}
#classic-shifts .checkbox-line input { flex: 0 0 auto; margin: 0; }
.message-empty { height: 100px; text-align: center !important; color: var(--muted); }
.schedule-table tbody th:first-child,
.nurse-table tbody th:first-child,
.schedule-table tfoot th:first-child,
.nurse-table tfoot th:first-child {
  position: sticky;
  right: 0;
  z-index: 3;
  background: var(--panel);
}
.classic-input {
  padding: 0 2px !important;
  min-width: 12px !important;
  text-overflow: clip;
}
#select-dialog .modal-card { width: min(440px, calc(100vw - 24px)); }
#select-dialog .select-search { width: 100% !important; margin-bottom: 12px; }
.select-options { display: grid; gap: 5px; max-height: 52dvh; overflow-y: auto; }
.select-options button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  height: auto;
  padding: 10px 12px;
  text-align: right;
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.select-options button[aria-selected="true"] { border-color: var(--teal); background: var(--teal); color: white; }
.select-options button:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
@media (max-width: 700px) {
  #profile-form, #user-editor { grid-template-columns: minmax(0, 1fr); }
  :is(#profile-form, #user-editor) > label:not(.checkbox-line) {
    grid-template-columns: 120px minmax(0, 1fr);
  }
}
@media (max-width: 650px) {
  .main-content .topbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding: 12px 12px 12px;
    gap: 12px 6px;
  }
  .topbar .header-date {
    padding-right: 50px;
    min-width: 0;
  }
  .topbar .header-date #today-label { white-space: normal; font-size: 10px; }
  .topbar .connection-status { white-space: normal; flex-wrap: wrap; line-height: 1.6; }
  .header-date .connection-status::before { content: none; }
  .topbar .header-user { min-width: 0; align-items: center; }
  .topbar .logged-user { flex-basis: 100%; justify-content: flex-end; }
  .topbar .logged-user b { white-space: normal; font-size: 10px; }
  .topbar #hospital-title { width: 100%; text-align: center; overflow-wrap: anywhere; }
  .topbar #hospital-title {
    align-self: center;
    margin: 0;
    padding: 0;
    line-height: 1.3;
  }
}

.clear-modal-card { width: min(560px, calc(100vw - 24px)); }
.clear-options { display: grid; gap: 10px; margin-block: 16px; }
.clear-options button {
  display: grid;
  justify-items: start;
  gap: 5px;
  width: 100%;
  height: auto;
  min-height: 64px;
  padding: 12px 14px;
  text-align: right;
}
.clear-options button small { font-weight: 400; opacity: .78; }
.clear-options .clear-scope-button {
  border-color: var(--line-strong, var(--line));
  background: var(--surface-soft, var(--surface));
  color: var(--text);
}
@media (max-width: 640px) {
  .leave-balance { grid-template-columns: 1fr; }
  .leave-balance > div,
  .leave-balance > div:nth-child(3n) {
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }
  .leave-balance > div:last-child { border-bottom: 0; }
}
.context-menu .danger-menu-item { color: #b43e48; }
.subcell.leave-request.leave-approved {
  border-style: solid !important;
  background: #d98075 !important;
  color: #fff !important;
  box-shadow: none !important;
}
.subcell.unavailable-request {
  border: 1px dashed #b47acc !important;
  background: #f2e7f8 !important;
  color: #74418d !important;
}
.subcell.unavailable-request.unavailable-approved {
  border-style: solid !important;
  background: #a66bc2 !important;
  color: #fff !important;
}
.legend-dot.unavailable { background: #a66bc2; }
.coverage.missing-lead {
  outline: 2px solid #d69629;
  outline-offset: -2px;
}
@media (max-width: 480px) {
  .leave-balance {
    gap: 12px;
  }
  .leave-balance > div {
    padding-inline-end: 12px;
  }
  .leave-balance dd {
    font-size: 14px;
  }
}

.schedule-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 8px; }
.schedule-icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cell-code-badges { position: absolute; top: 0; left: 1px; display: flex; gap: 1px; max-width: 22px; overflow: hidden; }
.cell-code-badge { display: inline-block; min-width: 8px; max-width: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 1px; border: 1px solid currentColor; border-radius: 2px; font-size: 8px; font-weight: 700; line-height: 9px; }
.subcell:has(.cell-code-badge) .shift-label { display: block; padding-top: 7px; }
#group-list > .data-table-wrap { width: 100%; }
#leave-menu { max-height: calc(100dvh - 16px); overflow-y: auto; }
#admin-table .subcell { -webkit-touch-callout: none; user-select: none; }

:is(#profile-form, #user-editor) > label.checkbox-line {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  white-space: nowrap;
  width: 100%;
}
:is(#profile-form, #user-editor) > label.checkbox-line input {
  width: 16px !important;
  height: 16px;
  flex: 0 0 16px;
  margin: 0;
}
.clear-options button { justify-items: center; text-align: center; }
@media (max-width: 700px) {
  #user-editor-card, #profile-view > .settings-card { width: 100%; max-width: 100%; }
}
@media (max-width: 650px) {
  .main-content .topbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 8px 5px;
    padding: 12px;
  }
  .topbar .header-date { grid-column: 1; grid-row: 1; padding-right: 36px; }
  .topbar #hospital-title {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    font-size: 11px;
    line-height: 1.6;
  }
  .topbar .header-user { grid-column: 3; grid-row: 1; align-items: start; justify-content: flex-end; }
  .topbar .logged-user { width: 100%; margin: 0; min-height: 0; }
  .topbar .logged-user b, .topbar .header-date #today-label { line-height: 1.6; margin: 0; padding: 0; }
  .topbar #theme-toggle, .topbar .logout-button { padding: 3px 6px; min-width: 0; font-size: 10px; }
  .topbar .connection-status { font-size: 8px; gap: 3px; }
}
