/* Дентал Про. Демо-CRM стоматологии. Собственная тема, без внешних ресурсов. */

:root {
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-soft: #ecfdf5;
  --teal-line: #d6ece5;
  --mint: #ecfdf5;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe9e5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px rgba(15, 23, 42, 0.045);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--mint);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

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

button {
  cursor: pointer;
}

svg {
  display: block;
}

a {
  color: var(--teal);
}

h1,
h2,
h3,
p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Кнопки и поля */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  background: #f6faf9;
}

.btn .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.btn-primary {
  background: var(--teal);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.18);
}

.btn-primary:hover {
  background: var(--teal-dark);
}

.btn-ghost {
  background: #ffffff;
  border-color: var(--line);
  color: #334155;
}

.btn-ghost:hover {
  background: var(--teal-soft);
  border-color: var(--teal-line);
}

.btn-soft {
  background: var(--teal-soft);
  color: var(--teal);
  border-color: var(--teal-line);
}

.btn-soft:hover {
  background: #dff7ee;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 32px;
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn-xs {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: #991b1b;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #64748b;
}

.icon-btn:hover {
  background: #f1f7f5;
  color: var(--text);
}

.icon-btn .icon {
  width: 18px;
  height: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}

.field > span {
  display: block;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 400;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #94a3b8;
}

.form-error {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #fecaca;
  border-radius: 9px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
}

.select-plain {
  min-height: 36px;
  max-width: 210px;
  padding: 7px 30px 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  font-size: 12.5px;
  color: #334155;
  outline: none;
}

.select-plain:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

/* Экран входа */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  background:
    radial-gradient(900px 520px at 6% -12%, #d1fae5 0%, rgba(209, 250, 229, 0) 62%),
    radial-gradient(760px 520px at 108% 112%, #ccfbf1 0%, rgba(204, 251, 241, 0) 58%),
    var(--mint);
}

.login-wrap {
  width: 100%;
  max-width: 840px;
}

.login-card {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  border: 1px solid #d8ece6;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.13);
  overflow: hidden;
}

.login-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 34px 30px;
  background: linear-gradient(155deg, #0f766e 0%, #115e59 100%);
  color: #ffffff;
  overflow: hidden;
}

.login-aside::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -100px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.login-brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.login-brand span {
  display: block;
  font-size: 12px;
  opacity: 0.82;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: var(--teal);
  color: #ffffff;
  box-shadow: 0 7px 16px rgba(15, 118, 110, 0.22);
}

.brand-mark .icon {
  width: 23px;
  height: 23px;
  stroke-width: 1.7;
}

.brand-mark-light {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

.login-aside h2 {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  font-size: 21px;
  line-height: 1.28;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.login-features {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: auto 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.35;
}

.login-features li {
  display: flex;
  align-items: center;
  gap: 9px;
}

.login-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}

.login-check .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.6;
}

.login-address {
  position: relative;
  z-index: 1;
  font-size: 11.5px;
  line-height: 1.5;
  opacity: 0.72;
}

.login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 38px;
}

.login-form h1 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.login-sub {
  margin: 4px 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.login-form .field {
  margin-bottom: 13px;
}

.login-form .btn {
  margin-top: 6px;
  min-height: 42px;
}

.login-hint {
  margin-top: 18px;
  padding: 10px 12px;
  border: 1px dashed var(--teal-line);
  border-radius: 10px;
  background: var(--teal-soft);
  color: #33615b;
  font-size: 12.5px;
  text-align: center;
}

.login-hint b {
  color: var(--teal);
}

.login-note {
  margin-top: 12px;
  color: #94a3b8;
  font-size: 11.5px;
  text-align: center;
}

.login-foot {
  margin-top: 16px;
  color: #7c8f8a;
  font-size: 11.5px;
  text-align: center;
}

/* Каркас приложения */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
}

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

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-slogan {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.topbar-date {
  margin-left: auto;
  padding-right: 8px;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.avatar-user {
  background: #0f766e;
  color: #ffffff;
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.user-name {
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}

.user-name-short {
  display: none;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.user-role {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.shell {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - 64px);
}

.sidebar {
  position: sticky;
  top: 64px;
  display: flex;
  flex-direction: column;
  width: 226px;
  height: calc(100vh - 64px);
  flex: none;
  padding: 16px 12px 12px;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.nav-item:hover {
  background: #f2faf7;
  color: var(--teal);
}

.nav-item.is-active {
  background: var(--teal-soft);
  color: var(--teal);
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  color: #7c8f8a;
}

.nav-item.is-active .icon {
  color: var(--teal);
}

.nav-count {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.5;
}

.nav-item.is-active .nav-count {
  background: #ffffff;
  color: var(--teal);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sidebar-note {
  margin: 0 4px 8px;
  color: #94a3b8;
  font-size: 10.5px;
  line-height: 1.4;
}

.reset-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.reset-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.reset-btn .icon {
  width: 15px;
  height: 15px;
}

.reset-confirm {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 9px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: var(--danger-bg);
}

.reset-confirm p {
  width: 100%;
  color: #7f1d1d;
  font-size: 11.5px;
  line-height: 1.35;
}

.reset-actions {
  display: flex;
  gap: 6px;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 22px 24px 56px;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  animation: page-in 0.18s ease;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Шапка страницы, карточки, таблицы */

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

.page-head h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: none;
}

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

.card + .card {
  margin-top: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #edf5f2;
}

.card-head h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-head .muted {
  font-size: 12px;
}

.card-pad {
  padding: 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid #edf5f2;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: #f0f6f4;
}

.segmented button {
  min-height: 30px;
  padding: 5px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #52646f;
  font-size: 12.5px;
  font-weight: 600;
}

.segmented button:hover {
  color: var(--teal);
}

.segmented button.is-active {
  background: #ffffff;
  color: var(--teal);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.search {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 300px;
}

.search .icon {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 16px;
  height: 16px;
  color: #94a3b8;
  transform: translateY(-50%);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 36px;
  padding: 7px 12px 7px 33px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  font-size: 12.5px;
  outline: none;
}

.search input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #f1f7f5;
  color: var(--muted);
  font-size: 12px;
}

.list-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #cbd5e1;
}

.list-meta strong {
  color: var(--text);
  font-weight: 650;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 12.8px;
}

th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfefd;
  color: #64748b;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid #eef5f2;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbfefd;
}

.row-click {
  cursor: pointer;
}

.row-click:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
}

.cell-main {
  font-size: 12.8px;
  font-weight: 600;
  color: var(--text);
}

.cell-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.cell-person {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.cell-person .avatar {
  width: 30px;
  height: 30px;
  font-size: 10.5px;
}

.money {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.text-muted {
  color: var(--muted);
}

.text-ok {
  color: var(--ok);
}

.text-warn {
  color: var(--warn);
}

.text-danger {
  color: var(--danger);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.45;
  white-space: nowrap;
}

.badge-ok {
  background: var(--ok-bg);
  color: #166534;
}

.badge-planned {
  background: #ccfbf1;
  color: #0f766e;
}

.badge-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-muted {
  background: #f1f5f9;
  color: #52646f;
}

.badge-source {
  background: #f0f9ff;
  color: #075985;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 44px 20px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal);
}

.empty-icon .icon {
  width: 23px;
  height: 23px;
}

.empty p {
  max-width: 320px;
  color: var(--muted);
  font-size: 12.5px;
}

.empty .btn {
  margin-top: 2px;
}

/* Пациент */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.back-link:hover {
  color: var(--teal);
}

.back-link .icon {
  width: 15px;
  height: 15px;
}

.patient-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px;
}

.avatar-lg {
  width: 54px;
  height: 54px;
  font-size: 17px;
}

.patient-id {
  flex: 1;
  min-width: 180px;
}

.patient-id h1 {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.patient-id p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
}

.patient-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.patient-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
  padding: 16px 18px;
  border-top: 1px solid #edf5f2;
}

.fact > span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.fact strong {
  display: block;
  font-size: 12.8px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.fact-wide {
  grid-column: 1 / -1;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.detail-grid > .card {
  min-width: 0;
}

.detail-grid .card + .card {
  margin-top: 0;
}

.detail-grid .table-wrap {
  min-width: 0;
}

.patient-plans {
  display: flex;
  flex-direction: column;
}

.patient-plan {
  padding: 12px 16px;
  border-bottom: 1px solid #eef5f2;
}

.patient-plan:last-child {
  border-bottom: 0;
}

.patient-plan-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  font-weight: 600;
}

.patient-plan-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

/* Планы лечения */

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.plan-card {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

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

.plan-head h2 {
  font-size: 14.5px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.plan-patient {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}

.plan-patient:hover {
  color: var(--teal);
}

.plan-money {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
  padding: 10px 0;
  border-top: 1px solid #eef5f2;
  border-bottom: 1px solid #eef5f2;
}

.plan-money span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.plan-money strong {
  font-size: 12.8px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11.5px;
}

.progress-head strong {
  color: var(--text);
  font-size: 11.5px;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e6f4ef;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #14b8a6, #0f766e);
  transition: width 0.25s ease;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.step {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 12.3px;
  text-align: left;
}

.step:hover {
  background: #f5faf8;
}

.step-box {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: transparent;
}

.step-box .icon {
  width: 12px;
  height: 12px;
  stroke-width: 3;
}

.step.is-done .step-box {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.step.is-done .step-label {
  color: var(--muted);
  text-decoration: line-through;
}

.plan-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 12px;
}

.plan-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
}

.plan-link .icon {
  width: 14px;
  height: 14px;
}

/* Оплаты */

.pay-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #0f766e, #115e59);
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(15, 118, 110, 0.18);
}

.pay-summary .label {
  display: block;
  font-size: 11.5px;
  opacity: 0.82;
}

.pay-summary .value {
  display: block;
  margin-top: 2px;
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.pay-summary .sub {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  opacity: 0.78;
}

.pay-side {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

.pay-side > div {
  padding-left: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.pay-side .value {
  font-size: 18px;
}

/* Задачи */

.quick-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 138px auto;
  gap: 8px;
  align-items: end;
  padding: 14px 16px;
}

.task-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #eef5f2;
}

.task:last-child {
  border-bottom: 0;
}

.task:hover {
  background: #fbfefd;
}

.task-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: transparent;
}

.task-check:hover {
  border-color: var(--teal);
}

.task-check .icon {
  width: 13px;
  height: 13px;
  stroke-width: 3;
}

.task.is-done .task-check {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.task-body {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 12.8px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.task.is-done .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.task-meta .icon {
  width: 13px;
  height: 13px;
}

.task-due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-delete {
  width: 28px;
  height: 28px;
  color: #94a3b8;
}

.task-delete:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.task-delete .icon {
  width: 15px;
  height: 15px;
}

.task-divider {
  padding: 9px 16px;
  border-top: 1px solid #eef5f2;
  border-bottom: 1px solid #eef5f2;
  background: #fbfefd;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Отчёты */

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

.metric {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.metric-label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 7px;
  font-size: 23px;
  font-weight: 750;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.metric-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.metric.is-warn .metric-value {
  color: var(--warn);
}

.metric.is-danger .metric-value {
  color: var(--danger);
}

.metric.is-ok .metric-value {
  color: var(--ok);
}

.reports-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.reports-grid .card + .card {
  margin-top: 0;
}

.chart {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 208px;
  padding: 20px 18px 14px;
}

.chart-col {
  display: flex;
  flex: 1;
  min-width: 0;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.chart-value {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chart-track {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 126px;
}

.chart-bar {
  width: 100%;
  max-width: 62px;
  min-height: 4px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #2dd4bf, #0f766e);
  transition: height 0.3s ease;
}

.chart-name {
  max-width: 100%;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
}

.chart-role {
  color: var(--muted);
  font-size: 10.5px;
  text-align: center;
}

.chart-note {
  padding: 0 18px 14px;
  color: var(--muted);
  font-size: 11px;
}

.service-list {
  display: flex;
  flex-direction: column;
}

.service-row {
  display: grid;
  grid-template-columns: 160px minmax(50px, 1fr) 46px 100px;
  gap: 10px;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid #eef5f2;
  font-size: 12px;
}

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

.service-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.service-bar {
  height: 7px;
  border-radius: 999px;
  background: #eef5f2;
  overflow: hidden;
}

.service-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #99d9cd;
}

.service-count {
  color: var(--muted);
  font-size: 11.5px;
  text-align: right;
  white-space: nowrap;
}

.service-sum {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* Модальные окна и уведомления */

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  padding: 28px 16px;
  background: rgba(15, 23, 42, 0.46);
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 540px;
  margin: auto;
  padding: 20px 22px 18px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3);
}

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

.modal-head h2 {
  font-size: 17px;
  letter-spacing: -0.015em;
}

.modal-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 200;
  max-width: calc(100vw - 24px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #0f172a;
  color: #ffffff;
  font-size: 12.5px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.28);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Адаптив */

@media (max-width: 1100px) {
  .topbar-date {
    display: none;
  }

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

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

@media (max-width: 900px) {
  .shell {
    flex-direction: column;
  }

  .sidebar {
    position: sticky;
    top: 64px;
    z-index: 30;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sidebar::-webkit-scrollbar {
    display: none;
  }

  .nav {
    flex-direction: row;
    flex: none;
    gap: 4px;
  }

  .nav-item {
    width: auto;
    min-height: 36px;
    padding: 7px 11px;
    font-size: 12.5px;
    white-space: nowrap;
  }

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

  .nav-count {
    padding: 1px 6px;
  }

  .sidebar-foot {
    display: flex;
    align-items: center;
    flex: none;
    margin: 0;
    padding: 0 0 0 4px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .sidebar-note {
    display: none;
  }

  .reset-btn {
    width: auto;
    min-height: 36px;
    padding: 7px 10px;
    white-space: nowrap;
  }

  .reset-btn span {
    display: none;
  }

  .reset-confirm {
    flex-wrap: nowrap;
    align-items: center;
    min-height: 36px;
    padding: 4px 6px;
  }

  .reset-confirm p {
    width: auto;
    white-space: nowrap;
    font-size: 11px;
  }

  .reset-actions .btn {
    min-height: 26px;
    padding: 3px 7px;
    font-size: 11px;
  }

  .main {
    padding: 18px 16px 48px;
  }
}

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

  .login-aside {
    gap: 14px;
    padding: 22px 24px;
  }

  .login-aside h2 {
    margin-top: 0;
    font-size: 16px;
  }

  .login-features,
  .login-address {
    display: none;
  }

  .login-form {
    padding: 26px 24px 30px;
  }

  .table-wrap table {
    min-width: 0;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap tr {
    margin: 10px 12px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .table-wrap tr:hover {
    background: #ffffff;
  }

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

  .table-wrap td {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 2px;
    align-items: start;
    padding: 5px 0;
    border-bottom: 0;
    font-size: 12.5px;
    text-align: right;
  }

  .table-wrap td::before {
    content: attr(data-label);
    grid-column: 1;
    grid-row: 1;
    padding-top: 1px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-align: left;
  }

  .table-wrap td > * {
    grid-column: 2;
  }

  .table-wrap td:first-child {
    margin-bottom: 3px;
    padding-bottom: 7px;
    border-bottom: 1px dashed #e6f0ed;
  }

  .table-wrap td:first-child .cell-main {
    font-size: 13px;
  }

  .table-wrap td .cell-person {
    justify-content: flex-end;
    text-align: right;
  }

  .table-wrap td .cell-sub {
    text-align: right;
  }

  .table-wrap td .badge {
    margin-left: auto;
  }

  .table-wrap td .money {
    margin-left: auto;
  }

  .list-meta {
    padding: 9px 14px;
  }

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

  .patient-facts {
    grid-template-columns: 1fr 1fr;
  }

  .quick-add {
    grid-template-columns: 1fr 1fr;
  }

  .quick-add .quick-text {
    grid-column: 1 / -1;
  }

  .quick-add .btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .topbar {
    height: 58px;
    gap: 10px;
    padding: 0 12px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .brand-mark .icon {
    width: 20px;
    height: 20px;
  }

  .brand-name {
    font-size: 14px;
  }

  .brand-slogan {
    display: none;
  }

  .user {
    margin-left: auto;
    padding-left: 10px;
  }

  .user-info {
    display: flex;
  }

  .user-name,
  .user-role {
    display: none;
  }

  .user-name-short {
    display: inline;
  }

  .sidebar {
    top: 58px;
  }

  .main {
    padding: 14px 12px 44px;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .page-head h1 {
    font-size: 19px;
  }

  .page-head .btn {
    width: 100%;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .toolbar {
    padding: 11px 12px;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
    padding: 5px 6px;
  }

  .search {
    max-width: none;
    flex-basis: 100%;
  }

  .select-plain {
    max-width: none;
    flex: 1;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .metric {
    padding: 12px;
  }

  .metric-value {
    font-size: 19px;
  }

  .metric-label {
    font-size: 9.5px;
  }

  .pay-summary {
    padding: 16px;
  }

  .pay-summary .value {
    font-size: 23px;
  }

  .pay-side {
    width: 100%;
    gap: 14px;
  }

  .pay-side > div {
    flex: 1;
    padding-left: 12px;
  }

  .chart {
    gap: 8px;
    height: 196px;
    padding: 16px 10px 12px;
  }

  .chart-name {
    font-size: 10.5px;
  }

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

  .patient-top {
    padding: 15px;
  }

  .patient-actions {
    width: 100%;
  }

  .patient-actions .btn {
    flex: 1;
  }

  .modal {
    padding: 16px 15px 14px;
  }

  .modal-backdrop {
    padding: 14px 10px;
  }

  .patient-facts {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    margin-top: 12px;
  }

  .service-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    padding: 9px 12px;
  }

  .service-bar {
    grid-column: 1 / -1;
    order: 3;
  }

  .service-count {
    grid-column: 2;
    grid-row: 2;
  }

  .service-sum {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 430px) {
  .nav-item {
    padding: 7px 9px;
    font-size: 12px;
  }

  .nav-item .icon {
    width: 15px;
    height: 15px;
  }

  .nav-count {
    display: none;
  }

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

  .metric-value {
    font-size: 21px;
  }

  .quick-add {
    grid-template-columns: 1fr;
  }

  .quick-add .quick-text,
  .quick-add .btn {
    grid-column: auto;
  }

  .plan-money {
    gap: 5px;
  }

  .plan-money strong {
    font-size: 12px;
  }

  .table-wrap tr {
    margin: 8px 10px;
  }

  .empty {
    padding: 34px 16px;
  }

  .login-form {
    padding: 22px 18px 26px;
  }

  .login-aside {
    padding: 20px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
