
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.boot-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--nav);
}

.boot-mark {
  color: #fff;
  font-size: 24px;
  font-weight: var(--weight-bold);
  letter-spacing: 0;
}

.boot-line {
  position: fixed;
  inset: auto 40vw 42vh;
  height: 2px;
  background: linear-gradient(90deg, transparent, #5aa7e8, transparent);
  animation: loadingLine 1.2s ease-in-out infinite;
}

@keyframes loadingLine {
  0% { transform: scaleX(0.2); opacity: 0.45; }
  50% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(0.2); opacity: 0.45; }
}

.shell {
  isolation: isolate;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 216px minmax(720px, 1fr) 284px;
  grid-template-rows: 56px minmax(0, 1fr);
}

.system-admin-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  color: var(--text);
  background: var(--bg);
}

.system-admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px 22px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.system-admin-brand {
  display: grid;
  gap: 6px;
}

.system-admin-brand strong {
  font-size: var(--font-size-title);
  font-weight: var(--weight-bold);
}

.system-admin-brand span,
.system-admin-header p,
.system-org-list-head p,
.system-admin-sidebar-note span {
  color: var(--muted);
}

.system-admin-nav {
  display: grid;
  gap: 6px;
}

.system-admin-nav-item {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  color: var(--muted);
  font-size: var(--font-size-sm);
  font-weight: var(--weight-semibold);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.system-admin-nav-item:hover,
.system-admin-nav-item:focus-visible {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--line);
}

.system-admin-nav-item.is-active {
  color: var(--green);
  background: #EAF8F6;
  border-color: rgba(20, 184, 166, 0.24);
}

.system-admin-nav-item b {
  min-width: 24px;
  padding: 3px 7px;
  color: inherit;
  font-size: 12px;
  text-align: center;
  background: var(--surface);
  border-radius: 999px;
}

.system-admin-nav-item .icon-plus {
  width: 16px;
  height: 16px;
}

.system-admin-sidebar-note {
  display: grid;
  gap: 6px;
  padding: 14px;
  font-size: var(--font-size-sm);
  line-height: 1.4;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.system-admin-sidebar-note strong {
  font-size: var(--font-size-sm);
}

.system-admin-sidebar > #system-logout {
  margin-top: auto;
}

.system-admin-workspace {
  min-width: 0;
  padding: 28px;
  overflow-x: hidden;
}

.system-admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.system-admin-header h1,
.system-admin-card h2 {
  margin: 0;
}

.system-admin-header p {
  margin: 6px 0 0;
}

.system-admin-summary {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: end;
}

.system-admin-summary span {
  padding: 8px 10px;
  color: var(--muted);
  font-size: var(--font-size-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.system-admin-summary b {
  color: var(--text);
}

.system-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.system-admin-details {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.system-admin-create-layout {
  width: min(100%, 940px);
}

.system-admin-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.system-org-form {
  display: grid;
  gap: 13px;
  padding: 18px;
}

.system-org-empty {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 210px;
  padding: 22px;
}

.system-org-empty p {
  max-width: 36ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.system-org-empty .btn {
  width: fit-content;
}

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

.system-form-section {
  display: grid;
  gap: 3px;
  padding-top: 2px;
}

.system-form-section strong {
  font-size: var(--font-size-sm);
}

.system-form-section span {
  color: var(--muted);
  font-size: var(--font-size-sm);
  line-height: 1.35;
}

.system-form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.system-form-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: var(--font-size-sm);
  line-height: 1.35;
}

.system-form-head .btn {
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.system-org-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--font-size-sm);
  font-weight: var(--weight-semibold);
}

.system-org-form input,
.system-org-form select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.system-password-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.system-password-control .btn {
  min-height: 42px;
  padding: 0 10px;
  font-size: var(--font-size-sm);
  white-space: nowrap;
}

.system-check-row {
  grid-template-columns: 18px 1fr;
  align-items: center;
}

.system-org-list {
  min-width: 0;
  padding: 18px;
}

.system-org-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.system-org-list-head h2,
.system-org-list-head p {
  margin: 0;
}

.system-org-list-head p {
  margin-top: 5px;
  font-size: var(--font-size-sm);
  line-height: 1.35;
}

.system-org-list-head > strong {
  min-width: 28px;
  padding: 4px 8px;
  color: var(--green);
  font-size: var(--font-size-sm);
  text-align: center;
  background: #EAF8F6;
  border-radius: 999px;
}

.system-org-search {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 42px;
  margin-top: 16px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.system-org-search-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.system-org-search-icon svg {
  display: block;
  width: 18px;
  height: 18px;
}

.system-org-search input {
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.system-org-table {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.system-org-row {
  display: flex;
  width: 100%;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px;
  color: var(--text);
  text-align: left;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.system-org-row:hover,
.system-org-row:focus-visible {
  background: var(--surface);
  border-color: rgba(20, 184, 166, 0.38);
  outline: 0;
}

.system-org-row:active {
  transform: translateY(1px);
}

.system-org-row.is-archived {
  opacity: 0.7;
}

.system-org-row.is-selected {
  background: #EAF8F6;
  border-color: rgba(20, 184, 166, 0.38);
}

.system-org-main,
.system-org-row-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.system-org-main strong,
.system-org-main small,
.system-org-row-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-org-main small,
.system-org-row-meta small {
  color: var(--muted);
  font-size: var(--font-size-sm);
}

.system-org-row-meta {
  flex: 0 0 auto;
  justify-items: end;
}

.system-members-card {
  display: grid;
  gap: 13px;
  padding: 18px;
}

.system-members-count {
  display: inline-grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  color: var(--green);
  background: #EAF8F6;
  border-radius: 999px;
}

.system-members-list {
  display: grid;
  gap: 9px;
}

.system-member-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.system-member-identity,
.system-member-meta,
.system-member-action {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.system-member-identity > span:last-child,
.system-member-meta {
  display: grid;
  gap: 3px;
}

.system-member-identity strong,
.system-member-identity small,
.system-member-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-member-identity small,
.system-member-meta small {
  color: var(--muted);
  font-size: var(--font-size-sm);
}

.system-member-shared {
  color: #9a6b14 !important;
}

.system-member-action {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.system-member-action .btn {
  min-height: 34px;
  padding: 0 10px;
  font-size: var(--font-size-sm);
  white-space: nowrap;
}

.system-reset-confirm-label {
  color: #9a6b14;
  font-size: var(--font-size-sm);
  font-weight: var(--weight-semibold);
}

.system-members-empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.system-reset-result {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: #176c63;
  background: #EAF8F6;
  border: 1px solid rgba(20, 184, 166, 0.28);
  border-radius: var(--radius);
}

.system-reset-result > span {
  color: var(--muted);
  font-size: var(--font-size-sm);
  line-height: 1.35;
}

.system-reset-password-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.system-reset-password-line code {
  padding: 8px 10px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--font-size-sm);
  letter-spacing: 0.04em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (max-width: 1360px) {
  .system-admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .system-member-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .system-member-action {
    justify-content: flex-start;
  }
}

@media (max-width: 960px) {
  .system-admin-shell {
    grid-template-columns: 1fr;
  }

  .system-admin-sidebar {
    gap: 14px;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .system-admin-sidebar-note {
    display: none;
  }

  .system-admin-sidebar > #system-logout {
    margin-top: 0;
  }
}

@media (max-width: 640px) {
  .system-admin-workspace {
    padding: 18px;
  }

  .system-admin-header,
  .system-org-row {
    align-items: flex-start;
  }

  .system-admin-header,
  .system-org-row,
  .system-org-list-head {
    flex-direction: column;
  }

  .system-admin-summary,
  .system-org-row-meta {
    justify-content: start;
    justify-items: start;
  }

  .system-org-form-grid {
    grid-template-columns: 1fr;
  }
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}

.brand-title {
  font-size: 19px;
  font-weight: var(--weight-bold);
}

.brand-subtitle {
  max-width: 560px;
  overflow: hidden;
  color: #d8e3ee;
  font-size: 16px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  font-weight: var(--weight-bold);
  background: var(--green);
  border-radius: 50%;
}

.sidebar {
  padding: 10px 0;
  color: #93a3b4;
  background: var(--nav);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.nav-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
}

.nav-item.is-active {
  color: #fff;
  background: var(--nav-2);
}

.nav-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: currentColor;
  opacity: 0.75;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.is-active .nav-icon {
  opacity: 1;
}

.sidebar-subnav {
  display: grid;
  gap: 2px;
  padding: 3px 12px 8px 56px;
}

.sidebar-subnav button {
  width: 100%;
  padding: 7px 9px;
  color: #aebdcc;
  font-size: 13px;
  text-align: left;
  background: transparent;
  border: 0;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
}

.sidebar-subnav button.is-active {
  color: #fff;
  border-left-color: var(--accent);
}

.sidebar-subnav button:disabled {
  cursor: default;
  opacity: 0.48;
}

.workspace {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #fff;
}

.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 7px 18px;
  background: #fbf9f8;
  border-bottom: 1px solid var(--line);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: #eaf0f6;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented button {
  min-width: 34px;
  padding: 6px 9px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.segmented button.is-active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 1px 4px rgba(16, 37, 53, 0.12);
}

.select,
.input,
.textarea {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--text);
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

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

.select:focus,
.input:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 128, 216, 0.14);
}

.time-select {
  font-family: var(--font-ui);
  font-size: 15px;
}

.date-control {
  display: grid;
  grid-template-columns: 32px 150px 32px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.date-control button,
.date-control input {
  min-height: 34px;
  background: #fff;
  border: 0;
}

.date-control input {
  text-align: center;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.primary-outline {
  color: var(--accent-dark) !important;
  background: #fff !important;
  border-color: var(--accent) !important;
}

.link-button {
  padding: 0;
  color: var(--accent-dark);
  font: inherit;
  font-weight: var(--weight-semibold);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.link-button.danger {
  color: #ff5b1f;
}

.icon-plus {
  position: relative;
  width: 16px;
  height: 16px;
}

.icon-plus::before,
.icon-plus::after {
  position: absolute;
  content: "";
  background: currentColor;
  border-radius: 2px;
}

.icon-plus::before {
  inset: 7px 1px;
}

.icon-plus::after {
  inset: 1px 7px;
}


.journal {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: calc(100dvh - 124px);
  overflow: hidden;
}

.journal-head-row,
.journal-body-row {
  display: grid;
  grid-template-columns: 90px repeat(var(--master-count), minmax(0, 1fr));
  width: 100%;
  min-width: 0;
}

.journal-head-row {
  z-index: 8;
}

.journal-body-scroll {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* The day header and columns share one scroll surface, so horizontal
   scrolling can never misalign a master's name and appointments. */
.journal.journal-day-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.journal-day-grid .journal-head-row { position: sticky; top: 0; }
.journal-empty-day { padding: 24px; color: var(--text-secondary); }
.journal-filter-hint { margin: 4px 10px 10px; color: var(--text-secondary); font-size: 12px; }

.time-head,
.master-head {
  min-height: 60px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.time-head {
  position: sticky;
  left: 0;
  z-index: 8;
  color: var(--muted);
  border-right: 1px solid var(--line);
}

.master-head {
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 7;
  border-right: 1px solid var(--line);
}

.master-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: var(--weight-bold);
  background: #6bc9c2;
  border-radius: 50%;
}

.master-name {
  font-weight: var(--weight-semibold);
}

.master-hours {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.time-col {
  position: sticky;
  left: 0;
  /* The time marker inherits this stacking context: above appointments (2)
     and the drop guide (4), but below the slot action popover (6). */
  z-index: 5;
  align-self: start;
  overflow: visible;
  background: #fff;
  border-right: 1px solid var(--line);
}

.journal-scroll-indicator {
  position: absolute;
  left: 0;
  right: calc(-1 * (100vw - 96px));
  z-index: 6;
  height: 0;
  pointer-events: none;
}

.journal-scroll-indicator::before {
  position: absolute;
  top: 50%;
  left: 66px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid rgba(20, 184, 166, 0.72);
  content: "";
  transform: translateY(-50%);
}

.journal-scroll-indicator::after {
  position: absolute;
  top: 50%;
  left: 74px;
  right: 0;
  height: 1px;
  background: rgba(20, 184, 166, 0.18);
  content: "";
  transform: translateY(-50%);
}

.journal-scroll-indicator span {
  position: absolute;
  top: 50%;
  left: 8px;
  padding: 2px 8px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(20, 184, 166, 0.12);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  transform: translateY(-50%);
}

.time-slot {
  height: 72px;
  padding: 10px 12px;
  color: #7f8d9e;
  font-weight: var(--weight-semibold);
  text-align: right;
  border-bottom: 1px solid #e8edf3;
}

.master-column {
  position: relative;
  min-width: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 17px,
      rgba(216, 224, 234, 0.58) 18px
    ),
    repeating-linear-gradient(
      to bottom,
      #fff 0,
      #fff 71px,
      #e8edf3 72px
    );
  border-right: 1px solid var(--line);
}

.journal-nonworking-time {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(148, 163, 184, 0.055) 0,
      rgba(148, 163, 184, 0.055) 7px,
      rgba(255, 255, 255, 0.76) 7px,
      rgba(255, 255, 255, 0.76) 14px
    ),
    rgba(248, 250, 252, 0.26);
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  border-bottom: 1px solid rgba(148, 163, 184, 0.06);
}

.slot-button {
  position: absolute;
  left: 0;
  width: 100%;
  height: var(--journal-slot-height, 6.833px);
  background: transparent;
  border: 0;
  color: var(--accent-dark);
}

.slot-button::after {
  position: absolute;
  inset: 3px 8px;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 12px;
  font-weight: var(--weight-bold);
  line-height: 1;
  content: attr(data-new-time);
  border-radius: 8px;
  pointer-events: none;
}

.slot-button:hover,
.slot-button:focus-visible {
  z-index: 3;
  background: rgba(24, 184, 166, 0.08);
  outline: 1px solid rgba(24, 184, 166, 0.22);
  outline-offset: -1px;
}

.slot-button:hover::after,
.slot-button:focus-visible::after {
  color: var(--accent-dark);
  background: rgba(230, 248, 246, 0.92);
}

.appointment-card {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 8px 12px;
  overflow: hidden;
  color: rgba(23, 32, 42, 0.72);
  font: inherit;
  text-align: left;
  background: var(--event-color);
  border: 1px solid rgba(47, 128, 216, 0.35);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32);
  cursor: pointer;
}

.appointment-card:hover,
.appointment-card:focus-visible {
  border-color: rgba(47, 128, 216, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  outline: 2px solid rgba(47, 128, 216, 0.16);
  outline-offset: 0;
}

.appointment-card.is-blocked {
  color: #475569;
  background: repeating-linear-gradient(
      135deg,
      rgba(148, 163, 184, 0.07) 0,
      rgba(148, 163, 184, 0.07) 7px,
      rgba(255, 255, 255, 0.7) 7px,
      rgba(255, 255, 255, 0.7) 14px
    ),
    #f8fafc;
}

.appointment-time {
  font-size: 12px;
  font-weight: var(--weight-semibold);
}

.appointment-client {
  margin-top: 3px;
  font-weight: var(--weight-bold);
}

.appointment-meta {
  margin-top: 4px;
  color: rgba(23, 32, 42, 0.58);
  font-size: 13px;
  line-height: 1.35;
}

.slot-action-popover {
  position: absolute;
  left: 50%;
  z-index: 6;
  display: grid;
  width: min(240px, calc(100% - 24px));
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 18px 36px rgba(15, 35, 55, 0.22);
  transform: translateX(-50%);
}

.slot-action-popover::before {
  position: absolute;
  top: -8px;
  left: calc(50% - 8px);
  width: 14px;
  height: 14px;
  content: "";
  background: #fff;
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  transform: rotate(45deg);
}

.slot-action-time {
  text-align: center;
  color: var(--muted);
  font-size: 18px;
  font-weight: var(--weight-bold);
}

.slot-action-popover .btn {
  width: 100%;
}

.right-panel {
  min-width: 0;
  overflow: auto;
  background: #f8fafc;
}

.panel-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: var(--weight-bold);
}

.client-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 14px;
}

.clients-workspace {
  padding: 0;
  overflow: hidden;
}

.client-base-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 8px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.client-base-search {
  display: grid;
  grid-template-columns: 18px minmax(220px, 420px);
  align-items: center;
  gap: 10px;
  width: min(480px, 48vw);
  min-height: 38px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.client-base-search svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
}

.client-base-search input {
  width: 100%;
  min-height: 36px;
  color: var(--text);
  font-size: 12.5px;
  background: transparent;
  border: 0;
  outline: 0;
}

.settings-page {
  padding: 0;
  background: #fff;
}

.settings-service-filters {
  display: grid;
  grid-template-columns: 180px 180px 180px minmax(220px, 1fr) auto;
  gap: 10px;
  padding: 12px 18px;
  background: #fbf9f8;
  border-bottom: 1px solid var(--line);
}

.employees-filters {
  grid-template-columns: minmax(190px, 260px) minmax(260px, 1fr) minmax(160px, 220px) auto auto;
  align-items: center;
}

.settings-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
}

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

.employees-filters .settings-search > span {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.employees-filters .settings-search > span svg {
  display: block;
}

.settings-table {
  width: 100%;
  background: #fff;
}

.settings-table-head,
.settings-row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
}

.employees-table .settings-table-head,
.employees-table .settings-row {
  grid-template-columns: minmax(220px, 1.25fr) minmax(160px, 1fr) minmax(150px, 0.9fr) 86px;
}

.employees-filters .employees-search { max-width: 370px; }

.services-table .settings-table-head,
.services-table .settings-row {
  grid-template-columns: minmax(230px, 1.55fr) minmax(130px, 0.85fr) 92px 120px 120px 86px;
}

.access-table .settings-table-head,
.access-table .settings-row {
  grid-template-columns: minmax(250px, 1.45fr) 120px minmax(160px, 1fr) minmax(210px, 1.1fr) 96px;
}

.settings-table-head {
  min-height: 40px;
  color: #8a95a3;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #f3f6f9;
  border-bottom: 1px solid var(--line);
}

.settings-row {
  width: 100%;
  min-height: 64px;
  color: var(--text);
  font-weight: var(--weight-regular);
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.settings-row:hover {
  background: #f4f9ff;
}

.settings-row > span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.settings-person {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.settings-person strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.settings-service-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: var(--weight-semibold);
}

.settings-status {
  display: inline-flex;
  padding: 2px 7px;
  color: #7a8795;
  font-size: 11px;
  font-style: normal;
  font-weight: var(--weight-semibold);
  background: #eef1f4;
  border-radius: 999px;
}

.settings-status.is-active {
  color: var(--accent-dark);
  background: #eef6ff;
}

.settings-placeholder {
  margin: 18px;
  padding: 18px;
  max-width: 620px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings-placeholder h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 18px;
}

.settings-placeholder p {
  margin: 0;
  line-height: 1.5;
}

.settings-side-panel .note-box {
  margin-top: 12px;
}

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

.profile-settings-stack {
  display: grid;
  gap: 14px;
}

/* Settings share the same full desktop work area as the journal and client base. */
.settings-page,
.profile-settings-stack {
  width: 100%;
  max-width: none;
}

.panel-section.profile-settings-card {
  margin-bottom: 0;
  padding: 18px;
  border-bottom: 0;
}

.profile-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.profile-settings-head h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: var(--weight-semibold);
}

.profile-settings-head p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.profile-session-card .profile-settings-head {
  align-items: center;
  margin-bottom: 0;
}

.profile-settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.branch-source-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.branch-source-entry { display: flex; flex: 0 1 370px; min-width: 0; gap: 8px; }
.branch-source-entry .input { min-width: 0; }
.branch-source-chips { display: flex; flex: 1 1 240px; flex-wrap: wrap; gap: 8px; min-width: 0; }
.branch-source-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 4px 3px 12px; border-radius: 12px; background: var(--primary-soft); color: var(--accent-dark); }
.branch-source-chip > span { overflow-wrap: anywhere; min-width: 0; }
.branch-source-chip button { flex-shrink: 0; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: inherit; font-size: 22px; cursor: pointer; }
.branch-source-chip button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.branch-source-feedback { margin: 0; color: var(--text-secondary); font-size: 13px; }
.branch-source-feedback:empty { display: none; }

.profile-logout-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.inline-success {
  margin-bottom: 14px;
  padding: 12px 14px;
  color: var(--accent-dark);
  background: var(--primary-soft);
  border: 1px solid rgba(24, 184, 166, 0.16);
  border-radius: 14px;
  font-weight: var(--weight-medium);
}

.dictionary-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.dictionary-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.dictionary-row:last-child {
  border-bottom: 0;
}

.dictionary-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

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

.calendar-section {
  padding-top: 16px;
}

.calendar-head {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  text-align: center;
}

.calendar-title {
  font-size: 18px;
  font-weight: var(--weight-bold);
}

.calendar-year {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-nav,
.calendar-day {
  display: grid;
  place-items: center;
  color: var(--text);
  background: #fff;
  border: 1px solid transparent;
  border-radius: 6px;
}

.calendar-nav {
  color: var(--primary);
  border-color: var(--border-light);
}

.calendar-nav:hover,
.calendar-day:hover {
  background: #eef6ff;
  border-color: #bdd7f2;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--weight-bold);
  text-align: center;
}

.calendar-day {
  min-height: 34px;
  font-size: 14px;
}

.calendar-day.is-muted {
  color: var(--muted-2);
}

.calendar-day.is-today {
  border-color: #9ec8ef;
}

.calendar-day.is-selected {
  color: #fff;
  font-weight: var(--weight-bold);
  background: var(--accent);
  border-color: var(--accent-dark);
}

.calendar-day.is-week-range {
  color: var(--text-primary);
  background: #e8f7f5;
  border-color: transparent;
  border-radius: 0;
}

.calendar-day.is-week-range-start {
  border-radius: 7px 0 0 7px;
}

.calendar-day.is-week-range-end {
  border-radius: 0 7px 7px 0;
}

.calendar-day.is-week-range.is-selected {
  color: #087d75;
  background: #ccefe9;
  border-color: #83d9ce;
}

.client-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.client-list.is-full {
  max-height: calc(100dvh - 196px);
}

.client-register {
  width: 100%;
  min-width: 0;
  background: #fff;
}

.client-register-head,
.client-register-row {
  display: grid;
  grid-template-columns: 38px minmax(180px, 1.35fr) minmax(122px, 0.75fr) 92px 58px 112px 100px 112px;
  align-items: center;
}

.client-register.is-finance-hidden .client-register-head,
.client-register.is-finance-hidden .client-register-row {
  grid-template-columns: 38px minmax(180px, 1.35fr) minmax(122px, 0.75fr) 92px 58px 112px;
}

.client-register-head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 42px;
  color: #5f6b7a;
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: #f3f6f9;
  border-bottom: 1px solid var(--line);
}

.client-register-head span {
  text-align: center;
}

.client-register-head span:nth-child(2) {
  text-align: left;
}

.client-register-head span,
.client-register-row > span,
.client-register-cell {
  padding: 0 6px;
}

.client-register-head input,
.client-register-row input {
  width: 16px;
  height: 16px;
}

.client-register-row {
  min-height: 54px;
  border-bottom: 1px solid var(--line);
}

.client-register-row:hover,
.client-register-row.is-active {
  background: #f4f9ff;
}

.client-directory-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 4px 2px;
  color: var(--muted);
  font-size: 13px;
}

.client-directory-pagination > div {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.client-directory-pagination b {
  min-width: 58px;
  color: var(--text);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.client-register-person,
.client-register-cell {
  min-width: 0;
  min-height: 54px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
}

.client-register-person {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: 8px;
}

.client-register-person strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.client-register-person strong {
  font-size: 13.5px;
  font-weight: var(--weight-semibold);
}

.client-register-cell {
  display: grid;
  align-items: center;
  justify-items: center;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 12px;
  white-space: nowrap;
}

.client-phone-cell {
  color: var(--muted);
}

.client-status-dot {
  display: inline-flex;
  width: max-content;
  padding: 2px 7px;
  color: var(--accent-dark);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  background: #eef6ff;
  border: 1px solid #cfe3f7;
  border-radius: 999px;
}

.client-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.client-row.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 128, 216, 0.11);
}

.client-title {
  display: block;
  overflow: hidden;
  font-weight: var(--weight-bold);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.client-phone,
.client-note,
.muted {
  color: var(--muted);
}

.client-phone,
.client-note {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.client-row-side {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.client-kpi {
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: var(--weight-bold);
}

.client-status {
  padding: 3px 7px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: var(--weight-bold);
  background: #eef6ff;
  border: 1px solid #cfe3f7;
  border-radius: 999px;
}

.client-filter-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.clients-filter-panel .section-title {
  margin-bottom: 10px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.client-filter-list button {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
}

.client-filter-list button.is-active {
  color: var(--accent-dark);
  background: #eef6ff;
  border-color: #9ec8ef;
}

.client-filter-list span,
.client-filter-list strong,
.client-filter-list small {
  display: block;
}

.client-filter-list strong {
  font-size: 13px;
}

.client-filter-list small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.client-filter-list b {
  color: #506070;
  font-family: var(--font-ui);
  font-size: 11px;
}

.client-card-title {
  margin: 0;
  font-size: 19px;
  line-height: 1.1;
}

.client-card-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.client-card-page {
  min-height: calc(100dvh - 108px);
  padding: 14px 20px 28px;
  background: #fff;
}

.client-card-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.client-card-main {
  min-width: 0;
}

.client-card-main h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.client-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.client-card-meta span {
  padding: 4px 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.client-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 96px);
  gap: 6px;
}

.client-card-metrics div {
  padding: 8px 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.client-card-metrics strong,
.client-card-metrics span {
  display: block;
}

.client-card-metrics strong {
  font-family: var(--font-ui);
  font-size: 16px;
}

.client-card-metrics span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.client-tab-panel {
  padding-top: 18px;
}

.client-tabs-mobile {
  display: none;
}

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

.client-section-card,
.info-item {
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.client-section-card h3,
.client-tab-head h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.client-section-card p,
.client-tab-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.info-item span,
.info-item strong {
  display: block;
}

.info-item span {
  color: var(--muted);
  font-size: 13px;
}

.info-item strong {
  margin-top: 5px;
  font-weight: var(--weight-bold);
}

.client-tab-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.client-wide-list {
  max-width: 760px;
}

.client-form-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

.control-grid .medical-field.wide {
  grid-column: span 2;
}

.control-red-zone {
  align-self: end;
  min-height: 40px;
  padding: 8px 10px;
  background: #fff7f7;
  border: 1px solid #f2c9c4;
  border-radius: 6px;
}

.client-overview-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.client-overview-column {
  display: grid;
  gap: 12px;
  align-content: start;
}

.client-status-summary h3,
.client-work-status-card h3 {
  margin-bottom: 12px;
}

.client-status-lines {
  display: grid;
}

.client-status-line {
  display: grid;
  grid-template-columns: minmax(128px, 0.86fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.client-status-line:last-child {
  border-bottom: 0;
}

.client-status-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.client-status-line strong {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: var(--weight-semibold);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.client-popular-services-list {
  display: grid;
}

.client-popular-service {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.client-popular-service:last-child {
  border-bottom: 0;
}

.client-popular-service span {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.client-popular-service strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.work-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 24px;
  max-width: 100%;
  padding: 4px 10px;
  color: #667085;
  font-size: 12px;
  font-style: normal;
  font-weight: var(--weight-semibold);
  line-height: 1.15;
  background: #eef2f7;
  border-radius: 999px;
  white-space: normal;
  text-align: center;
}

.client-work-status-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.client-work-status-fields .wide {
  grid-column: 1 / -1;
}

.client-work-status-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.client-work-status-help {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.client-work-status-head {
  align-items: flex-start;
}

.client-work-status-head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.client-work-status-head .work-status-pill {
  flex: 0 0 104px;
  min-width: 104px;
}

.client-data-card {
  display: grid;
  gap: 12px;
}

.client-data-card-head,
.client-history-tab > h3 {
  margin-bottom: 0;
}

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

.client-data-field-editor {
  display: contents;
}

.client-data-row {
  display: grid;
  grid-template-columns: 40% minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  padding: 10px 0;
  box-sizing: border-box;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.client-data-row.is-wide {
  grid-column: 1 / -1;
  grid-template-columns: minmax(140px, 0.5fr) minmax(0, 1fr);
}

.client-data-row-label,
.client-data-row-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.medical-required-mark {
  color: #d85a45;
  font-weight: var(--weight-bold);
}

.client-data-row-value {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: var(--weight-semibold);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.client-data-row-value.is-note {
  font-weight: var(--weight-regular);
  white-space: normal;
}

.client-data-row.is-editing {
  align-items: center;
  grid-template-columns: 40% minmax(0, 1fr);
}

.client-data-row.is-editing.is-wide {
  grid-template-columns: minmax(140px, 0.5fr) minmax(0, 1fr);
}

.client-data-row-editor input,
.client-data-row-editor select,
.client-data-row-editor textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  box-sizing: border-box;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.client-data-row-editor {
  min-width: 0;
}

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

.client-data-choice-option {
  min-height: 40px;
  padding: 8px 12px;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: var(--weight-semibold);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
}

.client-data-choice-option:hover {
  color: var(--primary-dark);
  border-color: var(--primary);
}

.client-data-choice-option.is-selected {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: var(--primary);
}

.client-data-row-editor textarea {
  min-height: 44px;
  resize: vertical;
}

.client-data-row-editor input:focus,
.client-data-row-editor select:focus,
.client-data-row-editor textarea:focus {
  outline: none;
  color: var(--primary-dark);
  border-color: var(--line-strong);
  box-shadow: none;
}

.client-data-row-edit svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
}

.client-inline-check {
  min-height: 42px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.client-control-history {
  margin-top: 20px;
}

.client-history-tab .timeline,
.client-control-history .timeline {
  margin-top: 14px;
}

.visit-list,
.recommendation-list {
  display: grid;
  gap: 8px;
}

.visit-card,
.recommendation-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: start;
  padding: 11px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.visit-card-button {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.visit-card-button:hover,
.visit-card-button:focus-visible {
  border-color: rgba(24, 184, 166, 0.45);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.visit-card strong,
.visit-card span,
.visit-card-comment,
.recommendation-card strong,
.recommendation-card span,
.recommendation-card p,
.recommendation-card em {
  display: block;
}

.visit-card strong,
.recommendation-card strong {
  font-weight: var(--weight-semibold);
}

.visit-card span,
.visit-card-comment,
.recommendation-card span,
.recommendation-card p,
.recommendation-card em {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.visit-card-comment,
.recommendation-card p,
.recommendation-card em {
  grid-column: 1 / -1;
  margin: 0;
}

.recommendation-card em {
  font-style: normal;
}

.visit-card-side {
  display: grid;
  justify-items: end;
  gap: 3px;
  white-space: nowrap;
}

.visit-card-side b {
  font-family: var(--font-ui);
  font-size: 13px;
}

.visit-card-side em {
  color: var(--accent-dark);
  font-size: 11px;
  font-style: normal;
  font-weight: var(--weight-semibold);
}

.medical-form {
  display: grid;
  gap: 12px;
  font-family: var(--font-ui);
}

.client-profile-card {
  padding: 0 16px;
}

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

.client-profile-column {
  min-width: 0;
}

.client-medical-field-editor {
  position: relative;
  min-width: 0;
}

.client-medical-field-editor.is-wide {
  grid-column: 1 / -1;
}

.client-profile-row {
  display: grid;
  grid-template-columns: 40% minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 60px;
  box-sizing: border-box;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.client-profile-row-display {
  padding: 10px 0;
  background: transparent;
  cursor: pointer;
}

.client-profile-row > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.client-profile-row input,
.client-profile-row select {
  width: 100%;
  min-width: 0;
  padding: 8px 0;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: var(--weight-semibold);
  background: transparent;
  border: 0;
  border-radius: 0;
}

.client-profile-row-value {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: var(--weight-semibold);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.client-profile-row.is-editing .client-data-row-editor input {
  min-height: 40px;
  padding: 8px 10px;
  box-sizing: border-box;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.client-profile-row select {
  cursor: pointer;
}

.client-profile-row input:focus,
.client-profile-row select:focus {
  outline: none;
  color: var(--primary-dark);
}

.client-profile-row input::placeholder {
  color: var(--text);
  font-weight: var(--weight-semibold);
  opacity: 1;
}

.client-profile-column > .medical-conditional {
  margin: 0;
}

.client-profile-column .medical-field.wide,
.client-profile-column .medication-tag-field {
  margin-top: 12px;
}

.client-profile-column .medical-field textarea,
.client-profile-column .medication-tags {
  background: #fff;
}

.client-notes-card .medical-field > span,
.client-profile-column .medical-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.client-notes-card .medical-field,
.client-profile-column .medical-field {
  gap: 10px;
}

.client-data-card + .medical-form {
  margin-top: 12px;
}

.client-data-card + .client-notes-card,
.client-notes-card + .medical-form,
.medical-form + .client-notes-card {
  margin-top: 12px;
}

.client-notes-card {
  display: grid;
  gap: 12px;
}

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

.client-note-editor {
  position: relative;
  min-width: 0;
}

.client-note-editor.is-wide {
  grid-column: 1 / -1;
}

.client-note-editor .medical-field textarea {
  min-height: 76px;
}

.client-note-editor.is-wide .medical-field textarea {
  min-height: 132px;
}

@media (max-width: 760px) {
  .client-profile-columns {
    grid-template-columns: 1fr;
  }

  .client-profile-row {
    grid-template-columns: 40% minmax(0, 1fr);
  }

  .client-medical-field-editor.is-wide {
    grid-column: auto;
  }

  .client-notes-grid {
    grid-template-columns: 1fr;
  }

  .client-note-editor.is-wide {
    grid-column: auto;
  }
}


.medical-card {
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.medical-card h3,
.medical-card p {
  margin: 0;
}

.medical-card h3 {
  font-size: 17px;
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  letter-spacing: 0;
}

.medical-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.medical-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.medical-card-head .btn {
  flex: 0 0 auto;
}

.problems-workspace {
  display: grid;
  grid-template-columns: minmax(270px, 0.38fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.problems-list-card,
.problem-detail-card,
.problem-history-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
}

.problems-list-card {
  display: grid;
  gap: 16px;
  padding: 14px;
}

.problems-list-head,
.problem-detail-head,
.problem-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.problems-list-head h3,
.problem-detail-head h3,
.problem-history-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: var(--weight-semibold);
  line-height: 1.25;
}

.problems-list-head p,
.problem-detail-head p,
.problem-history-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.problem-add-button {
  flex: 0 0 auto;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
}

.problem-add-button .icon-plus {
  display: inline-block;
  flex: 0 0 16px;
  margin: 0;
}

[data-saved-visit-photos]:empty { display: none; }
.saved-visit-photo-grid { display: flex; gap: 6px; }
.saved-visit-photo-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: var(--type-caption-size);
  font-weight: var(--weight-semibold);
  line-height: var(--line-compact);
}
.saved-visit-photo-thumb, .saved-visit-photo-more, .saved-visit-photo-state {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 48px; width: 48px; height: 48px; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--primary-soft); color: var(--primary); font: inherit; font-weight: 600;
}
.saved-visit-photo-thumb, .saved-visit-photo-more { cursor: pointer; }
.saved-visit-photo-grid img { width: 100%; height: 100%; object-fit: cover; }
.saved-visit-photo-thumb:focus-visible, .saved-visit-photo-more:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.saved-visit-photo-viewer {
  width: min(980px, calc(100vw - 32px)); max-width: none;
  max-height: calc(100dvh - 32px); padding: 16px; margin: auto;
  border: 1px solid var(--line); border-radius: 16px;
  background: #fff; color: var(--text);
}
.saved-visit-photo-viewer::backdrop { background: rgba(15, 23, 42, .62); }
.saved-visit-viewer-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.saved-visit-viewer-stage { display: flex; align-items: center; justify-content: center; gap: 8px; }
.saved-visit-viewer-stage img { display: block; min-width: 0; width: 100%; height: min(68dvh, 720px); object-fit: contain; }
.saved-visit-viewer-arrow { flex: 0 0 36px; width: 36px; height: 44px; padding: 8px; border: 0; border-radius: 8px; color: var(--primary); background: var(--primary-soft); cursor: pointer; }
.saved-visit-viewer-arrow[hidden] { display: none; }
.saved-visit-viewer-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.saved-visit-viewer-caption { margin: 12px 0 0; overflow-wrap: anywhere; }
.saved-visit-viewer-caption:empty { display: none; }
@media (max-width: 760px) {
  .saved-visit-photo-viewer { padding: 12px; }
  .saved-visit-viewer-stage { position: relative; min-height: 160px; }
  .saved-visit-viewer-stage img { height: auto; max-height: 65dvh; }
  .saved-visit-viewer-arrow { position: absolute; left: 4px; }
  .saved-visit-viewer-arrow[data-saved-photo-step="1"] { left: auto; right: 4px; }
}

.problem-filter-control {
  display: grid;
  gap: 5px;
}

.problem-filter-control > span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: var(--weight-semibold);
}

.problems-list-section {
  display: grid;
  gap: 6px;
}

.problems-list-section > span,
.problem-detail-eyebrow {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.problem-list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
}

.problem-list-item:hover {
  background: var(--surface-soft);
}

.problem-list-item.is-active {
  background: var(--primary-soft);
  border-color: rgba(24, 184, 166, 0.22);
}

.problem-list-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.problem-list-main strong,
.problem-list-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.problem-list-main strong {
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.problem-list-main small {
  color: var(--muted);
  font-size: 11.5px;
}

.problem-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  font-size: 11px;
  font-style: normal;
  font-weight: var(--weight-semibold);
  border-radius: 999px;
}

.problem-status-active {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.problem-status-control {
  color: #996114;
  background: var(--warning-soft);
}

.problem-status-closed {
  color: var(--muted);
  background: var(--surface-soft);
}

.problems-list-empty {
  padding: 12px 10px;
  color: var(--muted);
  font-size: 12px;
  background: var(--surface-soft);
  border-radius: 10px;
}

.problem-empty-state {
  display: grid;
  min-height: 340px;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 28px;
  text-align: center;
  background: #fff;
  border: 1px dashed var(--line-strong);
  border-radius: var(--card-radius);
}

.problem-empty-state-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 16px;
}

.problem-empty-state-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.problem-empty-state h3 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 18px;
}

.problem-empty-state p {
  max-width: 390px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.problems-list-closed {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.problem-detail-stack {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.problem-detail-card,
.problem-history-card {
  padding: 16px;
}

.problem-delete-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  background: #fff;
  border: 1px solid #f2c7bf;
  border-radius: var(--card-radius);
}

.problem-delete-card h3 {
  margin: 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: var(--weight-semibold);
}

.problem-delete-card p {
  max-width: 680px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.problem-delete-card .btn {
  flex: 0 0 auto;
}

.problem-detail-head {
  margin-bottom: 18px;
}

.problem-detail-head .btn {
  flex: 0 0 auto;
}

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

.problem-context-grid {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.problem-origin-history {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.problem-origin-history-head h3,
.problem-origin-history-head p {
  margin: 0;
}

.problem-origin-history-head h3 {
  color: var(--text);
  font-size: 15px;
  font-weight: var(--weight-semibold);
}

.problem-origin-history-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

.problem-create-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

.problem-history-head {
  margin-bottom: 14px;
}

.problem-attach-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.problem-attach-form select {
  min-width: 0;
  min-height: var(--control-h);
  padding: 0 38px 0 12px;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  background-color: #fff;
  border: 1px solid var(--border-light);
  border-radius: 10px;
}

.problem-followup-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.problem-followup-list > span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.problem-followup-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.problem-followup-list strong {
  color: var(--text);
  font-size: 13px;
}

.problem-followup-list em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.problem-timeline {
  display: grid;
  gap: 10px;
}

.problem-history-empty {
  max-width: none;
}

.problem-timeline-item {
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.problem-timeline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.problem-visit-link {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 0;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
}

.problem-visit-link strong {
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.problem-visit-link span,
.problem-timeline-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.problem-visit-unlink {
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.problem-visit-unlink:hover {
  color: #b8483f;
  background: #fff5f3;
  border-color: #f0c9c5;
}

.problem-timeline-note {
  margin-top: 10px;
}

.problem-timeline-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--primary-dark);
  font-size: 11.5px;
}

.problem-timeline-summary span {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  background: var(--primary-soft);
  border-radius: 50%;
}

.problem-timeline-photos {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.problem-timeline-photos img,
.problem-timeline-photos span {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 8px;
}

.problem-timeline-photos span {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  background: #fff;
  border: 1px solid var(--line);
}

.recommendation-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
  gap: 14px;
}

.recommendation-editor-card > * {
  width: 100%;
  box-sizing: border-box;
}

.recommendation-editor-card {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
}

.recommendation-form-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.recommendation-item-section {
  display: grid;
  gap: 12px;
}

.recommendation-item-sections {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  width: 100%;
  min-width: 0;
}

.recommendation-item-section,
.recommendation-item-list,
.recommendation-item-row {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.recommendation-item-section,
.recommendation-item-list {
  grid-template-columns: minmax(0, 1fr);
}

.recommendation-editor-card .medical-field > span,
.recommendation-editor-card .recommendation-item-section h4 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.recommendation-item-list {
  display: grid;
  gap: 8px;
}

.recommendation-item-row {
  display: grid;
  grid-template-columns: 25% minmax(0, 3fr) 24px;
  gap: 8px;
  align-items: center;
}

.recommendation-item-row input,
.recommendation-item-row select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  box-sizing: border-box;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.recommendation-item-remove {
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.recommendation-item-remove:hover {
  color: var(--danger);
  background: #fff1f2;
}

.recommendation-add-item {
  justify-self: start;
  padding: 2px 0;
  color: var(--primary-dark);
  font: inherit;
  font-size: 13px;
  font-weight: var(--weight-semibold);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.recommendation-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.recommendation-form-actions .btn.danger {
  margin-right: auto;
}

.recommendation-export-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 760px) {
  .family-empty-card {
    grid-template-columns: 1fr;
  }

  .family-card-head,
  .family-card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .family-card-actions .btn {
    width: 100%;
  }

  .family-booking-time-grid,
  .family-booking-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .family-booking-row .check-row {
    grid-row: auto;
  }

  .recommendation-meta-grid {
    grid-template-columns: 1fr;
  }

  .problem-delete-card {
    align-items: stretch;
    flex-direction: column;
  }

  .problem-delete-card .btn {
    width: 100%;
  }

  .recommendation-form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .recommendation-form-actions .btn.danger {
    margin-right: 0;
  }

  .recommendation-editor-card .medical-card-head {
    flex-direction: column;
  }

  .recommendation-export-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .recommendation-export-actions .btn {
    width: 100%;
  }

  .recommendation-export-actions.is-single {
    grid-template-columns: minmax(0, 1fr);
  }

  .recommendation-item-row {
    grid-template-columns: minmax(0, 1fr) 32px;
  }

  .recommendation-item-row input,
  .recommendation-item-row select {
    grid-column: 1;
  }

  .recommendation-item-row input + input,
  .recommendation-item-row select + input {
    grid-row: 2;
  }

  .recommendation-item-remove {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

.medical-history-card {
  background: #fbfcfd;
}

.medical-exam-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.medical-exam-list button {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  color: var(--text);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.medical-exam-list button:hover,
.medical-exam-list button.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(47, 128, 216, 0.12);
}

.medical-exam-list strong,
.medical-exam-list span,
.medical-exam-list em {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.medical-exam-list strong {
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.medical-exam-list span,
.medical-exam-list em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

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

.medical-subsection {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.medical-subsection h4 {
  margin: 0;
  color: #253246;
  font-size: 14px;
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  letter-spacing: 0;
}

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

.medical-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.medical-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.medical-field.wide {
  grid-column: span 2;
}

.medical-grid.compact .medical-field.wide {
  grid-column: 1 / -1;
}

.medical-conditional {
  display: contents;
}

.medical-conditional.is-hidden {
  display: none;
}

.medical-field span,
.medical-field small,
.medical-specialists > span,
.medical-side-grid strong,
.medical-nail-side > strong {
  color: var(--text);
  font-size: 12.5px;
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  letter-spacing: 0;
}

.medical-field small {
  color: var(--muted);
  font-weight: var(--weight-regular);
}

.medical-field input,
.medical-field select,
.medical-field textarea {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.medical-field textarea {
  min-height: 70px;
  resize: vertical;
}

.medication-tag-field {
  gap: 6px;
}

.medication-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.medication-tags:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14);
}

.medication-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  padding: 5px 8px;
  color: #0f766e;
  font-size: 13px;
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  background: #e6fffb;
  border: 1px solid rgba(20, 184, 166, 0.25);
  border-radius: 999px;
}

.medication-tag span {
  overflow: hidden;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.medication-tag button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  padding: 0;
  color: #0f766e;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  background: rgba(20, 184, 166, 0.12);
  border: 0;
  border-radius: 999px;
}

.medication-tag button:hover {
  background: rgba(20, 184, 166, 0.22);
}

.medical-field .medication-tag-input {
  width: auto;
  min-width: 180px;
  flex: 1 1 180px;
  padding: 5px 4px;
  border: 0;
  border-radius: 0;
}

.medical-field .medication-tag-input:focus {
  outline: 0;
  box-shadow: none;
}

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

.medical-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.medical-check-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.medical-check-grid input {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.medical-check-grid span {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.medical-nail-side {
  min-width: 0;
}

.medical-nail-grid {
  display: grid;
  grid-template-columns: minmax(116px, 1fr) repeat(5, 32px);
  align-items: center;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.medical-nail-grid > * {
  display: grid;
  min-height: 30px;
  place-items: center;
  padding: 4px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.medical-nail-grid span {
  justify-content: start;
  color: var(--text);
  font-size: 11px;
  text-align: left;
}

.medical-nail-grid b {
  color: var(--muted);
  font-size: 11px;
}

.medical-nail-grid input {
  width: 14px;
  height: 14px;
}

.medical-specialists {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.medical-specialists .medical-check-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 0;
}

.client-context-panel {
  display: grid;
  gap: 12px;
}

.client-side-actions {
  display: grid;
  gap: 10px;
}

.panel-back {
  justify-self: start;
}

.context-status-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.context-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.context-row strong {
  color: var(--text);
  text-align: right;
}

.client-side-note {
  display: grid;
  gap: 12px;
  color: var(--text);
}

.client-side-note-block {
  display: grid;
  gap: 4px;
}

.client-side-note-block strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.client-side-note-block p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.profile-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.profile-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.profile-name {
  margin: 0 0 4px;
  font-size: 18px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.profile-metric {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
}

.profile-metric:last-child {
  border-right: 0;
}

.metric-value {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: var(--weight-bold);
}

.metric-label {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.profile-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

 .schedule-heading {
  min-width: 170px;
  margin: 0;
  text-align: center;
}

.schedule-layout {
  overflow: auto;
  min-height: calc(100dvh - 116px);
  background: #fff;
}

.schedule-matrix {
  --schedule-staff-column: 62px;
  display: grid;
  grid-template-columns: var(--schedule-staff-column) repeat(var(--day-count), 74px);
  align-content: start;
  min-width: max-content;
  user-select: none;
}

.schedule-corner,
.schedule-date-head,
.schedule-master-cell,
.schedule-cell {
  min-height: 58px;
  background: #fff;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.schedule-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 5;
  display: grid;
  align-items: center;
  place-items: center;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  background: #f8fafc;
}

.schedule-corner-diagram {
  position: relative;
  display: block;
  width: 34px;
  height: 34px;
  color: var(--muted);
  background: linear-gradient(45deg, transparent 48%, var(--border-soft) 49%, var(--border-soft) 51%, transparent 52%);
  transition: opacity 0.14s ease;
}

.schedule-corner-person,
.schedule-corner-calendar {
  position: absolute;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
}

.schedule-corner-person {
  bottom: 1px;
  left: 1px;
}

.schedule-corner-calendar {
  top: 1px;
  right: 1px;
}

.schedule-corner-diagram svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.schedule-date-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 6px 4px;
  color: var(--text);
  text-align: center;
}

.schedule-date-head strong {
  font-size: 19px;
  line-height: 1;
}

.schedule-date-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-bold);
}

.schedule-master-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 66px;
  padding: 8px;
  background: #fff;
}

.schedule-master-cell .client-initial {
  width: 38px;
  height: 38px;
  font-size: 12px;
}

.schedule-cell {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 66px;
  padding: 6px 4px;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.schedule-cell strong,
.schedule-cell span {
  font-family: var(--font-ui);
}

.schedule-cell strong {
  color: var(--text);
  font-size: 13px;
}

.schedule-cell span {
  margin-top: 2px;
  font-size: 12px;
}

.schedule-cell em {
  margin-top: 3px;
  padding: 2px 5px;
  color: #8a5a00;
  font-size: 10px;
  font-style: normal;
  background: #fff3cf;
  border: 1px solid #f0d48a;
  border-radius: 999px;
}

.schedule-cell.is-working {
  color: var(--accent-dark);
  background: #f4f9ff;
}

.schedule-cell.is-working:hover,
.schedule-date-head:hover,
.schedule-cell.is-off:hover {
  background: #e8f3ff;
}

.schedule-cell.is-off {
  background: #fbfcfd;
}

.schedule-cell.is-weekend,
.schedule-date-head.is-weekend {
  background: #fff7f7;
}

.schedule-cell.is-selected,
.schedule-date-head.is-selected {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.schedule-cell.is-current-day,
.schedule-date-head.is-current-day {
  box-shadow: inset 0 0 0 2px rgba(47, 128, 216, 0.4);
}

.schedule-cell[data-schedule-readonly="true"] {
  cursor: pointer;
}

.schedule-tools-panel {
  min-height: calc(100dvh - 56px);
  background: #f8fafc;
}

.schedule-readonly-panel {
  display: grid;
  align-content: start;
  gap: 18px;
}

.schedule-readonly-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

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

.schedule-readonly-summary strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-readonly-summary span:not(.client-initial) {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.schedule-tools-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.schedule-tools-head .section-title {
  margin-bottom: 4px;
}

.schedule-tools-head .muted {
  overflow: hidden;
  max-width: 170px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.schedule-edit-box {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}

.schedule-edit-box > label {
  color: var(--text);
  font-weight: var(--weight-semibold);
}

.schedule-time-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.schedule-break-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #fff8e6;
  border: 1px solid #efd799;
  border-radius: 6px;
}

.schedule-break-box label {
  color: #8a5a00;
  font-weight: var(--weight-bold);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--text);
  line-height: 1.35;
}

.check-row.wide {
  grid-column: 1 / -1;
}

.check-row input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
}

 .schedule-panel-action {
  width: 100%;
}

.schedule-panel-or {
  color: var(--muted);
  text-align: center;
}

.schedule-empty-panel {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 328px;
  margin: 0 auto;
  padding-top: 6px;
  text-align: left;
}

.regular-schedule-head {
  padding-bottom: 0;
}

.regular-schedule-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
}

.regular-schedule-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.regular-schedule-box {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 0 0 16px;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.regular-schedule-box > label {
  color: var(--text);
  font-size: 14px;
  font-weight: var(--weight-bold);
}

.weekday-pills {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.weekday-pill {
  position: relative;
}

.weekday-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.weekday-pill span {
  display: grid;
  min-height: 30px;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-bold);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.weekday-pill input:checked + span {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent-dark);
}

.schedule-rule-note {
  padding: 9px 10px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
  background: var(--primary-soft);
  border: 1px solid rgba(20, 184, 166, 0.16);
  border-radius: 10px;
}

.schedule-mini-demo {
  display: grid;
  grid-template-columns: 34px repeat(3, 54px);
  gap: 0;
  justify-content: center;
  margin: 6px auto 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.schedule-mini-demo > * {
  display: grid;
  min-height: 42px;
  place-items: center;
  background: #fff;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.schedule-mini-demo button {
  border: 0;
}

.schedule-mini-demo .is-on {
  background: var(--accent);
}

.note-box {
  padding: 12px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  line-height: 1.45;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photo-upload-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(240px, 0.7fr);
  gap: 12px;
  max-width: 1040px;
}

.photo-upload-grid > .medical-field:first-child {
  grid-column: auto;
}

.photo-upload-grid > .medical-field:last-child {
  grid-column: 1 / -1;
}

.photo-file-control {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 7px 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.photo-file-control:focus-within {
  border-color: rgba(24, 184, 166, 0.45);
  box-shadow: 0 0 0 3px rgba(24, 184, 166, 0.08);
}

.photo-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.photo-file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  color: var(--primary);
  font-size: var(--type-control-size);
  font-weight: var(--weight-semibold);
  background: var(--primary-soft);
  border-radius: 9px;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.photo-file-button:hover,
.photo-file-button:focus-visible {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(24, 184, 166, 0.18);
}

.photo-file-button:active {
  transform: translateY(1px);
}

.photo-file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: var(--weight-medium);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.photo-upload-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.visit-quick-actions-section {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.visit-quick-actions-label,
.visit-quick-subtitle,
.visit-quick-static-value {
  color: var(--muted);
  font-size: var(--type-control-size);
  font-weight: var(--weight-medium);
}

.visit-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.visit-quick-actions .btn {
  min-height: 36px;
  padding: 0 12px;
}

.visit-quick-modal {
  width: min(980px, calc(100vw - 48px));
}

.visit-photo-modal {
  width: min(680px, calc(100vw - 48px));
}

.visit-problem-modal {
  width: min(760px, calc(100vw - 48px));
}

.master-visit-modal {
  width: min(680px, calc(100vw - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.master-visit-modal > .modal-header,
.master-visit-modal > .modal-footer {
  flex-shrink: 0;
}

.master-visit-body {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  flex: 1 1 auto;
}

.master-visit-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.master-visit-summary > div {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 84px;
  padding: 14px;
  background: var(--surface);
}

.master-visit-summary .is-wide {
  grid-column: 1 / -1;
  min-height: auto;
}

.master-visit-services {
  min-width: 0;
  overflow-wrap: anywhere;
}

.master-visit-finance > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
}

.master-visit-finance strong {
  text-align: right;
}

.master-visit-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
}

.master-visit-summary strong,
.master-visit-summary p {
  margin: 0;
}

.master-visit-summary p {
  color: var(--text);
  line-height: 1.45;
}

.master-visit-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.master-visit-note {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding: 14px;
  background: var(--surface);
}

.master-visit-note span {
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
}

.master-visit-note p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-line;
}

.master-visit-note p.is-empty {
  color: var(--muted);
}

.master-visit-quick-actions {
  gap: 10px;
}

.master-visit-quick-actions .btn {
  min-width: 124px;
}

.master-visit-footer {
  justify-content: flex-end;
}

.visit-quick-subtitle {
  margin: 5px 0 0;
  line-height: 1.4;
}

.visit-quick-body {
  max-height: min(70vh, 760px);
  overflow-y: auto;
}

.visit-quick-body .recommendation-form-content {
  margin-top: 20px;
}

.visit-photo-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.visit-problem-section,
.visit-problem-create {
  display: grid;
  gap: 12px;
}

.visit-problem-create {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.visit-problem-section-head h3,
.visit-problem-section-head p {
  margin: 0;
}

.visit-problem-section-head h3 {
  color: var(--text);
  font-size: 14px;
  font-weight: var(--weight-semibold);
}

.visit-problem-section-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.visit-problem-list {
  display: grid;
  gap: 8px;
}

.visit-problem-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.visit-problem-row > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.visit-problem-row strong {
  overflow: hidden;
  max-width: 360px;
  font-size: 13px;
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.visit-problem-row .btn {
  flex: 0 0 auto;
}

.visit-problem-create-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.visit-quick-static-value {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 7px 12px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.client-photo-grid {
  margin-top: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.client-photo-tab-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.client-photo-tab-head h3,
.client-photo-tab-head p {
  margin: 0;
}

.client-photo-tab-head h3 {
  font-size: 20px;
}

.client-photo-tab-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.client-photo-filters {
  margin-top: 18px;
  padding: 14px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.client-photo-filters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.client-photo-filters h4 {
  margin: 0;
}

.client-photo-filters h4 {
  font-size: 15px;
}

.client-photo-filters .link-button.is-placeholder {
  visibility: hidden;
  pointer-events: none;
}

.client-photo-filters-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.15fr) minmax(280px, 1.2fr);
  gap: 12px;
  margin-top: 14px;
}

.client-photo-period-filter {
  display: grid;
  gap: 6px;
  position: relative;
}

.client-photo-period-filter > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.client-photo-date-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.client-photo-date-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  color: var(--text);
  font: inherit;
  text-align: left;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.client-photo-date-field strong {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: var(--weight-regular);
  white-space: nowrap;
}

.client-photo-date-field > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.client-photo-date-field:hover,
.client-photo-date-field:focus-visible,
.client-photo-date-field.is-active {
  border-color: rgba(24, 184, 166, 0.55);
  box-shadow: 0 0 0 3px rgba(24, 184, 166, 0.09);
}

.client-photo-date-field .client-photo-calendar-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.client-photo-date-picker {
  position: absolute;
  z-index: 12;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(31, 54, 84, 0.16);
}

.client-photo-picker-head {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  text-align: center;
}

.client-photo-picker-head strong {
  font-size: 14px;
}

.client-photo-picker-head .icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  min-height: 36px;
  place-items: center;
  padding: 0;
  border-radius: 10px;
}

.client-photo-picker-head .icon-button svg {
  width: 16px;
  height: 16px;
}

.client-photo-picker-weekdays,
.client-photo-picker-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.client-photo-picker-weekdays {
  margin-bottom: 4px;
}

.client-photo-picker-weekdays span {
  padding: 5px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  text-align: center;
}

.client-photo-picker-day,
.client-photo-picker-empty {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  padding: 0;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  background: transparent;
  border: 0;
  border-radius: 9px;
}

.client-photo-picker-day {
  cursor: pointer;
}

.client-photo-picker-day:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.client-photo-picker-day.is-today {
  box-shadow: inset 0 0 0 1px rgba(24, 184, 166, 0.5);
}

.client-photo-picker-day.is-selected {
  color: #fff;
  font-weight: var(--weight-semibold);
  background: var(--accent);
  box-shadow: none;
}

.client-photo-grid > .empty {
  grid-column: 1 / -1;
  max-width: 520px;
  padding: 18px 22px;
}

.photo-tile {
  aspect-ratio: 1;
  overflow: hidden;
  background: #eef3f7;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.client-photo-card-button {
  width: 100%;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: zoom-in;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.client-photo-card-button:hover,
.client-photo-card-button:focus-visible {
  border-color: rgba(24, 184, 166, 0.55);
  box-shadow: 0 12px 28px rgba(31, 54, 84, 0.12);
  transform: translateY(-2px);
}

.photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.photo-card div {
  display: grid;
  gap: 3px;
  padding: 10px;
}

.photo-card strong,
.photo-card span,
.photo-card em {
  display: block;
}

.photo-card strong {
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.photo-card span,
.photo-card em {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.photo-card em {
  font-style: normal;
}

.photo-gallery-backdrop {
  padding: 24px 36px;
  background: rgba(15, 23, 42, 0.42);
  cursor: zoom-out;
}

.modal.photo-gallery-modal {
  width: calc(100vw - 72px);
  height: min(1040px, calc(100dvh - 48px));
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border-color: var(--line-strong);
  border-radius: var(--radius-xl);
  box-shadow: 0 28px 72px rgba(31, 54, 84, 0.24);
  cursor: default;
}

.photo-gallery-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.photo-gallery-header > div:first-child {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 10px;
}

.photo-gallery-header span {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.photo-gallery-header strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: var(--weight-medium);
}

.photo-gallery-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.btn.ghost.photo-gallery-close {
  color: var(--muted);
  background: var(--surface-soft);
  border-color: var(--line);
}

.btn.ghost.photo-gallery-close:hover {
  color: var(--accent-dark);
  background: var(--primary-soft);
  border-color: rgba(20, 184, 166, 0.32);
}

.photo-gallery-close {
  display: inline-grid;
  width: 42px;
  height: 42px;
  min-height: 42px;
  place-items: center;
  padding: 0;
}

.photo-gallery-arrow svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.photo-gallery-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  height: calc(100% - 64px);
  min-height: 0;
}

.photo-gallery-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #eef3f7;
  touch-action: none;
  user-select: none;
}

.photo-gallery-stage-scroll {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px 72px 76px;
}

.photo-gallery-image-button {
  display: block;
  max-width: 100%;
  max-height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: default;
}

.photo-gallery-image-button img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 120px);
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 16px 42px rgba(31, 54, 84, 0.16);
  transform-origin: center;
  will-change: transform;
  -webkit-user-drag: none;
}

.photo-gallery-stage:not(.is-dragging) .photo-gallery-image-button img {
  transition: transform 160ms ease;
}

.photo-gallery-modal.is-zoomed .photo-gallery-image-button {
  cursor: grab;
}

.photo-gallery-stage.is-dragging .photo-gallery-image-button {
  cursor: grabbing;
}

.photo-gallery-controls {
  position: absolute;
  z-index: 4;
  bottom: 14px;
  left: 50%;
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 5px;
  padding: 5px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  box-shadow: 0 12px 30px rgba(31, 54, 84, 0.15);
  transform: translateX(-50%);
}

.photo-gallery-controls button {
  display: grid;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  place-items: center;
  padding: 0 9px;
  color: var(--text);
  font: inherit;
  font-size: 18px;
  font-weight: var(--weight-medium);
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}

.photo-gallery-controls button:hover:not(:disabled),
.photo-gallery-controls button:focus-visible {
  color: var(--accent-dark);
  background: var(--primary-soft);
}

.photo-gallery-controls button:disabled {
  color: var(--muted-2);
  cursor: default;
}

.photo-gallery-controls [data-photo-gallery-scale] {
  min-width: 52px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-semibold);
  text-align: center;
}

.photo-gallery-controls > i {
  width: 1px;
  height: 24px;
  margin: 0 2px;
  background: var(--line);
}

.photo-gallery-controls .photo-gallery-fit-button {
  min-width: auto;
  padding: 0 10px;
  font-size: 12px;
}

.photo-gallery-pan-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px 0 4px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.company-clinical-history { display: grid; gap: 16px; margin-bottom: 20px; }
.company-client-branch-filter { display: grid; min-width: 200px; }
.client-register-person small { display: block; margin-top: 6px; color: var(--muted); }
.company-clinical-branch { border: 1px solid var(--border, #e3eaf3); border-radius: 12px; }
.company-clinical-branch > summary { padding: 16px; cursor: pointer; font-weight: 600; }
.company-clinical-branch > summary span { margin-left: 12px; font-size: 12px; color: var(--muted, #71839d); font-weight: 400; }
.company-clinical-content { display: grid; gap: 16px; padding: 0 16px 16px; min-width: 0; }
.company-clinical-content summary { cursor: pointer; }
.company-clinical-content h4 { margin: 0; font-size: 14px; }
.company-clinical-items { display: grid; gap: 16px; min-width: 0; }
.company-clinical-items:empty, .company-clinical-photos:empty { display: none; }
.company-clinical-pagination { display: grid; justify-items: start; gap: 8px; }
.company-clinical-pagination p { margin: 0; color: var(--muted, #71839d); font-size: 13px; }
[data-clinical-more][hidden] { display: none; }
.company-clinical-fields { margin: 0; display: grid; gap: 12px; }
.company-clinical-fields > div { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr); gap: 12px; }
.company-clinical-fields dt { color: var(--muted, #71839d); }
.company-clinical-fields dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.company-clinical-visit { display: grid; gap: 8px; border-bottom: 1px solid var(--border, #e3eaf3); padding-bottom: 12px; }
.company-clinical-visit > span { color: var(--muted, #71839d); font-size: 12px; }
.company-clinical-visit p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.company-clinical-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.company-clinical-photos a { display: grid; gap: 8px; color: inherit; font-size: 12px; overflow-wrap: anywhere; }
.company-clinical-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
@media (max-width: 600px) { .company-clinical-fields > div { grid-template-columns: 1fr; gap: 4px; } .company-clinical-branch > summary span { display: block; margin-left: 0; margin-top: 6px; } }

.photo-gallery-pan-hint[hidden],
[data-appointment-complete][hidden],
[data-master-documentation-complete][hidden] {
  display: none;
}

.photo-gallery-pan-hint svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.photo-gallery-arrow {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(31, 54, 84, 0.14);
  cursor: pointer;
  transform: translateY(-50%);
  backdrop-filter: blur(10px);
}

.photo-gallery-arrow:hover,
.photo-gallery-arrow:focus-visible {
  color: var(--accent-dark);
  background: var(--primary-soft);
  border-color: rgba(20, 184, 166, 0.35);
}

.photo-gallery-arrow.is-prev {
  left: 14px;
}

.photo-gallery-arrow.is-next {
  right: 14px;
}

.photo-gallery-details {
  min-width: 0;
  overflow: auto;
  padding: 24px;
  color: var(--text);
  background: #fff;
  border-left: 1px solid var(--line);
}

.photo-gallery-filter-label {
  display: inline-flex;
  max-width: 100%;
  padding: 6px 9px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  line-height: 1.35;
  background: var(--accent-soft);
  border-radius: 8px;
}

.photo-gallery-details h2 {
  margin: 16px 0 22px;
  font-size: 23px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.photo-gallery-details dl {
  display: grid;
  gap: 16px;
  margin: 0;
}

.photo-gallery-details dl > div {
  display: grid;
  gap: 4px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.photo-gallery-details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
}

.photo-gallery-details dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.photo-gallery-help {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .photo-upload-grid {
    grid-template-columns: minmax(0, 1fr);
    max-width: none;
  }

  .client-photo-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .client-photo-filters-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .client-photo-tab-head {
    align-items: stretch;
    flex-direction: column;
  }

  .client-photo-tab-head .btn {
    width: 100%;
  }

  .client-photo-date-range {
    grid-template-columns: minmax(0, 1fr);
  }

  .client-photo-date-picker {
    right: auto;
    left: 0;
    width: min(320px, 100%);
  }

  .photo-gallery-backdrop {
    padding: 0;
    cursor: default;
  }

  .modal.photo-gallery-modal {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .photo-gallery-header {
    min-height: 58px;
    padding: 8px 8px 8px 14px;
  }

  .photo-gallery-header > div:first-child {
    align-items: flex-start;
    flex-direction: column;
    gap: 1px;
  }

  .photo-gallery-header span {
    max-width: 42vw;
    font-size: 13px;
  }

  .photo-gallery-header strong {
    font-size: 11px;
  }

  .photo-gallery-close {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .photo-gallery-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    height: calc(100% - 58px);
  }

  .photo-gallery-stage-scroll {
    padding: 10px 46px 66px;
  }

  .photo-gallery-image-button img {
    max-height: calc(70dvh - 122px);
  }

  .photo-gallery-arrow {
    width: 42px;
    height: 42px;
  }

  .photo-gallery-arrow.is-prev {
    left: 3px;
  }

  .photo-gallery-arrow.is-next {
    right: 3px;
  }

  .photo-gallery-details {
    max-height: 30dvh;
    padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .photo-gallery-details h2 {
    margin: 11px 0 14px;
    font-size: 18px;
  }

  .photo-gallery-details dl {
    gap: 10px;
  }

  .photo-gallery-details dl > div {
    padding-bottom: 9px;
  }

  .photo-gallery-controls {
    bottom: 9px;
    max-width: calc(100vw - 16px);
  }

  .photo-gallery-pan-hint {
    width: 24px;
    overflow: hidden;
    padding: 0 4px;
    color: rgba(255, 255, 255, 0.78);
  }
}

.timeline {
  display: grid;
  gap: 8px;
}

.timeline-item {
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.timeline-title {
  font-weight: var(--weight-semibold);
}

.timeline-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.client-history-head,
.client-actions-footer,
.client-actions-pages,
.client-actions-size,
.timeline-action-details summary,
.timeline-changes > div,
.timeline-changes span {
  display: flex;
  align-items: center;
}

.client-history-head {
  justify-content: space-between;
  gap: 12px;
}

.client-history-head h3 {
  margin: 0;
}

.timeline-action-details summary {
  cursor: pointer;
  gap: 6px;
  list-style: none;
}

.timeline-action-details summary::-webkit-details-marker {
  display: none;
}

.timeline-action-details summary::after {
  width: 14px;
  height: 14px;
  margin-left: auto;
  content: "›";
  color: var(--muted);
  font-size: 20px;
  line-height: 12px;
  transform: rotate(0deg);
  transition: transform 160ms ease;
}

.timeline-action-details[open] summary::after {
  transform: rotate(90deg);
}

.timeline-action-details summary .timeline-meta {
  margin-top: 0;
}

.timeline-changes {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.timeline-changes > div {
  justify-content: space-between;
  gap: 18px;
  font-size: 13px;
}

.timeline-changes span {
  justify-content: flex-end;
  min-width: 0;
  gap: 7px;
  color: var(--muted);
  text-align: right;
}

.timeline-changes del {
  color: #b4534b;
  text-decoration-color: rgba(180, 83, 75, 0.45);
}

.timeline-changes ins {
  color: var(--text);
  font-weight: var(--weight-medium);
  text-decoration: none;
}

.client-actions-footer {
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.client-actions-size {
  gap: 8px;
}

.client-actions-size .select {
  width: auto;
  min-height: 32px;
  padding-block: 0;
}

.client-actions-pages {
  gap: 8px;
}

.client-actions-pages .btn {
  min-height: 32px;
  padding-inline: 10px;
}

.client-actions-loading {
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  z-index: 1000;
  place-items: center;
  overflow: auto;
  padding: 24px;
  background: rgba(16, 37, 53, 0.48);
}

.modal {
  position: relative;
  z-index: 1001;
  width: min(1040px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  background: #fff;
  border: 1px solid rgba(184, 196, 210, 0.7);
  border-radius: var(--radius);
  box-shadow: 0 30px 70px -40px rgba(16, 37, 53, 0.7);
}

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

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-help-button {
  position: relative;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  color: #55708f;
  font-family: inherit;
  font-size: 15px;
  font-weight: var(--weight-bold);
  line-height: 1;
  cursor: help;
  background: #f4f8fc;
  border: 1px solid #d8e4ef;
  border-radius: 50%;
}

.modal-help-button:focus-visible {
  outline: 3px solid rgba(22, 184, 169, 0.24);
  outline-offset: 2px;
}

.modal-help-tooltip {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 2;
  width: min(340px, calc(100vw - 72px));
  padding: 11px 12px;
  color: #fff;
  font-size: 12px;
  font-weight: var(--weight-regular);
  line-height: 1.45;
  text-align: left;
  pointer-events: none;
  visibility: hidden;
  background: rgba(42, 54, 71, 0.96);
  border-radius: 9px;
  box-shadow: 0 12px 28px rgba(16, 37, 53, 0.24);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}

.modal-help-button:hover .modal-help-tooltip,
.modal-help-button:focus-visible .modal-help-tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.client-delete-confirmation {
  width: min(520px, calc(100vw - 48px));
  border-color: #efd8d3;
}

.client-delete-confirmation .modal-header {
  align-items: flex-start;
}

.client-delete-eyebrow {
  margin: 0 0 6px;
  color: #b8422d;
  font-size: 12px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.client-delete-confirmation-body {
  display: grid;
  gap: 16px;
}

.client-delete-confirmation-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #b8422d;
  font-size: 21px;
  font-weight: var(--weight-bold);
  line-height: 1;
  background: #fff0ed;
  border: 1px solid #f3c9c1;
  border-radius: 50%;
}

.client-delete-confirmation-body > p {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

.client-delete-safety-note {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  color: #7a493f;
  background: #fff8f5;
  border: 1px solid #f3d7d0;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.client-delete-safety-note strong {
  color: #8e3828;
}

.client-delete-confirmation-footer {
  justify-content: flex-end;
}

.client-delete-confirm-button {
  color: #fff;
  background: #d85a45;
  border-color: #d85a45;
}

.client-delete-confirm-button:hover {
  background: #bf4836;
  border-color: #bf4836;
}

.service-delete-confirmation-layer {
  position: fixed;
  z-index: 1002;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 37, 53, 0.38);
}

.service-delete-confirmation {
  width: min(500px, calc(100vw - 48px));
  padding: 28px;
  background: #fff;
  border: 1px solid #efd8d3;
  border-radius: 18px;
  box-shadow: 0 28px 72px rgba(16, 37, 53, 0.28);
}

.service-delete-confirmation-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin-bottom: 14px;
  color: #b8422d;
  font-size: 21px;
  font-weight: var(--weight-bold);
  line-height: 1;
  background: #fff0ed;
  border: 1px solid #f3c9c1;
  border-radius: 50%;
}

.service-delete-confirmation-content .eyebrow {
  margin: 0 0 6px;
  color: #b8422d;
  font-size: 12px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.service-delete-confirmation h3 {
  margin: 0;
  color: var(--ink);
  font-size: 23px;
  line-height: 1.2;
}

.service-delete-confirmation-content > p:not(.eyebrow) {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.service-delete-history-note {
  margin-top: 14px;
  padding: 12px 13px;
  color: #7a493f;
  background: #fff8f5;
  border: 1px solid #f3d7d0;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.service-delete-confirmation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.appointment-move-confirmation {
  width: min(560px, calc(100vw - 48px));
  border-color: #bce8e2;
}

.appointment-move-eyebrow {
  margin: 0 0 6px;
  color: #0f9f91;
  font-size: 12px;
  font-weight: var(--weight-semibold);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.appointment-move-confirmation-body {
  display: grid;
  gap: 16px;
}

.appointment-move-confirmation-body > p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.appointment-move-route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.appointment-move-route > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 13px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.appointment-move-route > div:last-child {
  background: #f0fdfa;
  border-color: #bce8e2;
}

.appointment-move-route span,
.appointment-move-route small {
  color: var(--muted);
  font-size: 12px;
}

.appointment-move-route strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-move-arrow {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #0f9f91 !important;
  font-size: 18px !important;
  font-weight: var(--weight-bold);
  background: #e6f8f5;
  border-radius: 50%;
}

.appointment-move-note {
  padding: 11px 12px;
  color: #52657a;
  font-size: 13px;
  line-height: 1.45;
  background: #f8fafc;
  border-left: 3px solid #14b8a6;
  border-radius: 8px;
}

.appointment-move-confirmation-footer {
  justify-content: flex-end;
}

.sale-cancelled-note {
  padding: 11px 12px;
  color: #9a4b38;
  font-size: 13px;
  font-weight: var(--weight-medium);
  line-height: 1.45;
  background: #fff6f2;
  border: 1px solid #f1d0c7;
  border-radius: 10px;
}

.sale-payments-history .is-voided {
  color: var(--muted);
  text-decoration: line-through;
}

.appointment-cancel-confirmation-layer {
  position: fixed;
  z-index: 1002;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 37, 53, 0.34);
}

.appointment-cancel-confirmation {
  width: min(470px, calc(100vw - 48px));
  padding: 28px;
  background: #fff;
  border: 1px solid #efd8d3;
  border-radius: 18px;
  box-shadow: 0 28px 72px rgba(16, 37, 53, 0.28);
}

.appointment-cancel-confirmation-icon {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 18px;
  place-items: center;
  color: #b8422d;
  font-size: 20px;
  font-weight: var(--weight-bold);
  line-height: 1;
  background: #fff0ed;
  border: 1px solid #f3c9c1;
  border-radius: 50%;
}

.appointment-cancel-confirmation .eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.appointment-cancel-confirmation h3 {
  margin: 0;
  color: var(--ink);
  font-size: 23px;
  line-height: 1.2;
}

.appointment-cancel-confirmation-content > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.appointment-cancel-confirmation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
}

.appointment-cancel-confirm-button {
  color: #fff;
  background: #d85a45;
  border-color: #d85a45;
}

.appointment-cancel-confirm-button:hover {
  background: #bf4836;
  border-color: #bf4836;
}

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

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

.master-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
}

.master-modal-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.master-modal-title h2 {
  margin: 0;
  font-size: 24px;
  font-weight: var(--weight-semibold);
  line-height: 1.1;
}

.master-modal-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.modal-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.master-modal-avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: var(--weight-bold);
  border-radius: 50%;
  object-fit: cover;
}

.staff-avatar-placeholder {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #60cdc4, #1aaea4);
}

.staff-avatar-placeholder svg {
  width: 58%;
  height: 58%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.staff-avatar-photo {
  object-fit: cover;
}

.master-modal-tabs {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 26px;
  background: #f7f8fa;
  border-bottom: 1px solid var(--line);
}

.master-modal-tabs button {
  min-height: 44px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
}

.master-modal-tabs button.is-active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

.master-modal-body {
  min-height: 420px;
  padding: 28px 32px;
}

.master-profile-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 32px;
}

.master-avatar-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.master-avatar-upload {
  position: relative;
  display: grid;
  place-items: center;
  height: 230px;
  cursor: pointer;
  background: #eef4fa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.master-avatar-preview {
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 30px;
  font-weight: var(--weight-bold);
  border-radius: 50%;
  object-fit: cover;
}

.master-avatar-upload span:last-child {
  position: absolute;
  right: 18px;
  bottom: 18px;
  padding: 7px 10px;
  color: #fff;
  font-size: 12px;
  font-weight: var(--weight-semibold);
  background: var(--accent);
  border-radius: 999px;
}

.master-status-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.master-status-toggle label {
  display: grid;
  min-height: 38px;
  place-items: center;
  cursor: pointer;
  background: #fff;
}

.master-status-toggle label.is-active,
.master-status-toggle label:has(input:checked) {
  color: #fff;
  background: #35a853;
}

.master-status-toggle label:has(input[value="0"]:checked) {
  background: #7a8795;
}

.master-status-toggle input {
  position: absolute;
  opacity: 0;
}

.master-profile-form {
  align-content: start;
}

.master-access-layout {
  display: grid;
  grid-template-columns: minmax(230px, .68fr) minmax(0, 1.32fr);
  gap: 26px;
  align-items: start;
}

.master-access-summary,
.master-access-form {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.master-access-summary {
  background: #f7fbfb;
}

/* Password help text must not stretch the adjacent role/status field. */
.master-access-form .form-grid,
#access-user-form .form-grid {
  align-items: start;
}

.master-access-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  color: #7a6870;
  font-size: 12px;
  font-weight: var(--weight-semibold);
  background: #f4eef0;
  border-radius: 999px;
}

.master-access-status.is-active {
  color: #08796c;
  background: #dff6f0;
}

.master-access-summary h3 {
  margin: 14px 0 0;
  color: var(--text);
  font-size: 18px;
}

.master-access-summary > p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.master-access-summary dl {
  display: grid;
  gap: 10px;
  margin: 20px 0 0;
}

.master-access-summary dl > div {
  display: grid;
  gap: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.master-access-summary dt {
  color: var(--muted);
  font-size: 11px;
}

.master-access-summary dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.master-access-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.master-access-branches {
  margin: 24px 0 0;
  padding: 24px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.master-access-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.master-access-section-head h3 {
  margin: 0;
  font-size: 16px;
}

.company-access-status {
  flex: 0 0 min(230px, 100%);
  transform: translateY(10px);
}

.company-branch-permissions {
  width: 100%;
  margin: 0;
}

.company-branch-permissions[hidden] { display: none; }

.master-access-success,
.master-access-validation {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.master-access-success {
  display: grid;
  gap: 3px;
  color: #08796c;
  background: #effcf8;
  border: 1px solid #aeeadf;
}

.master-access-validation {
  color: #a13b2d;
  background: #fff5f2;
  border: 1px solid #f5c1b9;
}

.field-optional {
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-regular);
}

.profile-avatar-setting {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfd;
}

.avatar.profile-user-avatar {
  flex: 0 0 58px;
  width: 58px;
  min-width: 58px;
  height: 58px;
  min-height: 58px;
  aspect-ratio: 1;
}

.profile-avatar-setting strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.profile-avatar-setting p {
  margin: 3px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.profile-avatar-upload {
  min-height: 32px;
  padding: 0 11px;
  font-size: 12px;
}

.user-avatar-photo,
.user-avatar-placeholder {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  color: #0b9486;
  background: #def6f1;
  border-radius: 50%;
  object-fit: cover;
}

.user-avatar-placeholder svg {
  width: 58%;
  height: 58%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.access-permissions-panel {
  grid-column: 1 / -1;
  margin-top: 18px;
  padding: 15px 18px;
  border: 1px solid #bcebe3;
  border-radius: 12px;
  background: #f7fcfb;
}

.access-permissions-panel h4 {
  margin: 0;
  color: var(--text);
}

.access-permissions-grid {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.access-permissions-enable {
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.access-permissions-enable span {
  display: grid;
  gap: 3px;
}

.access-permissions-enable small {
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-regular);
  line-height: 1.4;
}

.access-permissions-enable:has(input:checked) + .access-permissions-grid {
  display: grid;
}

.role-permissions-panel .access-permissions-grid {
  display: grid;
}

.access-permissions-grid > section {
  display: grid;
  gap: 11px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.access-permissions-panel h4 {
  font-size: 14px;
}

.access-permission-row span {
  display: grid;
  gap: 2px;
  font-size: 13px;
}

.access-permission-row small {
  color: var(--muted);
  font-size: 11px;
}

.access-permission-scope {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.access-permission-scope .select {
  min-height: 36px;
  font-size: 13px;
}

.master-access-self-note {
  padding: 14px;
  color: #52657b;
  font-size: 13px;
  line-height: 1.5;
  background: #f3f7fb;
  border: 1px solid #dce7f1;
  border-radius: 8px;
}

.master-access-empty-state {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px 14px;
  align-items: center;
  min-height: 180px;
  padding: 18px;
  border: 1px dashed #badbd8;
  border-radius: 10px;
  background: #f8fcfb;
}

.master-access-empty-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #148f86;
  background: #e3f7f3;
  border-radius: 50%;
}

.master-access-empty-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.master-access-empty-state h3 {
  margin: 0;
  font-size: 16px;
}

.master-access-empty-state p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.master-access-empty-state .btn {
  grid-column: 2;
  justify-self: start;
}

@media (max-width: 720px) {
  .master-access-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .master-access-summary,
  .master-access-form {
    padding: 16px;
  }

  .master-access-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .company-access-status {
    flex-basis: auto;
    transform: none;
  }

  .master-access-empty-state .btn {
    grid-column: 1 / -1;
  }

  .access-permissions-grid {
    grid-template-columns: 1fr;
  }
}

.color-dot-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 36px;
  align-items: center;
}

.color-dot-picker label {
  position: relative;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 50%;
}

.color-dot-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.color-dot-picker span {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(16, 37, 53, 0.18);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.color-dot-picker label.is-selected,
.color-dot-picker label:has(input:checked) {
  border-color: var(--accent);
  background: #eef6ff;
}

.appointment-neutral-color span {
  position: relative;
  background: #f8fafc;
  border-color: #94a3b8;
}

.appointment-neutral-color span::after {
  position: absolute;
  width: 8px;
  height: 1px;
  content: "";
  background: #94a3b8;
}

 .master-schedule-calendar {
  display: grid;
  grid-template-columns: 250px minmax(520px, 1fr);
  gap: 28px;
  align-items: start;
}

.master-schedule-controls {
  display: grid;
  gap: 24px;
}

.master-schedule-controls h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: var(--weight-semibold);
}

.schedule-preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.master-schedule-timebox {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.master-schedule-timebox:not(:has(#master-calendar-break-toggle:checked)) .master-calendar-break-row {
  display: none;
}

.master-schedule-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.master-schedule-actions .btn:first-child {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.master-schedule-actions .btn:last-child {
  grid-column: 1 / -1;
}

.master-calendar-panel {
  min-width: 0;
}

.master-calendar-head {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: #5d7898;
  text-align: center;
}

.master-calendar-head strong {
  font-size: 15px;
}

.master-calendar-weekdays,
.master-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(72px, 1fr));
}

.master-calendar-weekdays {
  color: #9aa3ad;
  font-size: 13px;
  text-align: center;
}

.master-calendar-weekdays span {
  padding: 7px 0;
}

.master-calendar-grid {
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
}

.master-calendar-day {
  display: grid;
  align-content: start;
  justify-items: start;
  min-height: 74px;
  padding: 8px;
  color: #5d7898;
  text-align: left;
  background: #fff;
  border: 0;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.master-calendar-day strong {
  font-size: 15px;
  font-weight: var(--weight-semibold);
}

.master-calendar-day small {
  margin-top: 9px;
  color: var(--accent-dark);
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1.35;
}

.master-calendar-day.is-muted {
  color: #c4cbd4;
  background: #fbfcfd;
}

.master-calendar-day.is-past {
  cursor: not-allowed;
  opacity: 0.58;
}

.master-calendar-day.is-past small {
  color: #94a3b8;
}

.master-calendar-day.is-off {
  background: #fcfbfa;
}

.master-calendar-day.is-today {
  background: #eef6ff;
}

.master-calendar-day.is-selected {
  background: #dfeafe;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.master-placeholder {
  margin: 0;
}

.service-settings-form {
  max-width: 760px;
}

.service-auto-control {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 220px);
  align-items: end;
  width: 100%;
  gap: 10px 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.service-auto-control-label {
  padding-bottom: 10px;
  color: var(--text);
  font-weight: var(--weight-semibold);
}

.service-auto-control-days {
  width: 100%;
}

.service-auto-control > p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 560px) {
  .service-auto-control {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .service-auto-control-label {
    padding-bottom: 0;
  }
}

.service-master-table {
  overflow: hidden;
  margin: -12px -18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.service-master-head,
.service-master-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 140px 160px 36px;
  gap: 12px;
  align-items: center;
  padding: 7px 18px;
}

.service-master-head {
  min-height: 38px;
  color: #9aa3ad;
  font-size: 12px;
  font-weight: var(--weight-semibold);
  background: #f7f8fa;
}

.service-master-row {
  min-height: 54px;
  border-top: 1px solid var(--line);
}

.service-master-row:hover {
  background: #f4f9ff;
}

.service-master-row .select,
.service-price-input {
  height: 34px;
}

.service-price-input {
  text-align: right;
}

.service-mini-toggle,
.service-mini-toggle input {
  position: absolute;
  opacity: 0;
}

.service-mini-toggle span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #b6c2cf;
  border-radius: 8px;
}

.service-mini-toggle span::before {
  content: "●";
  font-size: 12px;
}

.service-mini-toggle input:checked + span {
  background: var(--accent);
}

.service-remove-master {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #8191a5;
  font-size: 24px;
  font-weight: var(--weight-semibold);
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.service-remove-master:hover {
  color: #d85a45;
  background: #fff0ed;
}

.service-add-master-wrap {
  position: relative;
  border-top: 1px solid var(--line);
}

.service-add-master-row {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: #35a853;
  text-align: left;
  background: #fff;
  border: 0;
  cursor: pointer;
  padding: 10px 18px;
}

.service-add-master-row:hover {
  background: #f4fbf6;
}

.service-add-master-row:disabled {
  cursor: default;
  opacity: 0.55;
}

.service-add-master-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #35a853;
  font-size: 26px;
  font-weight: var(--weight-bold);
  background: #dff4e6;
  border-radius: 50%;
}

.service-master-empty {
  border-top: 1px solid var(--line);
}

.service-master-popover {
  position: absolute;
  left: 54px;
  bottom: calc(100% - 4px);
  z-index: 40;
  width: min(360px, calc(100% - 72px));
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(15, 35, 55, 0.22);
}

.service-master-popover-title {
  padding: 9px 12px 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.service-master-popover-list {
  max-height: 260px;
  overflow-y: auto;
}

.service-master-popover button {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 18px;
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.service-master-popover button:last-child {
  border-bottom: 0;
}

.service-master-popover button:hover {
  background: #f4f9ff;
}

.service-master-popover strong,
.service-master-popover small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.service-master-popover small {
  color: var(--muted);
  font-size: 12px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  margin: 0;
  font-size: 24px;
  line-height: 1;
}

.modal-body {
  padding: 16px 20px;
}

.company-employee-modal {
  width: min(740px, calc(100vw - 32px));
}

.company-employee-fields {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.company-employee-fields .form-grid {
  gap: 24px 20px;
}

.company-employee-fields h3 {
  margin: 28px 0 14px;
}

.master-branch-access {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.master-branch-access h3 {
  margin-top: 0;
}

.journal-shift-edit {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  padding: 4px 0;
  text-align: left;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 4px;
}

.journal-shift-edit:disabled { cursor: wait; opacity: .6; }
.journal-shift-edit:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.modal.journal-shift-modal { width: min(480px, calc(100vw - 32px)); height: auto; min-height: 0; }
.journal-shift-modal .check-row { margin: 20px 0; }
.journal-shift-modal .modal-header p { margin: 6px 0 0; }
.journal-shift-day-off { order: -1; }

.company-employee-list, .company-branch-list {
  display: grid;
  gap: 12px;
}

.company-employee-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.company-employee-row, .company-branch-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  white-space: normal;
}

.company-employee-row .muted, .company-branch-row .muted {
  margin-left: auto;
}

.company-branch-row input {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--accent, #10b8a6);
}
.company-branch-row { flex-wrap: wrap; }
.company-branch-row > label:first-child { display: flex; align-items: center; gap: 12px; flex: 1 1 170px; min-width: 0; }
.company-branch-row > label:first-child span { overflow-wrap: anywhere; }
.company-branch-role { display: grid; gap: 6px; flex: 1 1 190px; min-width: 0; }
.company-branch-role > span { font-size: 12px; color: var(--muted); }
.company-branch-role select { width: 100%; min-width: 0; }
[data-company-role-warning][hidden] { display: none; }

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

.appointment-form-layout {
  display: grid;
  gap: 12px;
}

.appointment-section {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.appointment-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.appointment-sale-summary {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(0, 1.7fr) auto;
  width: 100%;
  margin-top: 2px;
  padding: 14px 16px;
  align-items: center;
  gap: 18px;
  color: var(--text);
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--line-strong);
  border-left: 4px solid #0f9d8b;
  border-radius: 12px;
}

.appointment-sale-summary.has-due {
  border-left-color: #d97706;
  background: #fffaf0;
}

.appointment-sale-summary:hover,
.appointment-sale-summary:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.1);
}

.appointment-sale-summary-head,
.appointment-sale-summary-values,
.appointment-sale-summary-values > span,
.appointment-sale-summary-open {
  display: flex;
  align-items: center;
}

.appointment-sale-summary-head {
  gap: 8px;
}

.appointment-sale-summary-head > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 9px;
}

.appointment-sale-summary-head svg,
.appointment-sale-summary-open svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.appointment-sale-summary-head small,
.appointment-sale-summary-values small {
  color: var(--muted);
  font-size: 11px;
}

.appointment-sale-summary-head small {
  margin-left: auto;
}

.appointment-sale-summary-values {
  justify-content: space-between;
  gap: 16px;
}

.appointment-sale-summary-values > span {
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.appointment-sale-summary-values b {
  font-size: 15px;
}

.appointment-sale-summary-values > span:nth-child(2) b {
  color: #0f806f;
}

.appointment-sale-summary-values > span:nth-child(3) b {
  color: #b45309;
}

.appointment-sale-summary.is-paid .appointment-sale-summary-values > span:nth-child(3) b {
  color: #0f806f;
}

.appointment-sale-summary-open {
  gap: 4px;
  color: var(--primary);
  font-size: 13px;
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.appointment-section h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.appointment-time-grid {
  grid-template-columns: minmax(260px, 1fr) 170px 170px;
}

.appointment-service-grid {
  grid-template-columns: minmax(280px, 1fr) 130px 140px 130px;
}

.appointment-services-list {
  display: grid;
  gap: 10px;
}

.appointment-service-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 135px 160px 34px;
  align-items: end;
  gap: 12px;
}

.appointment-service-row .field {
  min-width: 0;
}

.appointment-service-search-field {
  position: relative;
}

.appointment-service-results {
  width: 100%;
}

.appointment-service-remove {
  display: grid;
  width: 34px;
  height: 48px;
  padding: 0;
  place-items: center;
  color: #c25744;
  font-size: 24px;
  line-height: 1;
  background: #fff7f5;
  border: 1px solid #f0d1ca;
  border-radius: 12px;
  cursor: pointer;
}

.appointment-service-remove:hover {
  color: #a23d2d;
  background: #ffede9;
}

.appointment-services-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
}

.appointment-services-summary {
  display: grid;
  min-width: 0;
  gap: 4px;
  justify-items: end;
  text-align: right;
}

.appointment-services-summary strong {
  color: var(--ink);
  font-size: 14px;
}

.appointment-add-service {
  min-height: 40px;
}

.appointment-availability-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: var(--weight-semibold);
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
  max-width: 560px;
}

.appointment-availability-hint[data-conflict="true"] {
  color: var(--danger);
}

.appointment-client-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 170px 260px;
  gap: 14px;
  align-items: start;
}

.appointment-client-search-field {
  position: relative;
}

.family-contact-search-field {
  position: relative;
}

.family-contact-search-field .input {
  padding-right: 16px;
}

.family-member-rule,
.family-booking-hint {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.family-member-rule {
  padding: 12px 14px;
  border: 1px solid #c9e9e5;
  border-radius: 12px;
  background: #f1fbf9;
  color: #3f6470;
}

.family-empty-card,
.family-card {
  display: grid;
  gap: 18px;
}

.family-empty-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.family-empty-card h3,
.family-card-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
}

.family-empty-card p,
.family-card-head p {
  max-width: 620px;
  margin: 7px 0 0;
  color: var(--muted);
}

.family-empty-warning {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff8e7;
  color: #8b6715;
}

.family-card {
  padding: 22px;
  border: 1px solid #dce8ee;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(38, 58, 77, 0.045);
}

.family-card-head {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
}

.family-card-head > div:first-child > span,
.family-data-note > span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
}

.family-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.family-members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.family-member-card {
  display: grid;
  gap: 5px;
  min-height: 138px;
  padding: 15px;
  text-align: left;
  border: 1px solid #e0e9ee;
  border-radius: 15px;
  background: #fff;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.family-member-card:hover,
.family-member-card.is-current {
  border-color: var(--primary);
  background: #f5fcfb;
}

.family-member-card:hover { transform: translateY(-1px); }

.family-member-role {
  color: var(--primary-dark, #168f85);
  font-size: 12px;
  font-weight: var(--weight-semibold);
}

.family-member-card strong { color: var(--text); font-size: 16px; }
.family-member-card small,
.family-member-card em { color: var(--muted); font-size: 13px; font-style: normal; }
.family-member-card em { margin-top: auto; }

.family-contact-note,
.family-data-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 14px;
}

.family-data-note strong { color: var(--text); }
.family-data-note small { color: var(--muted); }

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

.family-booking-time-grid {
  max-width: 420px;
  grid-template-columns: 1fr 150px;
  margin-bottom: 18px;
}

.family-booking-rows {
  display: grid;
  gap: 9px;
  margin-bottom: 16px;
}

.family-booking-row {
  display: grid;
  grid-template-columns: 28px minmax(180px, 1fr) minmax(220px, 1.25fr) minmax(170px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.family-booking-person { display: grid; gap: 3px; }
.family-booking-person strong { color: var(--text); }
.family-booking-person small { color: var(--muted); font-size: 12px; }

.appointment-client-search-field .input {
  padding-right: 52px;
}

.client-info-button {
  position: absolute;
  right: 10px;
  bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: var(--weight-bold);
  font-style: normal;
  line-height: 1;
  background: #dff0ff;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: none;
}

.client-info-button:hover {
  background: #cbe5ff;
}

.appointment-client-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 45;
  width: min(420px, 100%);
  max-height: 250px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 18px 36px rgba(15, 35, 55, 0.22);
}

.appointment-client-results:empty {
  display: none;
}

.appointment-client-results button {
  width: 100%;
  display: block;
  padding: 8px 12px;
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.appointment-client-results button:hover {
  background: #f4f9ff;
}

.appointment-client-results strong,
.appointment-client-results small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.appointment-client-results small {
  margin-top: 2px;
  color: var(--muted);
}

.appointment-client-empty {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

.appointment-client-create {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #35a853;
  font-weight: var(--weight-semibold);
  background: #fbfdfb !important;
}

.appointment-client-create span {
  font-size: 22px;
  line-height: 1;
}

.appointment-confirm-row {
  align-self: end;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0;
  line-height: 1;
}

.appointment-confirm-row input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-top: 0;
}

.visit-status-toggle {
  align-self: end;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 42px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.visit-status-toggle label {
  display: grid;
  place-items: center;
  cursor: pointer;
  background: #fff;
}

.visit-status-toggle label + label {
  border-left: 1px solid var(--line-strong);
}

.visit-status-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.visit-status-toggle label.is-active,
.visit-status-toggle label:has(input:checked) {
  color: #fff;
  background: var(--accent);
}

.appointment-anonymous-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 10px;
}

.appointment-note-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 1.8fr);
  gap: 16px;
  align-items: start;
}

.appointment-note-grid .field.wide {
  grid-column: auto;
}

.appointment-color-picker {
  flex-wrap: wrap;
  gap: 8px;
}

.appointment-color-picker label {
  width: 28px;
  height: 28px;
}

.appointment-color-picker span {
  width: 19px;
  height: 19px;
}

.appointment-note-grid .textarea {
  min-height: 70px;
}

.appointment-photo-inline {
  display: grid;
  grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.appointment-photo-inline > [data-saved-visit-photos] { align-self: end; }
.appointment-photo-inline > .field { min-width: 0; }
.appointment-photo-inline .photo-file-control,
.appointment-photo-inline #appointment_photo_caption { height: 48px; min-height: 48px; }
.appointment-photo-inline .photo-file-button { flex-shrink: 0; }
@media (min-width: 761px) {
  .appointment-photo-inline:has(> [data-saved-visit-photos]:not(:empty)) {
    grid-template-columns: auto minmax(200px, .9fr) minmax(180px, 1.1fr);
  }
}

.appointment-photo-preview {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 12px;
}

.appointment-photo-preview img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.visit-problem-inline {
  display: grid;
  grid-template-columns: 150px minmax(210px, .75fr) minmax(0, 1.25fr);
  align-items: center;
  gap: 12px 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.visit-problem-inline-label {
  color: var(--text-secondary);
  font-size: var(--type-caption-size);
  font-weight: var(--weight-semibold);
  line-height: var(--line-compact);
}

.visit-problem-inline-select {
  min-width: 0;
  height: 48px;
}

.visit-problem-inline-tags {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  align-items: center;
  min-width: 0;
  gap: 7px;
}

.visit-problem-inline-tag {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  height: 34px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--line));
  border-radius: 9px;
}

.visit-problem-inline-tag > span {
  min-width: 0;
  padding: 0 8px 0 10px;
  overflow: hidden;
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.visit-problem-inline-tag button {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  color: var(--primary-dark);
  font-size: 20px;
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.visit-problem-inline-tag button:hover,
.visit-problem-inline-tag button:focus-visible {
  color: #a8463e;
  background: #fff1ef;
  outline: none;
}

.visit-problem-inline-state {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.visit-problem-inline-state.is-error { color: #b8483f; }

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

.sale-modal-body {
  max-height: min(70vh, 760px);
  overflow-y: auto;
}

.sale-status-line,
.sale-total-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sale-status-line {
  margin-bottom: 18px;
  color: var(--muted);
}

.sale-items-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.sale-items-head h3,
.sale-payments-history h3 {
  margin: 0;
  font-size: 17px;
}

.sale-items-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.sale-item-list {
  display: grid;
  gap: 10px;
}

.sale-item-row {
  display: grid;
  grid-template-columns: minmax(170px, 0.95fr) minmax(220px, 1.45fr) minmax(110px, 0.55fr) minmax(100px, 0.45fr) 38px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdff;
}

.sale-item-row .field label {
  display: block;
  margin-bottom: 6px;
}

.sale-item-remove {
  min-width: 34px;
  height: 42px;
  font-size: 25px;
  color: var(--muted);
}

.sale-total-preview {
  margin-top: 16px;
  padding: 14px 2px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}

.sale-total-preview b,
.sale-due {
  font-size: 22px;
}

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

.sale-summary-grid > div {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdff;
}

.sale-summary-grid span,
.sale-payments-history span {
  color: var(--muted);
  font-size: 13px;
}

.sale-summary-grid b {
  font-size: 20px;
}

.sale-payment-grid {
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.7fr);
}

.sale-split-fields { display: grid; gap: 20px; margin: 24px 0; padding: 0; border: 0; min-width: 0; }
.sale-split-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 32px; align-items: end; gap: 12px; }
.sale-split-row .field { display: grid; gap: 8px; min-width: 0; }
.sale-split-row .field label { margin: 0; }
.sale-split-row > button { align-self: end; min-height: 44px; padding: 0; }
.sale-split-certificate { grid-column: 1 / -1; }
.sale-split-summary { color: var(--text-secondary); font-size: 14px; font-variant-numeric: tabular-nums; margin: 20px 0; }
@media (max-width: 480px) {
  .sale-split-row { grid-template-columns: minmax(0, 1fr) 32px; }
  .sale-split-row .field:first-child { grid-column: 1 / -1; }
  .sale-payment-actions { flex-wrap: wrap; }
}

.sale-payment-layer {
  position: fixed;
  z-index: 1002;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 37, 53, 0.34);
}

.sale-payment-dialog {
  position: relative;
  width: min(620px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(16, 37, 53, 0.25);
}

.payment-receipt-list { display: grid; gap: 16px; margin-top: 18px; }
.payment-receipt { border-top: 1px solid var(--line-strong); padding-top: 14px; }
.payment-receipt-head { display: flex; justify-content: space-between; gap: 12px; }
.payment-receipt small { display: block; margin-top: 5px; color: var(--muted); }
.payment-receipt p { margin: 8px 0; overflow-wrap: anywhere; }
.payment-receipt.is-voided { opacity: .7; }
.payment-receipt.is-voided .payment-receipt-head { text-decoration: line-through; }
.payment-receipt-values { display: grid; gap: 7px; margin: 12px 0; }
.payment-receipt-values > div { display: flex; justify-content: space-between; gap: 16px; }
.payment-receipt-values dt { color: var(--muted); }
.payment-receipt-values dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.payment-receipt-summary dd { font-weight: var(--weight-semibold); }
#sale-payment-split { color: var(--text-secondary); font-size: 13px; }

.sale-payment-dialog-head,
.sale-selected-method,
.sale-payment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sale-payment-dialog-head > div {
  display: grid;
  gap: 3px;
}

.sale-payment-dialog-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.sale-payment-dialog-head h3,
.sale-payment-complete h3 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
}

.sale-payment-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: 9px;
}

.sale-payment-close:hover,
.sale-payment-close:focus-visible {
  color: var(--text);
  background: var(--surface-soft);
}

.sale-payment-total {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0;
  padding: 18px 20px;
  background: #f0fdfa;
  border: 1px solid #b8eee8;
  border-radius: 14px;
}

.sale-payment-total span {
  color: var(--muted);
  font-size: 14px;
}

.sale-payment-total b {
  color: var(--text);
  font-size: 28px;
}

.sale-payment-balance {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: -10px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.sale-payment-balance b {
  color: var(--text);
}

.sale-balance-change {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 9px;
  align-items: center;
  margin-top: 14px;
  color: var(--text);
  font-size: 14px;
  font-weight: var(--weight-semibold);
}

.sale-balance-change input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--primary);
}

.sale-balance-change small {
  grid-column: 2;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-regular);
}

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

.sale-payment-method {
  display: flex;
  min-height: 96px;
  padding: 15px;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}

.sale-payment-method:hover,
.sale-payment-method:focus-visible {
  border-color: var(--primary);
  background: #f0fdfa;
  box-shadow: 0 8px 18px rgba(13, 148, 136, 0.1);
}

.sale-payment-method > span:last-child,
.sale-selected-method > div {
  display: grid;
  gap: 4px;
}

.sale-payment-method small,
.sale-selected-method small,
.sale-cashier-note,
.sale-payment-complete p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.sale-payment-method-icon,
.sale-payment-complete-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 11px;
}

.sale-payment-method-icon svg,
.sale-payment-complete-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sale-selected-method {
  margin-bottom: 16px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.sale-selected-method > .btn {
  margin-left: auto;
}

.sale-cashier-note {
  margin: 14px 0 0;
}

.sale-payment-actions {
  justify-content: flex-end;
  margin-top: 22px;
}

.sale-payment-complete {
  display: grid;
  justify-items: center;
  text-align: center;
}

.sale-payment-complete .sale-payment-complete-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  color: #0f9d8b;
}

.sale-payment-complete p {
  margin: 8px 0 20px;
}

.sale-payments-history {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.sale-payments-history > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.client-finance-history {
  margin-top: 18px;
}

.client-balance-card {
  margin-top: 18px;
}

.client-balance-history {
  display: grid;
}

.client-balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.client-balance-row:last-child {
  border-bottom: 0;
}

.client-balance-row > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.client-balance-row span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.client-balance-row b {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.client-balance-row b.is-positive {
  color: #078b7d;
}

.client-balance-row b.is-negative {
  color: var(--text);
}

.client-balance-deposit-current {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 15px 16px;
  background: var(--primary-soft);
  border: 1px solid #b8eee8;
  border-radius: 12px;
}

.client-balance-deposit-current span,
.client-balance-deposit-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.client-balance-deposit-current b {
  color: var(--text);
  font-size: 22px;
}

.client-balance-deposit-note {
  margin: 0 0 18px;
}

.client-balance-deposit-modal .field + .field {
  margin-top: 14px;
}

.finance-sale-list {
  display: grid;
  gap: 8px;
}

.finance-sale-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.finance-sale-row:last-child {
  border-bottom: 0;
}

.finance-sale-row > div {
  display: grid;
  gap: 4px;
}

.finance-sale-row > div:last-child {
  justify-items: end;
}

.finance-sale-row span,
.finance-sale-row small {
  color: var(--muted);
  font-size: 13px;
}

.appointment-history-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.appointment-change-history {
  position: absolute;
  left: 0;
  bottom: calc(100% + 14px);
  z-index: 7;
  width: 320px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 18px 38px rgba(14, 31, 46, 0.18);
}

.appointment-change-history::after {
  position: absolute;
  bottom: -7px;
  left: 58px;
  width: 12px;
  height: 12px;
  content: "";
  background: #fff;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  transform: rotate(45deg);
}

.appointment-change-history div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
}

.appointment-change-history b {
  font-size: 13px;
}

.appointment-change-history span,
.appointment-change-history p {
  color: var(--muted);
  font-size: 12px;
}

.appointment-change-history p {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  line-height: 1.35;
}

.appointment-client-card-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  background: rgba(12, 28, 41, 0.2);
}

.appointment-client-card {
  width: min(620px, calc(100vw - 48px));
  max-height: min(720px, calc(100vh - 70px));
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 24px 54px rgba(11, 28, 43, 0.28);
}

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

.appointment-client-card-title {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.appointment-client-card-title h3 {
  margin: 0 0 4px;
  font-size: 22px;
}

.appointment-client-card-title p {
  margin: 0;
  color: var(--muted);
}

.client-preview-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px 20px;
}

.client-preview-metrics div,
.client-preview-note,
.client-preview-visit {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
}

.client-preview-metrics div {
  padding: 10px 12px;
}

.client-preview-metrics b,
.client-preview-metrics span {
  display: block;
}

.client-preview-metrics b {
  font-size: 20px;
}

.client-preview-metrics span,
.client-preview-visit small {
  color: var(--muted);
}

.client-preview-note {
  margin: 0 20px 16px;
  padding: 12px;
  color: var(--muted);
}

.appointment-client-card h4 {
  margin: 0 20px 10px;
  font-size: 16px;
}

.client-preview-history {
  display: grid;
  gap: 8px;
  padding: 0 20px 20px;
}

.client-preview-visit {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.quick-client-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  background: rgba(12, 28, 41, 0.18);
}

.quick-client-card {
  width: min(760px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 24px 54px rgba(11, 28, 43, 0.28);
}

.quick-client-head,
.quick-client-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quick-client-head {
  margin-bottom: 18px;
}

.quick-client-head h2 {
  margin: 0;
}

.quick-client-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.modal.block-time-modal {
  width: min(620px, calc(100vw - 36px));
}

.block-time-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.block-time-comment {
  margin-top: 16px;
}

.block-time-comment .textarea {
  min-height: 88px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 16px;
}

.form-grid.two {
  grid-template-columns: repeat(2, 1fr);
}

.field {
  display: grid;
  gap: 6px;
}

.field.wide {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

/* Certificate rules are entered in independent groups; keep each label with
   its own control instead of visually attaching it to the row above. */
.certificate-template-form,
.certificate-sale-form {
  display: grid;
  gap: 20px;
}

.certificate-template-form .form-grid {
  gap: 16px;
}

.certificate-template-form .modal-actions,
.certificate-sale-form .modal-actions {
  margin-top: 2px;
}

.certificate-sale-form .field {
  gap: 8px;
}

.certificate-client-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.certificate-client-results {
  display: grid;
  max-height: 224px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.certificate-client-result {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 11px 13px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.certificate-client-result:last-child {
  border-bottom: 0;
}

.certificate-client-result:hover,
.certificate-client-result:focus-visible {
  background: var(--primary-soft);
  outline: none;
}

.certificate-client-result span,
.certificate-selected-client span {
  color: var(--muted);
  font-size: 13px;
}

.certificate-selected-client {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid #b8e6df;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
}

.certificate-selected-client > div {
  display: grid;
  gap: 2px;
}

@media (max-width: 600px) {
  .certificate-client-search {
    grid-template-columns: 1fr;
  }

  .certificate-client-search .btn {
    justify-self: start;
  }
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
}

.appointment-modal .modal-footer {
  justify-content: space-between;
}

.modal-footer-left,
.modal-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-footer-left:empty {
  display: none;
}

/* Keep Save first in the DOM for implicit Enter submission, but rightmost visually. */
.appointment-modal .modal-footer-right [data-appointment-save-sale] {
  order: -1;
}

.inline-error {
  margin-top: 14px;
  padding: 10px 12px;
  color: #8d2f24;
  background: #fff4f1;
  border: 1px solid #f2c7bf;
  border-radius: 6px;
}

.empty {
  padding: 18px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
  }

  .sidebar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 0;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 6px;
    padding: 10px 6px;
    font-size: 12px;
  }

  .workspace {
    border-right: 0;
  }

  .right-panel {
    border-top: 1px solid var(--line);
  }

  .view-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

   .journal {
    grid-template-columns: 70px repeat(var(--master-count), minmax(190px, 1fr));
    min-height: 720px;
  }

  .form-grid,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .modal {
    width: calc(100vw - 24px);
  }
}

/* Premium SaaS redesign layer */
html {
  background: var(--bg-main);
}

body {
  min-width: 1180px;
  color: var(--text-primary);
  background: var(--bg-main);
  font-family: var(--font-ui);
  font-size: 14px;
}

button,
input,
select,
textarea {
  letter-spacing: 0;
}

.shell {
  grid-template-columns: 216px minmax(0, 1fr) 288px;
  grid-template-rows: 32px minmax(0, 1fr);
  background: var(--bg-main);
}

.shell.is-sidebar-collapsed {
  grid-template-columns: 68px minmax(0, 1fr) 288px;
}

.icon-btn svg,
.chevron svg,
.collapse-link svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-name strong {
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: var(--weight-semibold);
}

.topbar-avatar {
  width: 20px;
  height: 20px;
  font-size: 9.5px;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.76);
}

.icon-btn {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 12px;
  transition: all 180ms ease;
}

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

.notification-unread-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--bg-main);
  border-radius: 50%;
  background: var(--primary);
  box-sizing: content-box;
  pointer-events: none;
}

.notify-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-variant-numeric: tabular-nums;
}

.avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #5ed5ca, var(--primary));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.72);
}

.profile-copy {
  display: grid;
  gap: 1px;
  color: var(--text-primary);
}

.profile-copy strong {
  font-size: 12.5px;
  font-weight: var(--weight-semibold);
}

.profile-copy small {
  color: var(--text-secondary);
  font-size: 11px;
}

.chevron {
  display: grid;
  color: var(--text-secondary);
}

.sidebar {
  grid-row: 1 / -1;
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  width: 216px;
  height: 100dvh;
  max-height: 100dvh;
  overflow-y: auto;
  padding: 18px 10px 14px;
  color: var(--text-secondary);
  background: #fff;
  border-top: 0;
  border-right: 1px solid var(--border-light);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  min-height: 70px;
  padding: 0 8px 18px;
}

.sidebar-logo-img {
  display: block;
  width: 100%;
  max-width: 204px;
  height: auto;
  object-fit: contain;
}

.sidebar-nav {
  display: grid;
  align-content: start;
  gap: 6px;
}

.nav-item {
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 9px;
  min-height: 38px;
  padding: 0 10px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: var(--weight-medium);
  border-radius: 12px;
  transition: all 180ms ease;
}

.nav-chevron {
  display: grid;
  place-items: center;
  width: 16px;
  color: #94a3b8;
  opacity: 0.72;
  transition: transform 180ms ease;
}

.nav-chevron svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.is-open .nav-chevron {
  transform: rotate(180deg);
}

.nav-item:hover .nav-chevron,
.nav-item.is-active .nav-chevron {
  color: var(--text-muted);
  opacity: 0.9;
}

.nav-item:hover {
  color: var(--primary);
  background: #f7fbfb;
}

.nav-item.is-active {
  color: var(--primary);
  font-weight: var(--weight-semibold);
  background: var(--primary-soft);
}

.nav-icon {
  width: 18px;
  height: 18px;
  opacity: 1;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.55;
}

.sidebar-subnav {
  display: grid;
  gap: 2px;
  padding: 2px 4px 8px 38px;
}

.sidebar-subnav button {
  min-height: 32px;
  padding: 0 0 0 12px;
  text-align: left;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 12.5px;
}

.sidebar-subnav button.is-active {
  color: var(--primary);
  border-left-color: var(--primary);
}

.collapse-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font-size: 12px;
  transition: all 180ms ease;
}

.collapse-link:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
}

.shell.is-sidebar-collapsed .sidebar {
  width: 68px;
  padding: 14px 8px;
}

.shell.is-sidebar-collapsed .sidebar-logo,
.shell.is-sidebar-collapsed .sidebar-subnav,
.shell.is-sidebar-collapsed .nav-item span:last-child,
.shell.is-sidebar-collapsed .nav-chevron,
.shell.is-sidebar-collapsed .collapse-link span {
  display: none;
}

.shell.is-sidebar-collapsed .sidebar-nav {
  align-content: start;
  gap: 8px;
}

.shell.is-sidebar-collapsed .nav-item {
  grid-template-columns: 1fr;
  justify-items: center;
  min-height: 42px;
  padding: 0;
}

.shell.is-sidebar-collapsed .collapse-link {
  justify-content: center;
}

.workspace {
  min-width: 0;
  overflow: auto;
  background: var(--bg-main);
  border-right: 0;
}

.right-panel {
  grid-column: 3;
  grid-row: 2;
  padding: 18px 16px 18px 0;
  font-size: 13px;
  background: var(--bg-main);
}

.view-toolbar,
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 12px 16px;
  background: transparent;
  border-bottom: 0;
}

.page-header {
  padding-bottom: 12px;
}

.page-header p {
  margin: 6px 0 0;
  color: var(--text-secondary);
}

.toolbar-title-group {
  min-width: 0;
  gap: 10px;
}

.page-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 22px;
  font-weight: var(--weight-semibold);
  line-height: 1.15;
}

 .journal-title {
  max-width: 250px;
  font-size: 15px;
  line-height: 1.18;
  white-space: nowrap;
  font-weight: var(--weight-semibold);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.analytics-page .page-actions { align-items: flex-end; flex-wrap: wrap; }
.report-branch-filter { margin: 0; min-width: 180px; }
.analytics-page .report-branch-filter { flex: 1 1 200px; max-width: 280px; }
@media (max-width: 760px) {
  .analytics-page .report-branch-filter { flex-basis: 100%; max-width: none; }
}

.date-inline {
  position: relative;
  height: 38px;
  width: 38px;
  padding: 0;
  color: transparent;
  background: #fff;
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 2v4M16 2v4M4 9h16M6 4h12a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  text-align: center;
}

.date-inline::-webkit-datetime-edit,
.date-inline::-webkit-datetime-edit-fields-wrapper {
  display: none;
}

.date-inline::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  cursor: pointer;
  opacity: 0;
}

.select,
.input,
.textarea,
.medical-field input,
.medical-field select,
.medical-field textarea {
  min-height: 38px;
  color: var(--text-primary);
  background: #fff;
  border-color: var(--border-light);
  border-radius: 12px;
}

.select,
.medical-field select,
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
}

.select:disabled,
.medical-field select:disabled,
select:disabled {
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.select:focus,
.input:focus,
.textarea:focus,
.medical-field input:focus,
.medical-field select:focus,
.medical-field textarea:focus {
  border-color: rgba(24, 184, 166, 0.62);
  box-shadow: 0 0 0 4px rgba(24, 184, 166, 0.12);
}

.medical-field .medication-tag-input:focus {
  border-color: transparent;
  box-shadow: none;
}

 .journal {
  min-height: 0;
  height: 100%;
  margin: 0 var(--page-x) 0;
  overflow: hidden;
  scrollbar-color: rgba(148, 163, 184, 0.16) transparent;
  scrollbar-width: thin;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
}

.journal-body-scroll {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.journal-body-scroll::-webkit-scrollbar {
  display: none;
}

.journal-head-row,
.journal-body-row {
  grid-template-columns: 72px repeat(var(--master-count), minmax(0, 1fr));
}

.journal-head-row {
  top: 0;
  z-index: 12;
  background: #fff;
}

.time-head,
.master-head {
  min-height: 64px;
  background: #fff;
  border-bottom-color: var(--border-light);
  box-shadow: 0 1px 0 rgba(226, 232, 240, 0.95);
}

.time-head {
  left: 0;
  z-index: 14;
  color: var(--text-muted);
}

.master-head {
  z-index: 13;
  gap: 12px;
  border-right-color: var(--border-soft);
}

.journal-master-week-trigger {
  width: 100%;
  min-width: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border: 0;
  box-shadow: none;
}

.journal-master-week-trigger:hover,
.journal-master-week-trigger:focus-visible {
  background: #f0fdfa;
  outline: none;
}

.journal-week-exit {
  min-height: 32px;
  padding: 0 11px;
  font-size: 12px;
  border-radius: 9px;
}

.journal-week-master-switch {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 36px;
  padding: 3px 3px 3px 5px;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

.journal-week-master-switch .master-avatar {
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  font-size: 10px;
}

.journal-week-master-name {
  min-width: 0;
  max-width: 220px;
  padding: 0 9px;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journal-week-master-switch .journal-week-exit {
  min-height: 28px;
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.weekly-journal .journal-head-row,
.weekly-journal .journal-body-row {
  grid-template-columns: 64px repeat(7, minmax(0, 1fr));
}

.weekly-journal .time-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  text-align: left;
}

.weekly-journal .time-head .master-avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.week-day-head {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 10px 8px;
  background: #fff;
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-light);
}

.week-day-head strong,
.week-day-head span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-day-head strong {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: var(--weight-bold);
}

.week-day-head span {
  color: var(--text-secondary);
  font-size: 10.5px;
}

.week-day-head.is-weekend strong {
  color: #e35d62;
}

.week-day-head.is-today {
  background: #f0fdfa;
  box-shadow: inset 0 -3px 0 var(--primary);
}

.weekly-journal .appointment-card {
  padding: 7px 8px;
  border-radius: 9px;
}

.weekly-journal .appointment-time {
  font-size: 10.5px;
}

.weekly-journal .appointment-client {
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.2;
}

.weekly-journal .appointment-meta {
  margin-top: 2px;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.weekly-journal .appointment-quality-markers {
  display: none;
}

.journal-week-summary-panel {
  padding-top: 16px;
}

.journal-week-summary-panel .panel-card-head {
  align-items: flex-start;
}

.journal-week-summary-master {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
}

.journal-week-summary-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 16px;
}

.journal-week-summary-stats > div {
  min-width: 0;
  padding: 9px 10px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 10px;
}

.journal-week-summary-stats b {
  display: block;
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.15;
  white-space: nowrap;
}

.journal-week-summary-stats span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journal-week-overview {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.journal-week-overview-day {
  display: grid;
  grid-template-rows: auto auto 112px auto;
  min-width: 0;
  gap: 3px;
  text-align: center;
}

.journal-week-overview-label,
.journal-week-overview-day strong,
.journal-week-overview-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journal-week-overview-label {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: var(--weight-semibold);
}

.journal-week-overview-day strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.journal-week-overview-day.is-weekend .journal-week-overview-label,
.journal-week-overview-day.is-weekend strong {
  color: #e35d62;
}

.journal-week-overview-track {
  position: relative;
  min-height: 112px;
  overflow: hidden;
  background: #f8fafc;
  border-radius: 5px;
}

.journal-week-overview-day.is-off .journal-week-overview-track {
  background:
    repeating-linear-gradient(135deg, rgba(148, 163, 184, 0.07) 0, rgba(148, 163, 184, 0.07) 5px, rgba(255, 255, 255, 0.62) 5px, rgba(255, 255, 255, 0.62) 10px),
    #f8fafc;
}

.journal-week-overview-day.is-today .journal-week-overview-track {
  box-shadow: inset 0 0 0 1px #82dacf;
}

.journal-week-overview-visit {
  position: absolute;
  top: var(--visit-start);
  right: 3px;
  left: 3px;
  min-height: 7px;
  height: var(--visit-size);
  background: #aee6ba;
  border-radius: 3px;
}

.journal-week-overview-meta {
  color: var(--text-secondary);
  font-size: 9px;
  line-height: 1.2;
}

.master-avatar,
.client-initial {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: var(--weight-bold);
  background: linear-gradient(135deg, #5bd5ca, var(--primary));
  border-radius: 50%;
  object-fit: cover;
}

.master-avatar {
  width: 38px;
  height: 38px;
  font-size: 12px;
}

.master-name {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.master-hours {
  color: var(--text-secondary);
  font-size: 11.5px;
}

.time-slot {
  height: var(--journal-hour-height, 82px);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: var(--weight-medium);
  border-bottom-color: var(--border-soft);
}

.master-column {
  min-width: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--journal-quarter-height, 20.5px) - 1px),
      rgba(226, 232, 240, 0.42) var(--journal-quarter-height, 20.5px)
    ),
    repeating-linear-gradient(
      to bottom,
      #fff 0,
      #fff calc(var(--journal-hour-height, 82px) - 1px),
      var(--border-soft) var(--journal-hour-height, 82px)
    );
  border-right-color: var(--border-soft);
}

/* A full day off is intentionally quiet but unmistakable: the whole column
   remains in place, so the master journal never collapses into an unstable grid. */
.master-column.is-day-off .journal-nonworking-time {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(148, 163, 184, 0.045) 0,
      rgba(148, 163, 184, 0.045) 7px,
      rgba(255, 255, 255, 0.84) 7px,
      rgba(255, 255, 255, 0.84) 14px
    ),
    rgba(248, 250, 252, 0.58);
}

.journal-week-open {
  min-height: 36px;
  padding-inline: 13px;
  font-weight: var(--weight-semibold);
}

.weekly-journal {
  position: relative;
}

.journal-week-loading {
  position: absolute;
  top: 76px;
  left: 50%;
  z-index: 20;
  padding: 7px 12px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.09);
  transform: translateX(-50%);
}


.appointment-card {
  --appointment-status-color: #3b82f6;

  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  left: 0.5px;
  right: 0.5px;
  padding: 8px 12px;
  color: var(--text-primary);
  background: var(--event-color, #f0fdfa);
  border: 1px solid color-mix(in srgb, var(--event-color, #f0fdfa) 72%, #94a3b8);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.appointment-card.tone-blue,
.mobile-appointment-card.tone-blue {
  --appointment-status-color: #94a3b8;
}

.appointment-card.tone-danger,
.mobile-appointment-card.tone-danger {
  --appointment-status-color: #e15f5f;
}

.appointment-card.tone-success,
.mobile-appointment-card.tone-success {
  --appointment-status-color: var(--primary);
}

.appointment-card.tone-muted,
.mobile-appointment-card.tone-muted {
  --appointment-status-color: #64748b;
}

.appointment-card.tone-primary,
.mobile-appointment-card.tone-primary {
  --appointment-status-color: #3b82f6;
}

.appointment-card.is-blocked,
.mobile-appointment-card.is-blocked {
  --appointment-status-color: #e2e8f0;
  color: #64748b;
  background: repeating-linear-gradient(
      135deg,
      rgba(148, 163, 184, 0.07) 0,
      rgba(148, 163, 184, 0.07) 7px,
      rgba(255, 255, 255, 0.7) 7px,
      rgba(255, 255, 255, 0.7) 14px
    ),
    #f8fafc;
  border-color: #edf2f7;
  box-shadow: none;
}

.appointment-card:hover,
.appointment-card:focus-visible {
  border-color: #99f6e4;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.appointment-card.is-blocked:hover,
.appointment-card.is-blocked:focus-visible {
  border-color: #e2e8f0;
  box-shadow: none;
  transform: none;
}

.appointment-card.is-draggable {
  cursor: grab;
}

.appointment-card.is-draggable:active,
.appointment-card.is-draggable.is-dragging {
  cursor: grabbing;
}

.appointment-card.is-dragging {
  opacity: .42;
  transform: scale(.985);
}

.master-column.is-drop-target::after {
  position: absolute;
  z-index: 4;
  right: 8px;
  left: 8px;
  top: var(--drop-indicator-top, 0);
  height: 2px;
  pointer-events: none;
  content: "";
  background: var(--primary);
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(20, 184, 166, .12);
}

.journal-move-message {
  position: fixed;
  z-index: 90;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  box-shadow: 0 8px 30px rgba(16, 37, 53, .18);
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 10px 13px;
  color: #0f766e;
  font-size: 13px;
  font-weight: var(--weight-semibold);
  background: #f0fdfa;
  border: 1px solid #bce8e2;
  border-radius: 11px;
}

.journal-move-message > div { min-width: 0; }
.journal-move-message > .btn { flex-shrink: 0; }
.journal-drag-origin { position: fixed !important; left: -20000px !important; top: 0; width: 1200px; pointer-events: none; }
.calendar-day.is-calendar-drop-target, .calendar-nav.is-calendar-drop-target { outline: 2px solid var(--primary); outline-offset: 2px; background: #ddf7f2; color: #0f766e; }
.master-column.is-drop-target::before { content: attr(data-drop-time); position: absolute; z-index: 8; top: max(24px, var(--drop-indicator-top, 0px)); right: 8px; transform: translateY(-100%); padding: 3px 7px; background: #0f766e; color: #fff; border-radius: 5px; font-size: 12px; font-weight: 600; pointer-events: none; }
@media (max-width: 900px) {
  .journal-move-message { bottom: calc(82px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
}

.journal-move-message > span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: #0f9f91;
  font-weight: var(--weight-bold);
  background: #ddf7f2;
  border-radius: 50%;
}

.journal-move-message.is-error {
  color: #a44836;
  background: #fff5f2;
  border-color: #f2c9bf;
}

.journal-move-message.is-error > span {
  color: #b8422d;
  background: #ffe4dd;
}

.appointment-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.appointment-card-top-right,
.appointment-quality-markers {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.appointment-card-top-right {
  min-width: 0;
  overflow: hidden;
}

.appointment-paid-marker {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(15, 118, 110, .28);
  border-radius: 50%;
  background: #ecfdf5;
  color: #047857;
  font-size: 14px;
  font-weight: var(--weight-semibold);
  line-height: 1;
}

.appointment-card .appointment-time,
.appointment-card .appointment-quality-markers {
  flex: 0 0 auto;
}

.appointment-card .appointment-status-badge {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.appointment-quality-marker {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #a16207;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(180, 83, 9, 0.24);
  border-radius: 999px;
}

.appointment-quality-marker.is-medical {
  color: #9a6700;
  background: rgba(255, 251, 235, 0.92);
}

.appointment-quality-marker.is-photo {
  color: #a14d12;
  background: rgba(255, 244, 237, 0.92);
}

.appointment-quality-marker svg,
.appointment-quality-notice-items svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.appointment-quality-marker b {
  display: none;
}

.appointment-quality-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: #fff8e8;
  border: 1px solid #f4d58d;
  border-radius: 12px;
}

.appointment-quality-notice strong,
.appointment-quality-notice p {
  margin: 0;
}

.appointment-quality-notice p {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 13px;
}

.appointment-quality-notice-items {
  display: grid;
  gap: 6px;
}

.appointment-quality-notice-items span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #92400e;
  font-size: 12px;
}

.appointment-time {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.appointment-client {
  display: block;
  overflow: hidden;
  margin-top: 7px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-meta {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-card > .appointment-client,
.appointment-card > .appointment-meta {
  flex: 0 0 auto;
  margin-top: 0;
}

.appointment-card > .appointment-card-top {
  flex: 0 0 auto;
}

.appointment-card.is-compact {
  justify-content: flex-start;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 7px;
}

.appointment-card.is-compact .appointment-card-top {
  height: 16px;
}

.appointment-card.is-compact .appointment-time,
.appointment-card.is-inline .appointment-time {
  font-size: 10.5px;
  line-height: 14px;
}

.appointment-card.is-compact .appointment-client {
  margin-top: 0;
  font-size: 11px;
  line-height: 14px;
}

.appointment-card.is-compact .appointment-meta {
  font-size: 10.5px;
  line-height: 13px;
}

.appointment-card.is-compact .appointment-status-badge {
  min-height: 16px;
  height: 16px;
  padding: 1px 5px;
  font-size: 10px;
  line-height: 14px;
}

.appointment-card.is-compact .appointment-quality-marker,
.appointment-card.is-compact .appointment-paid-marker {
  width: 16px;
  height: 16px;
  font-size: 11px;
}

.appointment-card.is-compact .appointment-quality-marker svg,
.appointment-card.is-inline .appointment-quality-marker svg {
  width: 10px;
  height: 10px;
}

.appointment-card.is-inline {
  padding: 0 5px;
  border-radius: 5px;
}

.appointment-card-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
  height: 14px;
}

.appointment-card-inline .appointment-card-top-right {
  gap: 3px;
}

.appointment-card.is-inline .appointment-status-badge {
  min-height: 14px;
  height: 14px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 14px;
}

.appointment-card.is-inline .appointment-quality-marker,
.appointment-card.is-inline .appointment-paid-marker {
  width: 14px;
  height: 14px;
  font-size: 10px;
}

.status-badge,
.client-status,
.client-status-dot,
.settings-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 20px;
  padding: 2px 7px;
  color: var(--primary);
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-style: normal;
  font-weight: var(--weight-semibold);
  background: var(--primary-soft);
  border: 0;
  border-radius: 999px;
}

/* Статус визита — отдельный от выбранного пользователем цвета карточки сигнал. */
.appointment-status-badge.is-booked {
  color: #2563eb;
  background: #eff6ff;
}

.appointment-status-badge.is-completed {
  color: var(--primary);
  background: var(--primary-soft);
}

.appointment-status-badge.is-confirmed {
  color: #7c3aed;
  background: #f3e8ff;
}

.appointment-status-badge.is-no-show,
.appointment-status-badge.is-cancelled {
  color: #c2413b;
  background: #fff1f0;
}

.appointment-status-badge.is-draft {
  color: #64748b;
  background: #f1f5f9;
}

.badge-active {
  color: var(--primary);
  background: var(--primary-soft);
}

.badge-control {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge-new {
  color: var(--blue);
  background: var(--blue-soft);
}

.badge-lost {
  color: var(--text-secondary);
  background: #f1f5f9;
}

.clients-page,
.analytics-page,
.settings-page {
  padding: 0 28px 28px;
  background: var(--bg-main);
}

.client-base-toolbar {
  min-height: auto;
  padding: 0 0 14px;
  background: transparent;
  border-bottom: 0;
}

.client-base-search {
  width: min(520px, 100%);
  min-height: 44px;
  border-color: var(--border-light);
  border-radius: 14px;
}

.table-card,
.settings-table,
.chart-card,
.stat-card,
.context-status-card,
.note-box,
.panel-section {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
}

.panel-section {
  margin-bottom: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border-light);
}

.calendar-section {
  padding: 12px 14px 14px;
}

.client-register {
  min-width: 0;
  background: #fff;
}

.client-register-head,
.client-register-row {
  grid-template-columns: 38px minmax(190px, 1.35fr) minmax(126px, 0.75fr) 96px 60px 116px 104px 118px;
}

.client-register-head {
  min-height: 48px;
  color: var(--text-secondary);
  background: var(--bg-soft);
  border-bottom-color: var(--border-soft);
}

.client-register-row {
  min-height: 62px;
  border-bottom-color: var(--border-soft);
}

.client-register-row:hover,
.client-register-row.is-active,
.settings-row:hover {
  background: #fafcfd;
}

.client-register-person,
.client-register-cell {
  min-height: 62px;
}

.client-register-person {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.client-register-person strong,
.client-title {
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

.client-phone-cell,
.client-note,
.client-phone {
  color: var(--text-secondary);
}

.client-register-cell {
  font-family: var(--font-ui);
  font-size: 13px;
}

.client-row {
  border-color: var(--border-light);
  border-radius: 14px;
}

.client-register-row.is-medical-card-pending {
  background: #fffaf0;
  box-shadow: inset 3px 0 0 var(--warning);
}

.client-register-row.is-medical-card-pending:hover,
.client-register-row.is-medical-card-pending.is-active {
  background: #fff5dd;
}

.client-row.is-medical-card-pending {
  border-color: #f3d08a;
  background: #fffaf0;
}

.client-row.is-medical-card-pending:hover,
.client-row.is-medical-card-pending.is-active {
  background: #fff5dd;
}

.client-medical-card-flag {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  color: #a16207;
  font-size: 11px;
  font-style: normal;
  font-weight: var(--weight-semibold);
  line-height: 1.2;
}

.client-medical-card-reminder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: #fff8e8;
  border: 1px solid #f3d08a;
  border-radius: 14px;
}

.client-medical-card-reminder strong {
  color: #854d0e;
  font-size: 14px;
  font-weight: var(--weight-semibold);
}

.client-medical-card-reminder p {
  margin: 4px 0 0;
  color: #94621a;
  font-size: 13px;
  line-height: 1.4;
}

.client-medical-card-reminder-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.client-filter-list {
  gap: 8px;
}

.clients-filter-panel .section-title,
.section-title {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
  text-transform: none;
}

.client-filter-list button {
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 14px;
}

.client-filter-list button.is-active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: transparent;
}

.client-card-page {
  min-height: calc(100dvh - 72px);
  padding: 24px 28px 32px;
  background: var(--bg-main);
}

.client-card-hero {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px;
  background: #fff;
  border-color: var(--border-light);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
}

.client-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.client-card-main h1 {
  font-size: 28px;
  font-weight: var(--weight-semibold);
}

.client-card-meta {
  gap: 8px;
}

.client-card-meta span {
  border-color: var(--border-soft);
  border-radius: 999px;
}

.client-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.client-card-metrics,
.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.client-card-metrics div,
.stat-card {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
}

.client-card-metrics strong,
.stat-card strong {
  display: block;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: var(--weight-semibold);
}

.client-card-metrics span,
.stat-card span,
.stat-card small {
  color: var(--text-secondary);
  font-size: 13px;
}

.stat-card small {
  display: block;
  margin-top: 8px;
  color: var(--primary);
  font-weight: var(--weight-semibold);
}

.client-section-card,
.info-item,
.client-form-card,
.medical-card,
.medical-subsection,
.visit-card,
.recommendation-card,
.timeline-item,
.profile-card {
  border-color: var(--border-light);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  gap: 18px;
  margin-top: 18px;
}

.chart-card {
  min-height: 280px;
  padding: 20px;
}

.chart-card h2 {
  margin: 0 0 18px;
  font-size: 16px;
}

.line-chart {
  height: 190px;
  background:
    linear-gradient(to bottom, transparent 0 24%, var(--border-soft) 25%, transparent 26% 49%, var(--border-soft) 50%, transparent 51% 74%, var(--border-soft) 75%, transparent 76%),
    linear-gradient(135deg, transparent 0 13%, rgba(24,184,166,.2) 14% 29%, transparent 30% 43%, rgba(24,184,166,.26) 44% 62%, transparent 63%);
  border-radius: 14px;
  position: relative;
}

.line-chart::after {
  position: absolute;
  inset: 40px 18px 35px;
  content: "";
  border-bottom: 4px solid var(--primary);
  border-radius: 50%;
  transform: skew(-26deg) rotate(-5deg);
}

.analytics-comparison {
  margin-top: 12px;
}

.analytics-comparison-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 12px;
}

.analytics-comparison-heading h2 {
  margin: 0;
  font-size: inherit;
  font-weight: var(--weight-medium);
}

.analytics-comparison-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.analytics-comparison-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--text-secondary);
  font-size: 12px;
}

.analytics-comparison-item strong {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.analytics-comparison-item.is-increase strong {
  color: var(--primary);
}

.analytics-comparison-item.is-decrease strong {
  color: var(--danger);
}

.analytics-revenue-chart {
  --plot-height: 190px;
  min-width: 0;
}

.analytics-chart-period {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 12px;
}

.analytics-chart-frame {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px;
}

.analytics-chart-axis {
  height: var(--plot-height);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: right;
  color: var(--text-secondary);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.analytics-chart-axis span {
  line-height: 0;
}

.analytics-chart-scroll {
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.analytics-line-bars {
  min-width: calc(var(--day-count) * 24px);
  display: grid;
  grid-template-columns: repeat(var(--day-count), minmax(0, 1fr));
  gap: 0;
  background:
    repeating-linear-gradient(to top, var(--border-soft) 0 1px, transparent 1px 25%);
  background-size: 100% var(--plot-height);
  background-repeat: no-repeat;
}

.analytics-day-bar {
  display: grid;
  grid-template-rows: var(--plot-height) 20px;
  gap: 8px;
  min-width: 0;
  padding: 0 3px 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.analytics-day-bar .analytics-bar-track {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: var(--plot-height);
}

.analytics-day-bar i {
  width: 100%;
  max-width: 32px;
  min-height: 1px;
  background: var(--primary);
  opacity: .55;
  border-radius: 4px 4px 0 0;
}

.analytics-day-bar.is-zero i {
  min-height: 0;
}

.analytics-day-bar[aria-pressed="true"] i {
  opacity: 1;
}

.analytics-day-bar[aria-pressed="true"] .analytics-day-label {
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

.analytics-day-bar:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.analytics-day-label {
  text-align: center;
  font-size: 11px;
  font-weight: var(--weight-medium);
}

.analytics-chart-detail {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 12px;
  font-size: 12px;
}

.analytics-chart-detail output {
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}

.analytics-chart-detail span {
  color: var(--text-secondary);
  font-size: 11px;
}

.donut-chart {
  width: 160px;
  height: 160px;
  margin: 20px auto 0;
  background: conic-gradient(var(--primary) 0 40%, var(--blue) 40% 70%, var(--warning) 70% 90%, var(--purple) 90% 100%);
  border-radius: 50%;
  box-shadow: inset 0 0 0 36px #fff;
}

.analytics-donut-wrap {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.analytics-legend {
  display: grid;
  gap: 12px;
}

.analytics-legend span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
}

.analytics-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.analytics-legend b,
.analytics-focus-list strong {
  color: var(--text-primary);
}

.analytics-legend em {
  color: var(--text-primary);
  font-style: normal;
  font-weight: var(--weight-semibold);
}

.bar-list,
.top-services {
  display: grid;
  gap: 14px;
}

.bar-list span,
.top-services span {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
}

.bar-list i {
  display: block;
  height: 12px;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 999px;
}

.top-services span {
  grid-template-columns: 24px 1fr auto;
  min-height: 34px;
}

.analytics-empty {
  display: grid;
  min-height: 190px;
  place-items: center;
  color: var(--text-secondary);
  text-align: center;
  border: 1px dashed var(--border-soft);
  border-radius: 14px;
}

.analytics-focus-list {
  display: grid;
  gap: 14px;
}

.analytics-focus-list div {
  display: grid;
  gap: 4px;
}

.analytics-focus-list span {
  color: var(--text-secondary);
  line-height: 1.45;
}

 .schedule-layout {
  margin: 0 28px 28px;
  min-height: calc(100dvh - 128px);
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
}

.schedule-corner,
.schedule-date-head,
.schedule-master-cell,
.schedule-cell {
  border-right-color: var(--border-soft);
  border-bottom-color: var(--border-soft);
}

.schedule-cell.is-working {
  color: var(--primary);
  background: var(--primary-soft);
}

.schedule-cell.is-weekend,
.schedule-date-head.is-weekend {
  background: #fff8f8;
}

.schedule-cell.is-selected,
.schedule-date-head.is-selected {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.schedule-cell.is-current-day,
.schedule-date-head.is-current-day {
  box-shadow: inset 0 3px 0 rgba(20, 184, 166, 0.65);
}

.schedule-cell.is-working.is-current-day,
.schedule-cell.is-off.is-current-day,
.schedule-date-head.is-current-day {
  background: #edfafa;
}

.regular-schedule-box {
  padding: 0;
  border: 0;
}

.weekday-pill span {
  min-height: 34px;
  border-radius: 10px;
}

.weekday-pill input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
}

.modal {
  border-color: var(--border-light);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
}

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

.modal-header,
.modal-footer {
  border-color: var(--border-soft);
}

.modal-title {
  font-size: 24px;
  font-weight: var(--weight-semibold);
}

.field label,
.medical-field span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: var(--weight-semibold);
}

.note-box {
  color: var(--text-secondary);
  background: var(--bg-soft);
  box-shadow: none;
}

.context-status-card {
  gap: 12px;
  padding: 14px;
  box-shadow: none;
}

.today-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.today-stats-grid > div {
  display: grid;
  gap: 5px;
  min-height: 70px;
  padding: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
}

.today-stats-grid b {
  color: var(--text-primary);
  font-size: 18px;
}

.today-stats-grid span,
.upcoming-list small {
  color: var(--text-secondary);
}

.panel-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-card-head .section-title {
  margin: 0;
}

.upcoming-list {
  display: grid;
  gap: 10px;
}

.upcoming-list button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
}

.upcoming-list strong,
.upcoming-list small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.upcoming-list b {
  color: var(--text-primary);
}

.calendar-title {
  font-size: 16px;
}

.calendar-day {
  min-height: 28px;
  font-size: 13px;
}

.calendar-weekdays {
  margin-bottom: 3px;
  font-size: 10.5px;
}

.calendar-head {
  grid-template-columns: 32px 1fr 32px;
  gap: 6px;
  margin-bottom: 8px;
}

.calendar-year {
  margin-top: 0;
  font-size: 11px;
}

.calendar-grid {
  gap: 2px 4px;
}

.clients-filter-panel .section-title,
.section-title {
  font-size: 15px;
}

.today-stats-grid {
  gap: 8px;
}

.today-stats-grid > div {
  min-height: 58px;
  padding: 10px;
}

.today-stats-grid b {
  font-size: 16px;
}

.today-stats-grid > .today-stat-wide {
  grid-column: 1 / -1;
  min-width: 0;
  align-content: center;
}

.today-stat-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
}

.today-stat-line > b {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.payment-breakdown {
  display: grid;
  gap: 6px;
  margin: 6px 0 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.payment-breakdown > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.payment-breakdown dt,
.payment-summary-caption {
  color: var(--text-secondary);
}

.payment-breakdown dd {
  margin: 0;
  font-weight: 600;
  color: var(--text-primary);
}

.payment-summary-caption {
  font-size: 11px;
  line-height: 1.45;
}

.upcoming-list button {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 52px;
  gap: 8px;
}

.client-filter-list button {
  min-height: 50px;
  padding: 8px 10px;
}

.client-filter-list strong {
  font-size: 12.5px;
}

.client-filter-list small {
  font-size: 10.5px;
}

.status-badge {
  flex: 0 0 auto;
}

@media (max-width: 1200px) {
  body {
    min-width: 0;
  }

  .shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .right-panel {
    display: none;
  }
}

@media (max-width: 900px) {
  .problems-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .problem-form-grid,
  .problem-context-grid,
  .problem-history-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .shell {
    grid-template-columns: 78px minmax(0, 1fr);
    grid-template-rows: 72px minmax(0, 1fr);
  }

  .sidebar {
    width: 78px;
    padding: 14px 10px;
  }

  .sidebar-logo,
  .collapse-link span,
  .nav-item span:last-child,
  .sidebar-subnav {
    display: none;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 0;
  }

  .profile-copy,
  .chevron {
    display: none;
  }

  .view-toolbar,
  .page-header {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  .journal,
  .schedule-layout,
  .clients-page,
  .analytics-page,
  .client-card-page {
    margin: 0 16px 16px;
    padding: 0;
  }

  .analytics-kpis,
  .analytics-comparison-grid,
  .client-card-metrics,
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

/* Shared compact clinical rhythm for every screen */
.workspace > .clients-page,
.workspace > .analytics-page,
.workspace > .settings-page,
.workspace > .client-card-page,
.workspace > .schedule-page,
.workspace > .journal-page {
  min-height: calc(100dvh - 32px);
  padding: var(--page-y) var(--page-x) 14px;
}

.workspace.is-schedule-workspace,
.workspace.is-journal-workspace {
  display: grid;
  min-height: 0;
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
}

.shell.is-schedule-shell,
.shell.is-journal-shell {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.shell.is-schedule-shell .sidebar,
.shell.is-schedule-shell .right-panel,
.shell.is-journal-shell .sidebar,
.shell.is-journal-shell .right-panel {
  max-height: 100dvh;
  overflow: auto;
}

.workspace > .schedule-page,
.workspace > .journal-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  gap: 0;
  /* Keep the work grid on the same baseline as the right-side tools. */
  padding-top: 0;
  padding-bottom: var(--work-bottom-gap);
  overflow: hidden;
}

.workspace > .settings-page {
  padding-top: 0;
}

/* Settings are wrapped for the mobile section switcher, so on desktop they
   are not direct workspace children. Keep their work area aligned with the
   toolbar and the journal/client pages instead of inheriting the old 28px
   inner gutter. */
@media (min-width: 761px) {
  .workspace .settings-page {
    padding: var(--page-y) var(--page-x) 14px;
    padding-top: 0;
  }

  .workspace .profile-settings-page {
    padding-top: var(--page-y);
  }
}

.settings-mobile-shell,
.team-mobile-shell {
  display: contents;
}

 .schedule-page {
  gap: 0;
  min-width: 0;
  padding-bottom: 10px;
  overflow: hidden;
}

.schedule-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.shell.is-schedule-shell .workspace {
  overflow: hidden;
}

.shell.is-schedule-shell .right-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  max-height: 100dvh;
  padding-bottom: var(--work-bottom-gap);
  overflow: hidden;
}

.shell.is-schedule-shell .schedule-tools-panel {
  min-height: 0;
  height: 100%;
  overflow: auto;
}

.page-header,
.view-toolbar {
  min-height: 54px;
  padding: var(--toolbar-y) var(--page-x);
}

.page-title {
  font-size: 18px;
  line-height: 1.2;
}

.page-header p {
  margin-top: 4px;
  font-size: 12px;
}

.page-actions,
.toolbar-group,
.modal-footer-left,
.modal-footer-right,
.quick-client-actions {
  gap: 8px;
}

.select,
.input,
.textarea,
.medical-field input,
.medical-field select,
.medical-field textarea,
.date-control button,
.date-control input {
  min-height: var(--control-h);
  font-size: 12.5px;
  border-radius: 10px;
}

.client-base-toolbar,
.settings-service-filters {
  min-height: auto;
  padding: 0 0 12px;
  background: transparent;
  border-bottom: 0;
}

.settings-service-filters {
  grid-template-columns: minmax(150px, 180px) minmax(150px, 180px) minmax(130px, 160px) minmax(220px, 1fr) auto;
}

.employees-filters {
  grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr) minmax(150px, 190px) auto auto;
}

.table-card,
.settings-table,
.chart-card,
.stat-card,
.client-card-hero,
.client-card-metrics div,
.client-section-card,
.info-item,
.client-form-card,
.medical-card,
.medical-subsection,
.visit-card,
.recommendation-card,
.timeline-item,
.profile-card,
.schedule-layout,
.modal,
.quick-client-card,
.appointment-client-card {
  border-radius: var(--card-radius);
}

.client-register-head,
.settings-table-head {
  min-height: 42px;
  font-size: 10.5px;
}

.client-register-row,
.client-register-person,
.client-register-cell,
.settings-row {
  min-height: var(--row-h);
}

.settings-table-head,
.settings-row {
  padding-inline: 14px;
}

.settings-row {
  font-size: 13px;
}

.settings-person {
  grid-template-columns: 34px minmax(0, 1fr);
}

.settings-person strong {
  font-size: 13px;
}

.dictionary-row small,
.client-register-person small,
.client-register-person em {
  font-size: 11px;
}

 .schedule-layout {
  position: relative;
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.schedule-layout::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.schedule-layout::-webkit-scrollbar-thumb {
  background: transparent;
}

.schedule-layout::-webkit-scrollbar-track {
  background: transparent;
}

.schedule-scroll-arrow {
  position: absolute;
  top: 9px;
  z-index: 9;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
  transition: opacity 0.18s ease, transform 0.18s ease;
  backdrop-filter: blur(10px);
}

.schedule-scroll-arrow.is-left {
  left: 14px;
}

.schedule-stage:has(.schedule-scroll-arrow.is-left:not(.is-hidden)) .schedule-corner-diagram {
  opacity: 0;
}

.schedule-scroll-arrow.is-right {
  right: 10px;
}

.schedule-scroll-arrow svg {
  width: 16px;
  height: 16px;
}

.schedule-scroll-arrow.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
}

.schedule-heading {
  min-width: 130px;
  font-size: 18px;
}

.schedule-corner,
.schedule-date-head,
.schedule-master-cell,
.schedule-cell {
  min-height: 54px;
}

.schedule-date-head strong {
  font-size: 16px;
}

.schedule-date-head span,
.schedule-cell span,
.schedule-cell em {
  font-size: 11px;
}

.schedule-cell strong {
  font-size: 12px;
}

.schedule-master-cell:hover {
  z-index: 12;
}

.schedule-master-tooltip {
  position: absolute;
  left: calc(100% - 6px);
  top: 50%;
  z-index: 20;
  display: grid;
  gap: 2px;
  min-width: max-content;
  max-width: 240px;
  padding: 8px 11px;
  color: #fff;
  line-height: 1.25;
  pointer-events: none;
  background: rgba(42, 54, 71, 0.94);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translate(-4px, -50%);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.schedule-master-tooltip strong {
  font-size: 12px;
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.schedule-master-tooltip small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.schedule-master-tooltip::before {
  position: absolute;
  top: 50%;
  left: -5px;
  width: 10px;
  height: 10px;
  content: "";
  background: rgba(42, 54, 71, 0.94);
  transform: translateY(-50%) rotate(45deg);
}

.schedule-master-cell:hover .schedule-master-tooltip {
  opacity: 1;
  transform: translate(0, -50%);
}

.client-card-page {
  padding-top: var(--page-y);
}

.client-card-hero {
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 14px;
}

.client-card-main h1 {
  font-size: 22px;
}

.client-card-meta {
  margin-top: 5px;
}

.client-card-meta span {
  padding: 3px 7px;
  font-size: 11px;
}

.client-card-metrics,
.analytics-kpis {
  gap: 10px;
  margin-top: 12px;
}

.client-card-metrics div,
.stat-card {
  padding: 14px;
}

.client-card-metrics strong,
.stat-card strong {
  font-size: 18px;
}

.client-card-metrics span,
.stat-card span,
.stat-card small {
  font-size: 12px;
}

.client-tabs {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  overflow-x: auto;
  padding: 0 12px 1px;
  background: transparent;
  border-bottom: 1px solid var(--border-light);
  scrollbar-width: thin;
}

.client-tabs button {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 42px;
  padding: 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: var(--weight-semibold);
  line-height: 1.1;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-tabs button.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.client-tab-panel {
  padding-top: 14px;
}

.client-overview-grid,
.client-info-grid,
.medical-section-grid {
  gap: 10px;
}

.client-section-card,
.info-item,
.client-form-card,
.medical-card,
.medical-subsection {
  padding: 12px;
}

.client-section-card h3,
.client-tab-head h3,
.medical-card h3,
.settings-placeholder h3 {
  font-size: 15px;
}

.client-section-card p,
.client-tab-head p,
.medical-card p {
  font-size: 12px;
}

.form-grid,
.appointment-form-layout,
.medical-form,
.control-grid,
.medical-grid {
  gap: 10px;
}

.field,
.medical-field {
  gap: 5px;
}

.modal-backdrop {
  padding: 18px;
}

.modal,
.appointment-modal,
.master-modal,
.service-modal {
  width: min(900px, calc(100vw - 36px));
  max-height: calc(100dvh - 36px);
}

.modal.sm,
.service-modal {
  width: min(680px, calc(100vw - 36px));
}

.master-modal {
  width: min(980px, calc(100vw - 36px));
}

.modal-header,
.modal-footer,
.master-modal-head {
  padding: 12px 16px;
}

.modal-body,
.master-modal-body {
  padding: 14px 16px;
}

.modal-title,
.master-modal-title h2,
.quick-client-head h2 {
  font-size: 20px;
}

.appointment-section h3 {
  margin-bottom: 8px;
  font-size: 12px;
}

.appointment-time-grid {
  grid-template-columns: minmax(220px, 1fr) 140px 140px;
}

.appointment-service-grid {
  grid-template-columns: minmax(220px, 1fr) 110px 120px 110px;
}

.appointment-client-layout {
  grid-template-columns: minmax(280px, 1fr) 140px 220px;
  gap: 10px;
}

.appointment-note-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 1.6fr);
  gap: 12px;
}

.analytics-grid {
  gap: 14px;
  margin-top: 14px;
}

.chart-card {
  min-height: 240px;
  padding: 16px;
}

.chart-card h2 {
  margin-bottom: 12px;
  font-size: 15px;
}

.right-panel .panel-section {
  padding: 14px;
}

.workspace > .clients-page {
  padding-top: 0;
}

.clients-page > .client-base-toolbar.view-toolbar {
  min-height: 54px;
  padding: var(--toolbar-y) 0;
}

.clients-page > .clients-workspace {
  margin-top: 0;
}

.shell {
  grid-template-rows: minmax(0, 1fr);
}

.workspace {
  grid-column: 2;
  grid-row: 1;
}

.right-panel {
  grid-column: 3;
  grid-row: 1;
  padding: var(--toolbar-y) var(--page-x) 14px 0;
}

 .journal {
  margin: 0 var(--page-x) 0;
}

.right-panel {
  padding-top: 0;
}

.account-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: var(--control-h);
  min-height: var(--control-h);
  margin-bottom: 8px;
  padding: 0 10px;
  border-radius: 12px;
}

.account-actions,
.account-profile {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.account-profile-wrap {
  position: relative;
  display: flex;
  min-width: 0;
}

.account-profile-button {
  padding: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.account-profile-button:hover .topbar-avatar {
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.76), 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.account-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 80;
  width: 272px;
  padding: 12px;
  color: var(--text-primary);
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.16);
}

.account-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 24px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-top: 1px solid var(--border-light);
  border-left: 1px solid var(--border-light);
  transform: rotate(45deg);
}

.account-popover-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.account-popover-avatar {
  width: 38px;
  height: 38px;
  min-width: 38px;
  font-size: 14px;
}

.account-popover-head strong,
.account-popover-head small,
.account-popover-meta b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-popover-head strong {
  display: block;
  font-size: 14px;
  font-weight: var(--weight-semibold);
}

.account-popover-head small {
  display: block;
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
}

.account-popover-meta {
  display: grid;
  gap: 8px;
  padding: 10px 0;
}

.account-popover-meta div {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.account-popover-meta span {
  color: var(--text-secondary);
  font-size: 11.5px;
}

.account-popover-meta b {
  font-size: 12px;
  font-weight: var(--weight-semibold);
  text-align: right;
}

.account-popover-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.account-popover-actions .danger {
  grid-column: 1 / -1;
}

.account-popover-btn {
  min-height: 34px;
  padding: 0 10px;
}

.account-popover-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-actions .icon-btn {
  width: 26px;
  height: 26px;
}

.account-actions .icon-btn svg {
  width: 16px;
  height: 16px;
}

.account-actions .messages-icon-btn svg {
  transform: translateY(-1.5px);
}

.account-actions .notify-dot {
  top: -1px;
  right: -1px;
  min-width: 14px;
  height: 14px;
  font-size: 11px;
  border-width: 0;
}

.account-actions .notification-unread-dot {
  top: 0;
  right: 0;
  width: 6px;
  height: 6px;
}

.account-panel .topbar-avatar {
  width: 26px;
  height: 26px;
  min-width: 26px;
  font-size: 11px;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.76);
}

.account-panel .profile-copy {
  overflow: hidden;
}

.account-panel .profile-copy strong,
.account-panel .profile-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-panel .profile-copy strong {
  display: block;
  line-height: 1;
}

 .journal-toolbar {
  min-height: 56px;
  padding: 12px var(--page-x);
  gap: 10px;
}

.journal-toolbar .toolbar-title-group {
  flex: 0 1 auto;
  gap: 8px;
}

.journal-toolbar-actions {
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
  gap: 8px;
}

.journal-toolbar .day-nav-btn,
.journal-toolbar .date-inline {
  width: 32px !important;
  min-width: 32px !important;
  height: 32px;
  min-height: 32px;
  flex-basis: 32px;
  border-radius: 9px;
}

.journal-toolbar .date-inline {
  background-size: 15px 15px;
}

.journal-toolbar .day-nav-btn svg {
  width: 14px;
  height: 14px;
}

.journal-toolbar .journal-title {
  /* A fixed date slot keeps the next-day arrow in the same place while
     moving between dates and months. Weekdays use their short form. */
  width: 160px;
  min-width: 160px;
  max-width: 160px;
  flex: 0 0 160px;
  font-size: 14px;
  line-height: 1.1;
}

.journal-toolbar .staff-filter {
  flex: 0 1 176px;
  min-width: 176px;
}

.journal-toolbar .staff-filter-trigger {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 9px;
}

.journal-toolbar .compact-primary {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 12px;
}

.journal-toolbar .icon-plus {
  width: 14px;
  height: 14px;
}

.journal-toolbar .icon-plus::before {
  inset: 6px 1px;
}

.journal-toolbar .icon-plus::after {
  inset: 1px 6px;
}

.toolbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  color: var(--text-muted);
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 9px;
}

 .journal-toolbar-search {
  flex: 1 1 220px;
  min-width: 160px;
  max-width: 34vw;
}

.toolbar-search-icon {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  color: var(--text-muted);
}

.toolbar-search-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolbar-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--text-primary);
  font-size: 11.5px;
  background: transparent;
  border: 0;
  outline: 0;
}

.account-panel {
  height: 56px;
  min-height: 56px;
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: grid;
  grid-template-columns: auto minmax(82px, 1fr) auto;
  align-items: center;
  column-gap: 10px;
}

.account-actions .icon-btn {
  width: 24px;
  height: 24px;
  align-items: center;
  justify-items: center;
}

.account-actions .icon-btn:hover,
.account-profile-button:hover {
  background: transparent;
  box-shadow: none;
}

.account-actions .icon-btn svg {
  width: 15px;
  height: 15px;
}

.account-actions .messages-icon-btn svg {
  transform: translateY(-1px);
}

.account-panel .topbar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  min-width: 20px;
  height: 20px;
  padding-top: 0;
  font-size: 9px;
  line-height: 1;
}

.topbar-avatar .avatar-letter {
  display: block;
  line-height: 1;
  transform: translateY(0.5px);
}

.account-panel .profile-copy strong {
  font-size: 11.5px;
}

.branch-switcher {
  min-width: 0;
}

.organization-switcher {
  min-width: 0;
}

.organization-switcher-label {
  display: block;
  min-width: 0;
  max-width: 142px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 26px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.organization-switcher select,
.branch-switcher select {
  width: 100%;
  max-width: 124px;
  min-height: 26px;
  padding: 0 24px 0 9px;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: var(--weight-medium);
  line-height: 1;
  text-overflow: ellipsis;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  border: 0;
  border-radius: 8px;
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
}

.organization-switcher select {
  max-width: 142px;
}

.organization-switcher select:hover,
.organization-switcher select:focus-visible,
.branch-switcher select:hover,
.branch-switcher select:focus-visible {
  background-color: var(--primary-soft);
  color: var(--text-primary);
}

.organization-switcher select:disabled,
.branch-switcher select:disabled {
  opacity: 1;
}

@media (max-width: 1440px) {
  .journal-toolbar .journal-title {
    width: 160px;
    min-width: 160px;
    max-width: 160px;
    flex-basis: 160px;
  }

  .journal-toolbar-search {
    max-width: 240px;
  }

}

.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 0, rgba(20, 184, 166, 0.08), transparent 34%),
    var(--bg);
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px -36px rgba(15, 23, 42, 0.38);
}

.login-brand {
  display: grid;
  justify-items: center;
  margin-bottom: 24px;
}

.login-logo {
  width: 184px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.login-brand strong {
  color: var(--text);
  font-size: 24px;
  font-weight: var(--weight-bold);
  letter-spacing: 0;
}

.login-form label span,
.login-hint {
  color: var(--muted);
  font-size: var(--font-size-md);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
}

.login-form input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
}

.login-form input:focus {
  border-color: rgba(20, 184, 166, 0.48);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.login-password-group {
  display: grid;
  gap: 7px;
}

.login-password-field {
  position: relative;
}

.login-password-field input {
  padding-right: 52px;
}

.login-password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.login-password-toggle:hover {
  color: var(--primary-dark);
}

.login-password-toggle:focus-visible {
  outline: 2px solid var(--primary-dark);
  outline-offset: -4px;
}

.login-password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-form .btn {
  width: 100%;
  justify-content: center;
}

.login-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  line-height: var(--line-normal);
}

.login-hint code {
  padding: 2px 6px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.staff-filter {
  position: relative;
  flex: 0 0 220px;
  min-width: 220px;
  z-index: 30;
}

.staff-filter-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: var(--control-h);
  padding: 0 12px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: var(--weight-medium);
  text-align: left;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.staff-filter-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-filter-trigger svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
  stroke-width: 1.8;
}

.staff-filter.is-open .staff-filter-trigger {
  border-color: rgba(24, 184, 166, 0.42);
  box-shadow: 0 0 0 3px rgba(24, 184, 166, 0.12);
}

.staff-filter.is-open .staff-filter-trigger svg {
  transform: rotate(180deg);
}

.staff-filter-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  width: 278px;
  max-height: min(430px, calc(100dvh - 130px));
  overflow: auto;
  padding: 6px 0;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.staff-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 6px 10px 6px 14px;
  color: var(--text-secondary);
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid rgba(226, 232, 240, 0.72);
}

.staff-filter-row:last-child {
  border-bottom: 0;
}

.staff-filter-row:hover {
  background: #f8fbfd;
}

.staff-filter-row-group {
  min-height: 36px;
  font-weight: var(--weight-semibold);
}

.staff-filter-title,
.staff-filter-person-copy strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-filter-count {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
}

.staff-filter-person {
  grid-template-columns: 26px minmax(0, 1fr) 24px;
  padding-left: 18px;
}

.staff-filter-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  color: #fff;
  font-size: 11px;
}

.staff-filter-person-copy {
  display: flex;
  align-items: center;
  min-width: 0;
}

.staff-filter-check {
  position: relative;
  width: 18px;
  height: 18px;
  margin-left: auto;
  background: #eef3f8;
  border: 1px solid #d6e0ea;
  border-radius: 5px;
}

.staff-filter-row.is-selected .staff-filter-check {
  background: var(--primary);
  border-color: var(--primary);
}

.sidebar {
  color: #64748b;
  background: #ffffff;
  border-right-color: #e7ecf3;
  box-shadow: none;
}

.sidebar-logo {
  position: relative;
  min-height: 64px;
}

.brand-title {
  color: #0f172a;
}

.brand-subtitle {
  color: #94a3b8;
}

.nav-item {
  color: #64748b;
}

.nav-item:hover {
  color: #334155;
  background: #f5f8fc;
}

.nav-item.is-active {
  color: #14b8a6;
  background: #eaf8f6;
}

.nav-chevron {
  color: #94a3b8;
}

.nav-item:hover .nav-chevron,
.nav-item.is-active .nav-chevron {
  color: #64748b;
}

.sidebar-subnav button {
  color: #94a3b8;
  border-left-color: #e7ecf3;
}

.sidebar-subnav button.is-active {
  color: #14b8a6;
  border-left-color: #14b8a6;
}

.collapse-link {
  color: #64748b;
}

.collapse-link:hover {
  color: #14b8a6;
  background: #eaf8f6;
}

.shell.is-sidebar-collapsed .sidebar {
  width: 68px;
  padding: 18px 8px 14px;
  overflow-x: hidden;
}

.shell.is-sidebar-collapsed .sidebar-logo {
  display: grid;
  min-height: 64px;
  padding: 0 0 18px;
  place-items: center;
}

.shell.is-sidebar-collapsed .sidebar-logo::before {
  display: block;
  width: 38px;
  height: 38px;
  content: "";
  background-color: #ffffff;
  background-image: url("/imagen/icon1.jpg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  border: 1px solid #d9f1ee;
  border-radius: 50%;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.shell.is-sidebar-collapsed .sidebar-logo > * {
  display: none;
}

.shell.is-sidebar-collapsed .sidebar-nav {
  align-content: start;
  gap: 6px;
}

.shell.is-sidebar-collapsed .nav-item {
  grid-template-columns: 1fr;
  justify-items: center;
  min-height: 38px;
  padding: 0;
}

.shell.is-sidebar-collapsed .nav-item > span:not(.nav-icon),
.shell.is-sidebar-collapsed .sidebar-subnav,
.shell.is-sidebar-collapsed .nav-chevron,
.shell.is-sidebar-collapsed .collapse-link span {
  display: none;
}

.shell.is-sidebar-collapsed .collapse-link {
  justify-content: center;
  min-height: 38px;
  padding: 0;
}

.sidebar-nav-group {
  position: relative;
  display: grid;
  min-width: 0;
}

.shell.is-sidebar-collapsed .sidebar {
  z-index: 40;
  overflow: visible;
}

.shell.is-sidebar-collapsed .sidebar-nav-group {
  position: relative;
}

.shell.is-sidebar-collapsed .sidebar-nav-group.has-open-flyout {
  z-index: 2;
}

.shell.is-sidebar-collapsed .sidebar-subnav.sidebar-flyout {
  position: absolute;
  top: -6px;
  left: calc(100% + 12px);
  display: grid;
  width: 224px;
  gap: 3px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(30, 41, 59, 0.16);
  animation: sidebar-flyout-in 150ms ease-out;
}

.shell.is-sidebar-collapsed .sidebar-subnav.sidebar-flyout::before {
  position: absolute;
  top: 18px;
  left: -5px;
  width: 9px;
  height: 9px;
  content: "";
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  border-left: 1px solid #e2e8f0;
  transform: rotate(45deg);
}

.sidebar-flyout-title {
  padding: 7px 10px 8px;
  color: #0f172a;
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.shell.is-sidebar-collapsed .sidebar-subnav.sidebar-flyout button {
  min-height: 36px;
  padding: 0 10px;
  color: #64748b;
  font-size: 13px;
  font-weight: var(--weight-medium);
  border: 0;
  border-radius: 9px;
}

.shell.is-sidebar-collapsed .sidebar-subnav.sidebar-flyout button:hover {
  color: #0f766e;
  background: #f0fdfa;
}

.shell.is-sidebar-collapsed .sidebar-subnav.sidebar-flyout button.is-active {
  color: #0f766e;
  background: #eaf8f6;
}

.sidebar-flyout-backdrop {
  position: fixed;
  z-index: 1;
  inset: 0 0 0 68px;
  padding: 0;
  cursor: default;
  background: transparent;
  border: 0;
}

@keyframes sidebar-flyout-in {
  from {
    opacity: 0;
    transform: translateX(-4px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Typography system */
html,
body,
button,
input,
select,
textarea {
  font-family: var(--font-ui);
}

body {
  font-size: var(--type-body-size);
  font-weight: var(--weight-regular);
  line-height: var(--type-body-line);
  font-variant-numeric: tabular-nums;
}

button,
input,
select,
textarea {
  font-size: var(--type-control-size);
  font-weight: var(--weight-regular);
  line-height: var(--line-compact);
  letter-spacing: 0;
}

strong,
b {
  font-weight: var(--weight-semibold);
}

.brand-title {
  font-size: var(--font-size-xl);
  font-weight: var(--weight-semibold);
  line-height: var(--line-tight);
}

.brand-subtitle,
.profile-copy small,
.muted,
.empty,
.page-header p,
.client-section-card p,
.client-tab-head p,
.medical-card p,
.appointment-meta,
.master-hours,
.staff-filter-count,
.staff-filter-person-copy small {
  font-size: var(--type-label-size);
  font-weight: var(--weight-regular);
  line-height: var(--line-normal);
}

.topbar-name strong,
.profile-copy strong {
  font-size: var(--type-label-size);
  font-weight: var(--weight-semibold);
  line-height: var(--line-compact);
}

.nav-item {
  font-size: var(--type-menu-size);
  font-weight: var(--weight-medium);
  line-height: var(--line-compact);
}

.nav-item.is-active {
  font-weight: var(--weight-semibold);
}

.sidebar-subnav button {
  font-size: 12.5px;
  font-weight: var(--weight-medium);
  line-height: var(--line-compact);
}

.sidebar-subnav button.is-active {
  font-weight: var(--weight-semibold);
}

.page-title {
  font-size: var(--type-page-title-size);
  font-weight: var(--weight-semibold);
  line-height: var(--line-tight);
}

.journal-title {
  font-size: 16px;
  font-weight: var(--weight-semibold);
  line-height: var(--line-compact);
}

.schedule-heading,
.calendar-title,
.master-calendar-head strong,
.section-title,
.chart-card h2,
.client-section-card h3,
.client-tab-head h3,
.medical-card h3,
.settings-placeholder h3,
.regular-schedule-head h2,
.modal-header h2,
.master-modal-title h2,
.client-card-main h1 {
  font-weight: var(--weight-semibold);
  line-height: var(--line-tight);
}

.schedule-heading,
.calendar-title,
.master-calendar-head strong {
  font-size: var(--font-size-xl);
}

.schedule-corner {
  color: var(--text-secondary);
  font-size: var(--type-label-size);
  font-weight: var(--weight-semibold);
  line-height: var(--line-compact);
  text-transform: none;
  letter-spacing: 0;
}

.section-title,
.chart-card h2,
.client-section-card h3,
.client-tab-head h3,
.medical-card h3,
.settings-placeholder h3,
.regular-schedule-head h2 {
  font-size: var(--type-section-title-size);
}

.modal-header h2,
.master-modal-title h2,
.client-card-main h1 {
  font-size: var(--type-page-title-size);
}

.btn,
.compact-primary,
.client-tabs button,
.master-modal-tabs button,
.segmented button {
  font-size: var(--button-font-size);
  font-weight: var(--weight-semibold);
  line-height: var(--line-compact);
}

/* Button system */
.btn,
.compact-primary,
.calendar-nav,
.day-nav-btn,
.schedule-nav-btn,
.icon-only,
.date-inline,
.staff-filter-trigger,
.link-button {
  min-height: var(--button-h);
  border-radius: var(--button-radius);
}

.btn,
.compact-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--button-gap);
  min-width: auto;
  padding: 0 var(--button-padding-x);
  color: var(--text-primary);
  font-size: var(--button-font-size);
  font-weight: var(--weight-semibold);
  line-height: var(--line-compact);
  white-space: nowrap;
  background: #fff;
  border: 1px solid var(--border-light);
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover {
  border-color: #d8e1ec;
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary,
.btn.success {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(24, 184, 166, 0.14);
}

.btn-saving-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btnSavingSpin .72s linear infinite;
}

@keyframes btnSavingSpin {
  to { transform: rotate(360deg); }
}

.btn.primary:hover,
.btn.success:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn.ghost {
  color: var(--text-secondary);
  background: transparent;
  border-color: transparent;
}

.btn.danger {
  color: var(--danger);
  background: #fff4f1;
  border-color: #f2c7bf;
}

.btn.primary,
.btn.success,
.compact-primary {
  min-width: auto;
}

.icon-only,
.day-nav-btn,
.schedule-nav-btn,
.date-inline {
  width: var(--button-icon-size) !important;
  min-width: var(--button-icon-size) !important;
  height: var(--button-icon-size);
  min-height: var(--button-icon-size);
  flex: 0 0 var(--button-icon-size);
  padding: 0;
  border-radius: var(--button-icon-radius);
}

.calendar-nav {
  width: var(--calendar-nav-size) !important;
  min-width: var(--calendar-nav-size) !important;
  height: var(--calendar-nav-size);
  min-height: var(--calendar-nav-size);
  flex: 0 0 var(--calendar-nav-size);
  padding: 0;
  border-radius: var(--button-icon-radius);
}

.btn svg,
.icon-only svg,
.day-nav-btn svg,
.schedule-nav-btn svg,
.calendar-nav svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

.view-toolbar .toolbar-group,
.page-actions,
.client-base-toolbar,
.settings-service-filters,
.employees-filters {
  gap: var(--button-gap);
}

.toolbar-group .btn,
.view-toolbar .btn {
  min-width: auto;
}

/* Unified compact toolbar controls */
.view-toolbar,
.page-header {
  min-height: 56px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.view-toolbar .btn,
.page-header .btn,
.client-base-toolbar .btn,
.settings-service-filters .btn,
.employees-filters .btn {
  min-height: var(--toolbar-control-h);
  padding: 0 var(--toolbar-control-padding-x);
  border-radius: var(--toolbar-control-radius);
  font-size: var(--toolbar-font-size);
}

.view-toolbar .icon-only,
.view-toolbar .day-nav-btn,
.view-toolbar .schedule-nav-btn,
.view-toolbar .date-inline {
  width: var(--toolbar-icon-size) !important;
  min-width: var(--toolbar-icon-size) !important;
  height: var(--toolbar-icon-size);
  min-height: var(--toolbar-icon-size);
  flex-basis: var(--toolbar-icon-size);
  border-radius: var(--toolbar-control-radius);
}

.view-toolbar .btn svg,
.view-toolbar .icon-only svg,
.view-toolbar .day-nav-btn svg,
.view-toolbar .schedule-nav-btn svg {
  width: 14px;
  height: 14px;
}

.view-toolbar .date-inline {
  background-size: 15px 15px;
}

.view-toolbar .staff-filter-trigger,
.settings-service-filters .select,
.employees-filters .select {
  min-height: var(--toolbar-control-h);
  border-radius: var(--toolbar-control-radius);
  font-size: var(--toolbar-font-size);
}

.view-toolbar .staff-filter {
  flex-basis: 190px;
  min-width: 190px;
}

/* Keep month navigation as one unit on wide screens.  The mobile grid below
   deliberately uses the same three columns, so both layouts stay aligned. */
.schedule-month-switcher {
  display: inline-grid;
  grid-template-columns: var(--toolbar-icon-size) max-content var(--toolbar-icon-size);
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.schedule-month-switcher .schedule-heading {
  min-width: 0;
  margin: 0;
  white-space: nowrap;
}

.client-base-search,
.settings-search,
.toolbar-search {
  min-height: var(--toolbar-control-h);
  border-radius: var(--toolbar-control-radius);
}

.client-base-search input,
.settings-search input,
.toolbar-search input {
  min-height: calc(var(--toolbar-control-h) - 2px);
  font-size: var(--toolbar-font-size);
}

.settings-filter-check {
  min-height: var(--toolbar-control-h);
  font-size: var(--toolbar-font-size);
}

.view-toolbar.journal-toolbar .staff-filter {
  flex-basis: 176px;
  min-width: 176px;
}

.staff-filter {
  flex-basis: 200px;
  min-width: 200px;
}

.staff-filter-trigger {
  min-width: 0;
}

.select,
.input,
.textarea,
.medical-field input,
.medical-field select,
.medical-field textarea,
.staff-filter-trigger {
  font-size: var(--type-control-size);
  font-weight: var(--weight-regular);
  line-height: var(--line-compact);
}

.field label,
.medical-field label,
.schedule-edit-box > label,
.regular-schedule-box > label,
.master-schedule-timebox label,
.client-register-head,
.settings-table-head,
.service-master-head,
.status-badge {
  font-size: var(--type-caption-size);
  font-weight: var(--weight-semibold);
  line-height: var(--line-compact);
  letter-spacing: 0;
}

.master-name,
.appointment-client,
.client-register-person strong,
.settings-person strong,
.staff-filter-person-copy strong,
.service-master-row strong,
.timeline-title,
.client-filter-list strong,
.schedule-master-tooltip {
  font-size: var(--type-control-size);
  font-weight: var(--weight-semibold);
  line-height: var(--line-compact);
}

.time-head,
.time-slot,
.appointment-time,
.metric-value,
.schedule-cell strong,
.schedule-cell span,
.schedule-cell em,
.master-calendar-day small,
.calendar-day,
.client-card-metrics strong,
.stat-card strong {
  font-variant-numeric: tabular-nums;
}

.time-head,
.time-slot {
  font-size: var(--type-control-size);
  font-weight: var(--weight-medium);
  line-height: var(--line-compact);
}

.appointment-time,
.schedule-date-head span,
.schedule-cell span,
.schedule-cell em,
.master-calendar-day small {
  font-size: var(--type-caption-size);
  font-weight: var(--weight-regular);
}

.schedule-date-head strong {
  font-size: var(--font-size-lg);
  font-weight: var(--weight-semibold);
}

.schedule-cell strong {
  font-size: var(--font-size-sm);
  font-weight: var(--weight-semibold);
}

.calendar-day {
  font-size: var(--font-size-base);
  font-weight: var(--weight-regular);
}

.calendar-day.is-selected,
.calendar-day.is-today {
  font-weight: var(--weight-semibold);
}

.client-card-metrics strong,
.stat-card strong,
.metric-value {
  font-size: var(--type-number-size);
  font-weight: var(--weight-semibold);
  line-height: var(--line-tight);
}

.client-card-metrics span,
.stat-card span,
.stat-card small,
.dictionary-row small {
  font-size: var(--type-label-size);
  font-weight: var(--weight-regular);
  line-height: var(--line-normal);
}

.staff-filter-row-group {
  font-size: var(--type-control-size);
  font-weight: var(--weight-semibold);
}
.client-task-table .settings-table-head,
.client-task-table .settings-row {
  grid-template-columns: minmax(220px, 1.25fr) minmax(180px, 1fr) 110px 110px minmax(260px, 1.2fr);
}

.incoming-table .settings-table-head,
.incoming-table .settings-row {
  grid-template-columns: minmax(220px, 1.3fr) 100px 140px 120px minmax(250px, 1.1fr);
}

.incoming-form {
  margin-bottom: 16px;
}

.incoming-form > .btn[type="submit"] {
  margin-top: 12px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.settings-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-regular);
  line-height: 1.35;
}

.shell.is-wide-workspace {
  grid-template-columns: 216px minmax(0, 1fr);
}

.shell.is-sidebar-collapsed.is-wide-workspace {
  grid-template-columns: 68px minmax(0, 1fr);
}

.shell.is-wide-workspace .workspace {
  grid-column: 2;
  max-width: none;
  padding: 0;
  overflow: auto;
}

.empty.compact {
  padding: 18px;
}


@media (max-width: 760px) {
  .shell.is-wide-workspace,
  .shell.is-sidebar-collapsed.is-wide-workspace {
    grid-template-columns: 1fr;
  }

  .shell.is-wide-workspace .workspace {
    grid-column: 1;
  }

}

.client-head-count {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 10px;
  padding: 0 10px;
  border-radius: 999px;
  background: #EAF6FF;
  color: #64748B;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.client-register-row.is-selected {
  background: #EAF5FF;
}

.client-register-row.is-selected:hover {
  background: #E1F0FF;
}

.client-register-row.is-medical-card-pending.is-selected,
.client-register-row.is-medical-card-pending.is-selected:hover {
  background: #fff5dd;
}

.client-register-head input,
.client-register-row input[data-select-client-id] {
  accent-color: var(--primary);
  cursor: pointer;
}

.client-bulk-message {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #BFDBFE;
  border-radius: 12px;
  background: #EFF6FF;
  color: #1D4ED8;
  font-size: 13px;
  font-weight: 600;
}
.client-medical-readonly {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* Cashier reconciliation: a dense ledger, shared analytics/finance controls. */
.client-tabs.analytics-sections { display: flex; margin: 0 0 18px; }
.reconciliation-filters { display: flex; flex-wrap: wrap; gap: 14px; margin: 18px 0; }
.reconciliation-filters .field { flex: 1 1 180px; max-width: 300px; }
.reconciliation-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.reconciliation-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.reconciliation-table th { padding: 14px 12px; background: var(--surface-muted, #f6f8fb); color: var(--muted); font-weight: 600; white-space: nowrap; }
.reconciliation-table td { padding: 14px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.reconciliation-table tr[data-reconciliation-sale] { cursor: pointer; }
.reconciliation-table td:nth-child(2) { min-width: 190px; }
.reconciliation-table td:last-child { min-width: 120px; max-width: 230px; overflow-wrap: anywhere; }
.reconciliation-table small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.reconciliation-table .is-money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.reconciliation-table th:nth-child(n+4):nth-child(-n+7) { text-align: right; }
.reconciliation-table tr:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.reconciliation-pagination, .reconciliation-pagination > div { display: flex; align-items: center; gap: 12px; }
.reconciliation-pagination { justify-content: space-between; flex-wrap: wrap; margin-top: 16px; color: var(--muted); font-size: 13px; }
.reconciliation-payment .sale-payment-layer { background: transparent; }
.reconciliation-payment .sale-payment-dialog { width: min(620px, calc(100vw - 48px)); }
.payment-receipt.is-selected { border-top: 2px solid var(--primary); }
.certificates-workspace { min-width: 0; min-height: 100%; background: #F4F7FA; }
.certificates-page-head { align-items: center; margin: 0; }
.certificates-page-head .page-actions { margin-left: auto; }
.certificates-content { padding: 0 28px 28px; }
.certificates-tabs { display: flex; align-items: center; gap: 4px; margin: 2px 0 18px; padding-bottom: 8px; border-bottom: 1px solid #DDE6ED; }
.certificates-tab { min-height: 38px; padding: 0 13px; border: 0; border-radius: 9px; color: #64748B; background: transparent; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.certificates-tab:hover { background: #E8F2F4; color: #263852; }
.certificates-tab.is-active { color: #087F75; background: #DDF5F1; }
.certificates-tab span { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; margin-left: 5px; padding: 0 5px; border-radius: 99px; color: inherit; background: rgba(8, 127, 117, .12); font-size: 11px; }
.certificates-toolbar { display: grid; grid-template-columns: minmax(240px, 480px) 220px; gap: 10px; margin-bottom: 16px; }
.certificate-list-panel, .certificate-templates-panel { overflow: hidden; border: 1px solid #DDE6ED; border-radius: 16px; background: #fff; }
.certificate-row { display: grid; grid-template-columns: minmax(180px, 1.6fr) minmax(150px, 1fr) minmax(155px, 1fr) minmax(110px, .8fr) minmax(115px, .75fr); gap: 16px; align-items: center; }
.certificate-list-head { padding: 13px 18px; color: var(--muted); background: #FAFCFD; font-size: 12px; font-weight: 700; }
.certificate-list-row { min-height: 68px; padding: 14px 18px; border-top: 1px solid #E8EEF2; color: #31425C; font-size: 14px; }
.certificate-list-row:hover { background: #FCFEFE; }
.certificate-row strong, .certificate-row small { display: block; }.certificate-row small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.certificate-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px; border-bottom: 1px solid #E8EEF2; }
.certificate-panel-heading h2 { margin: 0; color: #17223A; font-size: 17px; }.certificate-panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.certificate-template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 12px; padding: 18px; }
.certificate-template-card { min-height: 142px; padding: 16px; border: 1px solid #E0E8EE; border-radius: 12px; background: #fff; }
.certificate-template-card strong { color: #21324C; font-size: 15px; }.certificate-template-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 8px; margin: 18px 0 0; }.certificate-template-card dl > div:last-child { grid-column: 1 / -1; }.certificate-template-card dt { color: var(--muted); font-size: 11px; }.certificate-template-card dd { margin: 3px 0 0; color: #31425C; font-size: 13px; font-weight: 700; }
@media (max-width: 760px) { .certificates-topbar { padding: 10px 12px 0; }.certificates-page-head { flex-wrap: wrap; gap: 12px; }.certificates-page-head h1 { font-size: 25px; }.certificates-page-head .page-actions { width: 100%; margin-left: 0; }.certificates-page-head .page-actions .btn { flex: 1 1 auto; }.certificates-content { padding: 12px 12px 20px; }.certificates-tabs { margin-top: 0; overflow-x: auto; }.certificates-tab { white-space: nowrap; }.certificates-toolbar { grid-template-columns: 1fr; }.certificate-row { grid-template-columns: 1fr 1fr; gap: 8px; }.certificate-list-head { display: none; }.certificate-list-row { padding: 14px; }.certificate-row > :first-child { grid-column: 1 / -1; }.certificate-panel-heading { align-items: flex-start; padding: 14px; }.certificate-panel-heading .btn { flex: 0 0 auto; }.certificate-template-grid { grid-template-columns: 1fr; padding: 14px; }.certificate-template-card { min-height: 0; } }
@media (hover: hover) and (pointer: fine) {
  .reconciliation-table tr[data-reconciliation-sale]:hover { background: var(--primary-soft, #edf9f7); }
}
@media (max-width: 600px) {
  .reconciliation-filters .field { max-width: none; flex-basis: 140px; }
  .reconciliation-filters .field:last-child { flex-basis: 100%; }
}
.company-task-batch .modal-body { display: grid; gap: 20px; }
.company-task-group h3 { margin: 0 0 10px; font-size: 16px; }
.company-task-group ul { list-style: none; padding: 0; margin: 0; }
.company-task-group li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.company-task-group small { flex-basis: 100%; color: var(--muted); }
.company-task-group time { color: var(--muted); font-size: 13px; }

/* The directory toolbar and account rail share one row, followed by the
   client table and filters at the same baseline. Keep other screens untouched. */
.shell.is-client-directory .client-base-search,
.shell.is-client-directory .client-base-toolbar .select,
.shell.is-client-directory .client-base-toolbar .btn {
  height: var(--toolbar-control-h);
  min-height: var(--toolbar-control-h);
}
.shell.is-client-directory .client-base-toolbar .select {
  padding-top: 0;
  padding-bottom: 0;
}
@media (min-width: 1201px) {
  .shell.is-client-directory .clients-page > .client-base-toolbar.view-toolbar {
    min-height: 54px;
    padding: 11px 0;
  }
  .shell.is-client-directory .client-base-search {
    min-width: 120px;
    grid-template-columns: 18px minmax(0, 1fr);
    flex: 1 1 520px;
  }
  .shell.is-client-directory .client-base-search input { min-width: 0; width: 100%; }
  .shell.is-client-directory .client-base-toolbar .page-actions { flex-wrap: nowrap; }
  .shell.is-client-directory > .right-panel > .account-panel {
    height: var(--toolbar-control-h);
    min-height: var(--toolbar-control-h);
    margin: 11px 0;
    padding: 0 10px;
  }
}
@media (min-width: 1201px) and (max-width: 1279px) {
  .shell.is-client-directory .company-client-branch-filter {
    min-width: 140px;
    width: 140px;
  }
  .shell.is-client-directory .client-base-toolbar .btn { padding-inline: 10px; }
}
