/* ============================================================
   ИМПОРТ ШРИФТОВ
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

/* ============================================================
   ПЕРЕМЕННЫЕ
   ============================================================ */
:root {
  --font-ui: 'Inter', -apple-system, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 48px;
  --sp-10: 64px;

  --accent: #7C5CFC;
  --accent-2: #9B7FFF;
  --accent-soft: rgba(124, 92, 252, .16);
  --teal: #2FD3A6;
  --teal-soft: rgba(47, 211, 166, .16);
  --amber: #F6B23B;
  --amber-soft: rgba(246, 178, 59, .16);
  --rose: #FF6693;
  --rose-soft: rgba(255, 102, 147, .16);
  --blue: #4C9AFF;
  --blue-soft: rgba(76, 154, 255, .16);

  --shadow-sm: 0 1px 2px rgba(10, 8, 20, .24);
  --shadow-md: 0 8px 24px -8px rgba(10, 8, 20, .4);
  --shadow-lg: 0 20px 48px -16px rgba(10, 8, 20, .55);
  --shadow-glow: 0 0 0 1px rgba(124, 92, 252, .4), 0 8px 24px -6px rgba(124, 92, 252, .35);

  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 340ms;
}

/* ============================================================
   ТЁМНАЯ / СВЕТЛАЯ ТЕМЫ
   ============================================================ */
html[data-theme="dark"] {
  --bg: #0A0A12;
  --bg-elevated: #0E0E18;
  --surface: #14141F;
  --surface-2: #191926;
  --surface-3: #21212F;
  --border: #26263380;
  --border-strong: #33334280;
  --text: #F3F2F9;
  --text-dim: #A19FB5;
  --text-faint: #6C6A80;
  --scrim: rgba(6, 6, 12, .6);
}

html[data-theme="light"] {
  --bg: #F5F4FA;
  --bg-elevated: #FBFAFE;
  --surface: #FFFFFF;
  --surface-2: #F3F1FA;
  --surface-3: #EAE7F5;
  --border: #E3E0F0;
  --border-strong: #D3CFE8;
  --text: #17151F;
  --text-dim: #6B6980;
  --text-faint: #9C9AB0;
  --scrim: rgba(30, 26, 50, .35);
}

/* ============================================================
   ГЛОБАЛЬНЫЕ СТИЛИ
   ============================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur-3) var(--ease), color var(--dur-3) var(--ease);
  overflow: hidden;
  height: 100vh;
}

button {
  font-family: inherit;
  cursor: pointer;
}

::selection {
  background: var(--accent-soft);
}

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================================================
   LAYOUT — APP + SIDEBAR
   ============================================================ */
.app {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--sp-5) var(--sp-4);
  transition: width var(--dur-3) var(--ease), padding var(--dur-3) var(--ease);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-2) var(--sp-6);
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16.5px;
  letter-spacing: -.01em;
  white-space: nowrap;
}

/* --- NAV --- */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: var(--sp-5) var(--sp-3) var(--sp-2);
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 9px var(--sp-3);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-item.active svg {
  stroke: var(--accent);
}

/* --- SIDEBAR FOOTER --- */
.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.upsell {
  background: linear-gradient(160deg, var(--accent-soft), transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}

.upsell h4 {
  margin: 0 0 4px;
  font-size: 13px;
  font-family: var(--font-display);
}
.upsell p {
  margin: 0 0 var(--sp-3);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

.btn-pro {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.btn-pro:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.user-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2);
  border-radius: var(--radius-md);
  transition: background var(--dur-1);
}
.user-row:hover {
  background: var(--surface-2);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--rose), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.user-meta {
  overflow: hidden;
  flex: 1;
}
.user-meta .name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.user-meta .role {
  font-size: 11.5px;
  color: var(--text-faint);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  flex-shrink: 0;
  transition: background var(--dur-2), transform var(--dur-2);
}
.theme-toggle:hover {
  background: var(--surface-3);
  transform: rotate(20deg);
}

.btn-outline {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  font-weight: 600;
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1);
}
.btn-outline:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-sm {
  font-size: 12px;
  padding: 6px 12px;
}
.btn-block {
  width: 100%;
}

/* --- HAMBURGER (mobile) --- */
.hamburger {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  align-items: center;
  justify-content: center;
  color: var(--text);
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.hamburger:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.hamburger:active {
  transform: scale(0.94);
}

/* ============================================================
   MAIN
   ============================================================ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

/* --- TOPBAR --- */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.page-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.searchbar {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 9px var(--sp-3);
  color: var(--text-faint);
  transition: border-color var(--dur-1), background var(--dur-1);
}
.searchbar:hover {
  background: var(--surface-3);
}
.searchbar:has(input:focus) {
  border-color: var(--accent);
  background: var(--surface);
}

.searchbar input {
  border: none;
  background: transparent;
  outline: none;
  color: var(--text);
  font-size: 13.5px;
  width: 100%;
  font-family: inherit;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-left: auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  position: relative;
  transition: background var(--dur-1), color var(--dur-1), transform var(--dur-1);
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.icon-btn:active {
  transform: scale(.94);
}

.dot-badge {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rose);
  border: 2px solid var(--surface);
  display: none;
}
.dot-badge.show {
  display: block;
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px var(--sp-4);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), background var(--dur-1);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}
.btn-primary:active {
  transform: translateY(0) scale(.98);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px var(--sp-4);
  font-size: 13.5px;
  font-weight: 600;
  transition: background var(--dur-1), border-color var(--dur-1);
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

/* --- CONTENT --- */
.content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-6);
}

.page {
  display: none;
  animation: fadein var(--dur-3) var(--ease);
}
.page.active {
  display: block;
}

@keyframes fadein {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   КОМПОНЕНТЫ
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur-2), box-shadow var(--dur-2), background var(--dur-2), transform var(--dur-2) var(--ease);
}

.card-title {
  font-size: 14.5px;
  font-weight: 700;
  font-family: var(--font-display);
}
.card-sub {
  font-size: 12px;
  color: var(--text-faint);
}

.link-sm {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
}
.link-sm:hover {
  text-decoration: underline;
}

/* --- KPI Grid --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.kpi {
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.kpi:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.kpi-label {
  font-size: 12.5px;
  color: var(--text-dim);
}
.kpi-delta {
  font-size: 12px;
  font-weight: 600;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 3px;
}
.kpi-delta.down {
  color: var(--rose);
}
.kpi-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.spark {
  opacity: .9;
}

/* --- Dash Grid --- */
.dash-grid {
  display: grid;
  grid-template-columns: 1.15fr 1.5fr 1.15fr;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

/* --- List --- */
.list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child {
  border-bottom: none;
}
.list-item:hover .list-title {
  color: var(--accent);
}

.list-title {
  font-size: 13.5px;
  font-weight: 600;
  transition: color var(--dur-1);
}
.list-sub {
  font-size: 12px;
  color: var(--text-faint);
}

.chip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.time-col {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-dim);
  /* width: 44px; */
  flex-shrink: 0;
  font-family: var(--font-display);
}

.bar-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 8px 0;
}
.bar-row .name {
  font-size: 12.5px;
  flex: 1;
  font-weight: 500;
}
.bar-track {
  flex: 2;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.bar-pct {
  font-size: 12px;
  color: var(--text-dim);
  width: 36px;
  text-align: right;
  font-weight: 600;
}

.chart-card {
  padding: var(--sp-5);
}
.chart-wrap {
  position: relative;
  height: 220px;
  margin-top: var(--sp-3);
}

/* ============================================================
   CALENDAR
   ============================================================ */
.cal-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.date-nav button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-1);
}
.date-nav button:hover {
  background: var(--surface-2);
}

.date-label {
  font-weight: 700;
  font-size: 14.5px;
  min-width: 130px;
  text-align: center;
}

.segmented {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}
.segmented button {
  border: none;
  background: transparent;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  transition: background var(--dur-1), color var(--dur-1);
}
.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.select-fake {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.cal-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--sp-4);
  align-items: start;
}

.cal-grid-card {
  overflow: hidden;
}
.cal-scroll {
  overflow-x: auto;
}

.cal-grid {
  display: grid;
  position: relative;
  min-width: 760px;
}

.cal-head-row {
  display: grid;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 5;
  border-bottom: 1px solid var(--border);
}

.cal-head-cell {
  padding: var(--sp-3) var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  border-right: 1px solid var(--border);
  min-width: 0;
}
.cal-head-cell:first-child {
  border-right: 1px solid var(--border);
}

.spec-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
}

.spec-meta .n {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.spec-meta .s {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}

.time-axis-cell {
  width: 64px;
  flex-shrink: 0;
}

.cal-body {
  position: relative;
  display: grid;
}

.time-gutter {
  border-right: 1px solid var(--border);
}

.time-slot {
  height: 64px;
  font-size: 11px;
  color: var(--text-faint);
  text-align: right;
  padding-right: 8px;
  position: relative;
  top: -6px;
  font-weight: 600;
}

.day-col {
  border-right: 1px solid var(--border);
  position: relative;
  background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 100% 64px;
}

.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px solid var(--rose);
  z-index: 6;
}
.now-line::before {
  content: '';
  position: absolute;
  left: 60px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rose);
}
.now-badge {
  position: absolute;
  left: 2px;
  top: -9px;
  background: var(--rose);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 5px;
}

.appt {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: 10px;
  padding: 6px 8px;
  overflow: hidden;
  border-left: 3px solid;
  cursor: pointer;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), filter var(--dur-1);
}
.appt:hover {
  transform: translateY(-1px) scale(1.012);
  box-shadow: var(--shadow-md);
  z-index: 7;
  filter: brightness(1.05);
}

.appt .cl {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appt .sv {
  font-size: 11px;
  opacity: .85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appt .meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}
.appt .pay {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.appt .dur {
  font-size: 10px;
  opacity: .75;
}

/* --- Mini Calendar --- */
.mini-cal {
  padding: var(--sp-4);
}
.mini-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}
.mini-cal-grid .dow {
  font-size: 10.5px;
  color: var(--text-faint);
  font-weight: 700;
  padding-bottom: 4px;
}

.mini-day {
  font-size: 12px;
  padding: 6px 0;
  border-radius: 8px;
  color: var(--text-dim);
  transition: background var(--dur-1);
  cursor: pointer;
}
.mini-day:hover {
  background: var(--surface-2);
}
.mini-day.muted {
  color: var(--text-faint);
  opacity: .4;
}
.mini-day.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.mini-day.today:not(.active) {
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.mini-day.has-data:not(.muted)::after {
  content: '';
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  margin: 2px auto 0;
}
.mini-day.active.has-data::after {
  background: #fff;
}

/* --- Day List --- */
.day-list-card {
  padding: var(--sp-4);
  margin-top: var(--sp-4);
}
.day-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.count-pill {
  background: var(--surface-2);
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.day-list-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.day-list-item:last-child {
  border-bottom: none;
}

.dl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.dl-time {
  font-size: 12px;
  font-weight: 700;
  width: 40px;
  color: var(--text-dim);
  font-family: var(--font-display);
}

/* --- Mobile Agenda --- */
.mobile-agenda {
  display: none;
}

.chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: var(--sp-3);
}

.filter-chip {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background var(--dur-1);
}
.filter-chip.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.agenda-appt {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: var(--sp-2);
  border-left: 3px solid;
}
.agenda-time {
  font-size: 12.5px;
  font-weight: 700;
  width: 76px;
  flex-shrink: 0;
  font-family: var(--font-display);
}

/* ============================================================
   CLIENTS TABLE
   ============================================================ */
.tabs-row {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}

.tab-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  transition: background var(--dur-1), color var(--dur-1);
  display: flex;
  gap: 6px;
  align-items: center;
  cursor: pointer;
}
.tab-pill .n {
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 0 6px;
  font-size: 11px;
}
.tab-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.tab-pill.active .n {
  background: rgba(255, 255, 255, .22);
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.table-card {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 12px var(--sp-4);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 13px var(--sp-4);
  border-bottom: 1px solid var(--border);
}
tbody tr {
  transition: background var(--dur-1);
  cursor: pointer;
}
tbody tr:hover {
  background: var(--surface-2);
}
tbody tr:last-child td {
  border-bottom: none;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-weight: 600;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 11.5px;
}

.muted-cell {
  color: var(--text-dim);
}

.kebab {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-1);
}
.kebab:hover {
  background: var(--surface-3);
  color: var(--text);
}

.kebab-wrap {
  position: relative;
  display: inline-block;
}

.row-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 150px;
  z-index: 30;
  overflow: hidden;
}
.row-menu.open {
  display: block;
  animation: slideUp .12s var(--ease);
}

.row-menu button {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  font-size: 13px;
  background: none;
  border: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}
.row-menu button:hover {
  background: var(--surface-2);
}
.row-menu button.danger {
  color: var(--rose);
}

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4);
  border-top: 1px solid var(--border);
}

.pager {
  display: flex;
  gap: 4px;
}
.pager button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.pager button.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.mobile-cards {
  display: none;
  flex-direction: column;
}
.mc-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.mc-row:last-child {
  border-bottom: none;
}
.mc-body {
  flex: 1;
}
.mc-body .top {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 13.5px;
}
.mc-body .bot {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}
.client-visits-count {
  color: var(--text-faint);
  font-size: smaller;
}
/* ============================================================
   PROFILE
   ============================================================ */
.profile-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--sp-4);
}

.profile-card {
  padding: var(--sp-5);
  text-align: center;
}

.profile-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  margin: 0 auto var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--rose), var(--accent));
}

.profile-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}
.profile-badge {
  display: inline-block;
  margin: 6px 0 var(--sp-4);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-soft);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.profile-fields {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.pf-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding-bottom: var(--sp-2);
  padding-top: var(--sp-2);
  border-bottom: 1px solid var(--border);
}
.pf-row .k {
  color: var(--text-faint);
}
.pf-row .v {
  font-weight: 600;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.stat-box {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-2);
}
.stat-box .v {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
}
.stat-box .l {
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 2px;
}

.tabbar {
  display: flex;
  gap: var(--sp-5);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
}
.tabbar button {
  background: none;
  border: none;
  padding: 10px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-faint);
  border-bottom: 2px solid transparent;
  transition: color var(--dur-1), border-color var(--dur-1);
}
.tabbar button.active {
  color: var(--text);
  border-color: var(--accent);
}

.visit-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.visit-row:last-child {
  border-bottom: none;
}

.visit-date {
  font-size: 12px;
  color: var(--text-dim);
  width: 130px;
  flex-shrink: 0;
  font-weight: 600;
}
.visit-mid {
  flex: 1;
}
.visit-mid .s {
  font-size: 12px;
  font-weight: 600;
}
.visit-mid .m {
  font-size: 12px;
  color: var(--text-faint);
}

.status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

/* ============================================================
   SERVICES GRID
   ============================================================ */
.svc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

.svc-card {
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.svc-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.svc-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.svc-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}
.svc-cat {
  font-size: 11.5px;
  color: var(--text-faint);
}

.svc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--sp-2);
}
.svc-price {
  font-weight: 700;
  font-size: 14.5px;
}
.svc-dur {
  font-size: 12px;
  color: var(--text-faint);
}
.stars {
  display: flex;
  gap: 2px;
}

/* ============================================================
   SPECIALISTS GRID & CARDS
   ============================================================ */

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: var(--sp-4);
}

.spec-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  cursor: pointer;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}

.spec-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* --- Шапка карточки --- */
.spec-card-head {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.spec-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}

.spec-card-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.spec-card-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spec-card-role {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spec-card-stats-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  background: var(--surface-2);
  padding: 2px 10px;
  border-radius: 16px;
}

.spec-card-stats-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.spec-card-stats-label {
  font-size: 9px;
  color: var(--text-faint);
}

/* --- Кебаб-меню --- */
.spec-card .kebab-wrap {
  flex-shrink: 0;
  margin-left: auto;
}

.spec-card .kebab {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-1);
}

.spec-card .kebab:hover {
  background: var(--surface-3);
  color: var(--text);
}

.spec-card .row-menu {
  top: 28px;
  right: 0;
  min-width: 140px;
}

.spec-card .row-menu button {
  padding: 7px 12px;
  font-size: 12px;
}

/* --- Статистика (3 блока) --- */
.spec-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 4px 0;
}

.spec-stat-box {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
}

.spec-stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.spec-stat-label {
  font-size: 9px;
  color: var(--text-faint);
  margin-top: 1px;
}

/* --- Бар загрузки --- */
.spec-load-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.spec-load-bar .bar-track {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}

.spec-load-bar .bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* --- Ближайшие записи --- */
.spec-upcoming {
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}

.spec-upcoming-title {
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.spec-upcoming-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  padding: 3px 0;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.spec-upcoming-item:last-child {
  border-bottom: none;
}

.spec-upcoming-item span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spec-upcoming-service {
  color: var(--text-faint);
  font-size: 10px;
  flex-shrink: 0;
}

.spec-upcoming-empty {
  font-size: 11px;
  color: var(--text-faint);
  padding: 4px 0;
  text-align: center;
}

/* --- Хедер страницы --- */
.spec-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
  gap: 10px;
}

.spec-page-header .card-title {
  font-size: 18px;
}

.spec-page-header .btn-primary {
  padding: 8px 18px;
  font-size: 13px;
}

/* ============================================================
   АДАПТИВНОСТЬ СПЕЦИАЛИСТОВ
   ============================================================ */

/* 1200px и меньше */
@media (max-width: 1200px) {
  .spec-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
  }
}

/* 1024px */
@media (max-width: 1024px) {
  .spec-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }

  .spec-card {
    padding: 14px 16px;
  }

  .spec-card-avatar {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .spec-card-name {
    font-size: 13px;
  }

  .spec-stat-value {
    font-size: 12px;
  }

  .spec-upcoming-item {
    font-size: 10px;
  }
}

/* 768px и меньше */
@media (max-width: 768px) {
  .spec-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
  }

  .spec-card {
    padding: 12px 14px;
    gap: 8px;
  }

  .spec-card-head {
    gap: 10px;
  }

  .spec-card-avatar {
    width: 36px;
    height: 36px;
    font-size: 12px;
  }

  .spec-card-name {
    font-size: 12px;
  }

  .spec-card-role {
    font-size: 10px;
  }

  .spec-card-stats-badge {
    padding: 1px 8px;
  }

  .spec-card-stats-count {
    font-size: 11px;
  }

  .spec-card-stats-label {
    font-size: 8px;
  }

  .spec-stats-grid {
    gap: 4px;
    padding: 2px 0;
  }

  .spec-stat-box {
    padding: 4px 2px;
  }

  .spec-stat-value {
    font-size: 11px;
  }

  .spec-stat-label {
    font-size: 8px;
  }

  .spec-upcoming-title {
    font-size: 9px;
  }

  .spec-upcoming-item {
    font-size: 10px;
    padding: 2px 0;
  }

  .spec-upcoming-service {
    font-size: 9px;
  }

  .spec-card .kebab {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }

  .spec-card .row-menu {
    min-width: 120px;
  }

  .spec-card .row-menu button {
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* 550px и меньше — одна колонка */
@media (max-width: 550px) {
  .spec-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .spec-card {
    padding: 14px 16px;
  }

  .spec-card-head {
    gap: 12px;
  }

  .spec-card-avatar {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }

  .spec-card-name {
    font-size: 14px;
  }

  .spec-card-role {
    font-size: 11px;
  }

  .spec-stat-value {
    font-size: 14px;
  }

  .spec-stats-grid {
    gap: 6px;
  }

  .spec-stat-box {
    padding: 6px 4px;
  }

  .spec-upcoming-item {
    font-size: 11px;
  }
}

/* 380px — очень маленькие */
@media (max-width: 380px) {
  .spec-card {
    padding: 10px 12px;
    gap: 6px;
  }

  .spec-card-avatar {
    width: 32px;
    height: 32px;
    font-size: 11px;
  }

  .spec-card-name {
    font-size: 12px;
  }

  .spec-card-role {
    font-size: 9px;
  }

  .spec-stat-value {
    font-size: 11px;
  }

  .spec-stat-label {
    font-size: 7px;
  }

  .spec-upcoming-item {
    font-size: 9px;
    padding: 2px 0;
  }

  .spec-upcoming-service {
    font-size: 8px;
  }

  .spec-page-header .card-title {
    font-size: 15px;
  }

  .spec-page-header .btn-primary {
    padding: 6px 12px;
    font-size: 11px;
  }
}

/* ============================================================
   SERVICES FILTERS
   ============================================================ */
.services-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.services-filters .sort-group {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
}
.services-filters .sort-label {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 600;
  margin-right: 4px;
  white-space: nowrap;
}

.services-filters .tab-pill {
  padding: 4px 12px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  transition: all 0.15s;
  white-space: nowrap;
}
.services-filters .tab-pill:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.services-filters .tab-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.services-filters .tab-pill .n {
  font-size: 10px;
  opacity: 0.7;
}

.services-filters select {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  max-width: 160px;
  text-overflow: ellipsis;
}
.services-filters select:focus {
  border-color: var(--accent);
}
.services-filters select option {
  font-size: 12px;
  padding: 4px 8px;
}

.services-filters .reset-btn {
  padding: 4px 14px;
  font-size: 11px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.services-filters .reset-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.services-filters .new-btn {
  padding: 6px 16px;
  font-size: 12px;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.services-filters .new-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.services-filters .mobile-sort-select {
  display: none;
  width: auto;
  min-width: 140px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236C6A80' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.services-filters .mobile-sort-select:focus {
  border-color: var(--accent);
}
.services-filters .mobile-sort-select option {
  font-size: 12px;
  padding: 4px 8px;
}

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  align-items: center;
  gap: 16px;
  max-width: 100%;
}

.settings-card {
  padding: 20px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
}

.settings-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.settings-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-card-icon.accent {
  background: var(--accent-soft);
  color: var(--accent);
}
.settings-card-icon.teal {
  background: var(--teal-soft);
  color: var(--teal);
}
.settings-card-icon.blue {
  background: var(--blue-soft);
  color: var(--blue);
}
.settings-card-icon.amber {
  background: var(--amber-soft);
  color: var(--amber);
}
.settings-card-icon.rose {
  background: var(--rose-soft);
  color: var(--rose);
}

.settings-card-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.settings-field {
  margin-bottom: 12px;
  flex: 1;
}
.settings-field:last-child {
  margin-bottom: 0;
}

.settings-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  display: block;
  margin-bottom: 4px;
}

.settings-field input,
.settings-field select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.settings-field input:focus,
.settings-field select:focus {
  border-color: var(--accent);
}
.settings-field input:disabled,
.settings-field select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.settings-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.settings-field input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

.settings-time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.settings-time-row .settings-field {
  margin-bottom: 0;
}

.settings-save-btn {
  padding: 6px 16px;
  font-size: 12px;
  border-radius: 8px;
  width: 100%;
  justify-content: center;
  margin-top: auto;
}

.settings-disabled-msg {
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
  padding: 8px 0;
  margin-top: auto;
}

.settings-hint {
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 12px;
  line-height: 1.4;
}

.settings-logo-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex: 1;
}

.settings-logo-preview {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  flex-shrink: 0;
}
.settings-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.settings-logo-preview span {
  font-size: 28px;
}

.settings-logo-actions {
  flex: 1;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-logo-btn {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
  width: 100%;
  justify-content: center;
}

.settings-owner-card {
  border: 1px solid var(--border);
}

/* ============================================================
   AUDIT
   ============================================================ */
.audit-card {
  padding: 24px;
}

.audit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.audit-title-block {
  display: flex;
  align-items: center;
  gap: 12px;
}
.audit-title-icon {
  font-size: 28px;
}
.audit-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.audit-subtitle {
  font-size: 13px;
  color: var(--text-faint);
}

.audit-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.audit-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
}

.audit-filter-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  align-items: flex-end;
}
.audit-filter-group .field {
  margin-bottom: 0;
  min-width: 120px;
  flex: 1;
}
.audit-filter-group .field label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
}
.audit-filter-group .field input,
.audit-filter-group .field select {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
}
.audit-filter-group .field input:focus,
.audit-filter-group .field select:focus {
  border-color: var(--accent);
}
.audit-filter-group .btn {
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 2px;
}

.audit-table-wrap {
  min-height: 200px;
}
.audit-table-scroll {
  overflow-x: auto;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.audit-table thead th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.audit-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.audit-table tbody tr:hover td {
  background: var(--surface-2);
}

.audit-cell-time {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.audit-cell-user .audit-user-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.audit-cell-user .audit-user-meta {
  font-size: 11px;
  color: var(--text-faint);
}

.audit-cell-changes {
  font-size: 12px;
  line-height: 1.6;
  max-width: 280px;
  word-break: break-word;
}

.audit-old {
  color: var(--rose);
  text-decoration: line-through;
  opacity: 0.7;
}
.audit-new {
  color: var(--teal);
  font-weight: 600;
}
.audit-more {
  color: var(--text-faint);
  font-size: 11px;
}

.audit-action-pill {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.audit-action-create {
  background: var(--teal-soft);
  color: var(--teal);
}
.audit-action-update {
  background: var(--amber-soft);
  color: var(--amber);
}
.audit-action-delete {
  background: var(--rose-soft);
  color: var(--rose);
}
.audit-action-default {
  background: var(--surface-2);
  color: var(--text-dim);
}

.audit-resource-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.audit-resource-meta {
  font-size: 11px;
  color: var(--text-faint);
}
.audit-resource-id {
  font-size: 10px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.audit-mobile-cards {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.audit-mobile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.audit-mobile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 6px;
}
.audit-mobile-time {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}

.audit-mobile-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.audit-mobile-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
}
.audit-mobile-label {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.audit-mobile-value {
  color: var(--text);
  text-align: right;
  word-break: break-word;
  max-width: 65%;
}
.audit-mobile-role {
  color: var(--text-faint);
  font-size: 11px;
}
.audit-mobile-resource {
  color: var(--text-dim);
  font-size: 12px;
}
.audit-mobile-id {
  color: var(--text-faint);
  font-size: 10px;
}
.audit-mobile-changes {
  font-size: 12px;
  line-height: 1.5;
}

.audit-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.audit-pagination-info {
  font-size: 13px;
  color: var(--text-dim);
}

.audit-pager {
  display: flex;
  gap: 4px;
  align-items: center;
}

.audit-pager-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.audit-pager-btn:hover:not(.disabled):not(.active) {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.audit-pager-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.audit-pager-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.audit-pager-dots {
  padding: 0 4px;
  color: var(--text-faint);
  font-size: 12px;
}

.audit-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-faint);
}
.audit-error {
  text-align: center;
  padding: 40px;
  color: var(--rose);
}
.audit-empty {
  text-align: center;
  padding: 40px;
}
.audit-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.audit-empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.audit-empty-sub {
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 4px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s var(--ease);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-content h2 {
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: var(--sp-4);
}

.field {
  margin-bottom: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.field input,
.field select,
.field textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--dur-1), background var(--dur-1);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  outline: none;
}
.field textarea {
  resize: vertical;
  min-height: 60px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

/* --- Модалка записи: расширенный, "живой" стиль в один экран --- */
.modal-content--wide {
  max-width: 700px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.ap-modal-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.ap-modal-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  background: var(--accent-soft);
}
.ap-modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
}
.ap-modal-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

.ap-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--sp-6);
}
@media (max-width: 640px) {
  .ap-grid { grid-template-columns: 1fr; }
}
.ap-col-side {
  border-left: 1px solid var(--border);
  padding-left: var(--sp-5);
}
@media (max-width: 640px) {
  .ap-col-side { border-left: none; padding-left: 0; padding-top: var(--sp-2); border-top: 1px solid var(--border); }
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ap-preview-card,
.ap-preview-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin: -6px 0 var(--sp-3);
}
.ap-preview-meta {
  overflow: hidden;
  flex: 1;
}
.ap-preview-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-preview-sub {
  font-size: 11.5px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-pill);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1), transform var(--dur-1);
}
.pill:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.char-count {
  text-align: right;
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

.btn-danger {
  background: var(--rose-soft);
  color: var(--rose);
  border: 1px solid var(--rose);
}

/* --- Бейдж на иконке колокольчика --- */
.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 50%;
  background: var(--rose);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--surface);
  box-shadow: 0 2px 8px rgba(255, 102, 147, 0.4);
  pointer-events: none;
  z-index: 5;
  font-family: var(--font-ui);
}

.notif-badge.show {
  display: inline-flex;
}

/* --- Дропдаун уведомлений --- */
.notif-dropdown {
  position: fixed;
  z-index: 200;
  width: 380px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  flex-direction: column;
  top: 66px;
  right: 20px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  visibility: hidden;
}

.notif-dropdown.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.notif-dropdown-arrow {
  position: absolute;
  top: -6px;
  right: 24px;
  width: 12px;
  height: 12px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}

.notif-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.notif-dropdown-head h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.notif-dropdown-actions {
  display: flex;
  gap: 4px;
}

.notif-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.notif-icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.notif-dropdown-list {
  max-height: 360px;
  overflow-y: auto;
  flex: 1;
}

.notif-dropdown-list::-webkit-scrollbar {
  width: 4px;
}

.notif-dropdown-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.notif-dropdown-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.notif-link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}

.notif-link-btn:hover {
  text-decoration: underline;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--dur-1);
}

.notification-item:hover {
  background: var(--surface-2);
}

.notification-item.unread {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
}

.notif-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: var(--surface-2);
  flex-shrink: 0;
  margin-top: 2px;
}

.notif-body {
  flex: 1;
  min-width: 0;
}

.notif-body .title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.notif-body .message {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.4;
  word-break: break-word;
}

.notif-body .time {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 4px;
}

.notif-delete {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 12px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
  margin-top: 2px;
}

.notif-delete:hover {
  background: var(--surface-3);
  color: var(--rose);
}

.notification-empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* ============================================================
   TOASTS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s var(--ease);
  max-width: 320px;
}
.toast-success {
  border-left: 4px solid var(--teal);
}
.toast-error {
  border-left: 4px solid var(--rose);
}
.toast-info {
  border-left: 4px solid var(--accent);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   SELECT В КАЛЕНДАРЕ
   ============================================================ */
.cal-toolbar .select-fake {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.cal-toolbar .select-fake:hover {
  border-color: var(--border-strong);
}
.cal-toolbar .select-fake:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.cal-toolbar .select-fake select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  padding: 8px 32px 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-ui);
  cursor: pointer;
  outline: none;
  width: 100%;
  min-width: 120px;
  border-radius: var(--radius-sm);
}
.cal-toolbar .select-fake select option {
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
}
.cal-toolbar .select-fake select option:hover {
  background: var(--accent-soft);
}
.cal-toolbar .select-fake select option:checked {
  background: var(--accent);
  color: #fff;
}

.cal-toolbar .select-fake::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-dim);
  pointer-events: none;
  transition: transform 0.2s ease;
}
.cal-toolbar .select-fake select:focus + .select-fake::after,
.cal-toolbar .select-fake:focus-within::after {
  transform: translateY(-50%) rotate(180deg);
}

/* ============================================================
   DRAWER SCRIM (mobile overlay)
   ============================================================ */
.drawer-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 39;
}
.drawer-scrim.show {
  display: block;
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */

/* --- 1280px --- */
@media (max-width: 1280px) {
  .dash-grid {
    grid-template-columns: 1fr 1fr;
  }
  .svc-grid,
  .spec-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cal-layout {
    grid-template-columns: 1fr 260px;
  }
}

/* --- 1080px: свёрнутый сайдбар --- */
@media (max-width: 1080px) {
  .sidebar {
    width: 76px;
    padding: var(--sp-5) var(--sp-3);
  }
  .brand-name,
  .nav-label,
  .nav-item span,
  .user-meta,
  .upsell {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 11px 0;
  }
  .user-row {
    justify-content: center;
  }
  .theme-toggle {
    margin: 0 auto;
  }
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .cal-layout {
    grid-template-columns: 1fr;
  }
}

/* --- 1024px: услуги/фильтры --- */
@media (max-width: 1024px) {
  .services-filters .sort-group .tab-pill {
    padding: 3px 10px;
    font-size: 10px;
  }
  .services-filters select {
    font-size: 10px;
    padding: 3px 10px;
    max-width: 130px;
  }
  .services-filters .reset-btn {
    padding: 3px 12px;
    font-size: 10px;
  }
  .services-filters .new-btn {
    padding: 4px 14px;
    font-size: 11px;
  }
  .audit-filters {
    flex-direction: column;
    align-items: stretch;
  }
}

/* --- 860px: мобильный сайдбар, скрытие таблиц --- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    max-width: 82vw;
    padding: var(--sp-5) var(--sp-4);
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    box-shadow: 12px 0 40px rgba(10, 12, 24, 0.25);
    z-index: 40;
    border-right: 1px solid var(--border);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open .brand-name,
  .sidebar.open .nav-label,
  .sidebar.open .nav-item span,
  .sidebar.open .user-meta,
  .sidebar.open .upsell {
    display: block;
  }
  .sidebar.open .nav-item {
    justify-content: flex-start;
  }
  .sidebar.open .user-row {
    justify-content: flex-start;
  }

  .hamburger {
    display: flex;
  }

  .page-title {
    font-size: 18px;
  }
  .searchbar {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3);
  }
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .profile-layout {
    grid-template-columns: 1fr;
  }
  .svc-grid,
  .spec-grid {
    grid-template-columns: 1fr 1fr;
  }
  .content {
    padding: var(--sp-4);
  }

  table {
    display: none;
  }
  .mobile-cards {
    display: flex;
    flex-direction: column;
  }

  /* Audit mobile cards */
  .audit-table-wrap {
    display: none;
  }
  .audit-mobile-cards {
    display: flex;
  }
  .audit-card {
    padding: 16px;
  }
  .audit-header {
    flex-direction: column;
    align-items: stretch;
  }
  .audit-actions {
    justify-content: flex-start;
  }
  .audit-filter-group {
    flex-direction: column;
    gap: 8px;
  }
  .audit-filter-group .field {
    min-width: unset;
    width: 100%;
  }
}

/* --- 768px: услуги и специалисты адаптив --- */
@media (max-width: 768px) {
  .svc-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .svc-card {
    min-height: 120px !important;
    padding: 16px !important;
  }
  .svc-card .svc-icon {
    width: 44px !important;
    height: 44px !important;
  }
  .svc-card .svc-icon svg {
    width: 20px !important;
    height: 20px !important;
  }
  .svc-card .svc-name {
    font-size: 15px !important;
  }
  .svc-card .svc-price {
    font-size: 16px !important;
  }
  .svc-card .svc-dur {
    font-size: 12px !important;
  }

  .spec-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .spec-card {
    padding: 16px !important;
  }
  .spec-card .spec-card-avatar {
    width: 44px !important;
    height: 44px !important;
    font-size: 15px !important;
  }

  .services-filters .sort-group .tab-pill {
    display: none;
  }
  .services-filters .sort-label {
    display: none;
  }
  .services-filters .mobile-sort-select {
    display: inline-block;
    width: auto;
    min-width: 140px;
    font-size: 11px;
    padding: 6px 14px;
  }
  .services-filters select:not(.mobile-sort-select) {
    width: auto;
    max-width: 160px;
    padding: 6px 14px;
    font-size: 11px;
    border-radius: 20px;
  }
  .services-filters .reset-btn {
    padding: 6px 14px;
    font-size: 11px;
    margin-left: auto;
  }
  .services-filters .new-btn {
    padding: 6px 16px;
    font-size: 11px;
  }

  .settings-grid {
    gap: 12px;
  }
  .settings-card {
    padding: 16px !important;
    min-height: 140px !important;
  }
}

/* --- 620px: мобильная агента, скрытие кнопок --- */
@media (max-width: 620px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .svc-grid,
  .spec-grid {
    grid-template-columns: 1fr;
  }

  .cal-grid-card {
    display: none;
  }
  .mobile-agenda {
    display: block;
  }
  .cal-layout {
    display: block;
  }
  .mini-cal {
    margin-bottom: var(--sp-4);
  }

  .btn-primary span.txt {
    display: none;
  }
  .topbar {
    padding: var(--sp-3) var(--sp-4);
  }
  .topbar-actions .icon-btn:nth-of-type(2) {
    display: none;
  }
}

/* --- 550px: телефоны --- */
@media (max-width: 550px) {
  .svc-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .svc-card {
    padding: 16px !important;
    min-height: 100px !important;
  }
  .svc-card .svc-icon {
    width: 40px !important;
    height: 40px !important;
  }
  .svc-card .svc-icon svg {
    width: 18px !important;
    height: 18px !important;
  }
  .svc-card .svc-name {
    font-size: 14px !important;
  }
  .svc-card .svc-price {
    font-size: 15px !important;
  }
  .svc-card .svc-dur {
    font-size: 12px !important;
  }
  .svc-card .bar-track {
    height: 4px !important;
  }

  .spec-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .spec-card {
    padding: 14px !important;
  }

  .services-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .services-filters .sort-group {
    flex-wrap: wrap;
    gap: 4px;
  }
  .services-filters .mobile-sort-select {
    width: 100%;
    min-width: unset;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 10px;
  }
  .services-filters select:not(.mobile-sort-select) {
    width: 100%;
    max-width: 100%;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 10px;
  }
  .services-filters .reset-btn {
    padding: 8px 14px;
    font-size: 12px;
    margin-left: 0;
    flex: 1;
    text-align: center;
  }
  .services-filters .new-btn {
    padding: 8px 14px;
    font-size: 12px;
    flex: 1;
    text-align: center;
  }
  .services-filters .mobile-actions {
    display: flex;
    gap: 6px;
    width: 100%;
  }

  .settings-grid {
    gap: 10px;
    grid-template-columns: 1fr;
  }
  .settings-card {
    padding: 14px !important;
    min-height: 120px !important;
  }
  .settings-time-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .audit-card {
    padding: 12px;
  }
  .audit-mobile-card {
    padding: 10px 12px;
  }
  .audit-mobile-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .audit-mobile-value {
    text-align: left;
    max-width: 100%;
    width: 100%;
  }
  .audit-pager-btn {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }
}

/* --- 400px: очень маленькие телефоны --- */
@media (max-width: 400px) {
  .audit-filter-group .field {
    min-width: unset;
  }
  .audit-filter-group .field input,
  .audit-filter-group .field select {
    font-size: 11px;
    padding: 6px 8px;
  }
}

/* --- 380px: экстремально маленькие --- */
@media (max-width: 380px) {
  .svc-grid {
    gap: 8px;
  }
  .svc-card {
    padding: 12px !important;
    min-height: 80px !important;
  }
  .svc-card .svc-icon {
    width: 34px !important;
    height: 34px !important;
  }
  .svc-card .svc-icon svg {
    width: 16px !important;
    height: 16px !important;
  }
  .svc-card .svc-name {
    font-size: 13px !important;
  }
  .svc-card .svc-price {
    font-size: 14px !important;
  }
  .svc-card .svc-dur {
    font-size: 11px !important;
  }
  .svc-card .bar-track {
    height: 3px !important;
  }

  .services-filters .mobile-sort-select {
    font-size: 12px;
    padding: 6px 12px;
  }
  .services-filters select:not(.mobile-sort-select) {
    font-size: 12px;
    padding: 6px 12px;
  }
  .services-filters .reset-btn,
  .services-filters .new-btn {
    font-size: 11px;
    padding: 6px 10px;
  }
}



/* ============================================================
   ГЛОБАЛЬНЫЙ ПОИСК
   ============================================================ */
.searchbar {
  position: relative;
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 9px var(--sp-3);
  color: var(--text-faint);
  transition: border-color var(--dur-1), background var(--dur-1);
}

.searchbar:focus-within {
  border-color: var(--accent);
  background: var(--surface);
}

.searchbar input {
  border: none;
  background: transparent;
  outline: none;
  color: var(--text);
  font-size: 13.5px;
  width: 100%;
  font-family: inherit;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 100;
  padding: 6px 0;
  min-width: 360px;
}

.search-results-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

.search-result-group {
  padding: 4px 0;
}

.search-result-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  padding: 6px 14px 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--dur-1);
  text-decoration: none;
  color: var(--text);
}

.search-result-item:hover {
  background: var(--surface-2);
}

.search-result-item .icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  background: var(--surface-2);
}

.search-result-item .icon.client {
  background: var(--accent-soft);
  color: var(--accent);
}

.search-result-item .icon.appointment {
  background: var(--amber-soft);
  color: var(--amber);
}

.search-result-item .icon.service {
  background: var(--teal-soft);
  color: var(--teal);
}

.search-result-item .info {
  flex: 1;
  min-width: 0;
}

.search-result-item .info .title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-item .info .sub {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-item .badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-dim);
  flex-shrink: 0;
}

.search-result-item .highlight {
  color: var(--accent);
  font-weight: 700;
}

/* --- Адаптив --- */
@media (max-width: 860px) {
  .searchbar {
    display: none;
  }

  .search-results {
    position: fixed;
    top: 70px;
    left: 10px;
    right: 10px;
    min-width: unset;
    max-height: 60vh;
  }
}
/* ============================================================
   ГЛОБАЛЬНЫЙ ПОИСК — ПОДСВЕТКА ЗАПИСИ
   ============================================================ */
.appt.highlighted,
.appt-block.highlighted {
  animation: searchPulse 0.6s ease 3;
}

@keyframes searchPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.04);
  }

  100% {
    transform: scale(1);
  }
}


.notif-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.notif-icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}


/* ============================================================
   УВЕДОМЛЕНИЯ — СТРАНИЦА
   ============================================================ */

.pager-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.pager-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.pager-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}



/* ============================================================
   АДАПТИВНЫЙ ДАШБОРД
   ============================================================ */

/* 1200px и меньше */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .dashboard-grid-2 {
    grid-template-columns: 1fr 1fr !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* 860px и меньше */
@media (max-width: 860px) {
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }

  .dashboard-grid-2 {
    grid-template-columns: 1fr !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* 550px и меньше */
@media (max-width: 550px) {
  .kpi-grid {
    grid-template-columns: 1fr !important;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .kpi-value {
    font-size: 22px !important;
  }

  .kpi {
    padding: 12px 16px !important;
  }

  .stats-grid>div {
    padding: 10px 8px !important;
  }

  .stats-grid>div>div:first-child {
    font-size: 20px !important;
  }
}

/* 400px и меньше */
@media (max-width: 400px) {
  .kpi-value {
    font-size: 18px !important;
  }

  .kpi-label {
    font-size: 11px !important;
  }

  .kpi-delta {
    font-size: 11px !important;
  }

  .kpi {
    padding: 10px 12px !important;
  }

  .stats-grid>div>div:first-child {
    font-size: 18px !important;
  }
}
/* ---- Баннер оплаты подписки (см. js/auth.js::showBillingBanner) ---- */
.billing-banner {
  display: none;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(90deg, #ff6363, #ff9f43);
  color: #fff;
  padding: 10px 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
}
.billing-banner a { color: #fff; }
