﻿:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #101828;
  --muted: #667085;
  --line: #dfe7f1;
  --soft-line: #edf2f7;
  --blue: #0b5bd3;
  --blue-dark: #0848a8;
  --blue-soft: #eaf2ff;
  --green: #079455;
  --green-soft: #e7f8f0;
  --orange: #dc8a00;
  --orange-soft: #fff4df;
  --red: #d92d20;
  --red-soft: #fff1f0;
  --purple: #7a5af8;
  --purple-soft: #f2efff;
  --shadow: 0 12px 30px rgba(16, 24, 40, 0.06);
  --radius: 8px;
  --sidebar: 260px;
  --sidebar-collapsed: 78px;
}

* { box-sizing: border-box; }
html { min-width: 1180px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; font-weight: 750; }
h2 { font-size: 28px; line-height: 1.2; }
h3 { font-size: 16px; }
.is-hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  padding: 34px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef4fb, #ffffff 45%, #edf5ff);
}
.login-card {
  width: min(1720px, 100%);
  min-height: 760px;
  display: grid;
  grid-template-columns: 0.78fr 1.38fr;
  overflow: hidden;
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 22px 65px rgba(16, 24, 40, 0.14);
}
.login-visual {
  position: relative;
  padding: 72px 60px;
  background:
    linear-gradient(180deg, rgba(12, 47, 91, 0.06), rgba(12, 47, 91, 0.12)),
    radial-gradient(circle at 28% 22%, #ffffff 0 0.5%, transparent 18%),
    linear-gradient(135deg, #dce8f4, #f8fbff 38%, #c8d9e9);
}
.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 38, 79, 0.08), transparent 42%),
    repeating-linear-gradient(0deg, transparent 0 74px, rgba(255,255,255,0.24) 75px 76px);
}
.clinic-sign, .secure-note { position: relative; z-index: 1; }
.clinic-sign { display: flex; align-items: center; gap: 18px; color: var(--blue-dark); font-size: 42px; font-weight: 800; }
.clinic-sign span { display: block; font-size: 20px; text-transform: uppercase; }
.secure-note {
  position: absolute;
  left: 58px;
  bottom: 92px;
  width: 455px;
  display: flex;
  gap: 22px;
  padding: 28px;
  border-radius: 10px;
  color: #ffffff;
  background: rgba(6, 55, 113, 0.88);
}
.secure-note strong, .secure-note span { display: block; }
.secure-note span { margin-top: 8px; font-size: 17px; }
.secure-icon { font-size: 34px; }
.login-form { width: min(660px, 80%); margin: auto; display: grid; gap: 24px; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 28px; color: var(--blue-dark); font-size: 58px; font-weight: 800; }
.login-logo span { display: block; color: var(--muted); font-size: 21px; font-weight: 500; }
.login-copy { text-align: center; margin: 22px 0; }
.login-copy h1 { font-size: 34px; }
.login-copy p { margin-top: 8px; color: var(--muted); font-size: 21px; }
.login-help { border-top: 1px solid var(--line); padding-top: 24px; text-align: center; color: var(--muted); font-size: 16px; }
.login-help strong { display: block; color: var(--text); margin-bottom: 4px; }
.login-form footer { display: flex; justify-content: space-between; color: var(--muted); margin-top: 44px; }

.brand-icon {
  position: relative;
  width: 48px; height: 48px; border-radius: 8px;
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, #0b62dc, #083f98);
  color: #fff; font-size: 0; font-weight: 800;
  box-shadow: 0 8px 18px rgba(11, 91, 211, 0.22);
}
.brand-icon::before,
.brand-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.brand-icon::before {
  width: 24px;
  height: 6px;
}
.brand-icon::after {
  width: 6px;
  height: 24px;
}
.brand-icon.large { width: 74px; height: 74px; font-size: 0; }
.brand-icon.large::before {
  width: 38px;
  height: 8px;
}
.brand-icon.large::after {
  width: 8px;
  height: 38px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  transition: grid-template-columns 0.24s ease;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar);
  height: 100dvh;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  transition: width 0.24s ease;
}
.brand {
  height: 92px; display: flex; align-items: center; gap: 14px; padding: 0 20px; border-bottom: 1px solid var(--line);
  transition: justify-content 0.24s ease, padding 0.24s ease, gap 0.24s ease;
}
.brand strong { display: block; color: var(--blue-dark); font-size: 25px; font-weight: 800; }
.brand span { color: var(--muted); font-size: 13px; }
.brand > div:not(.brand-icon),
.nav-item span:not(.nav-icon),
.logout-button,
.version {
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.18s ease, width 0.24s ease, transform 0.24s ease;
}
.sidebar-nav {
  display: grid;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  gap: 6px;
  padding: 28px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.nav-item {
  border: 0; background: transparent; color: #253858;
  display: flex; align-items: center; gap: 16px;
  width: 100%; min-height: 50px; padding: 0 16px;
  border-radius: 7px; font-weight: 650; text-align: left;
  transition: background-color 0.18s ease, color 0.18s ease, justify-content 0.24s ease, gap 0.24s ease, padding 0.24s ease;
}
.nav-item:hover, .nav-item.active { background: var(--blue-soft); color: var(--blue); }
.nav-icon { width: 22px; text-align: center; color: inherit; transition: width 0.24s ease; }
.logout-button {
  flex: 0 0 auto;
  margin: 0 20px; padding: 18px 0;
  border: 0; border-top: 1px solid var(--line);
  background: transparent; color: #253858; text-align: left; font-weight: 650;
}
.version { flex: 0 0 auto; color: var(--muted); font-size: 12px; padding: 20px; }
.app-shell.sidebar-collapsed,
body.sidebar-collapsed .app-shell {
  grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr);
}
.app-shell.sidebar-collapsed .sidebar,
body.sidebar-collapsed .app-shell .sidebar {
  width: var(--sidebar-collapsed);
}
.app-shell.sidebar-collapsed .brand,
body.sidebar-collapsed .app-shell .brand {
  justify-content: center;
  gap: 0;
  padding: 0 10px;
}
.app-shell.sidebar-collapsed .brand > div:not(.brand-icon),
body.sidebar-collapsed .app-shell .brand > div:not(.brand-icon),
.app-shell.sidebar-collapsed .nav-item span:not(.nav-icon),
body.sidebar-collapsed .app-shell .nav-item span:not(.nav-icon) {
  width: 0;
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
}
.app-shell.sidebar-collapsed .sidebar-nav,
body.sidebar-collapsed .app-shell .sidebar-nav { padding-inline: 10px; }
.app-shell.sidebar-collapsed .nav-item,
body.sidebar-collapsed .app-shell .nav-item {
  justify-content: center;
  gap: 0;
  padding: 0;
}
.app-shell.sidebar-collapsed .nav-icon,
body.sidebar-collapsed .app-shell .nav-icon {
  width: 44px;
  text-align: center;
}
.app-shell.sidebar-collapsed .logout-button,
body.sidebar-collapsed .app-shell .logout-button {
  position: relative;
  margin-inline: 10px;
  color: transparent;
  text-align: center;
}
.app-shell.sidebar-collapsed .logout-button::before,
body.sidebar-collapsed .app-shell .logout-button::before {
  content: "↪";
  position: absolute;
  inset: 18px 0 auto;
  color: #253858;
}
.app-shell.sidebar-collapsed .version,
body.sidebar-collapsed .app-shell .version {
  opacity: 0;
  pointer-events: none;
}
.workspace { grid-column: 2; min-width: 0; }
.topbar {
  height: 86px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 30px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,0.95);
  position: sticky; top: 0; z-index: 9;
}
.topbar-left, .topbar-actions, .profile, .button-group { display: flex; align-items: center; gap: 16px; }
.menu-button {
  border: 0;
  background: transparent;
  color: #18345d;
  font-size: 24px;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.menu-button:hover,
.menu-button:focus-visible {
  background: var(--blue-soft);
  color: var(--blue);
  outline: none;
}
.global-search {
  position: relative;
  width: 360px; min-height: 44px; display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 7px; padding: 0 12px; background: #fff; color: var(--muted);
}
.global-search input { border: 0; min-height: auto; padding: 0; flex: 1; }
.global-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: min(520px, calc(100vh - 110px));
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(16, 24, 40, 0.16);
  color: var(--ink);
}
.global-search-dropdown[hidden] { display: none; }
.global-search-group + .global-search-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--soft-line);
}
.global-search-group h4 {
  margin: 0 0 5px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.global-search-result {
  width: 100%;
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}
.global-search-result:hover,
.global-search-result:focus-visible {
  background: #eff6ff;
  outline: none;
}
.global-search-result strong {
  overflow: hidden;
  color: #101828;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.global-search-result span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.global-search-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
kbd { background: #f4f6f9; color: #667085; border-radius: 5px; padding: 2px 8px; font-size: 12px; }
.icon-button { position: relative; width: 44px; height: 44px; border: 0; border-left: 1px solid var(--line); background: transparent; color: #18345d; font-size: 24px; }
.icon-button span { position: absolute; top: 5px; right: 2px; min-width: 18px; height: 18px; border-radius: 99px; background: var(--blue); color: #fff; font-size: 11px; line-height: 18px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #d9e9ff; color: var(--blue); font-weight: 800; }
.profile strong, .profile span { display: block; }
.profile span { color: var(--muted); font-size: 13px; }
.content { padding: 28px 30px 34px; }
.view { display: none; }
.view.active { display: block; }

.page-head, .page-toolbar, .card, .table-card, .details-panel, .info-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.page-head { display: flex; justify-content: space-between; align-items: flex-start; background: transparent; border: 0; box-shadow: none; margin: 6px 0 20px; }
.page-head p { color: #475467; margin-top: 8px; font-size: 16px; }
.page-actions { display: flex; gap: 14px; }
.page-toolbar { display: flex; align-items: center; gap: 16px; padding: 18px; margin-bottom: 22px; }
.compact-toolbar { flex-wrap: wrap; background: transparent; border: 0; box-shadow: none; padding: 0; }
.search-box { flex: 1; min-width: 420px; }
.card { padding: 20px; }
.flat { box-shadow: none; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.two-columns { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; }
.master-detail { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; }
.stack { display: grid; gap: 18px; }

.stat-card { display: flex; align-items: center; gap: 24px; min-height: 112px; }
.stat-icon { width: 64px; height: 64px; border-radius: 10px; display: grid; place-items: center; font-size: 32px; background: var(--blue-soft); color: var(--blue); }
.stat-card b { display: block; font-size: 31px; margin: 2px 0; }
.stat-card span { color: var(--muted); }
.stat-card small { color: var(--green); }
.stat-card.warning small { color: var(--orange); }
.stat-card.green .stat-icon { background: var(--green-soft); color: var(--green); }
.stat-card.orange .stat-icon { background: var(--orange-soft); color: var(--orange); }
.stat-card.purple .stat-icon { background: var(--purple-soft); color: var(--purple); }

.list-card h3, .card h3 { margin-bottom: 16px; }
.item-row { display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--soft-line); }
.item-row:last-child { border-bottom: 0; }
.item-row strong, .item-row span { display: block; }
.item-row span { color: var(--muted); font-size: 13px; }
.time { color: var(--blue); font-weight: 800; }
.quick-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.quick-action { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 18px; text-align: center; display: grid; gap: 8px; }
.quick-action i { width: 58px; height: 58px; border-radius: 10px; display: grid; place-items: center; margin: auto; background: var(--blue-soft); color: var(--blue); font-style: normal; font-size: 28px; }
.quick-action span { color: var(--muted); }

.primary-button, .secondary-button, .view-button, .ghost-button {
  min-height: 42px; border-radius: 7px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 750;
}
.primary-button { border: 1px solid var(--blue); background: var(--blue); color: #fff; }
.primary-button:hover { background: var(--blue-dark); }
.secondary-button, .view-button, .ghost-button { border: 1px solid var(--line); background: #fff; color: #253858; }
.view-button.active, .secondary-button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.wide { width: 100%; min-height: 60px; font-size: 19px; }
.icon-only { width: 42px; padding: 0; }

input, select, textarea {
  width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text); padding: 0 14px;
}
textarea { padding-top: 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(11,91,211,0.13); border-color: var(--blue); }
label { display: grid; gap: 8px; color: #344054; font-weight: 650; }
.check-row { display: flex; align-items: center; gap: 10px; }
.check-row input, input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--blue); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: span 2; }
.form-message { min-height: 20px; color: var(--green); font-weight: 700; }
.field-error { color: var(--red); font-size: 12px; font-weight: 700; margin-top: -4px; }
.has-error { border-color: var(--red) !important; }

.table-card { overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--soft-line); padding: 17px 18px; text-align: left; vertical-align: middle; }
th { color: #253858; font-size: 13px; font-weight: 800; }
tr.selected, tr:hover { background: #f6faff; }
.person-cell { display: flex; align-items: center; gap: 14px; }
.initials, .mini-avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #e8f0fc; color: var(--blue); font-weight: 800; }
.mini-avatar { background: linear-gradient(135deg, #f0c3aa, #eef5ff); color: #1f2937; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 6px; font-weight: 800; font-size: 12px; background: var(--green-soft); color: var(--green); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.warning { background: var(--orange-soft); color: var(--orange); }
.status.danger { background: var(--red-soft); color: var(--red); }
.status.gray { background: #eef2f6; color: #475467; }
.action-buttons { display: flex; gap: 8px; }
.action-buttons button { min-height: 36px; padding: 0 12px; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; color: #344054; }

.calendar-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; }
.calendar-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.doctor-day-grid { min-width: 880px; display: grid; grid-template-columns: 72px repeat(4, minmax(190px, 1fr)); }
.calendar-corner, .doctor-header, .calendar-time, .calendar-cell { border-right: 1px solid var(--soft-line); border-bottom: 1px solid var(--soft-line); }
.calendar-corner, .doctor-header { min-height: 80px; background: #fbfdff; position: sticky; top: 0; z-index: 2; }
.doctor-header { display: flex; gap: 14px; align-items: center; padding: 14px 16px; }
.doctor-header strong, .doctor-header span { display: block; }
.doctor-header span { color: var(--muted); font-size: 13px; }
.calendar-time { min-height: 58px; padding: 12px; color: #344054; background: #fbfdff; }
.calendar-cell { min-height: 58px; padding: 7px; background: #fff; }
.appointment-card {
  width: 100%; border: 0; border-left: 3px solid var(--blue); border-radius: 6px; background: var(--blue-soft); color: #102a56;
  padding: 8px; text-align: left; display: grid; gap: 2px; min-height: 66px;
}
.appointment-card strong, .appointment-card span { display: block; font-size: 12px; }
.appointment-card { --appointment-accent: var(--blue); }
.appointment-card.general { --appointment-accent: #475569; border-left-color: #475569; background: #f1f5f9; }
.appointment-card.internal { --appointment-accent: var(--blue); border-left-color: var(--blue); background: var(--blue-soft); }
.appointment-card.cardiology { --appointment-accent: var(--green); border-left-color: var(--green); background: var(--green-soft); }
.appointment-card.dermatology { --appointment-accent: var(--orange); border-left-color: var(--orange); background: var(--orange-soft); }
.appointment-card.pediatrics { --appointment-accent: var(--purple); border-left-color: var(--purple); background: var(--purple-soft); }
.appointment-card.neurology { --appointment-accent: #0891b2; border-left-color: #0891b2; background: #ecfeff; }
.appointment-card.gynecology { --appointment-accent: #db2777; border-left-color: #db2777; background: #fdf2f8; }
.appointment-card.orthopedics { --appointment-accent: #7c3aed; border-left-color: #7c3aed; background: #f5f3ff; }
.appointment-card.diagnostics { --appointment-accent: #0f766e; border-left-color: #0f766e; background: #f0fdfa; }
.appointment-card.psychology { --appointment-accent: #be185d; border-left-color: #be185d; background: #fce7f3; }
.appointment-card.physiotherapy { --appointment-accent: #047857; border-left-color: #047857; background: #ecfdf5; }
.appointment-card.endocrinology { --appointment-accent: #c2410c; border-left-color: #c2410c; background: #fff7ed; }
.appointment-card.gastroenterology { --appointment-accent: #a16207; border-left-color: #a16207; background: #fefce8; }
.appointment-card.diabetology { --appointment-accent: #1d4ed8; border-left-color: #1d4ed8; background: #eff6ff; }
.appointment-card.pulmonology { --appointment-accent: #0369a1; border-left-color: #0369a1; background: #f0f9ff; }
.appointment-card.laryngology { --appointment-accent: #9333ea; border-left-color: #9333ea; background: #faf5ff; }
.appointment-card.procedure { --appointment-accent: #b91c1c; border-left-color: #b91c1c; background: #fee2e2; }
.appointment-card.lab { --appointment-accent: #0e7490; border-left-color: #0e7490; background: #e0f2fe; }
.side-stack { display: grid; gap: 16px; align-self: start; }
.mini-calendar { display: grid; gap: 12px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.mini-grid span { padding: 6px 0; border-radius: 6px; }
.mini-grid .active { background: var(--blue); color: #fff; }
.filter-card { display: grid; gap: 12px; }
.info-card { padding: 18px; color: #344054; background: #eff6ff; }

.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 28px; background: rgba(15,23,42,0.46); }
.modal-backdrop[hidden] { display: none; }
.modal { max-height: calc(100vh - 56px); overflow: auto; width: min(1000px, 100%); background: #fff; border-radius: 8px; box-shadow: 0 28px 80px rgba(15,23,42,0.28); }
.compact-modal { width: min(520px, 100%); }
.modal-heading { display: flex; align-items: center; justify-content: space-between; padding: 24px; border-bottom: 1px solid var(--line); }
.modal-close { border: 0; background: transparent; color: #344054; font-size: 28px; }
.appointment-form { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 22px; padding: 24px; }
.registration-left, .registration-right { display: grid; gap: 16px; align-content: start; }
.recent-patients { display: grid; gap: 10px; margin-top: 8px; }
.recent-patient { border: 1px solid var(--line); border-radius: 7px; padding: 10px; display: flex; align-items: center; gap: 10px; background: #fff; }
.duration-box { display: flex; justify-content: space-between; gap: 16px; background: var(--blue-soft); color: #18477c; border: 1px solid #c7ddfb; border-radius: 7px; padding: 12px 14px; }
.modal-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 12px; padding-top: 10px; }
.details-list { padding: 22px; display: grid; gap: 12px; margin: 0; }
.details-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.details-row dt { color: var(--muted); font-weight: 800; }
.details-row dd { margin: 0; }

.profile-hero { display: grid; grid-template-columns: 1fr 430px; gap: 24px; align-items: center; padding: 26px; }
.hero-person { display: flex; align-items: center; gap: 26px; }
.big-avatar { width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; background: #e8f0fc; color: var(--blue); font-size: 38px; font-weight: 800; }

.doctor-photo-avatar {
  overflow: hidden;
  flex-shrink: 0;
}

.doctor-photo-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
}

.doctor-photo-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.doctor-avatar {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: #e8f0fc;
  color: var(--blue);
  font-weight: 900;
  object-fit: cover;
  object-position: center;
}

img.doctor-avatar {
  display: inline-block;
}

.doctor-avatar-small {
  width: 32px;
  height: 32px;
  min-width: 32px;
  font-size: 12px;
}

.doctor-avatar-large {
  width: 112px;
  height: 112px;
}

.doctor-photo-avatar.user-avatar {
  width: 64px;
  height: 64px;
}
.meta-line { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 12px; color: #344054; }
.tabs { display: flex; gap: 28px; border-top: 1px solid var(--line); padding: 0 24px; }
.tabs button { border: 0; background: transparent; padding: 16px 0; color: #253858; font-weight: 750; }
.tabs button.active { color: var(--blue); border-bottom: 2px solid var(--blue); }
.info-list { display: grid; gap: 12px; }
.info-list div { display: grid; grid-template-columns: 190px 1fr; gap: 12px; }
.info-list span { color: var(--muted); }
.placeholder { display: grid; place-items: center; min-height: 360px; color: var(--muted); text-align: center; }

@media (max-width: 1380px) {
  :root { --sidebar: 236px; }
  .content { padding: 24px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .master-detail, .two-columns { grid-template-columns: 1fr; }
  .calendar-layout { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: repeat(3, 1fr); }
}

.calendar-cell.has-multiple {
  display: grid;
  gap: 6px;
  align-content: start;
}

/* Dashboard refined to match the approved main-screen reference. */
.dashboard-head {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  margin: 6px 0 22px;
}

.dashboard-head h2 {
  font-size: 30px;
  letter-spacing: -0.01em;
}

.dashboard-head p {
  color: #475467;
  font-size: 16px;
  margin-top: 6px;
}

.date-select {
  min-width: 270px;
  justify-content: flex-start;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.04);
}

.dashboard-date-picker {
  position: relative;
  z-index: 6;
}

.dashboard-date-trigger {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 270px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.04);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.dashboard-date-trigger:hover,
.dashboard-date-picker.open .dashboard-date-trigger {
  border-color: rgba(37, 99, 235, .35);
  background: #f8fbff;
  box-shadow: 0 12px 28px rgba(37, 99, 235, .12);
}

.dashboard-date-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
}

.dashboard-date-trigger strong,
.dashboard-date-trigger small {
  display: block;
  white-space: nowrap;
}

.dashboard-date-trigger strong {
  text-transform: capitalize;
}

.dashboard-date-trigger small {
  margin-top: 2px;
  color: var(--muted);
  font-weight: 700;
}

.dashboard-date-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 318px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .18);
}

.dashboard-date-popover[hidden] {
  display: none;
}

.dashboard-date-popover .calendar-preview {
  padding: 0;
}

.mini-calendar-title {
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 900;
  text-align: center;
  text-transform: capitalize;
}

.dashboard-stats {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.dashboard-stat {
  align-items: center;
  display: flex;
  gap: 24px;
  min-height: 128px;
  padding: 26px 30px;
}

.dashboard-stat .stat-icon {
  height: 66px;
  width: 66px;
}

.dashboard-stat b {
  display: block;
  font-size: 32px;
  line-height: 1.1;
  margin: 3px 0 6px;
}

.dashboard-stat span {
  color: #344054;
  font-size: 16px;
}

.dashboard-stat small {
  color: var(--green);
  display: block;
}

.dashboard-stat.orange small {
  color: var(--orange);
}

.dashboard-stat.green .stat-icon { background: var(--green-soft); color: var(--green); }
.dashboard-stat.orange .stat-icon { background: var(--orange-soft); color: var(--orange); }
.dashboard-stat.purple .stat-icon { background: var(--purple-soft); color: var(--purple); }

.doctor-dashboard-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-main {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.08fr 1fr 1fr;
  margin-bottom: 18px;
}

.doctor-dashboard-main {
  align-items: stretch;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-bottom {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 390px;
}

.dashboard-card {
  padding: 0;
  overflow: hidden;
}

.card-title {
  align-items: center;
  border-bottom: 1px solid var(--soft-line);
  display: flex;
  justify-content: space-between;
  min-height: 62px;
  padding: 0 24px;
}

.card-title h3 {
  font-size: 17px;
}

.link-button,
.footer-link,
.row-link {
  background: transparent;
  border: 0;
  color: var(--blue);
  font-weight: 750;
}

.dash-list {
  min-height: 302px;
  padding: 0 24px;
}

.visit-row,
.slot-row,
.profile-row {
  align-items: center;
  border-bottom: 1px solid var(--soft-line);
  display: grid;
  gap: 14px;
  min-height: 68px;
}

.visit-row { grid-template-columns: 64px 42px minmax(0, 1fr) minmax(138px, auto); }
.slot-row { grid-template-columns: 42px minmax(0, 1fr) auto; }
.profile-row { grid-template-columns: 42px minmax(0, 1fr) auto; }

.visit-row:last-child,
.slot-row:last-child,
.profile-row:last-child {
  border-bottom: 0;
}

.visit-time strong {
  color: var(--blue);
  display: block;
  font-size: 15px;
}

.visit-time .visit-date {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 2px;
}

.visit-time span,
.visit-row span,
.slot-row span,
.profile-row span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.visit-row .visit-time .visit-date {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 3px;
}

.visit-row-meta {
  align-self: stretch;
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 4px;
  min-width: 0;
}

.visit-row-meta .row-link {
  max-width: 100%;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visit-row em {
  background: var(--blue-soft);
  border-radius: 6px;
  color: var(--blue);
  font-style: normal;
  padding: 2px 8px;
  justify-self: end;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-buttons {
  display: flex;
  gap: 10px;
}

.slot {
  background: #ffffff;
  border: 1px solid #a6e2cd;
  border-radius: 7px;
  color: var(--green);
  font-weight: 800;
  min-height: 36px;
  min-width: 64px;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.slot:not(.muted):hover,
.slot:not(.muted):focus-visible {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 8px 18px rgba(7, 148, 85, 0.2);
  color: #ffffff;
  outline: 0;
  transform: translateY(-1px);
}

.slot.muted {
  align-items: center;
  border-color: var(--line);
  color: var(--muted);
  cursor: default;
  display: inline-flex;
  justify-content: center;
}

.doctor-availability-card {
  display: flex;
  flex-direction: column;
}

.doctor-availability-head {
  align-items: center;
  border-bottom: 1px solid var(--soft-line);
  display: flex;
  gap: 12px;
  padding: 18px 24px;
}

.doctor-availability-head strong,
.doctor-availability-head span {
  display: block;
}

.doctor-availability-head span {
  color: var(--muted);
  font-size: 13px;
}

.doctor-availability-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-height: 356px;
  overflow: auto;
  padding: 20px 24px 24px;
}

.doctor-slot {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 2px;
  min-height: 52px;
  padding: 8px 10px;
  place-items: center;
  text-align: center;
}

.doctor-slot strong {
  font-size: 14px;
  line-height: 1;
}

.doctor-slot small {
  font-size: 11px;
  font-weight: 750;
}

.doctor-slot.free {
  background: #ffffff;
  border-color: #a6e2cd;
  color: var(--green);
}

.doctor-slot.busy {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.doctor-slot.current {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  outline: 2px solid #ffffff;
}

.footer-link {
  border-top: 1px solid var(--soft-line);
  min-height: 58px;
  padding: 0 24px;
  text-align: left;
  width: 100%;
}

.dashboard-actions {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 18px 24px 24px;
}

.dash-action {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 150px;
  padding: 18px 14px;
  text-align: center;
}

.dash-action i {
  align-items: center;
  background: var(--blue-soft);
  border-radius: 10px;
  color: var(--blue);
  display: flex;
  font-size: 28px;
  font-style: normal;
  height: 58px;
  justify-content: center;
  width: 58px;
}

.dash-action.a1 i { background: var(--green-soft); color: var(--green); }
.dash-action.a2 i { background: var(--purple-soft); color: var(--purple); }
.dash-action.a3 i { background: var(--orange-soft); color: var(--orange); }

.dash-action span {
  color: var(--muted);
  line-height: 1.35;
}

.calendar-preview {
  padding: 24px;
}

.empty-note {
  color: var(--muted);
  padding: 24px 0;
}

@media (max-width: 1380px) {
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
  .dashboard-main,
  .dashboard-bottom { grid-template-columns: 1fr; }
}

/* Calendar and appointment modal refinements. */
.calendar-layout {
  align-items: start;
}

.calendar-card {
  background: #ffffff;
}

.doctor-day-grid {
  grid-template-columns: 72px repeat(4, minmax(210px, 1fr));
}

.calendar-cell {
  min-height: 62px;
}

.calendar-cell:empty {
  background: #ffffff;
}

.calendar-cell.has-multiple {
  align-content: start;
  display: grid;
  gap: 6px;
}

.appointment-card.short {
  padding-bottom: 6px;
  padding-top: 6px;
}

.appointment-card.normal {
  min-height: 66px;
}

.appointment-card.long {
  min-height: 92px;
}

.registration-modal {
  width: min(1040px, 100%);
}

.appointment-form select[name="time"] {
  color: var(--blue);
  font-weight: 800;
}

.duration-box span {
  margin-left: auto;
}

.recent-patient {
  color: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.recent-patient:hover {
  background: #f6faff;
  border-color: #b9d7fb;
}

/* Google Calendar-like day timeline layout. */
.doctor-day-grid {
  display: grid;
  grid-template-columns: 72px repeat(4, minmax(210px, 1fr));
  grid-template-rows: 88px var(--timeline-height, 1280px);
  min-width: 980px;
}

.calendar-corner {
  grid-column: 1;
  grid-row: 1;
}

.doctor-header {
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 3;
}

.calendar-time-axis {
  background: #fbfdff;
  border-right: 1px solid var(--soft-line);
  grid-column: 1;
  grid-row: 2;
  position: relative;
}

.calendar-time-axis span {
  color: #344054;
  font-weight: 650;
  left: 14px;
  position: absolute;
  transform: translateY(-0.55em);
}

.doctor-timeline {
  background:
    repeating-linear-gradient(
      to bottom,
      #ffffff 0,
      #ffffff calc(var(--slot-height, 64px) - 1px),
      var(--soft-line) calc(var(--slot-height, 64px) - 1px),
      var(--soft-line) var(--slot-height, 64px)
    );
  border-right: 1px solid var(--soft-line);
  grid-row: 2;
  position: relative;
}

.timeline-event {
  position: absolute;
  z-index: 2;
  overflow: hidden;
  min-height: 24px;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease, filter .18s ease;
}

.timeline-event:hover,
.timeline-event:focus-visible {
  z-index: 30;
  outline: none;
}

.timeline-event span,
.timeline-event strong {
  line-height: 1.25;
}

/* Right-side calendar date picker. */
.mini-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.mini-head > div {
  align-items: center;
  display: flex;
  gap: 12px;
}

.mini-head strong {
  min-width: 105px;
  text-align: center;
  text-transform: capitalize;
}

.mini-nav,
.mini-day {
  border: 0;
  background: transparent;
  color: #253858;
}

.mini-nav {
  border-radius: 7px;
  font-size: 22px;
  height: 32px;
  line-height: 1;
  width: 32px;
}

.mini-nav:hover,
.mini-day:hover {
  background: var(--blue-soft);
  color: var(--blue);
}

.mini-grid .mini-day {
  border-radius: 6px;
  min-height: 32px;
  padding: 0;
}

.mini-grid .mini-day.muted {
  color: #98a2b3;
}

.mini-grid .mini-day.today {
  box-shadow: inset 0 0 0 1px var(--blue);
  color: var(--blue);
  font-weight: 800;
}

.mini-grid .mini-day.active {
  background: var(--blue);
  color: #ffffff;
  font-weight: 800;
  box-shadow: none;
}

/* Week and Month calendar views. */
.week-mode {
  grid-template-columns: 72px repeat(7, minmax(150px, 1fr));
  grid-template-rows: 70px var(--timeline-height, 1280px);
  min-width: 1180px;
}

.week-day-header {
  align-items: center;
  background: #fbfdff;
  border-bottom: 1px solid var(--soft-line);
  border-right: 1px solid var(--soft-line);
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 12px;
  position: sticky;
  top: 0;
  z-index: 3;
}

.week-day-header strong {
  color: #101828;
  text-transform: capitalize;
}

.week-day-header span {
  color: var(--muted);
  font-size: 13px;
}

.week-timeline {
  background: repeating-linear-gradient(
    to bottom,
    #ffffff 0,
    #ffffff calc(var(--slot-height, 64px) - 1px),
    var(--soft-line) calc(var(--slot-height, 64px) - 1px),
    var(--soft-line) var(--slot-height, 64px)
  );
  border-right: 1px solid var(--soft-line);
  grid-row: 2;
  position: relative;
}

.compact-event {
  padding: 7px 8px;
}

.compact-event span,
.compact-event strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-grid {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(7, minmax(135px, 1fr));
  min-width: 980px;
  overflow: hidden;
}

.calendar-month-host {
  display: block;
  min-width: 0;
  width: 100%;
}

#calendarView .calendar-month-host .month-grid {
  min-width: 0;
  width: 100%;
}

.month-head {
  background: #fbfdff;
  border-bottom: 1px solid var(--soft-line);
  border-right: 1px solid var(--soft-line);
  color: #344054;
  font-weight: 800;
  min-height: 44px;
  padding: 12px;
  text-align: center;
}

.month-cell {
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid var(--soft-line);
  border-right: 1px solid var(--soft-line);
  color: #101828;
  min-height: 142px;
  padding: 10px;
  text-align: left;
}

.month-cell:hover {
  background: #f6faff;
}

.month-cell.muted {
  background: #fbfcfe;
  color: #98a2b3;
}

.month-cell.selected {
  box-shadow: inset 0 0 0 2px var(--blue);
}

.month-day {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.month-day strong {
  font-size: 15px;
}

.month-day span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.month-items {
  display: grid;
  gap: 5px;
}

.month-appointment,
.month-more {
  border-radius: 5px;
  display: block;
  font-size: 12px;
  overflow: hidden;
  padding: 3px 5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-appointment {
  background: var(--blue-soft);
  color: #123a69;
  cursor: pointer;
}

.month-appointment b {
  margin-right: 5px;
}

.month-more {
  color: var(--blue);
  font-weight: 800;
}

/* Quick appointment registration: existing patient selection and minimal new patient fields. */
.patient-new-button {
  width: max-content;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 700;
  cursor: pointer;
  padding: 2px 0;
}

.patient-new-button:hover { text-decoration: underline; }

.selected-patient {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(11, 91, 211, 0.22);
  border-radius: 8px;
  background: var(--blue-soft);
}

.selected-patient[hidden] { display: none; }

.selected-patient strong,
.recent-patient strong { display: block; }

.selected-patient span,
.recent-patient span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.patient-fields.is-minimized { display: none; }

.appointment-form input[readonly] {
  background: #f8fbff;
  color: var(--muted);
  cursor: default;
}

.recent-patient {
  align-items: center;
  text-align: left;
}


/* Appointment start time picker mirrors the reference modal with visible time buttons. */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.registration-modal {
  width: min(1060px, calc(100vw - 48px));
}

.time-choice-panel {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.time-choice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.time-choice-head strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}

.time-choice-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.time-slot-buttons {
  display: grid;
  grid-template-columns: repeat(6, minmax(72px, 1fr));
  gap: 10px;
}

.time-slot-buttons .time-slot-empty {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 14px;
  margin: 0;
  text-align: left;
  white-space: normal;
}

.time-choice {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--blue);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.time-choice:hover {
  border-color: rgba(11, 91, 211, 0.35);
  background: #f8fbff;
}

.time-choice.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(11, 91, 211, 0.22);
}

@media (max-width: 1180px) {
  .time-slot-buttons { grid-template-columns: repeat(4, minmax(72px, 1fr)); }
}

/* Keep minimal patient creation grouped in the left patient panel. */
.registration-left .patient-fields {
  gap: 12px;
  margin-top: 2px;
}

.registration-left .patient-fields label {
  min-width: 0;
}

.registration-left .patient-new-button {
  margin-top: -2px;
}

.registration-left .recent-patients {
  padding-top: 6px;
  border-top: 1px solid var(--soft-line);
}

.registration-right .form-grid {
  align-items: start;
}

/* Minimal patient layout: no e-mail field, compact search, centered create action. */
.registration-left {
  overflow: hidden;
}

.registration-left label.span-2,
.registration-left input[type="search"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.registration-left input[type="search"] {
  text-overflow: ellipsis;
}

.registration-left .patient-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.registration-left .patient-fields label:nth-child(3) {
  grid-column: 1 / -1;
  max-width: 160px;
  justify-self: center;
  width: 100%;
}

.registration-left .patient-new-button {
  justify-self: center;
  width: auto;
  margin: -4px auto 2px;
  text-align: center;
}

/* Final alignment for quick patient fields in appointment modal. */
.registration-left .patient-fields label:nth-child(3) {
  grid-column: 1 / -1;
  max-width: none;
  justify-self: stretch;
  width: 100%;
}

.registration-left .patient-new-button {
  display: block;
  justify-self: center;
  width: max-content;
  max-width: none;
  white-space: nowrap;
  text-align: center;
  line-height: 1.3;
  margin: 0 auto 4px;
}

/* Clean vertical layout for the left patient panel in Nowa rejestracja. */
.registration-left {
  display: flex !important;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
}

.registration-left > h3 {
  margin: 0;
}

.patient-panel-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.patient-panel-block h4,
.recent-patients h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.patient-search-label,
.patient-fields label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
}

.patient-search-label input,
.patient-fields input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.registration-left .patient-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.registration-left .patient-phone-field,
.registration-left .patient-email-field {
  grid-column: 1 / -1;
  max-width: none;
  justify-self: stretch;
  width: 100%;
}

.registration-left .patient-new-button {
  display: block;
  align-self: stretch;
  justify-self: auto;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 10px 12px;
  white-space: nowrap;
  text-align: center;
  border: 1px dashed rgba(11, 91, 211, 0.35);
  border-radius: 7px;
  background: #f8fbff;
}

.registration-left .recent-patients {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-top: 0;
  border-top: 0;
}

/* Compact full-viewport layout for Kalendarz wizyt. */
:root {
  --topbar-height: 86px;
  --calendar-slot-height: 36px;
  --calendar-header-height: 56px;
}

.content:has(#calendarView.active) {
  height: calc(100vh - var(--topbar-height));
  overflow: hidden;
  padding: 14px 18px 16px;
}

#calendarView.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#calendarView .page-toolbar.compact-toolbar {
  display: grid;
  grid-template-columns: auto auto auto auto minmax(160px, 1fr) minmax(150px, 190px) minmax(150px, 190px) minmax(150px, 210px) auto;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

#calendarView .button-group.segmented {
  gap: 6px;
}

#calendarView .primary-button,
#calendarView .secondary-button,
#calendarView .view-button {
  min-height: 36px;
  padding: 0 14px;
}

#calendarView .icon-only {
  width: 36px;
  padding: 0;
}

#calendarView .calendar-current {
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

#calendarView .page-toolbar select {
  width: 100%;
  min-width: 0;
  height: 36px;
}

#calendarView .calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#calendarView .calendar-card {
  min-height: 0;
  overflow: hidden;
  border-radius: 8px;
}

#calendarView .doctor-day-grid {
  min-width: 0;
  width: 100%;
  height: 100%;
  grid-template-columns: 64px repeat(4, minmax(0, 1fr));
  grid-template-rows: var(--calendar-header-height) minmax(0, 1fr);
  --slot-height: var(--calendar-slot-height);
}

#calendarView .week-mode {
  min-width: 0;
  grid-template-columns: 64px repeat(7, minmax(0, 1fr));
  --calendar-week-header-height: 88px;
  --calendar-week-top-gap: 6px;
  grid-template-rows: var(--calendar-week-header-height) minmax(0, 1fr);
  padding-top: var(--calendar-week-top-gap);
}

#calendarView .calendar-corner,
#calendarView .doctor-header,
#calendarView .week-day-header {
  min-height: var(--calendar-header-height);
  padding: 8px 10px;
  position: static;
}

#calendarView .week-day-header {
  min-height: var(--calendar-week-header-height, 84px);
  padding: 7px 8px;
}

#calendarView .doctor-header {
  gap: 10px;
}

#calendarView .doctor-header .mini-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

#calendarView .doctor-header strong,
#calendarView .doctor-header span,
#calendarView .week-day-header strong,
#calendarView .week-day-header span {
  overflow: hidden;
  text-overflow: ellipsis;
}

#calendarView .calendar-time-axis,
#calendarView .doctor-timeline,
#calendarView .week-timeline {
  height: 100% !important;
  min-height: 0;
}

#calendarView .calendar-time-axis {
  padding-top: 0;
  position: relative;
  z-index: 12;
  background: #fbfdff;
  transform: translateX(var(--calendar-sticky-offset, 0));
}

#calendarView .calendar-time-axis span {
  left: 10px;
  transform: translateY(calc(var(--calendar-slot-height) / 2 - 0.65em));
  font-size: 12px;
}

#calendarView .doctor-timeline,
#calendarView .week-timeline {
  background:
    repeating-linear-gradient(
      to bottom,
      #ffffff 0,
      #ffffff calc(var(--calendar-slot-height) - 1px),
      var(--soft-line) calc(var(--calendar-slot-height) - 1px),
      var(--soft-line) var(--calendar-slot-height)
    );
}

#calendarView .appointment-card.timeline-event,
#calendarView .compact-event.timeline-event {
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 11px;
}

#calendarView .timeline-event span,
#calendarView .timeline-event strong {
  line-height: 1.15;
}

#calendarView .timeline-event span:last-child {
  display: none;
}

#calendarView .side-stack {
  display: grid;
  grid-template-rows: auto auto minmax(0, auto);
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

#calendarView .mini-calendar,
#calendarView .filter-card,
#calendarView .info-card {
  box-shadow: none;
}

#calendarView .mini-calendar {
  gap: 8px;
  padding: 14px;
}

#calendarView .mini-grid {
  gap: 4px;
}

#calendarView .mini-grid .mini-day {
  min-height: 28px;
  font-size: 12px;
}

#calendarView .filter-card {
  gap: 8px;
  padding: 14px;
}

#calendarView .filter-card select,
#calendarView .filter-card input {
  height: 36px;
  width: 100%;
}

#calendarView .filter-card input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

#calendarView .calendar-clear-filters {
  width: 100%;
  justify-content: center;
}

#calendarView .calendar-corner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  position: relative;
  z-index: 13;
  background: #fff;
  transform: translateX(var(--calendar-sticky-offset, 0));
}

#calendarView .calendar-doctor-pager {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 106px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

#calendarView .calendar-doctor-pager-overlay {
  position: relative;
  width: calc(var(--calendar-scroll-viewport-width, 100%) - 64px);
  align-self: stretch;
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  pointer-events: none;
  z-index: 14;
  transform: translateX(var(--calendar-sticky-offset, 0));
}

#calendarView .calendar-doctor-pager button {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--blue);
  font-weight: 800;
  cursor: pointer;
}

#calendarView .calendar-doctor-pager-overlay button {
  pointer-events: auto;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.12);
}

#calendarView .calendar-doctor-pager-overlay .calendar-doctor-page-prev {
  justify-self: start;
}

#calendarView .calendar-doctor-pager-overlay .calendar-doctor-page-next {
  justify-self: end;
}

#calendarView .calendar-doctor-pager button:disabled {
  color: var(--muted);
  opacity: 0.45;
  cursor: not-allowed;
}

#calendarView .calendar-doctor-pager span {
  min-width: 58px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}

#calendarView .calendar-doctor-range {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 14px rgba(16, 24, 40, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

#calendarView .info-card {
  padding: 12px 14px;
  font-size: 12px;
}

#calendarView .month-grid {
  min-width: 0;
  height: 100%;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

#calendarView .month-head {
  min-height: 34px;
  padding: 8px;
}

#calendarView .month-cell {
  min-height: 0;
  padding: 7px;
}

@media (max-width: 1280px) {
  #calendarView .page-toolbar.compact-toolbar {
    grid-template-columns: auto auto auto auto minmax(130px, 1fr) minmax(130px, 170px) minmax(130px, 170px) minmax(130px, 180px) auto;
  }

  #calendarView .calendar-layout {
    grid-template-columns: minmax(0, 1fr) 240px;
  }
}

body.calendar-screen .content {
  height: calc(100vh - var(--topbar-height));
  overflow: hidden;
  padding: 14px 18px 16px;
}

/* Restore readable calendar grid height after compact viewport pass. */
:root {
  --calendar-slot-height: 48px;
  --calendar-header-height: 64px;
}

body.calendar-screen .content,
.content:has(#calendarView.active) {
  min-height: calc(100vh - var(--topbar-height));
  height: auto;
  overflow: visible;
  padding: 14px 18px 16px;
}

#calendarView.active {
  height: auto;
  min-height: calc(100vh - var(--topbar-height) - 30px);
  overflow: visible;
}

#calendarView .calendar-layout {
  align-items: start;
  flex: initial;
  min-height: 0;
  overflow: visible;
}

#calendarView .calendar-card {
  height: auto;
  min-height: 0;
  overflow: hidden;
}

#calendarView .doctor-day-grid {
  height: auto;
  min-height: calc(var(--calendar-header-height) + var(--timeline-height, 960px));
  grid-template-rows: var(--calendar-header-height) var(--timeline-height, 960px);
  --slot-height: var(--calendar-slot-height);
}

#calendarView .week-mode {
  --calendar-week-header-height: 88px;
  --calendar-week-top-gap: 6px;
  min-height: calc(var(--calendar-week-top-gap) + var(--calendar-week-header-height) + var(--timeline-height, 960px));
  grid-template-rows: var(--calendar-week-header-height) var(--timeline-height, 960px);
}

#calendarView .calendar-time-axis,
#calendarView .doctor-timeline,
#calendarView .week-timeline {
  height: var(--timeline-height, 960px) !important;
  min-height: var(--timeline-height, 960px);
}

#calendarView .calendar-time-axis span {
  transform: translateY(calc(var(--calendar-slot-height) / 2 - 0.65em));
}

#calendarView .doctor-timeline,
#calendarView .week-timeline {
  background:
    repeating-linear-gradient(
      to bottom,
      #ffffff 0,
      #ffffff calc(var(--calendar-slot-height) - 1px),
      var(--soft-line) calc(var(--calendar-slot-height) - 1px),
      var(--soft-line) var(--calendar-slot-height)
    );
}

#calendarView .side-stack {
  align-self: start;
  height: auto;
  overflow: visible;
}

#calendarView .month-grid {
  height: auto;
  min-height: 620px;
}

#calendarView .month-cell {
  min-height: 96px;
}

/* Day view card sizing and horizontal overflow hardening. */
html,
body {
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.app-shell,
.workspace,
.content,
#calendarView,
#calendarView .calendar-layout,
#calendarView .calendar-card,
#calendarView .doctor-day-grid,
#calendarView .side-stack {
  max-width: 100%;
  min-width: 0;
}

#calendarView .calendar-layout {
  width: 100%;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 260px);
  overflow: visible;
}

#calendarView .calendar-card {
  width: 100%;
  overflow: hidden;
}

#calendarView .calendar-card.calendar-drag-scroll {
  cursor: grab;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#calendarView .calendar-card.calendar-drag-scroll::-webkit-scrollbar {
  display: none;
}

#calendarView .calendar-card.calendar-drag-scroll.is-dragging {
  cursor: grabbing;
  user-select: none;
}

#calendarView .doctor-day-grid.day-mode {
  grid-template-columns: 64px repeat(4, minmax(340px, 1fr));
  min-width: 100%;
  overflow: hidden;
}

#calendarView .doctor-day-grid.week-mode {
  grid-template-columns: 64px repeat(7, minmax(0, 1fr));
  overflow: hidden;
}

#calendarView .doctor-header,
#calendarView .week-day-header,
#calendarView .doctor-header > div {
  min-width: 0;
}

#calendarView .doctor-header strong,
#calendarView .doctor-header span,
#calendarView .week-day-header strong,
#calendarView .week-day-header span:not(.calendar-absence-week-marker) {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#calendarView .doctor-timeline,
#calendarView .week-timeline {
  overflow: hidden;
}

#calendarView .doctor-timeline::before,
#calendarView .week-timeline::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--calendar-past-height, 0px);
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(148, 163, 184, .12) 0,
      rgba(148, 163, 184, .12) 8px,
      rgba(148, 163, 184, .2) 8px,
      rgba(148, 163, 184, .2) 16px
    ),
    rgba(241, 245, 249, .72);
  border-bottom: 1px solid rgba(148, 163, 184, .32);
  pointer-events: none;
  z-index: 1;
}

#calendarView .doctor-timeline.has-past-slots,
#calendarView .week-timeline.has-past-slots {
  cursor: default;
}

#calendarView .doctor-timeline.all-past-slots::before,
#calendarView .week-timeline.all-past-slots::before {
  border-bottom: 0;
}

#calendarView .appointment-card.timeline-event,
#calendarView .appointment-card.timeline-event.short,
#calendarView .appointment-card.timeline-event.normal,
#calendarView .appointment-card.timeline-event.long,
#calendarView .compact-event.timeline-event {
  box-sizing: border-box;
  min-height: 0 !important;
  max-height: none;
  overflow: hidden;
}

#calendarView .appointment-card.timeline-event:hover,
#calendarView .appointment-card.timeline-event:focus-visible {
  border-color: var(--appointment-accent, currentColor);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--appointment-accent, #2563eb) 22%, transparent), 0 0 0 2px color-mix(in srgb, var(--appointment-accent, #2563eb) 18%, transparent);
  filter: saturate(1.05);
  transform: translateY(-1px);
}

#calendarView .week-mode .appointment-card.timeline-event:hover,
#calendarView .week-mode .appointment-card.timeline-event:focus-visible,
#calendarView .week-mode .compact-event.timeline-event:hover,
#calendarView .week-mode .compact-event.timeline-event:focus-visible {
  z-index: 40;
  overflow: visible;
  box-shadow: 0 14px 30px rgba(16, 24, 40, .18), 0 0 0 2px color-mix(in srgb, var(--appointment-accent, #2563eb) 18%, transparent);
  transform: translateY(-1px) scale(1.01);
}

#calendarView .calendar-absence-block {
  position: absolute;
  left: 6px;
  right: 6px;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 7px 9px;
  border: 1px dashed #f59e0b;
  border-radius: 8px;
  background: rgba(255, 247, 237, .92);
  color: #92400e;
  cursor: pointer;
  pointer-events: auto;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

#calendarView .calendar-absence-block:hover,
#calendarView .calendar-absence-block:focus-visible {
  border-color: #ea580c;
  background: #ffedd5;
  box-shadow: 0 10px 24px rgba(234, 88, 12, .18);
  outline: none;
  transform: translateY(-1px);
}

#calendarView .calendar-absence-block.whole-day {
  border-style: solid;
  background: rgba(254, 243, 199, .92);
}

#calendarView .calendar-absence-block strong,
#calendarView .calendar-absence-block span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.15;
}

#calendarView .calendar-absence-week-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  min-height: 20px;
  width: 100%;
  max-width: 118px;
  margin: 5px auto 0;
  padding: 2px 8px;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #b45309;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

#calendarView .week-day-header {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: var(--calendar-week-header-height, 84px);
  padding: 9px 8px;
  border: 1px solid #dbe5f2;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: var(--navy);
  box-shadow: 0 8px 18px rgba(16, 24, 40, .045);
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}

#calendarView .week-day-header:hover,
#calendarView .week-day-header:focus-visible {
  border-color: rgba(37, 99, 235, .35);
  background: #eff6ff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, .08);
  outline: none;
  transform: translateY(-1px);
}

#calendarView .week-day-header .week-day-name {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .02em;
}

#calendarView .week-day-header strong {
  font-size: 12px;
  color: #667085;
  font-weight: 800;
}

#calendarView .week-day-header.today {
  border-color: rgba(37, 99, 235, .34);
  background: #eff6ff;
  color: var(--primary);
}

#calendarView .week-day-header.selected {
  border-color: rgba(37, 99, 235, .62);
  background: #eaf2ff;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, .18), 0 12px 26px rgba(37, 99, 235, .12);
}

#calendarView .month-absence {
  display: block;
  color: #b45309;
  background: #fff7ed;
  border-radius: 6px;
  padding: 2px 5px;
  font-weight: 800;
}

#calendarView .timeline-event span,
#calendarView .timeline-event strong {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#calendarView .timeline-event span:first-child {
  font-size: 11px;
}

#calendarView .timeline-event strong {
  font-size: 12px;
}

#calendarView .page-toolbar.compact-toolbar {
  max-width: 100%;
  overflow: hidden;
}

#calendarView .page-toolbar.compact-toolbar > * {
  min-width: 0;
}

#calendarView.doctor-calendar-mode .doctor-day-grid.doctor-only-day {
  min-width: 0;
  grid-template-columns: 64px minmax(0, 1fr);
}

#calendarView.doctor-calendar-mode .doctor-day-grid.doctor-only-week {
  min-width: 0;
  grid-template-columns: 64px repeat(7, minmax(0, 1fr));
}

#calendarView.doctor-calendar-mode .calendar-sidebar .filter-card,
#calendarView.doctor-calendar-mode .calendar-sidebar .info-card {
  display: none;
}

#calendarView.doctor-calendar-mode .doctor-header {
  justify-content: flex-start;
}

#calendarView .page-toolbar select,
#calendarView .page-toolbar button,
#calendarView .calendar-current {
  max-width: 100%;
}

#calendarView .side-stack {
  width: 100%;
  overflow: hidden;
}

#calendarView .mini-calendar,
#calendarView .filter-card,
#calendarView .info-card {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

/* Calendar controls are grouped in the right sidebar to keep the timeline clean. */
#calendarView .calendar-layout {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 292px);
  gap: 16px;
}

#calendarView .calendar-sidebar {
  position: sticky;
  top: 78px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: start;
  min-width: 0;
  max-width: 100%;
  max-height: calc(100vh - 94px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

#calendarView .calendar-sidebar-sticky {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
}

#calendarView .calendar-sidebar > .mini-calendar {
  position: sticky;
  top: 0;
  z-index: 4;
  flex: 0 0 auto;
}

#calendarView .calendar-control-card,
#calendarView .filter-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

#calendarView .calendar-control-card h3,
#calendarView .filter-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

#calendarView .sidebar-segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#calendarView .sidebar-segmented .view-button {
  width: 100%;
  padding: 10px 8px;
}

#calendarView .sidebar-period-label {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--navy);
  font-size: 13px;
  line-height: 1.35;
}

#calendarView .sidebar-navigation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#calendarView .sidebar-navigation #todayButton {
  grid-column: 1 / -1;
}

#calendarView .sidebar-navigation .secondary-button,
#calendarView .sidebar-action-button,
#calendarView .filter-card select {
  width: 100%;
}

#calendarView .sidebar-action-button {
  justify-content: center;
}

/* Lekarz sees a read-only calendar: only mini-calendar, view and navigation stay visible. */
#calendarView.calendar-doctor-mode .calendar-doctor-hidden,
#calendarView.calendar-doctor-mode .calendar-sidebar .filter-card,
#calendarView.calendar-doctor-mode .calendar-sidebar .info-card {
  display: none !important;
}

#calendarView.calendar-doctor-mode .calendar-sidebar .calendar-control-card:has(#newAppointmentButton) {
  display: none !important;
}

#calendarView.calendar-doctor-mode .calendar-card {
  width: 100%;
  min-width: 0;
}

#calendarView.calendar-doctor-mode .doctor-day-grid.doctor-only-day {
  grid-template-columns: 64px minmax(0, 1fr) !important;
  width: 100%;
}

#calendarView.calendar-doctor-mode .doctor-day-grid.doctor-only-week {
  grid-template-columns: 64px repeat(7, minmax(0, 1fr)) !important;
  width: 100%;
}

#calendarView.calendar-doctor-mode .month-grid.doctor-only-month {
  width: 100%;
}

#calendarView.calendar-doctor-mode .doctor-timeline,
#calendarView.calendar-doctor-mode .week-timeline {
  min-width: 0;
  width: 100%;
}

#calendarView.calendar-doctor-mode .appointment-card.timeline-event {
  max-width: 100%;
}

@media (max-width: 1180px) {
  #calendarView .calendar-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  #calendarView .calendar-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
  }

  #calendarView .calendar-sidebar-sticky {
    position: static;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #calendarView .calendar-sidebar > .mini-calendar {
    position: static;
  }
}

/* Reception appointment registration workspace. */
.registration-stepper {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 14px;
  margin-bottom: 16px;
  overflow: hidden;
}

.registration-stepper::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #dbe7ff 8%, #dbe7ff 92%, transparent);
  transform: translateY(-50%);
  z-index: 0;
}

.registration-step {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 850;
  padding: 7px 12px 7px 7px;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.registration-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 12px;
}

.registration-step.active {
  border-color: var(--blue);
  color: var(--blue);
  background: #eff6ff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .1);
}

.registration-step.done span {
  background: #dcfce7;
  color: #047857;
}

.registration-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.registration-step-workspace {
  grid-template-columns: minmax(310px, 390px) minmax(0, 1fr);
  min-height: calc(100vh - 335px);
  align-items: stretch;
}

.registration-search-panel,
.registration-form-panel,
.registration-side-panel,
.registration-main-panel {
  padding: 18px;
  border-radius: 14px;
}

.registration-side-panel {
  position: sticky;
  top: 80px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 0;
  max-height: calc(100vh - 320px);
  overflow: hidden;
}

.registration-main-panel {
  min-height: calc(100vh - 345px);
  max-height: calc(100vh - 320px);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  padding: 20px;
  overflow: hidden;
}

.registration-main-panel.registration-step-confirm,
.registration-main-panel.registration-step-service {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding-bottom: 0;
}

.registration-main-panel.registration-step-confirm .registration-action-bar,
.registration-main-panel.registration-step-service .registration-action-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -20px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .92), #fff 35%);
  box-shadow: 0 -12px 24px rgba(15, 23, 42, .06);
}

.registration-side-panel .settings-card-head {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.registration-side-panel .settings-card-head h2 {
  margin: 0;
  font-size: 20px;
}

.registration-single-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
}

.registration-single-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 750;
  outline: none;
}

.registration-single-search input:focus {
  border-color: rgba(37, 99, 235, .62);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

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

.registration-search-grid label,
.registration-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
}

.registration-search-grid input,
.registration-form-grid input,
.registration-form-grid select,
.registration-form-grid textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  padding: 10px 11px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.registration-search-grid input:focus,
.registration-form-grid input:focus,
.registration-form-grid select:focus,
.registration-form-grid textarea:focus {
  border-color: rgba(37, 99, 235, .62);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.registration-results {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 3px;
}

.registration-patient-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.registration-patient-row:hover {
  border-color: rgba(37, 99, 235, .35);
  background: #f8fbff;
}

.registration-patient-row.selected {
  border-color: var(--blue);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.registration-patient-row span {
  min-width: 0;
}

.registration-patient-row strong,
.registration-patient-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.registration-patient-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.registration-row-status {
  display: flex;
  justify-content: flex-end;
}

.registration-selected-card,
.registration-summary-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(37, 99, 235, .22);
  border-radius: 14px;
  background: #f8fbff;
  padding: 12px;
}

.registration-side-panel .full-width {
  width: 100%;
  justify-content: center;
}

.registration-add-patient-panel {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  width: 100%;
  min-height: 100%;
  height: 100%;
  border: 2px dashed rgba(37, 99, 235, .35);
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbff, #fff);
  color: var(--blue);
  cursor: pointer;
  text-align: center;
  padding: 28px;
  box-sizing: border-box;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}

.registration-main-panel:has(> .registration-add-patient-panel),
.registration-main-panel:has(> .registration-new-patient-form) {
  justify-content: stretch;
}

.registration-main-panel:has(> .registration-add-patient-panel) .registration-add-patient-panel {
  flex: 1 1 auto;
}

.registration-add-patient-panel:hover {
  border-color: var(--blue);
  background: #eff6ff;
  box-shadow: 0 16px 36px rgba(37, 99, 235, .12);
  transform: translateY(-1px);
}

.registration-add-patient-panel span {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 0;
  font-weight: 800;
  line-height: 1;
}

.registration-add-patient-panel span::before,
.registration-add-patient-panel span::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.registration-add-patient-panel span::before {
  width: 22px;
  height: 4px;
}

.registration-add-patient-panel span::after {
  width: 4px;
  height: 22px;
}

.registration-add-patient-panel strong {
  color: var(--navy);
  font-size: 20px;
}

.registration-add-patient-panel small {
  max-width: 360px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.registration-selected-card {
  display: block;
  border-color: var(--line);
  background: #fff;
}

.registration-selected-card small,
.registration-summary-card span,
.registration-confirm-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.registration-selected-card strong,
.registration-summary-card strong {
  display: block;
  margin-top: 3px;
  color: var(--navy);
}

.registration-summary-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.registration-step-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex: 0 0 auto;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.registration-step-head-with-search {
  align-items: flex-end;
}

.registration-service-search {
  flex: 0 0 min(320px, 42%);
  display: grid;
  gap: 6px;
  min-width: 220px;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
}

.registration-service-search span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.registration-service-search input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-weight: 750;
  padding: 9px 11px;
  outline: none;
}

.registration-service-search input:focus {
  border-color: rgba(37, 99, 235, .62);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.registration-step-head.compact {
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.registration-step-head h2 {
  margin: 0;
  color: var(--navy);
  font-size: 21px;
}

.registration-step-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.registration-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
  flex: 0 0 auto;
}

.registration-main-panel.registration-step-service .registration-card-grid {
  flex: 0 0 auto;
  min-height: 0;
  padding-bottom: 8px;
}

.registration-choice-card,
.registration-doctor-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.registration-choice-card {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
}

.registration-choice-card:hover,
.registration-doctor-card:hover {
  border-color: rgba(37, 99, 235, .4);
  background: #f8fbff;
}

.registration-choice-card.selected,
.registration-doctor-card.selected {
  border-color: var(--blue);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.registration-choice-card span,
.registration-choice-card small,
.registration-doctor-card small {
  color: var(--muted);
}

.registration-doctor-list {
  display: grid;
  align-content: start;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.registration-doctor-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 10px 12px;
}

.registration-doctor-card span {
  min-width: 0;
}

.registration-doctor-card strong,
.registration-doctor-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.registration-doctor-card em {
  color: #047857;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.registration-doctor-card.disabled,
.registration-doctor-card:disabled {
  cursor: not-allowed;
  opacity: .62;
  background: #f8fafc;
}

.registration-doctor-card.disabled:hover,
.registration-doctor-card:disabled:hover {
  border-color: var(--line);
  box-shadow: none;
  transform: none;
}

.registration-doctor-card.disabled em,
.registration-doctor-card:disabled em {
  color: #b45309;
}

.registration-date-control,
.registration-notes-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
}

.registration-date-control input,
.registration-notes-field textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  font: inherit;
  font-weight: 750;
}

.registration-time-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  align-content: start;
  flex: 0 0 auto;
}

.registration-mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 9px;
  flex: 0 0 auto;
}

.registration-day-card {
  display: grid;
  gap: 4px;
  justify-items: center;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--navy);
  padding: 10px 8px;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.registration-day-card:hover {
  border-color: rgba(37, 99, 235, .38);
  background: #f8fbff;
}

.registration-day-card.active {
  border-color: var(--blue);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.registration-day-card.disabled {
  color: var(--muted);
  background: #f8fafc;
}

.registration-day-card span,
.registration-day-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.registration-day-card strong {
  font-size: 16px;
}

.registration-confirm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
  flex: 0 0 auto;
}

.registration-main-panel.registration-step-confirm .registration-confirm-grid .registration-confirm-item:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.registration-confirm-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  padding: 13px;
}

.registration-confirm-item strong {
  display: block;
  margin-top: 4px;
  color: var(--navy);
  font-size: 15px;
}

.registration-confirm-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.registration-success-modal {
  max-width: 690px;
  overflow: hidden;
  border: 1px solid rgba(22, 163, 74, .24);
  box-shadow: 0 30px 80px rgba(15, 23, 42, .28);
}

.registration-success-backdrop {
  backdrop-filter: blur(3px);
}

.registration-success-modal .modal-header {
  align-items: center;
  padding: 24px 26px;
  background: linear-gradient(135deg, #ecfdf5, #f8fff9);
  border-bottom: 1px solid rgba(22, 163, 74, .18);
}

.registration-success-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.registration-success-title h2 {
  margin: 0;
  color: #065f46;
  font-size: 24px;
}

.registration-success-title p {
  margin: 5px 0 0;
  color: #047857;
  font-weight: 700;
}

.registration-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(22, 163, 74, .28);
}

.registration-success-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 22px 26px;
}

.registration-success-body .registration-confirm-item:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.registration-success-modal .registration-confirm-item {
  background: #fbfefc;
  border-color: rgba(22, 163, 74, .18);
}

.registration-success-modal .modal-footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 26px 24px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.registration-success-modal .modal-footer button {
  width: 100%;
  justify-content: center;
}

.registration-form-panel {
  display: grid;
  gap: 16px;
}

.registration-form-section {
  display: grid;
  gap: 12px;
  padding-top: 2px;
}

.registration-form-section h3 {
  margin: 0;
  color: var(--navy);
  font-size: 15px;
}

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

.registration-new-patient-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.registration-new-patient-form .registration-form-grid {
  flex: 1 1 auto;
  min-height: 0;
  align-content: stretch;
  grid-auto-rows: minmax(64px, 1fr);
}

.registration-new-patient-form .registration-form-grid label {
  justify-content: center;
}

.registration-form-grid .span-2 {
  grid-column: 1 / -1;
}

.registration-form-grid textarea {
  resize: vertical;
}

.registration-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.registration-action-bar-with-status .form-status {
  flex: 1 1 260px;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.registration-action-bar-with-status .form-status:empty,
.registration-main-panel > .form-status:empty {
  display: none;
}

.registration-main-panel > .form-status {
  margin: 0;
}

.registration-visit-button {
  min-width: 150px;
  box-shadow: 0 10px 20px rgba(37, 99, 235, .18);
}

.empty-state.compact {
  padding: 16px;
  min-height: auto;
}

@media (max-width: 980px) {
  .registration-stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .registration-stepper::before {
    display: none;
  }

  .registration-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .registration-side-panel {
    position: static;
    max-height: none;
  }

  .registration-main-panel,
  .registration-add-patient-panel {
    min-height: 360px;
  }

  .registration-step-head-with-search {
    align-items: stretch;
    flex-direction: column;
  }

  .registration-service-search {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }

  .registration-card-grid,
  .registration-confirm-grid,
  .registration-success-body,
  .registration-mini-calendar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .registration-search-grid,
  .registration-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Full patient profile page: separate from quick appointment registration modal. */
.full-patient-form-card {
  max-width: 1180px;
  padding: 0;
  overflow: hidden;
}

.patient-profile-form {
  display: flex;
  flex-direction: column;
}

.form-section {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 28px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
}

.section-title h3 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 17px;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.full-profile-grid label {
  min-width: 0;
}

.full-profile-grid .span-2 {
  grid-column: 1 / -1;
}

.full-profile-grid textarea {
  min-height: 86px;
  resize: vertical;
}

.consent-row {
  margin: 22px 28px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.patient-profile-form .form-message {
  margin: 12px 28px 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  padding: 20px 28px 28px;
}

.form-actions .primary-button {
  min-width: 280px;
}

@media (max-width: 900px) {
  .form-section {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 22px;
  }

  .full-profile-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .primary-button {
    width: 100%;
    min-width: 0;
  }
}

/* Patients list and selected patient card. */
.patient-controls {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
}

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

.patient-search-input {
  width: 100%;
}

.patient-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.patient-filter-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  cursor: pointer;
}

.patient-filter-tabs button.active {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 0 0 1px rgba(17, 93, 214, .08);
}

.patient-filter-tabs span {
  min-width: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 12px;
}

.result-count {
  margin: 0 0 14px;
  color: var(--muted);
}

.patients-table-card .row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.patients-table-card table {
  table-layout: fixed;
}

.patients-table-card th,
.doctors-table-card th {
  text-align: center;
}

.patients-table-card .patient-col-patient {
  width: 22%;
}

.patients-table-card .patient-col-phone,
.patients-table-card .patient-col-pesel,
.patients-table-card .patient-col-birth,
.patients-table-card .patient-col-status {
  width: 13%;
}

.patients-table-card .patient-col-last {
  width: 14%;
}

.patients-table-card .patient-col-actions {
  width: 12%;
  text-align: center;
}

.patients-table-card .patient-cell-center,
.doctors-table-card td:nth-child(2),
.doctors-table-card td:nth-child(3),
.doctors-table-card td:nth-child(4),
.doctors-table-card td:last-child {
  text-align: center;
}

.patients-table-card .patient-cell-center .status,
.patients-table-card .patient-cell-center .status-badge,
.patients-table-card .patient-cell-center .badge {
  margin-inline: auto;
}

.patients-table-card tbody tr:hover {
  background: #f8fbff;
}

.patients-table-card .table-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 850;
  text-align: center;
  cursor: pointer;
}

.patients-table-card .sort-title {
  display: inline-grid;
  grid-template-columns: 14px auto 14px;
  align-items: center;
  justify-content: center;
  column-gap: 4px;
}

.patients-table-card .sort-indicator {
  display: inline-flex;
  justify-content: center;
  width: 14px;
  min-width: 14px;
  color: var(--blue);
  font-size: 12px;
}

.patients-table-card .table-sort-button:hover,
.patients-table-card .table-sort-button.active {
  color: var(--blue);
}

.doctor-patients-table th:last-child,
.doctor-patients-table td:last-child {
  text-align: center;
}

.doctor-patients-table .row-actions.single-action {
  justify-content: center;
}

.doctor-patients-table .doctor-patient-col-center,
.doctor-patients-table .doctor-patient-cell-center {
  text-align: center;
}

.doctor-patients-table .doctor-patient-cell-center strong,
.doctor-patients-table .doctor-patient-cell-center span {
  display: block;
}

.doctor-patients-table .doctor-patient-cell-center span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.doctor-patients-table .doctor-patient-cell-center .status,
.doctor-patients-table .doctor-patient-cell-center .status-badge,
.doctor-patients-table .doctor-patient-cell-center .badge {
  margin-inline: auto;
}

.doctor-patients-table td,
.doctor-patients-table th {
  vertical-align: middle;
}

.doctor-patient-card .meta-line {
  gap: 18px;
}

.patient-card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.patient-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.15fr) 320px;
  gap: 18px;
}

.patient-summary-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, .7fr);
}

.patient-side-panel {
  display: grid;
  gap: 18px;
}

.patient-profile-header {
  padding: 0;
  overflow: hidden;
}

.patient-card-tabs {
  gap: 0;
  position: sticky;
  top: var(--topbar-height, 76px);
  z-index: 5;
  background: #fff;
}

.patient-card-tabs button {
  position: relative;
  padding: 16px 18px;
  border-radius: 0;
  transition: color .18s ease, background .18s ease;
}

.patient-card-tabs button:hover {
  color: var(--blue);
  background: #f8fbff;
}

.patient-card-tabs button.active {
  color: var(--blue);
  background: #f4f8ff;
  border-bottom-color: transparent;
}

.patient-card-tabs button.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--blue);
}

.patient-card-sections {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.patient-anchor-section {
  scroll-margin-top: calc(var(--topbar-height, 76px) + 74px);
}

#patientCardView .patient-profile-header {
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .045);
}

#patientCardView .patient-profile-header .profile-hero {
  grid-template-columns: minmax(0, 1fr) minmax(300px, auto);
  gap: 16px;
  align-items: start;
  padding: 14px 18px 10px;
}

#patientCardView .patient-profile-header .hero-person {
  align-items: stretch;
  gap: 14px;
  min-width: 0;
}

#patientCardView .patient-profile-header .mini-avatar {
  width: 96px;
  height: 96px;
  min-width: 96px;
  align-self: stretch;
  border-radius: 50%;
  font-size: 28px;
  font-weight: 850;
}

#patientCardView .patient-profile-header h1 {
  margin: 0 0 4px;
  font-size: 25px;
  line-height: 1.12;
}

#patientCardView .patient-profile-header .meta-line {
  gap: 7px 13px;
  margin-top: 6px;
  font-size: 12.5px;
}

#patientCardView .patient-profile-header .patient-card-actions {
  gap: 8px;
  align-items: flex-start;
  justify-content: flex-end;
  align-self: start;
  min-width: 0;
}

#patientCardView .patient-profile-header .patient-card-actions .secondary-button,
#patientCardView .patient-profile-header .patient-card-actions .primary-button {
  min-height: 34px;
  padding: 8px 11px;
  white-space: nowrap;
}

#patientCardView .patient-profile-header .patient-card-actions .patient-back-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
}

#patientCardView .patient-profile-header .patient-card-actions .patient-back-button .ui-icon {
  width: 17px;
  height: 17px;
}

#patientCardView .patient-card-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  max-width: calc(100% - 40px);
  margin: 0 auto 10px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbff;
}

#patientCardView .patient-card-tabs button {
  min-height: 29px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #344054;
  font-size: 12.5px;
  font-weight: 800;
}

#patientCardView .patient-card-tabs button.active {
  color: var(--blue);
  background: #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .1);
}

#patientCardView .patient-card-tabs button.active::after {
  left: 16px;
  right: 16px;
  bottom: 4px;
}

#patientCardView .patient-card-sections {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

#patientCardView .patient-anchor-section {
  position: relative;
  min-width: 0;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .035);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

#patientCardView .patient-anchor-section.active {
  border-color: rgba(37, 99, 235, .48);
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 58%, #f8fbff 100%);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .09), 0 10px 24px rgba(15, 23, 42, .055);
}

#patientCardView .patient-anchor-section.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: var(--blue);
}

#patientCardView .patient-anchor-section h3 {
  margin: 0 0 9px;
  color: var(--navy);
  font-size: 15px;
}

#patientCardView .patient-anchor-section.active h3 {
  color: var(--blue);
}

#patientCardView #patient-summary-section,
#patientCardView #patient-notes-section {
  grid-column: span 12;
}

#patientCardView #patient-visits-section {
  grid-column: span 8;
}

#patientCardView #patient-medical-section {
  grid-column: span 4;
}

#patientCardView .patient-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

#patientCardView .patient-priority-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid rgba(37, 99, 235, .22);
  border-radius: 13px;
  background: linear-gradient(135deg, #f4f8ff, #fff);
}

#patientCardView .patient-priority-card > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

#patientCardView .patient-priority-card span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .02em;
}

#patientCardView .patient-priority-card strong {
  color: var(--navy);
  font-size: 19px;
  line-height: 1.15;
}

#patientCardView .patient-priority-card small {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

#patientCardView .patient-summary-grid > div,
#patientCardView .patient-basic-grid .details-row,
#patientCardView #patient-medical-section .details-row {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #e6edf7;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

#patientCardView .patient-summary-grid span,
#patientCardView .patient-basic-grid dt,
#patientCardView #patient-medical-section dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

#patientCardView .patient-summary-grid strong,
#patientCardView .patient-basic-grid dd,
#patientCardView #patient-medical-section dd {
  margin: 0;
  color: var(--navy);
  font-size: 13px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

#patientCardView .patient-summary-grid strong {
  font-size: 15px;
}

#patientCardView .patient-basic-grid,
#patientCardView #patient-medical-section .details-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
}

#patientCardView #patient-medical-section .details-list {
  grid-template-columns: 1fr;
}

#patientCardView .patient-basic-grid .details-row,
#patientCardView #patient-medical-section .details-row {
  grid-template-columns: 1fr;
}

#patientCardView .patient-card-inline-form {
  display: block;
}

#patientCardView .patient-inline-grid {
  align-items: stretch;
}

#patientCardView .patient-inline-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
}

#patientCardView .patient-inline-field.full {
  grid-column: 1 / -1;
}

#patientCardView .patient-inline-field input,
#patientCardView .patient-inline-field select,
#patientCardView .patient-inline-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  padding: 10px 11px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

#patientCardView .patient-inline-field textarea {
  resize: vertical;
}

#patientCardView .patient-inline-field input:focus,
#patientCardView .patient-inline-field select:focus,
#patientCardView .patient-inline-field textarea:focus {
  border-color: rgba(37, 99, 235, .62);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

#patientCardView .patient-inline-medical {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#patientCardView [data-patient-inline-status] {
  margin: 10px 0 0;
}

#patientCardView .patient-visit-history {
  display: grid;
  gap: 8px;
}

#patientCardView .patient-visit-history .visit-row {
  display: grid;
  grid-template-columns: minmax(128px, .72fr) minmax(0, 1.35fr) minmax(130px, auto);
  align-items: center;
  gap: 14px;
  padding: 9px 10px;
  border: 1px solid #e6edf7;
  border-radius: 10px;
  background: #fbfdff;
}

#patientCardView .patient-visit-history .visit-time,
#patientCardView .patient-visit-history .visit-row > div:nth-child(2) {
  display: grid;
  gap: 3px;
  min-width: 0;
}

#patientCardView .patient-visit-history .visit-row > div:nth-child(2) span {
  color: var(--muted);
  font-size: 12.5px;
}

#patientCardView .patient-note-text {
  margin: 0;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fbfdff;
  color: var(--text);
}

.patient-visit-history .visit-status {
  white-space: nowrap;
}

#patientCardView .patient-visit-history .visit-status {
  justify-self: end;
}

.archive-button {
  min-height: 38px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 9px 14px;
  background: #fff7ed;
  color: #b45309;
  font-weight: 850;
}

.archive-button:hover {
  background: #ffedd5;
  border-color: #fdba74;
  color: #92400e;
}

.restore-button {
  min-height: 38px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 9px 14px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 850;
}

.restore-button:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.status.archived {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
}

.patient-edit-modal {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.patient-edit-form {
  padding: 22px;
}

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

.patient-edit-grid label {
  display: grid;
  gap: 6px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
}

.patient-edit-grid .full {
  grid-column: 1 / -1;
}

.patient-edit-grid input,
.patient-edit-grid select,
.patient-edit-grid textarea {
  width: 100%;
}

.patient-edit-form .form-actions {
  padding: 18px 0 0;
}

/* Doctors list and selected doctor card. */
.doctor-controls {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
}

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

.doctor-search-input {
  width: 100%;
  min-width: 0;
}

.doctor-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.doctor-filter-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  cursor: pointer;
}

.doctor-filter-tabs button.active {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 0 0 1px rgba(17, 93, 214, .08);
}

.doctor-filter-tabs span {
  min-width: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 12px;
}

.doctors-table-card .row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.doctors-table-card table {
  table-layout: fixed;
}

.doctors-table-card th:nth-child(1),
.doctors-table-card td:nth-child(1) {
  width: 17%;
}

.doctors-table-card th:nth-child(2),
.doctors-table-card td:nth-child(2) {
  width: 13%;
}

.doctors-table-card th:nth-child(3),
.doctors-table-card td:nth-child(3) {
  width: 14%;
}

.doctors-table-card th:nth-child(4),
.doctors-table-card td:nth-child(4) {
  width: 13%;
}

.doctors-table-card th:nth-child(5),
.doctors-table-card td:nth-child(5) {
  width: 17%;
}

.doctors-table-card th:nth-child(6),
.doctors-table-card td:nth-child(6) {
  width: 10%;
}

.doctors-table-card th:nth-child(7),
.doctors-table-card td:nth-child(7) {
  width: 16%;
}

.doctors-table-card .doctor-nowrap-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doctors-table-card td:nth-child(5).doctor-nowrap-cell {
  text-align: center;
}

.doctor-row-actions {
  justify-content: center;
  min-width: 0;
}

.doctor-row-actions .secondary-button {
  padding-inline: 12px;
}

.doctors-table-card tbody tr:hover {
  background: #f8fbff;
}

.doctor-profile-header {
  padding: 0;
  overflow: hidden;
}

.doctor-edit-card {
  padding: 0;
}

.doctor-card-edit-form {
  padding: 24px;
}

.doctor-edit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--soft-line);
}

.doctor-avatar-edit-block {
  display: grid;
  gap: 10px;
  justify-items: center;
  flex-shrink: 0;
}

.doctor-avatar-button {
  width: 100%;
  min-width: 128px;
}

.doctor-avatar-status {
  margin-top: 8px;
  color: var(--red);
}

.doctor-card-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.doctor-card-edit-grid label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--text);
  font-weight: 700;
}

.doctor-card-edit-grid input,
.doctor-card-edit-grid select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
}

.doctor-card-edit-grid input:focus,
.doctor-card-edit-grid select:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.doctor-email-field {
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.doctor-email-field input,
.doctor-card-edit-grid .doctor-email-field input,
.doctor-inline-edit-grid .doctor-email-field input {
  border-radius: 8px 0 0 8px;
  border-right: 0;
  min-width: 0;
}

.doctor-email-field span {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
  padding: 0 12px;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.doctor-email-field:focus-within span {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.doctor-card-inline-form {
  display: contents;
}

.doctor-inline-avatar {
  display: grid;
  gap: 8px;
  justify-items: center;
  align-self: stretch;
}

.doctor-inline-avatar .doctor-avatar-button {
  width: auto;
  min-width: 124px;
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12px;
}

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

.doctor-inline-edit-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 800;
}

.doctor-inline-edit-grid input,
.doctor-inline-edit-grid select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 650;
}

.doctor-inline-edit-grid input:focus,
.doctor-inline-edit-grid select:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.doctor-card-inline-form > .form-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.doctor-edit-services {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-weight: 700;
}

.doctor-services-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.doctor-services-preview span {
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}

.doctor-crop-modal {
  width: min(560px, calc(100vw - 32px));
  overflow: hidden;
}

.doctor-crop-body {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.doctor-crop-area {
  position: relative;
  width: min(360px, calc(100vw - 88px));
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #f8fafc;
  box-shadow: inset 0 0 0 999px rgba(15, 23, 42, .02);
  cursor: move;
}

.doctor-crop-area canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.doctor-crop-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 2px solid rgba(37, 99, 235, .82);
  background:
    linear-gradient(to right, transparent 32.9%, rgba(255,255,255,.55) 33%, rgba(255,255,255,.55) 33.4%, transparent 33.5%, transparent 66.4%, rgba(255,255,255,.55) 66.5%, rgba(255,255,255,.55) 66.9%, transparent 67%),
    linear-gradient(to bottom, transparent 32.9%, rgba(255,255,255,.55) 33%, rgba(255,255,255,.55) 33.4%, transparent 33.5%, transparent 66.4%, rgba(255,255,255,.55) 66.5%, rgba(255,255,255,.55) 66.9%, transparent 67%);
}

.doctor-zoom-label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.doctor-zoom-label input {
  width: 100%;
  accent-color: var(--blue);
}

.doctor-crop-actions {
  padding: 16px 22px 22px;
  border-top: 1px solid var(--line);
}

.doctor-stats {
  align-self: stretch;
  align-items: center;
}

.doctor-stats > div {
  display: grid;
  gap: 4px;
  place-items: center;
  min-height: 78px;
  border-left: 1px solid var(--soft-line);
}

.doctor-stats b {
  font-size: 24px;
}

.doctor-stats span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.doctor-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(320px, .95fr);
  gap: 18px;
}

.doctor-card-grid .card {
  min-width: 0;
}

.doctor-card-tabs {
  gap: 0;
  position: sticky;
  top: var(--topbar-height, 76px);
  z-index: 5;
  background: #fff;
}

.doctor-card-tabs button {
  position: relative;
  padding: 16px 18px;
  border-radius: 0;
  transition: color .18s ease, background .18s ease;
}

.doctor-card-tabs button:hover {
  color: var(--blue);
  background: #f8fbff;
}

.doctor-card-tabs button.active {
  color: var(--blue);
  background: #f4f8ff;
}

.doctor-card-tabs button.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--blue);
}

.doctor-tab-panel {
  margin-top: 18px;
}

.doctor-card-sections {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.doctor-anchor-section {
  scroll-margin-top: calc(var(--topbar-height, 76px) + 74px);
}

.doctor-schedule-display-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--soft-line);
}

.doctor-schedule-display-row:last-of-type {
  border-bottom: 0;
}

.doctor-schedule-display-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.doctor-schedule-display-row strong {
  font-weight: 800;
  color: var(--navy);
}

.doctor-schedule-display-row span:not(.doctor-day-badge) {
  color: var(--muted);
  font-size: 13px;
}

.doctor-day-badge {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 28px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.doctor-schedule-display-row.closed .doctor-day-badge {
  background: #eef2f6;
  color: #667085;
}

.doctor-schedule-display-row.closed strong,
.doctor-schedule-display-row.closed span:not(.doctor-day-badge) {
  color: #667085;
}

#doctorCardView .doctor-profile-header {
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .045);
}

#doctorCardView .doctor-profile-header .profile-hero {
  grid-template-columns: minmax(0, 1fr) minmax(360px, auto);
  gap: 16px;
  align-items: start;
  padding: 14px 18px 10px;
}

#doctorCardView .doctor-profile-header .hero-person {
  align-items: stretch;
  gap: 14px;
  min-width: 0;
}

#doctorCardView .doctor-profile-header .doctor-avatar-large,
#doctorCardView .doctor-profile-header .doctor-avatar,
#doctorCardView .doctor-profile-header .big-avatar {
  width: 96px !important;
  height: 96px !important;
  min-width: 96px;
  align-self: stretch;
}

#doctorCardView .doctor-profile-header h1 {
  margin: 0 0 4px;
  font-size: 25px;
  line-height: 1.12;
}

#doctorCardView .doctor-profile-header .meta-line {
  gap: 7px 13px;
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.3;
}

#doctorCardView .doctor-profile-header .patient-card-actions {
  gap: 8px;
  align-items: flex-start;
  justify-content: flex-end;
  align-self: start;
  min-width: 0;
}

#doctorCardView .doctor-profile-header .patient-card-actions .secondary-button {
  min-height: 34px;
  padding: 8px 11px;
  white-space: nowrap;
}

#doctorCardView .doctor-card-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  max-width: calc(100% - 40px);
  margin: 0 auto 10px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbff;
}

#doctorCardView .doctor-card-tabs button {
  min-height: 29px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #344054;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}

#doctorCardView .doctor-card-tabs button:hover {
  color: var(--blue);
  background: #eef5ff;
}

#doctorCardView .doctor-card-tabs button.active {
  color: var(--blue);
  background: #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .1);
}

#doctorCardView .doctor-card-tabs button.active::after {
  left: 16px;
  right: 16px;
  bottom: 4px;
}

#doctorCardView .doctor-card-sections {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
  align-items: start;
}

#doctorCardView .doctor-anchor-section {
  position: relative;
  grid-column: span 6;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

#doctorCardView .doctor-anchor-section.active {
  border-color: rgba(37, 99, 235, .62);
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 58%, #f8fbff 100%);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .09), 0 12px 28px rgba(15, 23, 42, .065);
}

#doctorCardView .doctor-anchor-section.active::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: -1px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: var(--blue);
}

#doctorCardView .doctor-anchor-section.active h3 {
  color: var(--blue);
}

#doctorCardView .doctor-anchor-section h3 {
  margin: 0 0 9px;
  color: var(--navy);
  font-size: 15px;
  letter-spacing: 0;
}

#doctorCardView #doctor-summary-section {
  grid-column: span 12;
}

#doctorCardView #doctor-schedule-section,
#doctorCardView #doctor-visits-section,
#doctorCardView #doctor-absences-section {
  grid-column: span 8;
}

#doctorCardView #doctor-services-section,
#doctorCardView #doctor-stats-section {
  grid-column: span 4;
}

#doctorCardView #doctor-stats-section {
  grid-row: span 2;
  display: flex;
  flex-direction: column;
}

#doctorCardView #doctor-services-section,
#doctorCardView #doctor-visits-section,
#doctorCardView #doctor-absences-section,
#doctorCardView #doctor-stats-section {
  align-self: stretch;
}

#doctorCardView #doctor-absences-section .section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

#doctorCardView #doctor-absences-section .section-title-row h3 {
  margin: 0;
}

.doctor-absence-add-button {
  position: relative;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(245, 158, 11, .42);
  border-radius: 8px;
  background: #fff7ed;
  color: #c2410c;
  box-shadow: 0 8px 18px rgba(245, 158, 11, .14);
}

.doctor-absence-add-button::before,
.doctor-absence-add-button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.doctor-absence-add-button::before {
  width: 14px;
  height: 3px;
}

.doctor-absence-add-button::after {
  width: 3px;
  height: 14px;
}

.doctor-absence-add-button:hover,
.doctor-absence-add-button:focus-visible {
  background: #fed7aa;
  border-color: rgba(234, 88, 12, .55);
  color: #9a3412;
  outline: none;
}

.doctor-absence-list {
  display: grid;
  gap: 8px;
}

.doctor-absence-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: #fbfdff;
}

.doctor-absence-row.cancelled {
  opacity: .72;
  background: #f8fafc;
}

.doctor-absence-row strong,
.doctor-absence-row span,
.doctor-absence-row small {
  display: block;
}

.doctor-absence-row small {
  color: var(--muted);
  margin-top: 2px;
}

.doctor-absence-modal {
  width: min(780px, calc(100vw - 40px));
  overflow: hidden;
  border: 1px solid rgba(245, 158, 11, .28);
  box-shadow: 0 30px 80px rgba(15, 23, 42, .28);
}

.doctor-absence-modal .doctor-absence-heading {
  align-items: center;
  padding: 24px 26px;
  border-bottom: 1px solid rgba(248, 113, 113, .28);
  background:
    radial-gradient(circle at 12% 18%, rgba(248, 113, 113, .24), transparent 28%),
    linear-gradient(135deg, #fff1f2, #fff7ed 58%, #fff);
}

.doctor-absence-heading-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.doctor-absence-heading-main h2 {
  margin: 0;
  color: #7f1d1d;
  font-size: 25px;
  line-height: 1.15;
}

.doctor-absence-heading-main p {
  margin: 5px 0 0;
  color: #b91c1c;
  font-weight: 800;
}

.doctor-absence-heading-icon {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid rgba(248, 113, 113, .38);
  box-shadow: 0 10px 26px rgba(248, 113, 113, .18);
}

.doctor-absence-heading-icon.warning {
  background: #ffedd5;
  color: #c2410c;
}

.doctor-absence-heading-icon .ui-icon {
  width: 21px;
  height: 21px;
}

.doctor-absence-heading .doctor-avatar {
  border: 3px solid rgba(255, 255, 255, .92);
  box-shadow: 0 12px 24px rgba(153, 27, 27, .14);
}

.doctor-absence-form {
  background: #fff;
}

.absence-confirm-body {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  color: var(--text);
}

.absence-confirm-body p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.absence-confirm-summary {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: #fff7ed;
  color: #92400e;
}

.absence-confirm-summary strong {
  color: #9a3412;
}

.absence-confirm-summary small {
  color: #b45309;
}

.doctor-absence-actions .danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid rgba(217, 45, 32, .35);
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.doctor-absence-actions .danger-button:hover,
.doctor-absence-actions .danger-button:focus-visible {
  background: #b42318;
  box-shadow: 0 12px 26px rgba(217, 45, 32, .22);
  outline: none;
}

.doctor-absence-actions .danger-button:disabled {
  cursor: wait;
  opacity: .65;
}

.absence-modal-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px 14px;
}

.absence-form-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: #fbfdff;
}

.absence-form-card:last-child {
  grid-column: 1 / -1;
}

.absence-form-label {
  color: #667085;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.absence-date-range,
.absence-time-range {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.absence-date-range .absence-form-label,
.absence-time-range .absence-form-label {
  grid-column: 1 / -1;
}

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

.absence-mode-toggle label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}

.absence-mode-toggle input {
  width: 16px;
  min-height: 16px;
  margin-right: 8px;
  accent-color: var(--blue);
}

.absence-mode-toggle label:has(input:checked) {
  border-color: rgba(37, 99, 235, .35);
  background: #eff6ff;
  color: var(--blue);
  box-shadow: 0 10px 22px rgba(37, 99, 235, .09);
}

.absence-mode-toggle label:has(input:disabled) {
  cursor: not-allowed;
  opacity: .52;
  background: #f8fafc;
  color: var(--muted);
  box-shadow: none;
}

.absence-appointment-hint {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(245, 158, 11, .28);
  border-radius: 10px;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.absence-time-range.is-disabled {
  opacity: .55;
  background: #f8fafc;
}

.doctor-absence-form [data-doctor-absence-status] {
  min-height: 18px;
  margin: 0 20px;
}

.doctor-absence-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.doctor-absence-actions button {
  width: 100%;
  justify-content: center;
}

#doctor-summary-section .details-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
}

#doctor-summary-section .details-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: #fbfdff;
}

#doctor-summary-section .details-row dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

#doctor-summary-section .details-row dd {
  min-width: 0;
  color: var(--navy);
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

#doctor-schedule-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto repeat(4, auto);
  grid-auto-flow: column;
  gap: 6px;
  align-content: start;
}

#doctor-schedule-section h3 {
  grid-column: 1 / -1;
}

#doctor-schedule-section .doctor-schedule-display-row {
  grid-template-columns: 25px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  min-height: 0;
  padding: 5px 8px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: #fbfdff;
}

#doctor-schedule-section .doctor-schedule-display-row > div {
  gap: 1px;
}

#doctor-schedule-section .doctor-schedule-display-row strong {
  font-size: 12.5px;
  line-height: 1.15;
}

#doctor-schedule-section .doctor-schedule-display-row span:not(.doctor-day-badge) {
  font-size: 12px;
  line-height: 1.15;
}

#doctor-schedule-section .doctor-day-badge {
  width: 22px;
  height: 28px;
  border-radius: 7px;
  font-size: 10.5px;
  align-self: start;
}

#doctor-schedule-section .doctor-schedule-display-row:last-of-type {
  border-bottom: 1px solid var(--soft-line);
}

#doctor-schedule-section .doctor-schedule-display-row:not(.closed) .doctor-day-badge {
  background: #dbeafe;
  color: #1d4ed8;
}

#doctor-schedule-section .doctor-schedule-display-row:not(.closed) span:not(.doctor-day-badge) {
  color: #0f766e;
  font-weight: 750;
}

#doctorCardView .doctor-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  flex: 1;
  justify-content: stretch;
  align-self: stretch;
  align-items: stretch;
  align-content: stretch;
}

#doctorCardView .doctor-stats > div {
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: #fbfdff;
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  align-items: center;
  place-items: initial;
}

#doctorCardView .doctor-stats b {
  color: var(--blue);
  font-size: 28px;
  line-height: 1;
  grid-row: auto;
}

#doctorCardView .doctor-stats span {
  text-align: left;
  line-height: 1.25;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

#doctor-visits-section .patient-visit-history {
  display: grid;
  gap: 7px;
}

#doctor-visits-section .visit-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: #fbfdff;
}

#doctor-visits-section .visit-time {
  display: grid;
  gap: 4px;
}

#doctor-visits-section .visit-time strong {
  color: var(--navy);
  font-size: 13px;
}

#doctor-visits-section .visit-time span {
  color: var(--blue);
  font-weight: 850;
}

#doctor-visits-section .visit-row > div:nth-child(2) {
  min-width: 0;
}

#doctor-visits-section .visit-row > div:nth-child(2) strong,
#doctor-visits-section .visit-row > div:nth-child(2) span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#doctor-services-section .history-service-row {
  gap: 10px;
  margin-top: 6px;
  padding: 8px 9px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: #fbfdff;
}

#doctor-services-section .empty-note {
  min-height: 44px;
  margin: 0;
  padding: 10px;
  display: flex;
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fbfdff;
}

#doctor-services-section .history-service-row:first-of-type {
  margin-top: 0;
}

#doctor-services-section .history-service-row strong {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--blue);
  font-size: 12px;
  white-space: nowrap;
}

#doctor-visits-section .empty-note {
  min-height: 40px;
  margin: 0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fbfdff;
}

@media (max-width: 1180px) {
  #patientCardView .patient-profile-header .profile-hero {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  #patientCardView .patient-profile-header .patient-card-actions {
    justify-content: flex-start;
  }

  #patientCardView .patient-card-tabs {
    margin-inline: auto;
  }

  #patientCardView .patient-card-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #patientCardView #patient-summary-section,
  #patientCardView #patient-visits-section,
  #patientCardView #patient-medical-section,
  #patientCardView #patient-notes-section {
    grid-column: span 2;
  }

  #patientCardView .patient-summary-grid,
  #patientCardView .patient-basic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #patientCardView .patient-visit-history .visit-row {
    grid-template-columns: minmax(110px, .7fr) minmax(0, 1fr);
  }

  #patientCardView .patient-visit-history .visit-status {
    grid-column: 1 / -1;
    justify-self: start;
  }

  #doctorCardView .doctor-profile-header .profile-hero {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  #doctorCardView .doctor-card-tabs {
    margin-inline: auto;
  }

  #doctorCardView .doctor-profile-header .patient-card-actions {
    justify-content: flex-start;
  }

  #doctorCardView .doctor-card-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #doctorCardView #doctor-summary-section,
  #doctorCardView #doctor-schedule-section,
  #doctorCardView #doctor-services-section,
  #doctorCardView #doctor-visits-section,
  #doctorCardView #doctor-absences-section,
  #doctorCardView #doctor-stats-section {
    grid-column: span 2;
  }

  #doctorCardView #doctor-stats-section {
    grid-row: auto;
  }

  #doctor-summary-section .details-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #doctorCardView .doctor-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #patientCardView .patient-card-tabs {
    width: auto;
    max-width: none;
    margin-inline: 20px;
    border-radius: 14px;
  }

  #patientCardView .patient-profile-header .mini-avatar {
    width: 64px;
    height: 64px;
    min-width: 64px;
    font-size: 20px;
  }

  #patientCardView .patient-profile-header h1 {
    font-size: 23px;
  }

  #patientCardView .patient-card-sections,
  #patientCardView .patient-summary-grid,
  #patientCardView .patient-basic-grid {
    grid-template-columns: 1fr;
  }

  #patientCardView .patient-priority-card {
    align-items: flex-start;
    flex-direction: column;
  }

  #patientCardView .patient-visit-history .visit-row,
  .patient-edit-grid {
    grid-template-columns: 1fr;
  }

  #patientCardView #patient-summary-section,
  #patientCardView #patient-visits-section,
  #patientCardView #patient-medical-section,
  #patientCardView #patient-notes-section {
    grid-column: span 1;
  }

  #doctorCardView .doctor-card-tabs {
    width: auto;
    max-width: none;
    margin-inline: 20px;
    border-radius: 14px;
  }

  #doctorCardView .doctor-profile-header .doctor-avatar-large,
  #doctorCardView .doctor-profile-header .doctor-avatar,
  #doctorCardView .doctor-profile-header .big-avatar {
    width: 64px !important;
    height: 64px !important;
    min-width: 64px;
  }

  #doctorCardView .doctor-profile-header h1 {
    font-size: 23px;
  }

  #doctorCardView .doctor-card-sections,
  #doctor-summary-section .details-list,
  #doctor-schedule-section,
  #doctorCardView .doctor-stats {
    grid-template-columns: 1fr;
  }

  #doctor-schedule-section {
    grid-template-rows: auto;
    grid-auto-flow: row;
  }

  #doctorCardView .doctor-stats > div {
    grid-template-columns: 1fr;
  }

  #doctorCardView .doctor-stats b {
    grid-row: auto;
  }

  #doctorCardView #doctor-summary-section,
  #doctorCardView #doctor-schedule-section,
  #doctorCardView #doctor-services-section,
  #doctorCardView #doctor-visits-section,
  #doctorCardView #doctor-absences-section,
  #doctorCardView #doctor-stats-section {
    grid-column: 1;
  }

  #doctorCardView #doctor-stats-section {
    grid-row: auto;
  }

  #doctor-visits-section .visit-row {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

.muted-note {
  margin-top: 12px;
  color: var(--muted);
}

.doctor-modal,
.doctor-schedule-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.doctor-schedule-form {
  padding: 22px;
}

.doctor-schedule-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.schedule-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 140px 140px;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfdff;
}

.schedule-row label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: var(--navy);
}

.schedule-row input[type="time"] {
  width: 100%;
}

.schedule-active {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

/* Rooms / cabinets master-detail screen. */
.rooms-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
}

.rooms-main {
  min-width: 0;
}

.room-controls {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
}

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

.room-search-input {
  min-width: 0;
  width: 100%;
}

.room-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.room-filter-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  cursor: pointer;
}

.room-filter-tabs button.active {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 0 0 1px rgba(17, 93, 214, .08);
}

.room-filter-tabs span {
  min-width: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 12px;
}

.rooms-table-card .row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.rooms-table-card th:nth-child(2),
.rooms-table-card th:nth-child(3),
.rooms-table-card th:nth-child(4),
.rooms-table-card th:nth-child(6),
.rooms-table-card td.room-number-cell,
.rooms-table-card td.room-floor-cell,
.rooms-table-card td.room-status-cell,
.rooms-table-card td.room-actions-cell {
  text-align: center;
}

.rooms-table-card td.room-status-cell .status-badge {
  margin-inline: auto;
}

.rooms-table-card .person-cell > div {
  min-width: 0;
}

.rooms-table-card .person-cell > div > strong,
.rooms-table-card .person-cell > div > span {
  display: block;
}

.rooms-table-card .person-cell > div > span {
  color: var(--muted);
  font-size: 12px;
}

.rooms-table-card tbody tr.selected {
  background: #f2f7ff;
  box-shadow: inset 3px 0 0 var(--blue);
}
.rooms-table-card tbody tr[data-cabinet-row] {
  cursor: pointer;
}
.rooms-table-card tbody tr[data-cabinet-row]:not(.selected):hover {
  background: #f8fbff;
}
.rooms-table-card tbody tr.selected:hover {
  background: #eef5ff;
}

.room-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  max-width: 42px;
  flex: 0 0 42px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
}

.room-icon.large {
  width: 64px;
  height: 64px;
  min-width: 64px;
  max-width: 64px;
  flex-basis: 64px;
  font-size: 18px;
}

.assigned-doctors {
  display: flex;
  align-items: center;
  gap: 6px;
}

.assigned-doctors .mini-avatar {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.avatar-count {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f2f4f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.room-detail {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 14px;
}

.room-detail-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-right: 36px;
}

.room-detail-head h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.room-detail-head p,
.room-detail-head span {
  color: var(--muted);
}

.room-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.room-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.room-metrics div {
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
}

.room-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.room-panel-section {
  border-top: 1px solid var(--soft-line);
  padding-top: 14px;
}

.room-detail .cabinet-visit-history {
  display: grid;
  gap: 10px;
}

.room-detail .cabinet-visit-row {
  display: grid;
  grid-template-columns: minmax(82px, .8fr) minmax(0, 1.15fr) minmax(92px, auto);
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfdff;
}

.room-detail .cabinet-visit-row > div {
  min-width: 0;
}

.room-detail .cabinet-visit-row strong,
.room-detail .cabinet-visit-row span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-detail .cabinet-visit-row .visit-row-meta {
  justify-items: end;
  text-align: right;
}

.room-detail .cabinet-visit-row .status-badge {
  max-width: 100%;
  white-space: nowrap;
}

.equipment-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.equipment-tags span {
  padding: 6px 10px;
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  color: #087443;
  background: #fbfffd;
  font-weight: 700;
  font-size: 12px;
}

.doctor-mini-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
}

.doctor-mini-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.context-wrap {
  position: relative;
}

.context-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 170px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.context-menu button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  color: var(--navy);
  font-weight: 700;
}

.context-menu button:hover {
  background: #f4f7fb;
}

.context-menu button.danger {
  color: var(--red);
}

.cabinet-modal {
  width: min(820px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.cabinet-form {
  padding: 22px;
}

.cabinet-form .form-actions {
  padding-top: 18px;
}

/* Medical services management. */
.services-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
}

.services-main {
  min-width: 0;
}

.service-controls {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
}

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

.service-search-input {
  min-width: 0;
  width: 100%;
}

.service-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.service-filter-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  cursor: pointer;
}

.service-filter-tabs button.active {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 0 0 1px rgba(17, 93, 214, .08);
}

.service-filter-tabs span {
  min-width: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 12px;
}

.services-table-card .row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.services-table-card table {
  table-layout: fixed;
}

.services-table-card th:nth-child(1),
.services-table-card td:nth-child(1) {
  width: 30%;
}

.services-table-card th:nth-child(2),
.services-table-card td:nth-child(2) {
  width: 17%;
}

.services-table-card th:nth-child(3),
.services-table-card td:nth-child(3),
.services-table-card th:nth-child(4),
.services-table-card td:nth-child(4),
.services-table-card th:nth-child(5),
.services-table-card td:nth-child(5) {
  width: 13%;
}

.services-table-card th:nth-child(6),
.services-table-card td:nth-child(6) {
  width: 24%;
}

.services-table-card th:nth-child(2),
.services-table-card th:nth-child(3),
.services-table-card th:nth-child(4),
.services-table-card th:nth-child(5),
.services-table-card th:nth-child(6),
.services-table-card td.service-specialization-cell,
.services-table-card td.service-duration-cell,
.services-table-card td.service-price-cell,
.services-table-card td.service-status-cell,
.services-table-card td.service-actions-cell {
  text-align: center;
}

.services-table-card td.service-status-cell .status-badge {
  margin-inline: auto;
}

.service-name-cell > div:last-child {
  min-width: 0;
}

.service-name-cell strong,
.service-name-cell span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-row-actions {
  justify-content: center;
  min-width: 0;
}

.service-row-actions .secondary-button {
  padding-inline: 12px;
}

.services-table-card tbody tr[data-service-row] {
  cursor: pointer;
}

.services-table-card tbody tr[data-service-row]:hover {
  background: #f8fbff;
}

.services-table-card tbody tr.selected {
  background: #f2f7ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 22px;
  align-items: start;
  min-width: 0;
}

.users-main {
  min-width: 0;
}

#usersView.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-height, 86px) - 62px);
  min-height: 0;
  overflow: hidden;
}

#usersView.active .page-head {
  flex: 0 0 auto;
}

#usersView.active .users-layout {
  flex: 1 1 auto;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}

#usersView.active .users-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#usersView.active .user-controls {
  flex: 0 0 auto;
}

#usersView.active .users-table-card {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.user-controls {
  padding: 18px;
  margin-bottom: 18px;
}

.user-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.user-filter-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #1f2f4d;
  font-weight: 700;
}

.user-filter-tabs button.active {
  border-color: var(--blue);
  color: var(--blue);
  background: #f6faff;
}

.user-filter-tabs span {
  min-width: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
}

.users-table-card table {
  table-layout: fixed;
}

.users-table-card th:nth-child(1),
.users-table-card td:nth-child(1) {
  width: 28%;
  text-align: left;
}

.users-table-card th:nth-child(2),
.users-table-card td:nth-child(2) {
  width: 27%;
  text-align: center;
  vertical-align: middle;
}

.users-table-card th:nth-child(3),
.users-table-card td:nth-child(3),
.users-table-card th:nth-child(4),
.users-table-card td:nth-child(4) {
  width: 14%;
  text-align: center;
  vertical-align: middle;
}

.users-table-card th:nth-child(5),
.users-table-card td:nth-child(5) {
  width: 17%;
  text-align: center;
  vertical-align: middle;
}

.users-table-card td > span,
.users-table-card .person-cell span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.users-table-card .row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.users-table-card .row-actions.single-action {
  justify-content: center;
}

.users-table-card .status {
  display: inline-flex;
  justify-content: center;
  white-space: nowrap;
  min-width: max-content;
  width: auto;
  flex-shrink: 0;
}

.users-table-card [data-user-menu],
.users-table-card .context-wrap {
  display: none !important;
}

.users-table-card td,
.users-table-card td strong,
.users-table-card td span {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.users-table-card tbody tr[data-user-row] {
  cursor: pointer;
}

.users-table-card tbody tr[data-user-row]:not(.selected):hover {
  background: #f8fbff;
}

.users-table-card tbody tr.selected {
  background: #f2f7ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.users-table-card tbody tr.selected:hover {
  background: #eef5ff;
}

.user-detail {
  position: sticky;
  top: calc(var(--topbar-height, 86px) + 18px);
  align-self: start;
  padding: 22px;
  min-width: 0;
  max-width: 100%;
  max-height: calc(100vh - var(--topbar-height, 86px) - 36px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

#usersView.active .user-detail {
  position: sticky;
  top: 0;
  height: 100%;
  max-height: 100%;
  align-self: stretch;
}

.user-detail,
.user-detail * {
  min-width: 0;
  box-sizing: border-box;
}

.user-detail-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--soft-line);
  min-width: 0;
}

.user-detail-title {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.user-detail-head h2 {
  margin: 0 0 4px;
  font-size: 24px;
  overflow-wrap: anywhere;
}

.user-detail-head p {
  margin: 0 0 8px;
  color: var(--muted);
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.user-avatar {
  width: 64px;
  height: 64px;
  font-size: 20px;
  flex-shrink: 0;
}

.user-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.user-detail .room-panel-section {
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--soft-line);
}

.user-detail .room-panel-section:first-of-type {
  margin-top: 0;
}

.user-detail .room-panel-section h3 {
  margin-bottom: 12px;
  font-size: 16px;
}

.user-info-list,
.user-info-list div,
.user-info-list strong {
  min-width: 0;
  max-width: 100%;
}

.user-info-list {
  padding: 0;
  grid-template-columns: 1fr;
  gap: 8px;
}

.user-info-list div {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  align-content: center;
  gap: 12px;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid rgba(37, 99, 235, .13);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .08), rgba(14, 165, 233, .05)),
    #f8fbff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.86);
  text-align: left;
  overflow: hidden;
}

.user-info-list div:nth-child(2n) {
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .08), rgba(14, 165, 233, .05)),
    #f8fbff;
  border-color: rgba(37, 99, 235, .13);
}

.user-info-list div:nth-child(3n) {
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .08), rgba(14, 165, 233, .05)),
    #f8fbff;
  border-color: rgba(37, 99, 235, .13);
}

.user-info-list dt {
  margin: 0;
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  line-height: 1.15;
  text-transform: uppercase;
}

.user-info-list dd {
  margin: 0;
  width: auto;
  min-width: 0;
  color: #0f172a;
  line-height: 1.25;
  text-align: right;
}

.user-info-list strong {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  display: block;
  font-size: 13px;
  font-weight: 850;
  text-align: right;
}

.doctor-mini-row {
  min-width: 0;
}

.user-linked-doctor-section {
  background: linear-gradient(180deg, #fbfdff, #fff);
}

.user-linked-doctor-card {
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: #f8fbff;
}

.doctor-mini-row div,
.doctor-mini-row strong,
.doctor-mini-row span {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.user-warning {
  color: #b42318;
  background: #fff3f3;
  border: 1px solid #ffd6d6;
  border-radius: 8px;
  padding: 10px 12px;
}

.users-pagination select {
  min-height: 38px;
  margin-left: 6px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.users-pagination .pager-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.user-detail-empty {
  min-height: 220px;
}

@media (max-width: 1180px) {
  .users-layout {
    grid-template-columns: 1fr;
  }
  .user-detail {
    position: static;
  }
}

.service-icon {
  position: relative;
  width: 42px;
  height: 42px;
  min-width: 42px;
  max-width: 42px;
  flex: 0 0 42px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.service-icon::before,
.service-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.service-icon::before {
  width: 13px;
  height: 3px;
}

.service-icon::after {
  width: 3px;
  height: 13px;
}

.service-icon.general { background: #f1f5f9; color: #475569; }
.service-icon.internal { background: #eef4ff; color: var(--blue); }
.service-icon.cardiology { background: var(--green-soft); color: var(--green); }
.service-icon.dermatology { background: var(--orange-soft); color: var(--orange); }
.service-icon.pediatrics { background: var(--purple-soft); color: var(--purple); }
.service-icon.neurology { background: #ecfeff; color: #0891b2; }
.service-icon.gynecology { background: #fdf2f8; color: #db2777; }
.service-icon.orthopedics { background: #f5f3ff; color: #7c3aed; }
.service-icon.diagnostics { background: #f0fdfa; color: #0f766e; }
.service-icon.psychology { background: #fce7f3; color: #be185d; }
.service-icon.physiotherapy { background: #ecfdf5; color: #047857; }
.service-icon.endocrinology { background: #fff7ed; color: #c2410c; }
.service-icon.gastroenterology { background: #fefce8; color: #a16207; }
.service-icon.diabetology { background: #eff6ff; color: #1d4ed8; }
.service-icon.pulmonology { background: #f0f9ff; color: #0369a1; }
.service-icon.laryngology { background: #faf5ff; color: #9333ea; }
.service-icon.procedure { background: #fee2e2; color: #b91c1c; }
.service-icon.lab { background: #e0f2fe; color: #0e7490; }

.service-icon.large {
  width: 60px;
  height: 60px;
  min-width: 60px;
  max-width: 60px;
}

.service-icon.large::before {
  width: 18px;
  height: 4px;
}

.service-icon.large::after {
  width: 4px;
  height: 18px;
}

.service-detail {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.service-detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.service-detail-head h2 {
  margin-bottom: 4px;
}

.service-detail-status {
  margin: 2px 0 6px;
}

.service-detail-head p {
  color: var(--muted);
}

.compact-tabs {
  gap: 0;
  overflow: auto;
}

.compact-tabs button {
  white-space: nowrap;
}

.service-panel-section {
  border-top: 1px solid var(--soft-line);
  padding-top: 14px;
}

.service-detail-summary .info-list div {
  align-items: flex-start;
}

.service-detail .patient-visit-history {
  display: grid;
  gap: 10px;
}

.service-detail .visit-row {
  display: grid;
  grid-template-columns: minmax(84px, .8fr) minmax(0, 1.2fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfdff;
}

.service-detail .visit-row > div {
  min-width: 0;
}

.service-detail .history-person {
  padding: 10px 0;
}

.service-detail .history-person + .history-person {
  border-top: 1px solid var(--soft-line);
}

.service-modal {
  width: min(820px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid rgba(245, 158, 11, .26);
  box-shadow: 0 30px 80px rgba(15, 23, 42, .28);
}

.service-form {
  display: grid;
  gap: 0;
  background: #fff;
}

.service-form-grid textarea {
  min-height: 108px;
}

.service-form .modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 18px 26px 24px;
  border-top: 1px solid var(--soft-line);
  background: #fff;
}

.service-form .modal-actions button {
  width: 100%;
  justify-content: center;
}

.service-modal-heading {
  align-items: center;
  padding: 24px 26px;
  border-bottom: 1px solid rgba(245, 158, 11, .20);
  background:
    radial-gradient(circle at 12% 18%, rgba(251, 191, 36, .22), transparent 28%),
    linear-gradient(135deg, #fff7ed, #fffbeb 58%, #fff);
}

.service-modal-heading-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 15px;
}

.service-modal-heading h2 {
  margin: 0;
  color: #7c2d12;
  font-size: 25px;
  line-height: 1.15;
}

.service-modal-heading p {
  margin: 5px 0 0;
  color: #9a3412;
  font-size: 14px;
  font-weight: 800;
}

.service-modal-heading-icon {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, .34);
  box-shadow: 0 10px 26px rgba(245, 158, 11, .18);
}

.service-modal-heading-icon .ui-icon {
  width: 22px;
  height: 22px;
}

.service-modal-heading-icon.internal { background: #eef4ff; color: var(--blue); border-color: rgba(37, 99, 235, .18); box-shadow: 0 10px 26px rgba(37, 99, 235, .12); }
.service-modal-heading-icon.cardiology { background: var(--green-soft); color: var(--green); border-color: rgba(22, 163, 74, .20); box-shadow: 0 10px 26px rgba(22, 163, 74, .12); }
.service-modal-heading-icon.dermatology { background: var(--orange-soft); color: var(--orange); }
.service-modal-heading-icon.pediatrics { background: var(--purple-soft); color: var(--purple); border-color: rgba(124, 58, 237, .18); box-shadow: 0 10px 26px rgba(124, 58, 237, .12); }
.service-modal-heading-icon.neurology { background: #ecfeff; color: #0891b2; border-color: rgba(8, 145, 178, .18); box-shadow: 0 10px 26px rgba(8, 145, 178, .12); }
.service-modal-heading-icon.gynecology { background: #fdf2f8; color: #db2777; border-color: rgba(219, 39, 119, .18); box-shadow: 0 10px 26px rgba(219, 39, 119, .12); }
.service-modal-heading-icon.orthopedics { background: #f5f3ff; color: #7c3aed; border-color: rgba(124, 58, 237, .18); box-shadow: 0 10px 26px rgba(124, 58, 237, .12); }
.service-modal-heading-icon.diagnostics { background: #f0fdfa; color: #0f766e; border-color: rgba(15, 118, 110, .18); box-shadow: 0 10px 26px rgba(15, 118, 110, .12); }
.service-modal-heading-icon.psychology { background: #fce7f3; color: #be185d; border-color: rgba(190, 24, 93, .18); box-shadow: 0 10px 26px rgba(190, 24, 93, .12); }
.service-modal-heading-icon.physiotherapy { background: #ecfdf5; color: #047857; border-color: rgba(4, 120, 87, .18); box-shadow: 0 10px 26px rgba(4, 120, 87, .12); }
.service-modal-heading-icon.endocrinology { background: #fff7ed; color: #c2410c; border-color: rgba(194, 65, 12, .18); box-shadow: 0 10px 26px rgba(194, 65, 12, .12); }
.service-modal-heading-icon.gastroenterology { background: #fefce8; color: #a16207; border-color: rgba(161, 98, 7, .18); box-shadow: 0 10px 26px rgba(161, 98, 7, .12); }
.service-modal-heading-icon.diabetology { background: #eff6ff; color: #1d4ed8; border-color: rgba(29, 78, 216, .18); box-shadow: 0 10px 26px rgba(29, 78, 216, .12); }
.service-modal-heading-icon.pulmonology { background: #f0f9ff; color: #0369a1; border-color: rgba(3, 105, 161, .18); box-shadow: 0 10px 26px rgba(3, 105, 161, .12); }
.service-modal-heading-icon.laryngology { background: #faf5ff; color: #9333ea; border-color: rgba(147, 51, 234, .18); box-shadow: 0 10px 26px rgba(147, 51, 234, .12); }
.service-modal-heading-icon.procedure { background: #fee2e2; color: #b91c1c; border-color: rgba(185, 28, 28, .18); box-shadow: 0 10px 26px rgba(185, 28, 28, .12); }
.service-modal-heading-icon.lab { background: #e0f2fe; color: #0e7490; border-color: rgba(14, 116, 144, .18); box-shadow: 0 10px 26px rgba(14, 116, 144, .12); }

.service-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px 16px;
}

.service-form-grid label {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: #fbfdff;
  color: #667085;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.service-form-grid label.full-width {
  grid-column: 1 / -1;
}

.service-form-grid input,
.service-form-grid select,
.service-form-grid textarea {
  width: 100%;
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.modal-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.duration-quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  text-transform: none;
  letter-spacing: 0;
}

.duration-quick-buttons button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--blue);
  font-weight: 800;
  cursor: pointer;
}

.duration-quick-buttons button:hover {
  border-color: var(--blue);
  background: #eef4ff;
}

.service-form .form-status {
  min-height: 20px;
  margin: -4px 26px 14px;
}

@media (max-width: 720px) {
  .service-form-grid,
  .service-form .modal-actions {
    grid-template-columns: 1fr;
  }
}

.danger-text {
  color: var(--red);
  border-color: #ffd5d5;
}

/* Visit history screen. */
.history-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}

.history-main {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.history-toolbar {
  padding: 16px;
}

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

.history-search {
  min-width: 0;
}

.history-sidebar {
  position: sticky;
  top: 104px;
  display: grid;
  gap: 16px;
}

.history-filter-card,
.history-summary-card,
.history-services-card {
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.04);
}

.history-side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

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

.history-filter-card {
  display: grid;
  gap: 12px;
}

.history-filter-card label {
  gap: 6px;
  font-size: 13px;
}

.history-filter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.history-table-card {
  overflow: hidden;
}

.history-table-card table {
  table-layout: fixed;
}

.history-table-card th,
.history-table-card td {
  padding: 16px 18px;
  vertical-align: middle;
}

.history-table-card tbody tr {
  height: 74px;
}

.history-table-card th:nth-child(1) { width: 122px; }
.history-table-card th:nth-child(2) { width: 166px; }
.history-table-card th:nth-child(3) { width: 166px; }
.history-table-card th:nth-child(4) { width: 150px; }
.history-table-card th:nth-child(5) { width: 180px; }
.history-table-card th:nth-child(6) { width: 134px; }
.history-table-card th:nth-child(7) { width: 220px; }
.history-table-card th:nth-child(8) { width: 148px; }

.history-table-card th:last-child,
.history-table-card td:last-child {
  padding-left: 12px;
  padding-right: 12px;
  text-align: center;
}

.doctor-history-table th:nth-child(1) { width: 140px; }
.doctor-history-table th:nth-child(2) { width: 260px; }
.doctor-history-table th:nth-child(3) { width: 240px; }
.doctor-history-table th:nth-child(4) { width: 150px; }
.doctor-history-table th:nth-child(5) { width: 130px; }

.doctor-history-table .history-actions {
  justify-content: center;
}

.doctor-history-table th,
.doctor-history-table td {
  text-align: center;
}

.doctor-history-table .history-date-cell,
.doctor-history-table .history-service-cell,
.doctor-history-table .history-person-text {
  justify-items: center;
  text-align: center;
}

.doctor-history-table .history-person {
  justify-content: center;
}

.doctor-history-table td:nth-child(4) .status-badge,
.doctor-history-table td:nth-child(4) .visit-status,
.doctor-history-table td:nth-child(4) > span {
  margin-inline: auto;
}

.doctor-history-layout .history-filter-card label {
  margin-bottom: 10px;
}

.history-table-card td,
.history-table-card td span {
  color: #253858;
}

.history-table-card td > span,
.history-table-card .person-cell span,
.history-table-card td br + span {
  color: var(--muted);
  font-size: 13px;
}

.history-date-cell,
.history-service-cell,
.history-cabinet-cell,
.history-person-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.history-date-cell strong,
.history-service-cell strong,
.history-cabinet-cell strong,
.history-person-text strong {
  display: block;
  color: #101828;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-date-cell span,
.history-service-cell span,
.history-cabinet-cell span,
.history-person-text span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.history-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0c3aa, #eef5ff);
  color: #1f2937;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.history-avatar.doctor-avatar-small {
  width: 32px;
  height: 32px;
  min-width: 32px;
}

.history-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #344054;
  min-width: 0;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}

.visit-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  vertical-align: middle;
}

.visit-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.visit-status.planned {
  background: var(--blue-soft);
  color: var(--blue);
}

.visit-status.in-progress {
  background: var(--purple-soft);
  color: var(--purple);
}

.visit-status.done {
  background: var(--green-soft);
  color: var(--green);
}

.visit-status.cancelled {
  background: var(--red-soft);
  color: var(--red);
}

.visit-status.no-show {
  background: #eef2f6;
  color: #475467;
}

.history-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  white-space: nowrap;
}

.history-actions .secondary-button {
  min-height: 36px;
  padding: 0 12px;
}

.history-actions {
  gap: 8px;
}

.secondary-button.danger-soft {
  border-color: #fecaca;
  color: #b42318;
  background: #fff5f5;
}

.secondary-button.danger-soft:hover {
  border-color: #fca5a5;
  background: #fee2e2;
}

.history-actions .icon-only {
  width: 36px;
  min-width: 36px;
  padding: 0;
}

.visit-details-modal {
  width: min(900px, calc(100vw - 40px));
  max-height: calc(100vh - 56px);
  overflow: auto;
  border: 1px solid rgba(37, 99, 235, 0.14);
}

.visit-details-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 62%);
}

.visit-details-heading h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

.visit-details-heading p {
  color: var(--muted);
  font-size: 14px;
}

.visit-details-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
  background: #f8fbff;
}

.visit-detail-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.04);
}

.visit-detail-card h3 {
  margin-bottom: 14px;
  color: #101828;
}

.visit-detail-person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #f8fbff;
}

.visit-detail-person strong,
.visit-detail-person span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.visit-detail-person span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.visit-detail-card.span-2 {
  grid-column: span 2;
}

.visit-detail-grid {
  display: grid;
  gap: 10px;
}

.visit-detail-row,
.visit-change-row {
  display: grid;
  grid-template-columns: minmax(130px, .75fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--soft-line);
}

.visit-detail-row:last-child,
.visit-change-row:last-child {
  border-bottom: 0;
}

.visit-detail-row span,
.visit-change-row span,
.visit-notes-grid span {
  color: var(--muted);
  font-size: 13px;
}

.visit-detail-row strong,
.visit-change-row strong {
  min-width: 0;
  color: #101828;
  font-weight: 800;
  overflow-wrap: anywhere;
}

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

.visit-notes-grid div {
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfdff;
}

.visit-notes-grid p {
  margin-top: 8px;
  color: #101828;
}

.visit-details-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-top: 1px solid var(--soft-line);
  color: #344054;
}

.history-pagination label {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.history-pagination select {
  width: 76px;
}

.history-page-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-summary-card h3,
.history-services-card h3 {
  margin-bottom: 2px;
}

.history-summary-card small,
.history-services-card small {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
}

.history-summary-row,
.history-service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
}

.history-summary-row span,
.history-service-row span {
  color: #344054;
}

.history-summary-row strong,
.history-service-row strong {
  color: #101828;
}

.history-summary-row.planned strong { color: var(--blue); }
.history-summary-row.in-progress strong { color: var(--purple); }
.history-summary-row.done strong { color: var(--green); }
.history-summary-row.cancelled strong { color: var(--red); }
.history-summary-row.no-show strong { color: #475467; }

@media (max-width: 1180px) {
  .patient-card-grid {
    grid-template-columns: 1fr;
  }

  .patient-profile-header .profile-hero,
  .doctor-profile-header .profile-hero {
    grid-template-columns: 1fr;
  }

  .doctor-card-grid {
    grid-template-columns: 1fr;
  }

  .doctor-edit-head {
    flex-direction: column;
  }

  .doctor-card-edit-grid {
    grid-template-columns: 1fr;
  }

  .doctor-inline-edit-grid {
    grid-template-columns: 1fr;
  }

  .doctor-control-row {
    grid-template-columns: 1fr;
  }

  .rooms-layout {
    grid-template-columns: 1fr;
  }

  .room-detail {
    position: static;
  }

  .services-layout {
    grid-template-columns: 1fr;
  }

  .service-detail {
    position: static;
  }

  .service-control-row {
    grid-template-columns: 1fr;
  }

  .history-layout {
    grid-template-columns: 1fr;
  }

  .history-sidebar {
    position: static;
  }

  .history-toolbar-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .patient-control-row {
    grid-template-columns: 1fr;
  }

  .patients-table-card {
    overflow-x: auto;
  }
}

/* Visual consistency pass: shared MediPlus UI system. */
:root {
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --focus: 0 0 0 3px rgba(11, 91, 211, 0.14);
}

body {
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.content,
.workspace,
.view,
.card,
.table-card,
.details-panel,
.info-card,
.modal {
  min-width: 0;
}

.card,
.table-card,
.details-panel,
.info-card,
.page-toolbar,
.patient-controls,
.doctor-controls,
.room-controls,
.service-controls,
.user-controls,
.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.055);
}

.card,
.details-panel,
.info-card {
  padding: 20px;
}

.card-title,
.settings-card-head,
.modal-heading,
.modal-head,
.visit-details-heading {
  gap: 14px;
}

.card h3,
.details-panel h3,
.settings-card h3,
.modal h2 {
  color: #101828;
  letter-spacing: 0;
}

.empty-note,
.user-detail-empty,
.placeholder p {
  color: var(--muted);
  font-weight: 600;
}

.empty-note {
  display: block;
  margin: 0;
  padding: 14px 16px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  background: #f8fbff;
}

#appointmentModal .time-slot-buttons .time-slot-empty {
  color: #b42318;
  border: 1px solid #fda29b;
  background: #fef3f2;
  font-weight: 700;
}

#appointmentModal .time-slot-buttons .time-slot-empty::before {
  content: "⚠";
  margin-right: 8px;
  color: #d92d20;
}

button,
.primary-button,
.secondary-button,
.view-button,
.ghost-button,
.link-button,
.footer-link {
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.primary-button,
.secondary-button,
.view-button,
.ghost-button {
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.primary-button {
  box-shadow: 0 8px 18px rgba(11, 91, 211, 0.16);
}

.primary-button:hover {
  border-color: var(--blue-dark);
  box-shadow: 0 10px 22px rgba(11, 91, 211, 0.2);
}

.secondary-button:hover,
.ghost-button:hover,
.view-button:hover {
  border-color: #b7c7dc;
  background: #f8fbff;
  color: var(--blue);
}

.secondary-button.active,
.view-button.active,
.pager-buttons .secondary-button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(11, 91, 211, 0.16);
}

.secondary-button.danger-text,
.danger-text,
.context-menu button.danger {
  color: var(--red);
}

button:disabled,
.primary-button:disabled,
.secondary-button:disabled,
.view-button:disabled {
  cursor: not-allowed;
  opacity: .56;
  box-shadow: none;
}

.icon-only,
.icon-button,
.modal-close {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

input,
select,
textarea {
  border-radius: var(--radius-sm);
  border-color: #d7e1ee;
  color: #101828;
}

input::placeholder,
textarea::placeholder {
  color: #8a97aa;
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: var(--blue);
  box-shadow: var(--focus);
}

label,
.settings-field label {
  color: #344054;
  font-weight: 700;
}

.form-message,
.field-error,
.doctor-avatar-status,
.doctor-password-message {
  font-size: 13px;
  line-height: 1.35;
}

.form-message {
  color: var(--green);
}

#appointmentStatus.is-error:not(:empty) {
  padding: 10px 12px;
  color: #b42318;
  border: 1px solid #fda29b;
  border-radius: 8px;
  background: #fef3f2;
}

#appointmentStatus.is-error:not(:empty)::before {
  content: "⚠";
  margin-right: 8px;
  color: #d92d20;
}

#appointmentStatus.is-success:not(:empty) {
  color: var(--green);
}

.field-error,
.has-error + .field-error {
  color: var(--red);
}

.modal-backdrop {
  background: rgba(15, 23, 42, .52);
  backdrop-filter: blur(2px);
}

.modal,
.registration-modal,
.doctor-modal,
.doctor-schedule-modal,
.service-modal,
.cabinet-modal,
.patient-edit-modal,
.visit-details-modal {
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 90px rgba(15, 23, 42, .26);
}

.modal-heading,
.modal-head {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.modal-heading.visit-details-heading {
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 62%);
}

.modal-actions,
.form-actions,
.visit-details-footer,
.settings-password-actions {
  gap: 12px;
}

.modal-close {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  color: #344054;
}

.modal-close:hover,
.icon-button:hover {
  background: #f1f5fb;
  color: var(--blue);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 16px 18px;
  vertical-align: middle;
}

th {
  color: #253858;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .01em;
  background: #fff;
}

tbody tr {
  min-height: 72px;
  transition: background-color .14s ease, box-shadow .14s ease;
}

tbody tr:hover {
  background: #f8fbff;
}

tr.selected,
tbody tr.selected,
.services-table-card tbody tr.selected,
.rooms-table-card tbody tr.selected,
.users-table-card tbody tr.selected {
  background: #edf5ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.person-cell,
.doctor-mini-row,
.visit-detail-person,
.assigned-doctors,
.row-actions,
.history-actions,
.service-row-actions,
.doctor-row-actions,
.user-action-grid {
  min-width: 0;
}

.person-cell > div:last-child,
.doctor-mini-row > div,
.visit-detail-person > div {
  min-width: 0;
}

.person-cell strong,
.person-cell span,
.doctor-mini-row strong,
.doctor-mini-row span,
td,
td strong,
td span {
  overflow-wrap: anywhere;
}

.row-actions,
.history-actions,
.service-row-actions,
.doctor-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.row-actions.single-action,
.history-actions {
  justify-content: center;
}

.pagination,
.users-pagination {
  min-height: 58px;
  border-top: 1px solid var(--soft-line);
  background: #fff;
}

.pager-buttons {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status,
.visit-status,
.service-detail-status,
.status-badge,
.badge,
.user-role-badge,
.user-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.15;
  white-space: nowrap;
}

.status::before,
.visit-status::before,
.status-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status,
.status.active,
.status.complete,
.visit-status.done,
.status-badge.status-zrealizowana,
.status-badge.status-complete {
  background: var(--green-soft);
  color: var(--green);
}

.status.planned,
.visit-status.planned,
.status-badge.status-zaplanowana {
  background: var(--blue-soft);
  color: var(--blue);
}

.status.in-progress,
.visit-status.in-progress,
.status-badge.status-w-trakcie {
  background: var(--purple-soft);
  color: var(--purple);
}

.status.warning,
.status.incomplete,
.visit-status.warning,
.status-badge.status-niepelen,
.status-badge.status-niepelny {
  background: var(--orange-soft);
  color: var(--orange);
}

.status.danger,
.status.blocked,
.visit-status.cancelled,
.status-badge.status-anulowana {
  background: var(--red-soft);
  color: var(--red);
}

.status.gray,
.status.inactive,
.visit-status.no-show,
.status-badge.status-nieobecny-pacjent {
  background: #eef2f6;
  color: #475467;
}

.initials,
.mini-avatar,
.avatar,
.big-avatar,
.history-avatar,
.doctor-photo-avatar,
.doctor-avatar-small,
.doctor-avatar-large,
.user-avatar,
.room-icon {
  flex-shrink: 0;
}

.initials,
.mini-avatar,
.avatar,
.big-avatar,
.history-avatar,
.doctor-photo-avatar,
.doctor-avatar-small,
.doctor-avatar-large,
.user-avatar {
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  line-height: 1;
  text-align: center;
}

.doctor-photo-avatar img,
.doctor-avatar-small img,
.doctor-avatar-large img,
.avatar img,
.mini-avatar img,
.history-avatar img,
.user-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.initials,
.mini-avatar,
.history-avatar {
  width: 42px;
  height: 42px;
}

.avatar,
.doctor-avatar-small {
  width: 40px;
  height: 40px;
}

.big-avatar,
.doctor-avatar-large {
  width: 112px;
  height: 112px;
}

.patient-filter-tabs,
.doctor-filter-tabs,
.room-filter-tabs,
.service-filter-tabs,
.user-filter-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.patient-filter-tabs button,
.doctor-filter-tabs button,
.room-filter-tabs button,
.service-filter-tabs button,
.user-filter-tabs button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #253858;
  font-weight: 800;
}

.patient-filter-tabs button:hover,
.doctor-filter-tabs button:hover,
.room-filter-tabs button:hover,
.service-filter-tabs button:hover,
.user-filter-tabs button:hover {
  background: #f8fbff;
  border-color: #b7c7dc;
}

.patient-filter-tabs button.active,
.doctor-filter-tabs button.active,
.room-filter-tabs button.active,
.service-filter-tabs button.active,
.user-filter-tabs button.active {
  border-color: var(--blue);
  background: #fff;
  color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(11, 91, 211, .08);
}

.patient-filter-tabs span,
.doctor-filter-tabs span,
.room-filter-tabs span,
.service-filter-tabs span,
.user-filter-tabs span {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 12px;
}

.info-list {
  display: grid;
  gap: 10px;
}

.info-list > div {
  display: grid;
  grid-template-columns: minmax(120px, .7fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.info-list span {
  color: var(--muted);
}

.info-list strong {
  min-width: 0;
  color: #101828;
  overflow-wrap: anywhere;
}

.page-head {
  align-items: center;
}

.page-head h2 {
  color: #101828;
}

.page-actions {
  align-items: center;
  flex-wrap: wrap;
}

.settings-layout,
.rooms-layout,
.services-layout,
.users-layout,
.history-layout,
.calendar-layout {
  min-width: 0;
}

.details-panel,
.room-detail-panel,
.service-detail-panel,
.user-detail {
  align-self: start;
}

.ui-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: -3px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 7px;
  background: #f3f7ff;
  color: #315174;
}

.nav-icon .ui-icon {
  width: 18px;
  height: 18px;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  background: #dbeafe;
  color: var(--blue);
}

.app-shell.sidebar-collapsed .nav-icon,
body.sidebar-collapsed .app-shell .nav-icon {
  width: 34px;
  height: 34px;
}

.notification-button {
  display: inline-grid;
  place-items: center;
}

.notification-button .ui-icon {
  width: 21px;
  height: 21px;
}

.notification-button .notification-count {
  position: absolute;
  top: 5px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.notification-button .notification-count[hidden] {
  display: none !important;
}

.notification-dropdown {
  position: fixed;
  width: min(390px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 96px));
  overflow: auto;
  z-index: 2500;
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.notification-dropdown[hidden] {
  display: none !important;
}

.notification-panel-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #e6edf6;
  backdrop-filter: blur(8px);
}

.notification-panel-head strong {
  display: block;
  color: #101828;
  font-size: 16px;
  line-height: 1.2;
}

.notification-panel-head span {
  display: block;
  margin-top: 2px;
  color: #667085;
  font-size: 12px;
}

.notification-mark-all {
  border: 1px solid #d6e0ee;
  border-radius: 10px;
  background: #f8fbff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
  white-space: nowrap;
}

.notification-mark-all:disabled {
  color: #98a2b3;
  cursor: not-allowed;
}

.notification-list {
  padding: 8px;
}

.notification-empty {
  padding: 28px 16px;
  color: #667085;
  text-align: center;
}

.notification-item {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
}

.notification-item + .notification-item {
  margin-top: 6px;
}

.notification-item:hover,
.notification-item:focus-visible {
  border-color: #cfe0ff;
  background: #f8fbff;
  outline: none;
}

.notification-item.is-unread {
  background: #f5f8ff;
}

.notification-marker {
  width: 4px;
  height: 100%;
  min-height: 46px;
  border-radius: 999px;
  background: #3b82f6;
}

.notification-success .notification-marker {
  background: #16a34a;
}

.notification-warning .notification-marker {
  background: #f59e0b;
}

.notification-danger .notification-marker {
  background: #dc2626;
}

.notification-content {
  min-width: 0;
}

.notification-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.notification-item-head strong {
  color: #101828;
  font-size: 14px;
  line-height: 1.25;
}

.notification-item-head time {
  color: #98a2b3;
  font-size: 11px;
  white-space: nowrap;
}

.notification-content p {
  margin: 5px 0 0;
  color: #475467;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.notification-content p.is-expanded {
  color: #344054;
}

.notification-expand,
.notification-delete {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.notification-expand {
  margin-top: 6px;
  padding: 0;
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
}

.notification-unread-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 999px;
  background: #2563eb;
  box-shadow: 0 0 0 3px #dbeafe;
}

.notification-delete {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: #98a2b3;
  font-size: 18px;
  line-height: 1;
}

.notification-delete:hover {
  background: #fee2e2;
  color: #b42318;
}

.profile {
  min-width: 0;
}

.profile-avatar-slot {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.profile-avatar-slot .avatar,
.profile-avatar-slot .doctor-avatar,
.profile-avatar-slot .doctor-photo-avatar {
  width: 42px;
  height: 42px;
  margin: 0;
}

.profile-avatar-slot img.doctor-avatar,
.profile-avatar-slot .doctor-photo-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
}

.profile-copy {
  min-width: 0;
}

.profile-copy strong,
.profile-copy span {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-icon .ui-icon {
  width: 30px;
  height: 30px;
}

.card-title h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.section-icon {
  width: 18px;
  height: 18px;
  color: var(--blue);
}

.date-select .ui-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

.dash-action i {
  display: grid;
  place-items: center;
}

.dash-action i .ui-icon {
  width: 28px;
  height: 28px;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.7fr);
  gap: 18px;
  align-items: start;
}

.settings-reception-layout {
  width: 100%;
  max-width: none;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-areas:
    "email email email email email email hours hours hours hours hours hours"
    "clinic clinic clinic clinic clinic transfer transfer transfer transfer transfer transfer transfer"
    "appointment appointment appointment appointment security security security security system system system system";
  gap: 16px;
  align-items: stretch;
}

.settings-card {
  padding: 0;
  overflow: visible;
}

.settings-reception-layout .settings-card {
  position: relative;
  z-index: 1;
  min-width: 0;
  border: 1px solid rgba(203, 213, 225, .86);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,255,.96)),
    #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .07);
}

.settings-reception-layout .settings-card:has(.settings-help:hover),
.settings-reception-layout .settings-card:has(.settings-help:focus-within) {
  z-index: 30;
}

.settings-reception-layout .settings-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, rgba(37,99,235,.85), rgba(14,165,233,.42));
  pointer-events: none;
}

.settings-reception-layout .settings-card-priority::before {
  background: linear-gradient(90deg, #2563eb, #10b981);
}

.settings-card-email { grid-area: email; }
.settings-card-hours { grid-area: hours; }
.settings-card-appointment { grid-area: appointment; }
.settings-card-security { grid-area: security; }
.settings-card-system { grid-area: system; }
.settings-card-clinic { grid-area: clinic; }
.settings-card-transfer { grid-area: transfer; }

.settings-card-transfer {
  min-width: 0;
}

.settings-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--soft-line);
}

.settings-reception-layout .settings-card-head {
  padding: 18px 20px 14px;
  background:
    radial-gradient(circle at top left, rgba(37,99,235,.08), transparent 38%),
    linear-gradient(180deg, #fff, #fbfdff);
}

.settings-card-head h2 {
  margin: 0 0 6px;
  font-size: 19px;
}

.settings-reception-layout .settings-card-head h2 {
  font-size: 18px;
}

.settings-card-head p {
  margin: 0;
  color: var(--muted);
}

.settings-reception-layout .settings-card-head p {
  font-size: 13px;
  line-height: 1.35;
}

.settings-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.settings-reception-layout .settings-actions {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-reception-layout .settings-actions .primary-button,
.settings-reception-layout .settings-actions .secondary-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 9px;
}

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

.settings-reception-layout .settings-form-grid {
  gap: 12px;
  padding: 16px 20px;
}

.settings-card-email .settings-form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-card-email .settings-actions {
  flex-wrap: nowrap;
}

.settings-card-email .settings-card-head {
  align-items: center;
}

.settings-card-email .settings-export-note {
  padding: 0 20px 14px;
  margin: 0;
}

.settings-card-hours .settings-card-head,
.settings-card-system .settings-card-head {
  padding-top: 14px;
  padding-bottom: 10px;
}

.settings-card-clinic .settings-form-grid {
  grid-template-columns: 1fr;
}

.settings-field,
.settings-day-row label {
  display: grid;
  gap: 7px;
  min-width: 0;
  font-weight: 700;
  color: #344054;
}

.settings-field span,
.settings-day-row label span {
  font-size: 13px;
}

.settings-field input,
.settings-field select,
.settings-day-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
}

.settings-reception-layout .settings-field input,
.settings-reception-layout .settings-field select,
.settings-reception-layout .settings-day-row input {
  min-height: 40px;
  padding: 9px 11px;
  border-radius: 10px;
  background: #fbfdff;
}

.settings-card-hours .settings-day-row input {
  min-height: 34px;
  padding: 7px 9px;
}

.settings-field input:disabled,
.settings-day-row input:disabled {
  color: #475467;
  background: #f8fafc;
}

.settings-field.inline {
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: center;
}

.settings-day-list {
  display: grid;
  gap: 10px;
  padding: 20px 22px 10px;
}

.settings-reception-layout .settings-day-list {
  gap: 4px;
  padding: 10px 14px 8px;
}

.settings-day-row {
  display: grid;
  grid-template-columns: 150px 1fr 1fr 130px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: #fff;
}

.settings-reception-layout .settings-day-row {
  grid-template-columns: 82px minmax(0, 1fr) minmax(0, 1fr) 82px;
  gap: 6px;
  min-height: 42px;
  padding: 4px 8px;
  border-radius: 11px;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.settings-day-row strong {
  color: #101828;
}

.settings-reception-layout .settings-day-row strong {
  font-size: 12px;
}

.settings-day-row.is-closed {
  background: #f8fafc;
}

.settings-check-list {
  display: grid;
  gap: 14px;
  padding: 20px 22px;
}

.settings-reception-layout .settings-check-list {
  gap: 10px;
  padding: 16px 20px;
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #344054;
  font-weight: 700;
}

.settings-reception-layout .settings-check {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--soft-line);
  border-radius: 11px;
  background: linear-gradient(180deg, #fff, #f8fbff);
  font-size: 13px;
}

.settings-check.compact {
  justify-content: flex-start;
  font-size: 13px;
}

.settings-reception-layout .settings-check.compact {
  justify-content: flex-start;
  gap: 6px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 12px;
}

.settings-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
  flex-shrink: 0;
}

.settings-check-text,
.settings-field > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.settings-help {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  line-height: 1;
  vertical-align: middle;
}

.settings-help-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  color: #64748b;
  background: #f1f5f9;
  font-size: 12px;
  font-weight: 900;
  cursor: help;
  user-select: none;
}

.settings-help-popup {
  position: absolute;
  right: 0;
  bottom: calc(100% + 9px);
  z-index: 500;
  width: min(300px, calc(100vw - 48px));
  padding: 10px 12px;
  border-radius: 10px;
  color: #fff;
  background: #475569;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.settings-help-popup::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: #475569;
  transform: rotate(45deg);
}

.settings-help:hover .settings-help-popup,
.settings-help:focus .settings-help-popup,
.settings-help:focus-within .settings-help-popup {
  opacity: 1;
  transform: translateY(0);
}

.settings-note {
  margin: 0 22px 16px;
  padding: 12px 14px;
  border-radius: 10px;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #dbeafe;
}

.settings-success {
  margin: 0 22px 20px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  font-weight: 700;
}

.settings-system-card {
  grid-column: span 2;
}

.settings-layout:not(.settings-reception-layout) .settings-card-system {
  grid-column: auto;
}

.settings-system-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 20px 22px;
}

.settings-card-system .settings-system-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 12px;
}

.settings-system-item {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: #f8fbff;
}

.settings-card-system .settings-system-item {
  min-height: 50px;
  padding: 8px;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(circle at top left, rgba(37,99,235,.1), transparent 42%),
    linear-gradient(145deg, #fff, #f8fbff);
}

.settings-system-item span {
  color: var(--muted);
}

.settings-system-item strong {
  font-size: 24px;
  color: #101828;
}

.settings-card-system .settings-system-item strong {
  font-size: 17px;
}

.settings-reception-layout .settings-card-system {
  grid-area: system;
  min-width: 0;
}

.doctor-settings-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.doctor-settings-profile-body {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--soft-line);
}

.doctor-settings-profile-body .doctor-avatar,
.doctor-settings-profile-body .big-avatar {
  flex-shrink: 0;
}

.doctor-settings-profile-copy {
  min-width: 0;
}

.doctor-settings-profile-copy h3 {
  margin: 0 0 4px;
  font-size: 22px;
  color: #101828;
}

.doctor-settings-profile-copy p {
  margin: 0 0 10px;
  color: var(--muted);
}

.settings-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-info-list {
  padding: 20px 22px;
}

.settings-info-list strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.doctor-settings-info-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 14px 18px 18px;
}

.doctor-settings-info-list div {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid rgba(37, 99, 235, .13);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .08), rgba(14, 165, 233, .05)),
    #f8fbff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.86);
  overflow: hidden;
}

.doctor-settings-info-list dt {
  margin: 0;
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  line-height: 1.15;
  text-transform: uppercase;
}

.doctor-settings-info-list dd {
  margin: 0;
  min-width: 0;
  color: #0f172a;
  line-height: 1.25;
  text-align: right;
}

.doctor-settings-info-list strong {
  display: block;
  font-size: 13px;
  font-weight: 850;
  overflow-wrap: anywhere;
  text-align: right;
  white-space: normal;
}

.settings-form-grid.single-column {
  grid-template-columns: 1fr;
}

.doctor-password-message {
  margin: 0 22px 12px;
}

.doctor-password-message.is-success {
  color: #047857;
}

.settings-password-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 22px 22px;
}

.doctor-settings-schedule {
  display: grid;
  gap: 10px;
  padding: 20px 22px;
}

.doctor-settings-schedule-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.doctor-settings-schedule-card .doctor-settings-schedule,
.doctor-settings-schedule-card .clinic-hours-readonly {
  flex: 1;
}

.doctor-settings-schedule-card .doctor-settings-schedule {
  gap: 8px;
  padding: 16px 18px 18px;
}

.doctor-settings-schedule-card .settings-day-row {
  min-height: 48px;
  padding: 9px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.doctor-settings-schedule-card .clinic-hours-readonly {
  display: grid;
  gap: 8px;
  padding: 16px 18px 18px;
}

.clinic-hours-readonly .settings-day-row.read-only {
  grid-template-columns: 170px minmax(0, 1fr);
}

.clinic-hours-readonly .settings-day-row.read-only > span {
  color: #344054;
  font-weight: 700;
}

@media (max-width: 1180px) {
  .settings-layout,
  .settings-system-card {
    grid-template-columns: 1fr;
    grid-column: auto;
  }

  .settings-reception-layout {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-areas:
      "email email email email email email"
      "hours hours hours hours hours hours"
      "clinic clinic clinic transfer transfer transfer"
      "appointment appointment appointment security security security"
      "system system system system system system";
  }

  .settings-system-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .settings-card-head,
  .settings-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-form-grid,
  .settings-system-grid {
    grid-template-columns: 1fr;
  }

  .settings-reception-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "email"
      "hours"
      "clinic"
      "transfer"
      "appointment"
      "security"
      "system";
  }

  .settings-card-email .settings-form-grid,
  .settings-card-clinic .settings-form-grid,
  .settings-card-system .settings-system-grid {
    grid-template-columns: 1fr;
  }

  .settings-card-email .settings-actions {
    flex-wrap: wrap;
  }

  .settings-day-row {
    grid-template-columns: 1fr;
  }

  .settings-field.inline {
    grid-template-columns: 1fr;
  }
}

/* Polished edit modals for catalog screens. Kept scoped so generic modals stay unchanged. */
.modal.editor-modal {
  width: min(820px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid rgba(245, 158, 11, .26);
  box-shadow: 0 30px 80px rgba(15, 23, 42, .28);
}

.modal.editor-modal .modal-heading,
.modal.editor-modal .service-modal-heading,
.modal.editor-modal .editor-modal-heading {
  align-items: center;
  padding: 24px 26px;
  border-bottom: 1px solid rgba(245, 158, 11, .20);
  background:
    radial-gradient(circle at 12% 18%, rgba(251, 191, 36, .22), transparent 28%),
    linear-gradient(135deg, #fff7ed, #fffbeb 58%, #fff);
}

.editor-modal-heading-main,
.service-modal-heading-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 15px;
}

.editor-modal-heading h2,
.service-modal-heading h2 {
  margin: 0;
  color: #7c2d12;
  font-size: 25px;
  line-height: 1.15;
}

.editor-modal-heading p,
.service-modal-heading p {
  margin: 5px 0 0;
  color: #9a3412;
  font-size: 14px;
  font-weight: 800;
}

.editor-modal-heading-icon,
.service-modal-heading-icon {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, .34);
  box-shadow: 0 10px 26px rgba(245, 158, 11, .18);
}

.editor-modal-heading-icon .ui-icon,
.service-modal-heading-icon .ui-icon {
  width: 22px;
  height: 22px;
}

.modal.editor-modal .service-form,
.modal.editor-modal .cabinet-form {
  display: grid;
  gap: 0;
  padding: 0;
  background: #fff;
}

.modal.editor-modal .service-form-grid,
.modal.editor-modal .cabinet-form .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px 16px;
}

.modal.editor-modal .service-form-grid label,
.modal.editor-modal .cabinet-form .form-grid label {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: #fbfdff;
  color: #667085;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.modal.editor-modal .service-form-grid label.full-width,
.modal.editor-modal .cabinet-form .form-grid label.full-width {
  grid-column: 1 / -1;
}

.modal.editor-modal .service-form-grid input,
.modal.editor-modal .service-form-grid select,
.modal.editor-modal .service-form-grid textarea,
.modal.editor-modal .cabinet-form .form-grid input,
.modal.editor-modal .cabinet-form .form-grid select,
.modal.editor-modal .cabinet-form .form-grid textarea {
  width: 100%;
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.modal.editor-modal .modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 26px 24px;
  border-top: 1px solid var(--soft-line);
  background: #fff;
}

.modal.editor-modal .modal-actions button {
  width: 100%;
  justify-content: center;
}

.modal.editor-modal .form-status {
  min-height: 20px;
  margin: -4px 26px 14px;
}

@media (max-width: 720px) {
  .modal.editor-modal .service-form-grid,
  .modal.editor-modal .cabinet-form .form-grid,
  .modal.editor-modal .modal-actions {
    grid-template-columns: 1fr;
  }
}

/* Final modal/table refinements for catalog edit dialogs and visit history. */
.modal.editor-modal .service-form-grid label:nth-child(5) {
  grid-column: 1 / -1;
}

.modal.editor-modal .cabinet-form select[multiple] {
  min-height: 118px;
  padding: 8px;
}

.modal.editor-modal .cabinet-form select[multiple] option {
  padding: 7px 8px;
  border-radius: 7px;
}

.modal.editor-modal .cabinet-form select[multiple] option:checked {
  background: linear-gradient(0deg, var(--blue-soft), var(--blue-soft));
  color: var(--blue);
  font-weight: 800;
}

.history-table-card th {
  text-align: center;
}

.history-table-card th:nth-child(5),
.history-table-card th:nth-child(6),
.history-table-card th:nth-child(7),
.history-table-card td:nth-child(5),
.history-table-card td:nth-child(6),
.history-table-card td:nth-child(7) {
  text-align: center;
}

.history-table-card th:nth-child(6) {
  width: 134px;
}

.history-table-card th:nth-child(7) {
  width: 220px;
}

.history-table-card td:nth-child(5) .history-cabinet-cell,
.history-table-card td:nth-child(6) {
  justify-items: center;
}

.history-table-card td:nth-child(6) .status-badge,
.history-table-card td:nth-child(6) .visit-status {
  margin-inline: auto;
}

.history-table-card td:last-child {
  overflow: visible;
}

.history-actions {
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.history-actions .secondary-button {
  flex: 0 0 auto;
  min-width: 88px;
  padding-inline: 12px;
}

/* Keep quick appointment actions visible while the long registration form scrolls. */
#appointmentModal .registration-modal {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 56px);
  overflow: hidden;
}

#appointmentModal .registration-modal .modal-heading {
  flex: 0 0 auto;
}

#appointmentModal .appointment-form {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-bottom: 0;
  align-items: stretch;
}

#appointmentModal .registration-left {
  max-height: calc(100vh - 190px);
  min-height: 0;
  overflow: hidden;
}

#appointmentModal .registration-left .recent-patient-block {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#appointmentModal .registration-left .recent-patients {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

#appointmentModal .appointment-form > .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 8;
  grid-column: 1 / -1;
  margin: 8px -24px 0;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 -12px 24px rgba(16, 24, 40, .08);
  backdrop-filter: blur(6px);
}

/* Short visits keep their true timeline height, then expand above the grid on hover/focus. */
#calendarView .appointment-card .appointment-card-short-time,
#calendarView .appointment-card .appointment-card-week-short,
#calendarView .appointment-card .appointment-card-full {
  display: none;
}

#calendarView .appointment-card.short-visit-event {
  padding: 4px 8px;
}

#calendarView .appointment-card.short-visit-event .appointment-card-doctor,
#calendarView .appointment-card.short-visit-event .appointment-card-short-time {
  display: block;
  line-height: 1.12;
}

#calendarView .appointment-card.short-visit-event .appointment-card-doctor {
  font-size: 12px;
}

#calendarView .appointment-card.short-visit-event .appointment-card-short-time {
  font-size: 11px;
  font-weight: 800;
}

#calendarView .appointment-card.short-visit-event .appointment-card-patient,
#calendarView .appointment-card.short-visit-event .appointment-card-service {
  display: none;
}

#calendarView .week-mode .appointment-card.short-visit-event .appointment-card-doctor,
#calendarView .week-mode .appointment-card.short-visit-event .appointment-card-short-time {
  display: none;
}

#calendarView .week-mode .appointment-card.short-visit-event .appointment-card-week-short {
  display: block;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
}

#calendarView .appointment-card.short-visit-event:hover,
#calendarView .appointment-card.short-visit-event:focus-visible {
  z-index: 60;
  min-height: 62px !important;
  height: auto !important;
  padding: 7px 9px;
  overflow: visible;
}

#calendarView .week-mode .appointment-card.short-visit-event:hover,
#calendarView .week-mode .appointment-card.short-visit-event:focus-visible {
  min-height: 58px !important;
}

#calendarView .appointment-card.short-visit-event:hover .appointment-card-doctor,
#calendarView .appointment-card.short-visit-event:focus-visible .appointment-card-doctor,
#calendarView .appointment-card.short-visit-event:hover .appointment-card-full,
#calendarView .appointment-card.short-visit-event:focus-visible .appointment-card-full {
  display: block;
}

#calendarView .appointment-card.short-visit-event:hover .appointment-card-short-time,
#calendarView .appointment-card.short-visit-event:focus-visible .appointment-card-short-time,
#calendarView .appointment-card.short-visit-event:hover .appointment-card-week-short,
#calendarView .appointment-card.short-visit-event:focus-visible .appointment-card-week-short {
  display: none;
}

#calendarView .appointment-card.short-visit-event .appointment-card-full span {
  display: block;
  font-size: 11px;
  line-height: 1.18;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Calendar visit cards: compact one-line default, full details on hover/focus. */
#calendarView .appointment-card.timeline-event {
  align-content: center;
  justify-items: start;
  padding: 5px 8px;
}

#calendarView .appointment-card.timeline-event .appointment-card-compact-line {
  display: block;
  width: 100%;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#calendarView .appointment-card.timeline-event .appointment-card-doctor,
#calendarView .appointment-card.timeline-event .appointment-card-short-time,
#calendarView .appointment-card.timeline-event .appointment-card-week-short,
#calendarView .appointment-card.timeline-event .appointment-card-patient,
#calendarView .appointment-card.timeline-event .appointment-card-service,
#calendarView .appointment-card.timeline-event .appointment-card-full {
  display: none;
}

#calendarView .appointment-card.timeline-event:hover,
#calendarView .appointment-card.timeline-event:focus-visible {
  align-content: start;
  z-index: 60;
  min-height: 64px !important;
  height: auto !important;
  padding: 7px 9px;
  overflow: visible;
}

#calendarView .appointment-card.timeline-event:hover .appointment-card-compact-line,
#calendarView .appointment-card.timeline-event:focus-visible .appointment-card-compact-line {
  display: none;
}

#calendarView .appointment-card.timeline-event:hover .appointment-card-full,
#calendarView .appointment-card.timeline-event:focus-visible .appointment-card-full {
  display: block;
}

#calendarView .appointment-card.timeline-event .appointment-card-full span {
  display: block;
  font-size: 11px;
  line-height: 1.18;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#calendarView .appointment-card.timeline-event.short-visit-event:hover .appointment-card-doctor,
#calendarView .appointment-card.timeline-event.short-visit-event:focus-visible .appointment-card-doctor {
  display: none;
}

/* Week view short visits: keep true timeline height, but show the same readable one-line label as day view. */
#calendarView .week-mode .appointment-card.timeline-event.short-visit-event {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding: 2px 8px;
  min-height: 0 !important;
  overflow: hidden;
}

#calendarView .week-mode .appointment-card.timeline-event.short-visit-event .appointment-card-compact-line {
  display: block !important;
  width: 100%;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#calendarView .week-mode .appointment-card.timeline-event.short-visit-event .appointment-card-doctor,
#calendarView .week-mode .appointment-card.timeline-event.short-visit-event .appointment-card-short-time,
#calendarView .week-mode .appointment-card.timeline-event.short-visit-event .appointment-card-week-short,
#calendarView .week-mode .appointment-card.timeline-event.short-visit-event .appointment-card-patient,
#calendarView .week-mode .appointment-card.timeline-event.short-visit-event .appointment-card-service,
#calendarView .week-mode .appointment-card.timeline-event.short-visit-event .appointment-card-full {
  display: none !important;
}

#calendarView .week-mode .appointment-card.timeline-event.short-visit-event:hover,
#calendarView .week-mode .appointment-card.timeline-event.short-visit-event:focus-visible {
  display: grid;
  align-content: start;
  min-height: 64px !important;
  padding: 7px 9px;
  overflow: visible;
}

#calendarView .week-mode .appointment-card.timeline-event.short-visit-event:hover .appointment-card-compact-line,
#calendarView .week-mode .appointment-card.timeline-event.short-visit-event:focus-visible .appointment-card-compact-line {
  display: none !important;
}

#calendarView .week-mode .appointment-card.timeline-event.short-visit-event:hover .appointment-card-full,
#calendarView .week-mode .appointment-card.timeline-event.short-visit-event:focus-visible .appointment-card-full {
  display: block !important;
}

/* Override generic white modal headers for doctor absence dialogs. */
.modal.doctor-absence-modal .modal-heading.doctor-absence-heading,
.modal.doctor-absence-confirm-modal .modal-heading.doctor-absence-heading {
  border-bottom-color: rgba(248, 113, 113, .28);
  background:
    radial-gradient(circle at 12% 18%, rgba(248, 113, 113, .24), transparent 28%),
    linear-gradient(135deg, #fff1f2 0%, #fff7ed 60%, #fff 100%);
}

.export-settings-card {
  gap: 18px;
  width: 100%;
  max-width: none;
  justify-self: stretch;
}

.settings-transfer-grid,
.settings-transfer-stack {
  display: grid;
  gap: 14px;
  align-items: start;
  padding: 16px 20px 18px;
}

.settings-transfer-grid {
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
}

.settings-transfer-stack {
  grid-template-columns: 1fr;
}

.settings-import-section,
.settings-export-section {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, .06);
}

.settings-card-transfer .settings-import-section,
.settings-card-transfer .settings-export-section {
  align-self: stretch;
  min-width: 0;
}

.settings-export-section {
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
  align-content: start;
  min-height: 0;
}

.export-actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.settings-subhead {
  display: grid;
  gap: 4px;
}

.settings-subhead h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text);
}

.settings-subhead p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.import-blocks-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.import-block {
  display: grid;
  align-content: start;
  grid-template-columns: minmax(0, 1fr) minmax(180px, .9fr);
  gap: 10px 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
}

.settings-transfer-stack .settings-import-section,
.settings-transfer-stack .settings-export-section {
  padding: 16px;
  box-shadow: none;
  min-width: 0;
}

.settings-transfer-stack .import-blocks-grid {
  gap: 8px;
}

.settings-transfer-stack .import-block {
  grid-template-columns: minmax(160px, .72fr) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.9), rgba(248,251,255,.95)),
    #fff;
}

.settings-transfer-stack .import-block > div:first-child {
  min-width: 0;
}

.settings-transfer-stack .import-block h4 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  line-height: 1.2;
  max-width: 100%;
  white-space: normal;
}

.settings-transfer-stack .import-block p {
  display: none;
  font-size: 12px;
  line-height: 1.28;
}

.settings-transfer-stack .import-block input[type="file"] {
  min-height: 36px;
  max-width: 100%;
  min-width: 0;
}

.settings-transfer-stack .import-block-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  justify-content: stretch;
}

.settings-transfer-stack .import-block-actions .secondary-button,
.settings-transfer-stack .import-block-actions .primary-button {
  min-width: 0;
}

.settings-transfer-stack .import-preview-area {
  grid-column: 1 / -1;
}

.settings-transfer-stack .export-actions-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.settings-transfer-stack .export-button {
  min-height: 38px;
}

.settings-card-transfer .import-block {
  min-height: 0;
}

.import-block h4 {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.import-block p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.import-block input[type="file"] {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px;
  border: 1px dashed #bfd0ea;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.import-block-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.import-block-actions .secondary-button,
.import-block-actions .primary-button {
  min-height: 38px;
  padding: 0 12px;
}

.import-preview-area {
  min-height: 0;
}

.import-result {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid #dbe7fb;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.import-result.is-done {
  border-color: rgba(22, 163, 74, .26);
  background: #f0fdf4;
}

.import-result.is-error {
  border-color: rgba(220, 38, 38, .26);
  background: #fef2f2;
  color: #991b1b;
}

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

.import-success-text {
  margin: 0;
  color: #166534;
  font-weight: 800;
}

.import-message-list {
  display: grid;
  gap: 4px;
  max-height: 120px;
  overflow: auto;
  padding: 8px;
  border-radius: 8px;
}

.import-message-list p {
  margin: 0;
  font-size: 12px;
}

.import-message-list.is-error {
  background: #fef2f2;
  color: #991b1b;
}

.import-message-list.is-warning {
  background: #fffbeb;
  color: #92400e;
}

.import-preview-table-wrap {
  max-height: 150px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.import-preview-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}

.import-preview-table th,
.import-preview-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 12px;
}

.import-preview-table th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 800;
}

.export-button {
  min-height: 40px;
  justify-content: center;
  text-align: center;
}

.settings-export-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.export-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 3000;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
  color: var(--text);
  font-weight: 800;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .18s ease, transform .18s ease;
}

.export-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.export-toast.is-success {
  border-color: rgba(22, 163, 74, .28);
  background: #f0fdf4;
  color: #166534;
}

.export-toast.is-error {
  border-color: rgba(220, 38, 38, .28);
  background: #fef2f2;
  color: #991b1b;
}

@media (max-width: 1100px) {
  .settings-transfer-grid {
    grid-template-columns: 1fr;
  }

  .settings-transfer-stack .import-block {
    grid-template-columns: 1fr;
  }

  .settings-transfer-stack .import-block-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .settings-transfer-stack .import-block-actions .secondary-button,
  .settings-transfer-stack .import-block-actions .primary-button {
    flex: 1;
    min-width: 0;
  }

  .settings-import-section,
  .settings-export-section {
    align-content: start;
  }
}

@media (max-width: 720px) {
  .export-settings-card {
    width: 100%;
  }

  .settings-import-section,
  .settings-export-section {
    padding: 14px;
  }

  .import-block {
    grid-template-columns: 1fr;
  }

  .settings-transfer-stack .export-actions-grid {
    grid-template-columns: 1fr;
  }
}
