:root {
  --ui-scale: 0.9;
  --timeline-day-width: 52px;
  --timeline-row-height: 42px;
  --timeline-bed-label-width: 96px;
  --bg: #eef1f7;
  --surface: #ffffff;
  --ink: #162033;
  --muted: #7b8798;
  --line: #e3e8f0;
  --teal: #4f7cff;
  --teal-dark: #3b63e8;
  --mint: #edf2ff;
  --blue: #315fd6;
  --green: #16a34a;
  --amber: #d88b1f;
  --red: #d94b46;
  --sidebar-bg: linear-gradient(180deg, #1a2f5c 0%, #132548 100%);
  --sidebar-rail: #132749;
  --sidebar-rail-width: 52px;
  --sidebar-width: 228px;
  --sidebar-ink: rgba(255, 255, 255, 0.72);
  --sidebar-ink-strong: #ffffff;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(91, 124, 250, 0.22);
  --shell-bg: var(--bg);
  --shadow: 0 14px 40px rgba(22, 32, 51, 0.08);
  --shadow-soft: 0 8px 24px rgba(22, 32, 51, 0.05);
  --radius: 14px;
  --radius-lg: 18px;
  --app-height: calc(100vh / var(--ui-scale));
  --text-xs: 10px;
  --text-sm: 11px;
  --text-base: 13px;
  --text-md: 12px;
  --heading-1: clamp(21px, 2.2vw, 26px);
  --heading-2: 16px;
  --heading-3: 14px;
  --stat-value: 21px;
}

html {
  zoom: var(--ui-scale);
}

@supports not (zoom: 1) {
  body {
    transform: scale(var(--ui-scale));
    transform-origin: top left;
    width: calc(100% / var(--ui-scale));
    min-height: calc(100vh / var(--ui-scale));
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-size: var(--text-base);
  font-family: "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Manrope", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  height: var(--app-height);
  max-height: var(--app-height);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 10px;
  border: 0;
  border-radius: 0;
  background: var(--sidebar-bg);
  box-shadow: none;
  overflow: hidden;
  z-index: 20;
  transition: width 0.2s ease, padding 0.2s ease;
}

.sidebar::before {
  display: none;
}

.sidebar > * {
  position: relative;
  z-index: 1;
  margin-left: 0;
  padding-right: 0;
  flex-shrink: 0;
}

.sidebar > .nav {
  flex: 1 1 auto;
  min-height: 0;
  flex-shrink: 1;
}

.sidebar-foot {
  display: grid;
  gap: 6px;
  margin-top: auto;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 2px 10px;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand-copy {
  min-width: 0;
  overflow: hidden;
  flex: 1;
}

.brand-mark {
  width: 32px;
  height: 32px;
  margin-left: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #5b7cfa, #8aa4ff);
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  box-shadow: 0 6px 16px rgba(91, 124, 250, 0.24);
  flex-shrink: 0;
}

.brand strong {
  font-size: 14px;
}

.brand span {
  font-size: 11px;
}

.brand strong,
.operator strong {
  display: block;
  color: var(--sidebar-ink-strong);
}

.brand span,
.operator small,
.panel-head p,
.stat-card p,
.eyebrow {
  color: var(--muted);
}

.brand span,
.operator small {
  color: var(--sidebar-ink);
}

.nav {
  display: grid;
  gap: 2px;
  padding: 0;
  margin-right: -10px;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--sidebar-ink);
  padding: 7px 10px;
  text-align: left;
  text-decoration: none;
  font-weight: 650;
  font-size: 12px;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-item svg {
  position: relative;
  z-index: 1;
  margin-left: 0;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.nav-item span {
  position: relative;
  z-index: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover:not(.active) {
  background: var(--sidebar-active);
  color: var(--sidebar-ink-strong);
}

.nav-item.active {
  background: var(--shell-bg);
  color: var(--ink);
  border-radius: 14px 0 0 14px;
  margin-right: 0;
  padding-right: 18px;
  font-weight: 750;
}

.nav-item.active svg {
  color: var(--teal-dark);
}

.nav-item.active::before,
.nav-item.active::after {
  display: none;
}

.icon-button svg,
.search svg,
.primary svg,
.secondary svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #5b7cfa, #7d97ff);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.sidebar-logout {
  margin-top: 0;
  min-height: 36px;
  padding: 7px 10px;
  font-size: 12px;
}

.operator {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--sidebar-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.operator-copy {
  min-width: 0;
  overflow: hidden;
}

.operator strong {
  font-size: 13px;
}

.operator small {
  font-size: 10px;
}

.sidebar-collapse {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--sidebar-ink);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.16s ease, color 0.16s ease;
}

.sidebar-collapse:hover {
  background: var(--sidebar-active);
  color: var(--sidebar-ink-strong);
}

.sidebar-collapse svg {
  width: 14px;
  height: 14px;
}

body.sidebar-collapsed .sidebar {
  width: 64px;
  padding: 12px 8px;
  align-items: stretch;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-item > span,
body.sidebar-collapsed .operator-copy,
body.sidebar-collapsed .sidebar-logout > span,
body.sidebar-collapsed .nav-submenu,
body.sidebar-collapsed .nav-toggle {
  display: none;
}

body.sidebar-collapsed .brand {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-inline: 0;
  border-bottom-color: transparent;
}

body.sidebar-collapsed .sidebar-collapse {
  margin-left: 0;
  width: 28px;
}

body.sidebar-collapsed .nav {
  margin-right: 0;
}

body.sidebar-collapsed .nav-item,
body.sidebar-collapsed .sidebar-logout,
body.sidebar-collapsed .operator {
  justify-content: center;
  padding-inline: 6px;
  overflow: hidden;
}

body.sidebar-collapsed .nav-item.active,
body.sidebar-collapsed .nav-group-row > .nav-item.active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--sidebar-ink-strong);
  border-radius: 10px;
  margin-right: 0;
  padding: 7px 6px;
}

body.sidebar-collapsed .nav-item.active svg,
body.sidebar-collapsed .nav-group-row > .nav-item.active svg {
  color: #fff;
}

body.sidebar-collapsed .nav-group {
  gap: 2px;
}

body.sidebar-collapsed .nav-group.expanded .nav-submenu {
  display: none !important;
}

body.sidebar-collapsed .nav-group-row {
  display: block;
}

body.sidebar-collapsed .nav-group-row > .nav-item {
  width: 100%;
}

.shell {
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 24px 28px 40px;
  background: var(--shell-bg);
  transition: margin-left 0.2s ease;
}

body.sidebar-collapsed .shell {
  margin-left: 64px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: var(--heading-1);
  line-height: 1.08;
}

h2 {
  margin-bottom: 4px;
  font-size: var(--heading-2);
}

h3 {
  margin-bottom: 4px;
  font-size: var(--heading-3);
}

.panel-head p {
  font-size: var(--text-sm);
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  min-width: 320px;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.icon-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.icon-button.small,
.icon-button.icon-only {
  width: auto;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
}

.stat-icon svg {
  width: 21px;
  height: 21px;
}

.stat-icon.teal {
  color: var(--teal);
  background: #edf2ff;
}

.stat-icon.blue {
  color: var(--blue);
  background: #e4ebff;
}

.stat-icon.green {
  color: var(--green);
  background: #dcfce7;
}

.stat-icon.amber {
  color: var(--amber);
  background: #fff0d9;
}

.stat-card p {
  margin-bottom: 2px;
  font-size: var(--text-sm);
}

.stat-card strong {
  font-size: var(--stat-value);
  color: #1a2744;
}

.panel {
  padding: 20px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.content-grid,
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.55fr);
  gap: 16px;
}

.split {
  grid-template-columns: minmax(330px, 0.58fr) minmax(0, 1fr);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head p {
  margin-bottom: 0;
}

.segmented {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f9fc;
}

.segmented button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  font-size: 13px;
}

.segmented .selected {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(23, 33, 38, 0.08);
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.room-building-group {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.room-building-head {
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, #1a2f5c 0%, #315fd6 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.room-building-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.room-location-filters {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.scroll-segmented {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: min(100%, 520px);
  -webkit-overflow-scrolling: touch;
}

.scroll-segmented button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.bed-picker-toolbar-stacked {
  display: grid;
  gap: 8px;
  width: 100%;
}

.reg-room-picker-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 4px;
  background: #fff;
}

.rooms-building-filter,
.rooms-floor-filter {
  max-width: 220px;
}

.rooms-list {
  display: grid;
  gap: 12px;
}

.room-card {
  min-height: 142px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.room-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(20, 47, 52, 0.1);
}

.room-top,
.booking-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.room-title strong {
  display: block;
  font-size: 15px;
}

.room-title span,
.bed span,
.booking-card span,
.timeline span {
  color: var(--muted);
  font-size: 12px;
}

.status {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.status.free {
  background: #dcfce7;
  color: #15803d;
}

.status.partial {
  background: #fff0d4;
  color: #96600b;
}

.status.busy {
  background: #ffe2e0;
  color: #a3302d;
}

.status.cleaning {
  background: #e5ebff;
  color: #2e4fba;
}

.beds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 14px;
}

.bed {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

#roomGrid .bed {
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px 2px;
}

#roomGrid .bed strong {
  font-size: 11px;
  color: var(--muted);
  line-height: 1;
}

#roomGrid .bed-meta-free {
  font-size: 11px;
  color: var(--muted);
}

#roomGrid .bed-count-num {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  color: #a3302d;
}

#roomGrid .bed-count-num.booked {
  color: #96600b;
}

#roomGrid .bed-count-num.soon {
  color: #c2410c;
}

#roomGrid .bed-date {
  font-size: 10px;
  line-height: 1.1;
  color: var(--muted);
  font-weight: 700;
}

.bed.free {
  border-color: rgba(22, 163, 74, 0.3);
  background: #f0fdf4;
}

.bed.booked {
  border-color: rgba(216, 139, 31, 0.35);
  background: #fff8eb;
}

.bed.busy {
  border-color: rgba(217, 75, 70, 0.35);
  background: #fff1f0;
}

.detailed .room-card {
  min-height: auto;
}

.detailed .beds {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.detailed .bed {
  min-height: 96px;
  align-content: start;
  justify-items: start;
  gap: 4px;
  padding: 10px;
  text-align: left;
}

.detailed .bed strong {
  font-size: 17px;
}

.detailed .bed span {
  display: block;
  line-height: 1.25;
}

.bed-patient {
  color: var(--ink) !important;
  font-weight: 850;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
}

.dashboard-queue-panel {
  display: grid;
  gap: 18px;
}

.dashboard-queue-block + .dashboard-queue-block {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.dashboard-queue-head {
  margin-bottom: 12px;
}

.dashboard-queue-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e6f7f4;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-queue-count.departure {
  background: #fff4e5;
  color: #b45309;
}

.timeline-item[data-view-queue-patient] {
  cursor: pointer;
}

.timeline-item[data-view-queue-patient]:hover {
  border-color: #b8ddd6;
  background: #f4fbf9;
}

.timeline-item-departure .time {
  color: #b45309;
}

.timeline-item-departure.timeline-item-today {
  border-color: #f59e0b;
  background: #fffbeb;
}

.timeline-item-departure.timeline-item-soon {
  border-color: #fcd34d;
  background: #fffdf5;
}

.timeline-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 58px;
}

.timeline-days-left {
  font-size: 11px;
  font-weight: 800;
  color: #b45309;
  line-height: 1.2;
}

.timeline-body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.timeline-body > strong {
  line-height: 1.25;
}

.timeline-location {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.timeline-loc-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.timeline-loc-chip.building {
  background: #eef6ff;
  color: #1d5f8a;
}

.timeline-loc-chip.room {
  background: #f0fdf4;
  color: #166534;
}

.timeline-loc-chip.bed {
  background: #fff7ed;
  color: #9a3412;
}

.timeline-item-arrival .time {
  color: var(--teal-dark);
}

.time {
  min-width: 54px;
  color: var(--teal-dark);
  font-weight: 900;
}

.form-panel {
  align-self: start;
}

.registration-form {
  max-width: none;
  padding: 18px;
}

#registration .registration-form .panel-head {
  margin-bottom: 14px;
}

#registration .registration-form .panel-head h2 {
  font-size: 14px;
}

#registration .registration-form .panel-head p {
  font-size: 10px;
}

#registration .registration-form .form-grid,
#registration .registration-form .form-grid.registration-form-grid {
  gap: 11px;
}

#registration .registration-form .inline-fields {
  gap: 11px;
}

#registration .registration-form label {
  gap: 6px;
  font-size: 10px;
}

#registration .registration-form input,
#registration .registration-form select {
  height: 36px;
  padding: 0 11px;
  font-size: 12px;
}

#registration .registration-form textarea {
  min-height: 72px;
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.45;
}

#registration .registration-form > .primary,
#registration .registration-form-actions .primary {
  min-height: 36px;
  margin-top: 0;
  padding: 0 14px;
  font-size: 12px;
}

#registration .reg-bed-picker-card {
  padding: 12px 14px;
}

#registration .reg-bed-picker-card .bed-picker-selected {
  font-size: 13px;
}

#registration .reg-bed-picker-card-head .primary {
  width: auto;
  margin-top: 0;
  min-height: 34px;
  padding: 0 14px;
  font-size: 12px;
  box-shadow: 0 8px 20px rgba(79, 124, 255, 0.2);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #46565c;
  font-size: var(--text-sm);
  font-weight: 750;
}

label.full {
  grid-column: 1 / -1;
}

.autocomplete-field {
  position: relative;
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 8;
  display: grid;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 16px 34px rgba(20, 47, 52, 0.14);
}

.suggestions:empty {
  display: none;
}

.suggestion-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: #fff;
  padding: 11px 12px;
  text-align: left;
}

.suggestion-item:hover {
  background: var(--mint);
}

.suggestion-item strong,
.suggestion-item span {
  overflow-wrap: anywhere;
}

.suggestion-item span,
.suggestion-empty {
  color: var(--muted);
  font-size: 12px;
}

.suggestion-empty {
  padding: 12px;
}

.calculation-box {
  min-height: 44px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid rgba(14, 165, 233, 0.24);
  border-radius: var(--radius);
  background: var(--mint);
}

.calculation-box span {
  color: var(--muted);
  font-size: 12px;
}

.calculation-box strong {
  color: var(--teal-dark);
}

.calculation-box.compact {
  margin-top: 10px;
}

.field-title {
  margin-bottom: 8px;
  color: #46565c;
  font-size: 13px;
  font-weight: 750;
}

.treatment-picker {
  display: block;
}

.check-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.check-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.check-item input {
  width: 18px;
  height: 18px;
}

.check-item span,
.check-item strong,
.check-item small {
  display: block;
}

.check-item small {
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: var(--text-base);
  padding: 0 12px;
  outline: 0;
}

textarea {
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.13);
}

.primary,
.secondary,
.danger {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  padding: 0 16px;
  font-weight: 850;
}

.primary {
  width: auto;
  margin-top: 14px;
  border: 0;
  background: linear-gradient(135deg, var(--teal), #6d92ff);
  color: #fff;
  box-shadow: 0 10px 24px rgba(79, 124, 255, 0.24);
}

.table-actions .primary,
.table-actions .secondary,
.table-actions .danger,
table .table-actions button {
  margin-top: 0;
}

.primary:hover {
  background: linear-gradient(135deg, var(--teal-dark), #5b7cfa);
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger {
  border: 1px solid rgba(217, 75, 70, 0.22);
  background: #fff1f0;
  color: var(--red);
}

.small {
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap > table:not(.rooms-detail-table),
.table-wrap table:not(.rooms-detail-table) {
  min-width: 820px;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

table.bookings-table > thead > tr:not(.table-filter-row) > th,
table.bookings-table > tbody > tr > td {
  padding: 8px 8px;
  font-size: 11px;
  line-height: 1.25;
}

table.bookings-table > thead > tr:not(.table-filter-row) > th {
  font-size: 10px;
  padding-top: 6px;
  padding-bottom: 6px;
}

table.bookings-table > thead > tr.table-filter-row > th {
  padding: 3px 5px;
}

table.bookings-table .table-filter-row input,
table.bookings-table .table-filter-row select {
  height: 27px;
  min-height: 27px;
  padding: 0 6px;
  font-size: 11px;
}

table.bookings-table td strong,
table.bookings-table .patient-name-link strong {
  font-size: 11px;
}

table.bookings-table .status {
  padding: 3px 6px;
  font-size: 10px;
  line-height: 1.1;
}

table.bookings-table .table-actions {
  gap: 3px;
  flex-wrap: nowrap;
}

table.bookings-table .table-actions button.small,
table.bookings-table .table-actions .secondary.small,
table.bookings-table .table-actions .primary.small,
table.bookings-table .table-actions .danger.small {
  min-height: 29px;
  height: 29px;
  padding: 0 7px;
  font-size: 10px;
}

table.bookings-table .table-actions button.icon-only,
table.bookings-table .table-actions .icon-only.small {
  width: 29px;
  min-width: 29px;
  height: 29px;
  padding: 0;
}

table.bookings-table .table-actions button.primary.small span {
  font-size: 10px;
}

table.bookings-table .table-actions svg {
  width: 14px;
  height: 14px;
}

table.cashier-table > thead > tr:not(.table-filter-row) > th,
table.cashier-table > tbody > tr > td {
  padding: 8px 8px;
  font-size: 11px;
  line-height: 1.25;
}

table.cashier-table > thead > tr:not(.table-filter-row) > th {
  font-size: 10px;
  padding-top: 6px;
  padding-bottom: 6px;
}

table.cashier-table > thead > tr.table-filter-row > th {
  padding: 3px 5px;
}

table.cashier-table .table-filter-row input,
table.cashier-table .table-filter-row select {
  height: 27px;
  min-height: 27px;
  padding: 0 6px;
  font-size: 11px;
}

table.cashier-table td strong {
  font-size: 11px;
}

table.cashier-table td span {
  font-size: 10px;
  line-height: 1.25;
}

table.cashier-table td input[data-payment-amount],
table.cashier-table td select[data-payment-method] {
  min-width: 70px;
  max-width: 106px;
  height: 27px;
  padding: 0 6px;
  font-size: 11px;
}

table.cashier-table .primary.small,
table.cashier-table .secondary.small {
  min-height: 29px;
  height: 29px;
  padding: 0 7px;
  font-size: 10px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.booking-list {
  display: grid;
  gap: 10px;
}

.booking-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
}

.booking-card strong {
  display: block;
}

.booking-location {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  color: var(--ink) !important;
  font-weight: 750;
}

.booking-location svg {
  width: 14px;
  height: 14px;
  color: var(--teal);
}

.booking-side {
  display: grid;
  justify-items: end;
  gap: 7px;
  flex: 0 0 auto;
}

.cashier-list {
  display: grid;
  gap: 12px;
}

.cashier-card {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(280px, 0.9fr) minmax(310px, 0.8fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
}

.cashier-main,
.cashier-money {
  display: grid;
  gap: 6px;
}

.cashier-main strong {
  font-size: 16px;
}

.cashier-main span,
.cashier-money span {
  color: var(--muted);
  font-size: 12px;
}

.cashier-money {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cashier-money div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.cashier-money strong {
  display: block;
  overflow-wrap: anywhere;
}

.cashier-pay {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  gap: 8px;
}

.primary:disabled,
.secondary:disabled,
.danger:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.45fr) minmax(360px, 0.55fr);
  gap: 16px;
}

.setup-page {
  display: none;
}

.setup-page.active {
  display: block;
}

.settings-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.settings-card {
  min-height: 142px;
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 10px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-align: left;
}

.settings-card:hover {
  border-color: rgba(14, 165, 233, 0.24);
  transform: translateY(-1px);
}

.settings-card strong {
  font-size: 18px;
}

.settings-card small {
  color: var(--muted);
  line-height: 1.35;
}

.settings-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.settings-toolbar h2 {
  margin: 0;
}

.setup-list-panel {
  align-self: start;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.chip-list,
.admin-room-list {
  display: grid;
  gap: 10px;
}

.type-chip,
.admin-room {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
}

.type-chip {
  min-height: 58px;
}

.type-chip strong,
.admin-room strong {
  display: block;
}

.type-chip span,
.admin-room span {
  color: var(--muted);
  font-size: 12px;
}

.mini-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.empty {
  margin: 0;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 25, 30, 0.38);
  backdrop-filter: blur(8px);
}

.modal-backdrop[hidden] {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

.modal {
  width: min(620px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-body {
  margin: 16px 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-grid div {
  min-height: 66px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
}

.detail-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.detail-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.detail-grid .full {
  grid-column: 1 / -1;
}

.modal-note {
  margin: 12px 0 0;
  padding: 11px;
  border-radius: var(--radius);
  background: #fff8eb;
  color: #775012;
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 340px;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: #18333b;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 40;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* 15–17" noutbuklar va past balandlikdagi ekranlar */
@media (max-width: 1600px) and (max-height: 900px) {
  :root {
    --ui-scale: 0.84;
    --timeline-day-width: 42px;
    --timeline-row-height: 36px;
    --timeline-bed-label-width: 84px;
  }
}

@media (max-width: 1440px), (max-height: 820px) {
  :root {
    --timeline-day-width: 38px;
    --timeline-row-height: 34px;
    --timeline-bed-label-width: 76px;
  }
}

@media (max-width: 1366px), (max-height: 768px) {
  :root {
    --ui-scale: 0.8;
    --timeline-day-width: 34px;
    --timeline-row-height: 30px;
    --timeline-bed-label-width: 68px;
  }
}

@media (max-height: 950px) {
  .modal-backdrop {
    padding: 10px;
    place-items: start center;
    overflow-y: auto;
    align-content: safe center;
  }
}

@media (max-width: 1080px) {
  body.sidebar-collapsed .sidebar {
    width: auto;
    padding: 16px;
    height: auto;
    max-height: none;
  }

  body.sidebar-collapsed .shell {
    margin-left: 0;
  }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
    max-height: none;
    margin: 0;
    padding: 16px;
    overflow: hidden;
  }

  .shell {
    margin-left: 0;
    min-height: 0;
    padding: 4px 14px 30px;
  }

  .sidebar > * {
    margin-left: 0;
    padding-right: 0;
  }

  .brand-mark,
  .nav-item svg {
    margin-left: 0;
  }

  .nav {
    margin-right: 0;
  }

  .nav-item.active,
  .nav-group-row > .nav-item.active,
  .nav-submenu a.active {
    border-radius: 12px;
    margin-right: 0;
    padding-right: 12px;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .operator {
    display: none;
  }

  .stats,
  .content-grid,
  .split,
  .setup-grid,
  .cashier-card {
    grid-template-columns: 1fr 1fr;
  }

  .cashier-pay,
  .cashier-money {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar,
  .actions,
  .panel-head:not(.hr-panel-head) {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    min-width: 0;
    width: 100%;
  }

  .nav,
  .stats,
  .content-grid,
  .split,
  .setup-grid,
  .form-grid,
  .cashier-card,
  .cashier-pay,
  .cashier-money {
    grid-template-columns: 1fr;
  }

  .type-chip,
  .admin-room {
    align-items: stretch;
    flex-direction: column;
  }

  .mini-actions {
    justify-content: flex-start;
  }

  .nav-item span {
    display: inline;
  }

  .segmented {
    overflow-x: auto;
  }

  .room-grid {
    grid-template-columns: 1fr;
  }

  .detailed .beds,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
