/* Основные переменные и глобальные стили */
:root {
  --bg-main: #f4f6fb;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-highlight: #edf1ff;
  --border-color: #e5e9f2;
  --text-primary: #1d2333;
  --text-secondary: #5c6378;
  --brand-primary: #37c074;
  --brand-secondary: #2f8fed;
  --accent-warning: #ffba5a;
  --badge-danger: #ff5d5d;
  --shadow-soft: 0 12px 32px rgba(24, 35, 82, 0.08);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --font-size-xs: 12px;
  --font-size-sm: 13px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 24px;
  
  /* Schedule scale variables */
  --schedule-row-height: 3.33px;
  --schedule-column-width: 220px;
  --schedule-font-scale: 1;
  --schedule-time-column-width: 80px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg-main);
  color: var(--text-primary);
}

/* ========== LOGIN PAGE ========== */
.login-page {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 40px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 8px 0;
}

.login-header p {
  font-size: 16px;
  color: #718096;
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: #2d3748;
}

.form-group input {
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  transition: all 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input:disabled {
  background-color: #f7fafc;
  cursor: not-allowed;
}

.login-error {
  padding: 12px;
  background-color: #fed7d7;
  border: 1px solid #fc8181;
  border-radius: 8px;
  color: #c53030;
  font-size: 14px;
  text-align: center;
}

.login-button {
  padding: 14px 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.login-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.login-button:active:not(:disabled) {
  transform: translateY(0);
}

.login-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ========== APP SHELL ========== */
.app-shell {
  min-height: 100vh;
  background-color: var(--bg-main);
}

/* ========== SIDEBAR ========== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 64px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 12px;
  background-color: var(--bg-sidebar);
  box-shadow: 1px 0 0 rgba(18, 27, 56, 0.06);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: width 0.25s ease, padding 0.25s ease, box-shadow 0.25s ease;
}

/* Sidebar expanded state */
.sidebar.expanded {
  width: 280px;
  padding: 16px 24px;
  z-index: 200;
  box-shadow: 4px 0 24px rgba(18, 27, 56, 0.15);
}

/* Sidebar overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* Sidebar toggle button */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background-color: rgba(47, 143, 237, 0.08);
  color: var(--brand-secondary);
}

.sidebar-toggle-icon {
  transition: transform 0.25s ease;
}

.sidebar.expanded .sidebar-toggle-icon {
  transform: rotate(90deg);
}

/* Sidebar navigation */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Sidebar icon */
.sidebar-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: currentColor;
}

/* Sidebar text */
.sidebar-text {
  opacity: 0;
  visibility: hidden;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  margin-left: 12px;
}

.sidebar.expanded .sidebar-text {
  opacity: 1;
  visibility: visible;
}

.sidebar-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.sidebar-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sidebar.expanded .sidebar-label {
  opacity: 1;
  visibility: visible;
}

.sidebar-entry {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--font-size-md);
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, padding 0.25s ease;
  cursor: pointer;
  gap: 0;
}

.sidebar.expanded .sidebar-entry {
  padding: 10px 14px;
}

.sidebar-entry:hover {
  background-color: rgba(47, 143, 237, 0.08);
}

.sidebar-entry.active {
  background-color: rgba(47, 143, 237, 0.12);
  color: var(--brand-secondary);
  font-weight: 600;
}

.sidebar-entry.secondary {
  color: var(--text-secondary);
}

.sidebar-entry.secondary:hover {
  color: var(--text-primary);
}

.sidebar-entry .badge {
  justify-content: flex-end;
  margin-left: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sidebar.expanded .sidebar-entry .badge {
  opacity: 1;
  visibility: visible;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  min-width: 20px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
}

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

/* ========== MAIN AREA ========== */
.main-area {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
  margin-left: 64px;
  height: 100vh;
  overflow-y: auto;
  transition: margin-left 0.25s ease;
}

/* ========== TOP BAR ========== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 32px;
  position: sticky;
  top: 0;
  background-color: var(--bg-main);
  z-index: 200;
  flex-shrink: 0;
}

.top-bar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(18, 27, 56, 0.06);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-menu-btn:hover {
  background-color: rgba(47, 143, 237, 0.08);
  color: var(--brand-secondary);
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 22px;
}

.brand-mark {
  color: var(--brand-secondary);
}

.brand-accent {
  color: var(--brand-primary);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  border: none;
  background-color: #ffffff;
  box-shadow: 0 4px 10px rgba(31, 46, 85, 0.08);
  cursor: pointer;
  color: var(--text-secondary);
  transition: transform 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(31, 46, 85, 0.12);
  color: var(--brand-secondary);
}

.user-card-wrapper {
  position: relative;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background-color: #ffffff;
  box-shadow: 0 6px 18px rgba(31, 46, 85, 0.08);
  cursor: pointer;
}

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

.user-name {
  font-weight: 600;
  font-size: var(--font-size-md);
}

.user-role {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  overflow: hidden;
  z-index: 1000;
  display: none;
}

.user-menu.show {
  display: block;
}

.user-menu-item {
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  font-size: var(--font-size-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.2s;
  display: block;
  text-decoration: none;
}

.user-menu-item:hover {
  background-color: rgba(47, 143, 237, 0.08);
}

.user-menu-item.logout {
  color: #e53e3e;
  border-top: 1px solid var(--border-color);
}

.user-menu-item.logout:hover {
  background-color: rgba(229, 62, 62, 0.08);
}

/* ========== GLOBAL PATIENT SEARCH ========== */
.global-search-wrapper {
  position: relative;
  flex: 1;
  max-width: 400px;
  margin: 0 24px;
}

.global-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.global-search-icon {
  position: absolute;
  left: 12px;
  color: #94a3b8;
  pointer-events: none;
  transition: color 0.2s;
}

.global-search-input {
  width: 100%;
  padding: 10px 120px 10px 40px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  background: #ffffff;
  transition: all 0.2s;
}

.global-search-input:focus {
  outline: none;
  border-color: var(--brand-secondary);
  box-shadow: 0 0 0 3px rgba(47, 143, 237, 0.12);
}

.global-search-input:focus + .global-search-icon,
.global-search-box:focus-within .global-search-icon {
  color: var(--brand-secondary);
}

.global-search-clear {
  position: absolute;
  right: 80px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.global-search-clear:hover {
  color: #64748b;
  background: #f1f5f9;
}

.global-search-shortcut {
  position: absolute;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}

.global-search-shortcut kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
}

.global-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  max-height: 420px;
  overflow: hidden;
  z-index: 1000;
}

.global-search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: #64748b;
  font-size: 14px;
}

.spinner-small {
  width: 20px;
  height: 20px;
  border: 2px solid #e2e8f0;
  border-top-color: var(--brand-secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.global-search-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}

.global-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s;
}

.global-search-item:hover,
.global-search-item.focused {
  background: #f1f5f9;
}

.global-search-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

.global-search-item-info {
  flex: 1;
  min-width: 0;
}

.global-search-item-name {
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-item-details {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
}

.global-search-item-phone {
  display: flex;
  align-items: center;
  gap: 4px;
}

.global-search-item-id {
  color: #94a3b8;
  font-size: 12px;
}

.global-search-item-birth {
  color: #64748b;
  font-size: 12px;
}

.global-search-item-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.global-search-item-badge.vip {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
}

.global-search-item-arrow {
  color: #cbd5e1;
  transition: transform 0.2s, color 0.2s;
}

.global-search-item:hover .global-search-item-arrow {
  color: var(--brand-secondary);
  transform: translateX(4px);
}

.global-search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}

.global-search-empty-text {
  font-size: 15px;
  font-weight: 500;
  color: #64748b;
}

.global-search-empty-hint {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 4px;
}

/* Responsive global search */
@media (max-width: 992px) {
  .global-search-wrapper {
    max-width: 280px;
    margin: 0 16px;
  }
  
  .global-search-shortcut {
    display: none;
  }
  
  .global-search-input {
    padding-right: 40px;
  }
  
  .global-search-clear {
    right: 12px;
  }
}

@media (max-width: 768px) {
  .global-search-wrapper {
    display: none;
  }
}

.icon {
  display: block;
}

/* ========== MAIN CONTENT ========== */
.main-content {
  flex: 1;
  padding: 0 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-x: auto;
  overflow-y: auto;
  min-height: 0;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-shrink: 0;
}

.content-header h1 {
  margin: 0;
  font-size: var(--font-size-xl);
}

.content-tools {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Scale control for schedule grid */
.scale-control {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-highlight);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.scale-control button {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scale-control button:hover {
  background: white;
  color: var(--brand-secondary);
}

.scale-control button.active {
  background: white;
  color: var(--brand-secondary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-sidebar-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  background: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.header-sidebar-toggle:hover {
  background: var(--bg-highlight);
  color: var(--brand-secondary);
  border-color: var(--brand-secondary);
}

.header-sidebar-toggle.active {
  background: var(--brand-secondary);
  color: white;
  border-color: var(--brand-secondary);
}

.search-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background-color: #ffffff;
  box-shadow: 0 6px 16px rgba(31, 46, 85, 0.08);
  color: var(--text-secondary);
}

.search-field input {
  border: none;
  outline: none;
  font-size: var(--font-size-md);
  width: 180px;
  color: var(--text-primary);
  background: transparent;
}

.search-field input::placeholder {
  color: var(--text-secondary);
}

.primary-button {
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  border: none;
  background: linear-gradient(135deg, #2f8fed, #5ea8ff);
  color: #ffffff;
  font-weight: 600;
  font-size: var(--font-size-md);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(47, 143, 237, 0.2);
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(47, 143, 237, 0.3);
}

.secondary-button {
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-weight: 600;
  font-size: var(--font-size-md);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.secondary-button:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* ========== TASKS PAGE COMPACT LAYOUT ========== */
.main-content:has(.tasks-header) {
  gap: 0;
  padding-top: 16px;
}

.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.tasks-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.tasks-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tasks-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tasks-header-actions .ghost-button {
  padding: 7px 12px;
  font-size: 13px;
  gap: 6px;
}

.tasks-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tasks-header-right .primary-button {
  padding: 8px 16px;
  font-size: 13px;
}

.tasks-header-right .view-buttons {
  padding: 3px;
}

.tasks-header-right .view-toggle-button {
  padding: 5px 12px;
  font-size: 13px;
}

.search-field-compact {
  padding: 6px 12px;
  min-width: 160px;
  max-width: 200px;
  gap: 6px;
}

.search-field-compact .icon {
  flex-shrink: 0;
  color: #9ca3af;
}

.search-field-compact input {
  width: 120px;
  font-size: 13px;
}

/* ========== TASKS TOOLBAR (LEGACY) ========== */
.tasks-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 12px;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(29, 35, 51, 0.08);
  background-color: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.ghost-button:hover {
  background-color: rgba(47, 143, 237, 0.05);
}

.view-buttons {
  display: flex;
  gap: 4px;
  background: #f3f4f6;
  padding: 4px;
  border-radius: 8px;
}

.view-toggle-button {
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: #6b7280;
  font-weight: 500;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-toggle-button:hover {
  background: #e5e7eb;
  color: #374151;
}

.view-toggle-button.active {
  background: white;
  color: #1f2937;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Filters Panel */
.filters-panel {
  margin-top: 12px;
  padding: 16px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  z-index: 100;
}

.filters-panel.hidden {
  display: none;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filters-panel .filter-group {
  overflow: visible;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding-bottom: 1px;
}

.custom-multiselect {
  position: relative;
  width: 100%;
}

/* ========== LOADING & ERROR STATES ========== */
.loading-state,
.error-state,
.info-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 20px;
}

.loading-state p,
.error-state p,
.info-state p {
  font-size: 16px;
  color: #64748b;
  margin: 0;
}

.error-state {
  color: #d32f2f;
}

.info-state {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 40px;
  margin: 40px 0;
}

.info-state p {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.6;
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-more-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 12px;
}

.loading-more-indicator .spinner {
  width: 30px;
  height: 30px;
  border-width: 3px;
}

.loading-more-indicator p {
  font-size: 14px;
  color: #64748b;
  margin: 0;
}

.retry-button {
  padding: 10px 20px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.retry-button:hover {
  background: #2563eb;
}

/* ========== KANBAN BOARD ========== */
.patients-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
}

/* Patients Page Header */
.patients-page .page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.patients-page .page-header-left h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.patients-page .page-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Search Box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 320px;
  padding: 10px 40px 10px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--brand-secondary);
  box-shadow: 0 0 0 3px rgba(47, 143, 237, 0.1);
}

.clear-search-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.clear-search-btn:hover {
  color: #4b5563;
}

/* Filter Group */
.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-select {
  padding: 10px 36px 10px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.filter-select:focus {
  outline: none;
  border-color: var(--brand-secondary);
  box-shadow: 0 0 0 3px rgba(47, 143, 237, 0.1);
}

/* Button Styles */
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.button-primary {
  background: var(--brand-secondary);
  color: white;
}

.button-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(47, 143, 237, 0.3);
}

.button-secondary {
  background: #f3f4f6;
  color: var(--text-primary);
}

.button-secondary:hover {
  background: #e5e7eb;
}

.button-info {
  background: #dbeafe;
  color: #1e40af;
}

.button-info:hover {
  background: #bfdbfe;
}

.button-icon {
  font-size: 18px;
  font-weight: 700;
}

.button-icon-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 4px 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #475569;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}

.button-icon-sm:hover {
  background: #e0f2fe;
  border-color: #0ea5e9;
  color: #0369a1;
}

.kanban-board {
  display: flex;
  gap: 16px;
  flex: 1;
  padding: 20px;
  background: #f8fafc;
  min-width: min-content;
  overflow-x: auto;
}

.kanban-column {
  display: flex;
  flex-direction: column;
  min-width: 300px;
  max-width: 350px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.kanban-column-header {
  padding: 16px 20px;
  background: #fff;
  border-top: 4px solid #3b82f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
  overflow: visible;
  z-index: 10;
}

.kanban-column-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.column-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.column-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #e2e8f0;
  color: #64748b;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  cursor: help;
  transition: all 0.2s;
  position: relative;
}

.column-help-icon:hover {
  background: #3b82f6;
  color: #fff;
  transform: scale(1.1);
}

.column-help-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  white-space: normal;
  max-width: 240px;
  text-align: left;
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  pointer-events: none;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.column-help-icon::before {
  content: '';
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: #1e293b;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  pointer-events: none;
  z-index: 10001;
}

.column-help-icon:hover::after,
.column-help-icon:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Payment status tooltip - uses JS for positioning to avoid overflow clipping */
.payment-tooltip {
  position: relative;
  cursor: help;
}

/* Tooltip container created by JS */
.payment-tooltip-popup {
  position: fixed;
  background: #1e293b;
  color: #fff;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  white-space: pre-line;
  min-width: 180px;
  max-width: 280px;
  text-align: left;
  line-height: 1.5;
  pointer-events: none;
  z-index: 100000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: tooltipFadeIn 0.15s ease-out;
}

.payment-tooltip-popup::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
}

/* Tooltip показывается снизу когда не помещается сверху */
.payment-tooltip-popup.tooltip-bottom::before {
  bottom: auto;
  top: -6px;
  border-top-color: transparent;
  border-bottom-color: #1e293b;
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.patient-count {
  background: #e2e8f0;
  color: #64748b;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
}

.kanban-column-content {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  background-color: #f8fafc;
  transition: background-color 0.2s;
}

.kanban-column-content.drag-over {
  background-color: #f1f5f9;
}

.empty-column {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #94a3b8;
  font-size: 14px;
  text-align: center;
  padding: 20px;
}

.kanban-column-content::-webkit-scrollbar {
  width: 6px;
}

.kanban-column-content::-webkit-scrollbar-track {
  background: transparent;
}

.kanban-column-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.kanban-column-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ========== PATIENT CARD ========== */
.patient-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  cursor: grab;
  transition: all 0.2s ease;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.patient-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.15);
  transform: translateY(-3px);
}

.patient-card:active {
  cursor: grabbing;
}

.patient-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.patient-card-header {
  margin-bottom: 8px;
}

.patient-name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.4;
}

.patient-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.patient-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
}

.info-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.info-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-notes {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #854d0e;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(251, 191, 36, 0.2);
  border-left: 3px solid #f59e0b;
  position: relative;
}

.patient-notes::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 20px;
  width: 40px;
  height: 4px;
  background: rgba(251, 191, 36, 0.3);
  border-radius: 2px;
}

.notes-icon {
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1.4;
}

.notes-text {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.5;
  word-break: break-word;
  font-weight: 500;
}

/* Sticky Note стиль для textarea в модальном окне */
.sticky-note-textarea {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #fbbf24;
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  padding: 12px;
  font-size: 14px;
  color: #854d0e;
  min-height: 100px;
  resize: vertical;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 1px 2px rgba(251, 191, 36, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  transition: all 0.2s ease;
  position: relative;
}

.sticky-note-textarea::placeholder {
  color: #b45309;
  opacity: 0.6;
}

.sticky-note-textarea:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), 0 0 0 3px rgba(251, 191, 36, 0.2);
  background: linear-gradient(135deg, #fef9e7 0%, #fef3c7 100%);
}

/* ========== TASK CARD ========== */
.task-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  cursor: grab;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.task-card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.task-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.task-card.urgent {
  border-left: 3px solid #ef4444;
}

.task-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 8px;
}

.task-title {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
  line-height: 1.4;
  flex: 1;
}

.priority-badge {
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.priority-badge.urgent {
  background: #ef4444;
}

.priority-badge.high {
  background: #f97316;
}

.priority-badge.medium {
  background: #eab308;
}

.priority-badge.low {
  background: #6b7280;
}

.task-type,
.task-dates,
.task-files,
.task-patients,
.task-assigned,
.task-doctor,
.task-date {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  font-size: 12px;
  color: #6b7280;
}

.task-label {
  color: #6b7280;
  font-weight: 500;
}

.task-value {
  color: #1f2937;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-description {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f3f4f6;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

/* ========== MODAL ========== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

.task-modal {
  max-width: 800px;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
}

.modal-close {
  background: none;
  border: none;
  font-size: 32px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Компактная таблица этапов */
#stagesListContent table {
  table-layout: auto;
}

#stagesListContent table tbody tr {
  transition: background-color 0.15s ease;
}

#stagesListContent table tbody tr:hover {
  background-color: #f8fafc;
}

#stagesListContent table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
}

/* Ограничение высоты модалки для компактного отображения */
#stagesModal .modal-body {
  max-height: calc(100vh - 200px);
  padding: 16px;
}

/* Стили для переключателя режима просмотра этапов */
.view-mode-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.view-mode-btn:hover {
  background: #e2e8f0;
  color: #334155;
}

.view-mode-btn.active {
  background: white;
  color: #0369a1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field.full-width {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 14px;
  font-weight: 500;
  color: #475569;
}

.form-field input,
.form-field textarea,
.form-field select {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.form-field select {
  background: white;
  cursor: pointer;
}

/* ========== FORM SECTIONS (Секции формы пациента) ========== */
.form-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e2e8f0;
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.form-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.form-section-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title .section-icon {
  font-size: 16px;
  opacity: 0.8;
}

/* Вертикальный layout формы с фиксированной шириной инпутов */
.form-grid-narrow {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 450px;
  margin-left: auto;
}

.form-grid-narrow .form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-grid-narrow .form-field input,
.form-grid-narrow .form-field select,
.form-grid-narrow .form-field textarea,
.form-grid-narrow .form-field .custom-select {
  width: 100%;
}

/* Строка из двух полей (напр. Дата рождения + Пол, Место работы + Должность) */
.form-row-inline {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  width: 100%;
}

.form-row-inline .form-field {
  flex: 1 1 auto;
}

.form-row-inline .form-field input,
.form-row-inline .form-field select {
  width: 100%;
}

.form-row-inline .form-field.flex-grow {
  flex: 1 1 140px;
}

.form-row-inline .form-field.compact {
  flex: 0 0 80px;
}

/* Секция представителя пациента */
.representative-section {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 20px;
  margin-top: 8px;
}

.representative-section .form-section-title {
  color: #0369a1;
}

.representative-section.auto-expanded {
  animation: highlightSection 2s ease-out;
}

@keyframes highlightSection {
  0% { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border-color: #fbbf24; }
  100% { background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); border-color: #bae6fd; }
}

.child-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #fef3c7;
  color: #a16207;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  margin-left: 8px;
}

/* Кнопки переключения типа приёма */
.appointment-type-btn {
  padding: 10px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.appointment-type-btn:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.appointment-type-btn.active {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1d4ed8;
}

.appointment-type-btn.active.technical {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #b45309;
}

/* Стили для ошибок валидации */
.form-field.error label {
  color: #dc2626;
}

.form-field.error input,
.form-field.error textarea,
.form-field.error select {
  border-color: #dc2626;
  background-color: #fef2f2;
}

.form-field.error .month-btn {
  border-color: #fecaca;
}

.form-field.error::after {
  content: 'Это поле обязательно для заполнения';
  color: #dc2626;
  font-size: 12px;
  margin-top: 4px;
}

.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
}

/* Time Picker Dropdown Styles */
.time-picker-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.time-dropdown-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.time-input {
  width: 44px;
  padding: 8px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 6px 0 0 6px;
  font-size: 14px;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  text-align: center;
  cursor: text;
  transition: all 0.2s;
  background: white;
  caret-color: #3b82f6;
}

.time-dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-left: none;
  border-radius: 0 6px 6px 0;
  background: #f8fafc;
  color: #64748b;
  font-size: 8px;
  cursor: pointer;
  transition: all 0.2s;
  height: 34px;
}

.time-dropdown-toggle:hover {
  background: #e2e8f0;
  color: #475569;
}

.time-dropdown-wrapper.open .time-dropdown-toggle {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.time-input:hover,
.time-input:hover + .time-dropdown-toggle {
  border-color: #94a3b8;
}

.time-input:focus,
.time-dropdown-wrapper.open .time-input {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.time-input:focus + .time-dropdown-toggle,
.time-dropdown-wrapper.open .time-input + .time-dropdown-toggle {
  border-color: #3b82f6;
}

.time-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 100%;
  max-height: 200px;
  overflow-y: auto;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 1000;
}

.time-dropdown-wrapper.open .time-dropdown {
  display: block;
}

.time-dropdown-option {
  padding: 8px 12px;
  font-size: 14px;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s;
}

.time-dropdown-option:hover {
  background: #f1f5f9;
}

.time-dropdown-option.selected {
  background: #3b82f6;
  color: white;
}

.time-dropdown-option.selected:hover {
  background: #2563eb;
}

.time-separator {
  font-size: 16px;
  font-weight: 600;
  color: #64748b;
  padding: 0 2px;
}

/* Duration Buttons */
.duration-buttons {
  display: flex;
  gap: 4px;
}

.duration-btn {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.duration-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.duration-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.duration-btn.active:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #e2e8f0;
}

.footer-left,
.footer-right {
  display: flex;
  gap: 12px;
}

/* Follow-up menu styles */
.follow-up-option {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  font-size: 14px;
  color: #3b82f6;
  cursor: pointer;
  transition: background 0.15s;
}

.follow-up-option:hover {
  background: #f1f5f9;
}

.follow-up-option:not(:last-child) {
  border-bottom: 1px solid #f1f5f9;
}

.button {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
}

.button-secondary {
  background: #f1f5f9;
  color: #475569;
}

.button-secondary:hover {
  background: #e2e8f0;
}

.button-info {
  background: #dbeafe;
  color: #1e40af;
}

.button-info:hover {
  background: #bfdbfe;
}

.button-primary {
  background: #3b82f6;
  color: white;
}

.button-primary:hover {
  background: #2563eb;
}

.button-primary.disabled,
.button-primary:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
}

.button-danger {
  background: #ef4444;
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
}

.button-danger:hover:not(:disabled) {
  background: #dc2626;
}

.button-danger:disabled {
  background: #fca5a5;
  cursor: not-allowed;
}

/* Комментарии */
.comments-section {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid #e2e8f0;
}

.comments-section h3 {
  margin: 0 0 20px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.comment-form textarea {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  transition: all 0.2s;
}

.comment-form textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.comment-form button {
  align-self: flex-end;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 8px;
}

.comments-list::-webkit-scrollbar {
  width: 6px;
}

.comments-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.no-comments {
  color: #94a3b8;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.comment-item {
  padding: 12px 12px 12px 16px;
  background: linear-gradient(to right, rgba(16, 185, 129, 0.08) 0%, transparent 100%);
  border-radius: 8px;
  border: 1px solid #d1fae5;
  border-left: 3px solid #10b981;
  position: relative;
}

.comment-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.comment-icon {
  font-size: 16px;
  line-height: 1;
  color: #10b981;
}

.comment-author {
  font-weight: 600;
  color: #047857;
  font-size: 13px;
}

.comment-date {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  margin-left: auto;
}

.comment-text {
  color: #475569;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

/* Системные комментарии */
.comment-item.system-comment {
  background: linear-gradient(to right, rgba(245, 158, 11, 0.08) 0%, transparent 100%);
  border: 1px solid #fef3c7;
  border-left: 3px solid #f59e0b;
}

.comment-item.system-comment .comment-icon {
  color: #d97706;
}

.comment-item.system-comment .comment-author {
  color: #b45309;
}

/* События */
.event-item {
  padding: 12px 12px 12px 16px;
  background: linear-gradient(to right, rgba(59, 130, 246, 0.03) 0%, transparent 100%);
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #3b82f6;
  position: relative;
}

.event-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.event-icon {
  font-size: 16px;
  line-height: 1;
}

.event-type {
  font-weight: 600;
  color: #1e293b;
  font-size: 13px;
}

.event-date {
  font-size: 12px;
  color: #64748b;
  margin-left: auto;
  white-space: nowrap;
}

.event-description {
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 4px;
}

.event-changes {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  font-size: 12px;
}

.event-old-value {
  color: #ef4444;
  text-decoration: line-through;
  opacity: 0.7;
}

.event-arrow {
  color: #94a3b8;
}

.event-new-value {
  color: #10b981;
  font-weight: 500;
}

.event-user {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 6px;
  font-style: italic;
}

/* Кастомный мультиселект с чекбоксами */
.custom-multiselect {
  position: relative;
  width: 100%;
  z-index: 1;
}

/* Увеличиваем z-index когда мультиселект активен */
.custom-multiselect.is-open {
  z-index: 1050;
}

.multiselect-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 42px;
}

.multiselect-trigger:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.multiselect-trigger.active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.multiselect-placeholder {
  color: #64748b;
  font-size: 14px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.multiselect-placeholder.has-selections {
  color: #1e293b;
}

.multiselect-arrow {
  color: #94a3b8;
  font-size: 12px;
  transition: transform 0.2s;
  margin-left: 8px;
}

.multiselect-trigger.active .multiselect-arrow {
  transform: rotate(180deg);
}

.selected-patients-display {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selected-patient-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  transition: all 0.2s;
}

.selected-patient-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.selected-patient-item svg {
  color: #64748b;
  flex-shrink: 0;
}

.selected-patient-link {
  color: #0284c7;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.selected-patient-link:hover {
  color: #0369a1;
  text-decoration: underline;
}

.multiselect-dropdown {
  position: fixed;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 1100;
  max-height: 400px;
  display: flex;
  flex-direction: column;
}

.multiselect-search {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.multiselect-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.multiselect-search input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.multiselect-stages {
  padding: 8px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stage-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.stage-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.stage-btn:active {
  transform: scale(0.98);
}

.stage-btn.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e40af;
  font-weight: 500;
}

.stage-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.multiselect-options {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: 250px;
  padding: 4px;
}

.multiselect-option {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
  user-select: none;
}

.multiselect-option:hover {
  background: #f8fafc;
}

.multiselect-option.hidden {
  display: none;
}

.multiselect-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  margin-right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.multiselect-option.selected .multiselect-checkbox {
  background: #3b82f6;
  border-color: #3b82f6;
}

.multiselect-checkbox::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: bold;
  display: none;
}

.multiselect-option.selected .multiselect-checkbox::after {
  display: block;
}

.multiselect-option-content {
  flex: 1;
  min-width: 0;
}

.multiselect-option-name {
  font-size: 14px;
  color: #1e293b;
  font-weight: 500;
  margin-bottom: 2px;
}

.multiselect-option-meta {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Стили для иерархической структуры категорий */
.category-item {
  margin-bottom: 4px;
}

.category-header {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
  user-select: none;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.category-header:hover {
  background: #f1f5f9;
}

.category-arrow {
  width: 16px;
  font-size: 10px;
  color: #64748b;
  margin-right: 8px;
  transition: transform 0.2s;
}

.category-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.category-count {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  margin-left: 8px;
}

.category-content {
  margin-left: 20px;
  margin-top: 4px;
  padding-left: 4px;
  border-left: 2px solid #e2e8f0;
}

.subcategory-wrapper {
  margin-bottom: 4px;
}

.subcategory-item {
  padding: 8px 12px;
  margin-bottom: 2px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid #e2e8f0;
}

.subcategory-item:hover {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.subcategory-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
}

.subcategory-count {
  font-size: 11px;
  color: #64748b;
  margin-left: 8px;
}

.subcategory-content {
  margin-left: 20px;
  margin-top: 4px;
  padding-left: 4px;
  border-left: 2px solid #e2e8f0;
}

.service-item {
  padding: 8px 12px;
  margin-bottom: 2px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
  background: white;
  border: 1px solid #e2e8f0;
}

.service-item:hover {
  background: #f0fdf4;
  border-color: #86efac;
  transform: translateX(2px);
}

.service-name {
  font-size: 13px;
  color: #0f172a;
  margin-bottom: 4px;
  font-weight: 500;
}

.service-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
}

.service-price {
  color: #0369a1;
  font-weight: 600;
}

.service-code {
  color: #64748b;
  font-size: 10px;
  padding: 2px 6px;
  background: #f1f5f9;
  border-radius: 3px;
}

.multiselect-option-stage {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #f1f5f9;
  border-radius: 4px;
  font-size: 11px;
  color: #475569;
}

.multiselect-empty {
  padding: 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

/* ========== APPOINTMENTS PAGE ========== */
.appointments-layout {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 400px;
  overflow: visible;
  transition: gap 0.3s ease;
}

.appointments-layout .schedule-container {
  flex: 1 !important;
  min-width: 400px;
  overflow-x: auto;
  overflow-y: auto;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.3s ease;
}

.appointments-sidebar {
  width: 360px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: width 0.3s ease, padding 0.3s ease;
  position: relative;
}

.appointments-sidebar.collapsed {
  width: 48px;
  padding: 12px 8px;
  overflow: visible;
}

.appointments-sidebar.collapsed .sidebar-content {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.appointments-sidebar.collapsed .sidebar-collapsed-icons {
  display: flex;
}

.sidebar-collapsed-icons {
  display: none;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  padding-top: 8px;
}

.sidebar-collapsed-icons button {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-highlight);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.sidebar-collapsed-icons button:hover {
  background: var(--brand-secondary);
  color: white;
}

.sidebar-toggle-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg-highlight);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
  z-index: 10;
}

.sidebar-toggle-btn:hover {
  background: var(--brand-secondary);
  color: white;
}

.appointments-sidebar.collapsed .sidebar-toggle-btn {
  position: static;
  margin: 0 auto 8px;
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.schedule-toolbar-compact {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}

.schedule-toolbar-compact .toolbar-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule-toolbar-compact .select-field {
  width: 100%;
}

.schedule-toolbar-compact .select-field select {
  width: 100%;
}

.date-navigation {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.ghost-button-sm {
  padding: 8px 10px;
  min-width: 36px;
}

/* Doctor Calendar Styles */
.doctor-calendar-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 8px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.calendar-header span {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--text-primary);
}

.calendar-nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
}

.calendar-nav-btn:hover {
  background: var(--bg-highlight);
  color: var(--brand-secondary);
}

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

.calendar-day-header {
  text-align: center;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 0;
}

.calendar-day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-size-sm);
  transition: background 0.2s;
}

.calendar-day:not(.empty):hover {
  background: var(--bg-highlight);
}

.calendar-day.empty {
  cursor: default;
}

.calendar-day.today {
  background: var(--brand-secondary);
  color: white;
  font-weight: 600;
}

.calendar-day.selected {
  background: var(--brand-primary);
  color: white;
  font-weight: 600;
}

.calendar-day.today.selected {
  background: var(--brand-primary);
  color: white;
  font-weight: 600;
  box-shadow: 0 0 0 2px var(--brand-secondary);
}

.calendar-day.has-appointment::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-primary);
}

.calendar-day.fully-booked::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
}

.calendar-day.today.has-appointment::after,
.calendar-day.selected.has-appointment::after,
.calendar-day.today.fully-booked::after,
.calendar-day.selected.fully-booked::after {
  background: white;
}

.calendar-day-number {
  position: relative;
  z-index: 1;
}

.calendar-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.calendar-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.calendar-legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.calendar-legend-dot.has-appointment {
  background: var(--brand-primary);
}

.calendar-legend-dot.fully-booked {
  background: #ef4444;
}

/* Past day styling for calendar */
.calendar-day.past-day {
  color: var(--text-tertiary);
  opacity: 0.5;
  cursor: not-allowed !important;
}

.calendar-day.past-day:hover {
  background: transparent;
}

/* Reschedule modal calendar */
.reschedule-calendar {
  background: #f8fafc;
  padding: 16px;
  border-radius: 8px;
}

.appointments-sidebar .sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}

.appointments-sidebar .sidebar-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.appointments-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 12px;
  background: var(--brand-secondary);
  color: white;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-pill);
}

.appointments-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.appointments-list::-webkit-scrollbar {
  width: 6px;
}

.appointments-list::-webkit-scrollbar-track {
  background: transparent;
}

.appointments-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.appointments-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.appointment-list-item {
  padding: 14px;
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.appointment-list-item:hover {
  transform: translateX(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--brand-secondary);
}

.appointment-list-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-secondary);
  letter-spacing: 0.3px;
}

.appointment-list-patient {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.appointment-list-details {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.appointment-list-doctor {
  font-weight: 500;
}

.appointment-list-divider {
  color: var(--border-color);
}

.appointment-list-room {
  font-weight: 400;
}

.appointment-list-status {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.no-appointments {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-secondary);
  font-size: 14px;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.loading-appointments {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 20px;
}

/* Patient Modal Layout */
.patient-modal-layout {
  display: flex;
  gap: 24px;
  width: 100%;
  /* flex-direction: column; Убрано, так как теперь по умолчанию column */
  /* align-items: flex-start; Добавлено для выравнивания вкладок */
}

.patient-form-section {
  flex: 1;
  min-width: 0;
  position: relative;
  /* width: 100%; Занимаем всю доступную ширину */
}

.patient-appointments-section {
  width: 380px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-color);
  padding-left: 24px;
}

.appointments-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.appointments-sidebar-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.appointments-sidebar-header .appointments-count {
  background: var(--brand-secondary);
  color: white;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  min-width: 24px;
  text-align: center;
}

/* Sidebar Tabs: Приемы / Дневники */
.sidebar-tabs {
  display: flex;
  gap: 4px;
  width: 100%;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 4px;
}

.sidebar-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-tab:hover {
  color: #334155;
  background: rgba(255, 255, 255, 0.5);
}

.sidebar-tab.active {
  color: #0f172a;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sidebar-tab-count {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  background: #e2e8f0;
  color: #64748b;
}

.sidebar-tab.active .sidebar-tab-count {
  background: var(--brand-secondary);
  color: white;
}

/* Patient Diaries List */
.patient-diaries-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.patient-diaries-list::-webkit-scrollbar {
  width: 6px;
}

.patient-diaries-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.patient-diaries-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.patient-diaries-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Diary Detail Section */
.diary-detail-section {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
  z-index: 1100;  /* Must be higher than .custom-select (100) and .select-dropdown (1003) */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.diary-detail-section.visible {
  opacity: 1;
  visibility: visible;
}

.diary-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.diary-detail-header h3 {
  flex: 1;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.diary-detail-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
}

.diary-detail-info {
  background: #f8fafc;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.diary-info-row {
  display: flex;
  align-items: baseline;
  margin-bottom: 8px;
}

.diary-info-row:last-child {
  margin-bottom: 0;
}

.diary-info-label {
  font-weight: 500;
  color: #64748b;
  min-width: 120px;
  font-size: 13px;
}

.diary-info-value {
  color: #1e293b;
  font-size: 14px;
}

.diary-detail-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.diary-detail-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
  font-size: 14px;
}

.diary-detail-table tr:last-child td {
  border-bottom: none;
}

.diary-field-label {
  font-weight: 500;
  color: #475569;
  background: #f8fafc;
  width: 220px;
  min-width: 220px;
}

.diary-field-value {
  color: #1e293b;
  white-space: pre-wrap;
  line-height: 1.5;
}

.diary-empty-message {
  text-align: center;
  padding: 40px;
  color: #94a3b8;
  font-size: 14px;
}

.diary-section {
  margin-bottom: 24px;
}

.diary-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

/* Dental Formula Styles */
.dental-formula-grid {
  background: #f8fafc;
  border-radius: 8px;
  padding: 16px;
  font-family: monospace;
  font-size: 13px;
}

.dental-jaw {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.dental-jaw-line {
  height: 2px;
  background: #cbd5e1;
  margin: 4px 0;
}

.dental-side {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 200px;
}

.dental-side.right {
  justify-content: flex-end;
}

.dental-side.left {
  justify-content: flex-start;
}

.dental-divider {
  color: #94a3b8;
  font-weight: bold;
  padding: 0 8px;
}

.dental-tooth {
  display: inline-block;
  padding: 4px 8px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.patient-appointments-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.patient-appointments-list::-webkit-scrollbar {
  width: 6px;
}

.patient-appointments-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.patient-appointments-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.patient-appointments-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Разделители групп приёмов */
.appointments-group-divider {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.appointments-group-divider:first-child {
  margin-top: 0;
}

.group-divider-icon {
  font-size: 12px;
  line-height: 1;
}

.group-divider-label {
  flex: 1;
}

.group-divider-count {
  background: rgba(255, 255, 255, 0.6);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}

/* Сегодня - акцентный цвет */
.group-today {
  background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 100%);
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

.group-today .group-divider-count {
  background: #3b82f6;
  color: white;
}

/* Будущие - мягкий зелёный */
.group-future {
  background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
  color: #15803d;
  border: 1px solid #86efac;
}

.group-future .group-divider-count {
  background: #22c55e;
  color: white;
}

/* Прошедшие - нейтральный серый */
.group-past {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.group-past .group-divider-count {
  background: #94a3b8;
  color: white;
}

.appointment-list-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.appointment-list-clinic {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.appointment-list-notes {
  font-size: 12px;
  color: var(--text-secondary);
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  line-height: 1.4;
}

/* Patient modal specific - wider */
#patientModal .modal-content {
  max-width: 80%;
}

/* ============================================
   TABS NAVIGATION
   ============================================ */
.tabs-navigation {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 24px;
  padding-bottom: 0;
  width: 100%; /* Занимаем всю доступную ширину */
}

.tab-button {
  background: transparent;
  border: none;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  bottom: -2px;
}

.tab-button:hover {
  color: var(--brand-primary);
  background: var(--bg-highlight);
  border-radius: 8px 8px 0 0;
}

.tab-button.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ============================================
   HEALTH QUESTIONNAIRE
   ============================================ */
.questionnaire-section {
  width: 100%;
}

.questionnaire-form {
  width: 100%;
}

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

.questionnaire-section-title {
  grid-column: 1 / -1;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 10px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.questionnaire-section-title:first-child {
  margin-top: 0;
}

.questionnaire-form-grid .form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.questionnaire-form-grid .form-field label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.questionnaire-form-grid .form-field input,
.questionnaire-form-grid .form-field textarea,
.questionnaire-form-grid .form-field select {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
  background: white;
}

.questionnaire-form-grid .form-field input:focus,
.questionnaire-form-grid .form-field textarea:focus,
.questionnaire-form-grid .form-field select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(55, 192, 116, 0.1);
}

.questionnaire-form-grid .form-field textarea {
  resize: vertical;
  min-height: 60px;
}

.questionnaire-form-grid .form-field.full-width {
  grid-column: 1 / -1;
}

.questionnaire-form-grid .button-primary {
  width: 100%;
  justify-content: center;
}

#questionnaireFieldsContainer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

#questionnaireFieldsContainer .form-field {
  margin-bottom: 0;
}

#questionnaireFieldsContainer h3.questionnaire-section-title {
  margin-top: 24px;
}

#questionnaireFieldsContainer h3.questionnaire-section-title:first-child {
  margin-top: 0;
}

/* Question field styling with colored borders */
.question-field {
  padding: 16px;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  transition: all 0.3s ease;
}

.question-field.question-unanswered {
  border-color: #e5e7eb;
  background: #ffffff;
}

.question-field.question-yes {
  border-color: #10b981;
  background: #f0fdf4;
}

.question-field.question-no {
  border-color: #ef4444;
  background: #fef2f2;
}

.question-field.question-unknown {
  border-color: #f59e0b;
  background: #fffbeb;
}

.question-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: block;
}

/* Radio button group styling */
.radio-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 6px;
  border: 2px solid #e5e7eb;
  background: white;
  transition: all 0.2s ease;
  user-select: none;
}

.radio-option:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}

.radio-option input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--brand-primary);
}

.radio-option input[type="radio"]:checked + .radio-label {
  font-weight: 600;
}

.radio-label {
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  margin: 0;
}

.error-message {
  padding: 20px;
  text-align: center;
  color: var(--badge-danger);
  background: #fee2e2;
  border-radius: var(--radius-md);
  margin: 20px 0;
}

/* Responsive adjustments */
@media (max-width: 1100px) {
  .patient-modal-layout {
    flex-direction: column; /* Возвращаем flex-direction: column для маленьких экранов */
  }
  
  .patient-appointments-section {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding-left: 0;
    padding-top: 24px;
    max-height: 400px;
  }
  
  #patientModal .modal-content {
    max-width: 80%;
  }

  .tabs-navigation {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }

  .tab-button {
    padding: 10px 16px;
    font-size: 13px;
  }
  
  /* Balance tab responsive layout */
  #tab-balance > .balance-section > div[style*="display: flex"] {
    flex-direction: column !important;
  }
  
  #tab-balance .balance-header {
    width: 100%;
  }
}

/* Утилиты */
.hidden {
  display: none !important;
}

/* ========== SERVICES PAGE ========== */
.services-page {
  padding: 32px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.services-page .page-header {
  margin-bottom: 32px;
}

.services-page .page-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.filters-section {
  display: flex;
  gap: 20px;
  margin-bottom: 32px;
  padding: 20px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  flex-wrap: wrap;
  overflow: visible;
}

.services-page .filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.filter-group label {
  font-size: var(--font-size-md);
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-group select,
.filter-group input {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-md);
  min-width: 200px;
}

.filter-group input {
  min-width: 300px;
}

.services-container {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 24px;
  width: 100%;
  overflow-x: auto;
}

.services-grid {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.service-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.service-type-header {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--brand-primary);
}

.services-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.services-table thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-highlight);
  color: var(--text-secondary);
  font-size: var(--font-size-md);
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
}

.services-table thead th:nth-child(1) {
  width: 30%;
}

.services-table thead th:nth-child(2) {
  width: 50%;
}

.services-table thead th:nth-child(3) {
  width: 20%;
}

.services-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s;
}

.services-table tbody tr:hover {
  background: var(--bg-highlight);
}

.services-table tbody td {
  padding: 16px;
  font-size: var(--font-size-md);
}

.service-name {
  font-weight: 600;
  color: var(--text-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.service-description {
  color: var(--text-secondary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.service-price {
  font-weight: 700;
  color: var(--brand-primary);
  text-align: right;
  white-space: nowrap;
}

.no-services {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
}

/* ========== DOCTORS PAGE ========== */
.doctors-page {
  padding: 32px 40px;
  max-width: 100%;
  margin: 0;
}

.doctors-page .page-header {
  margin-bottom: 32px;
}

.doctors-page .page-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.doctors-container {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 24px;
}

.doctors-grid {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.doctor-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.specialization-header {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--brand-primary);
}

.doctors-table {
  width: 100%;
  border-collapse: collapse;
}

.doctors-table thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-highlight);
  color: var(--text-secondary);
  font-size: var(--font-size-md);
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
}

.doctors-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s;
}

.doctors-table tbody tr:hover {
  background: var(--bg-highlight);
}

.doctors-table tbody td {
  padding: 16px;
  font-size: var(--font-size-md);
}

.doctor-name {
  font-weight: 600;
  color: var(--text-primary);
  width: 40%;
}

.doctor-phone {
  color: var(--text-secondary);
  width: 25%;
}

.doctor-email {
  color: var(--text-secondary);
  width: 35%;
}

.doctor-email a {
  color: var(--brand-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.doctor-email a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

.no-doctors {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
}

/* Адаптивность */
@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 240px 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 0;
    padding: 0;
    overflow: hidden;
    transform: translateX(-100%);
  }
  
  .sidebar.expanded {
    width: 280px;
    padding: 16px 24px;
    transform: translateX(0);
  }
  
  .sidebar-toggle {
    display: none;
  }

  .main-area {
    margin-left: 0;
  }

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

  .modal-footer {
    flex-direction: column;
  }

  .footer-left,
  .footer-right {
    width: 100%;
    justify-content: stretch;
  }

  .footer-left button,
  .footer-right button {
    flex: 1;
  }
}

/* ========== SCHEDULES PAGE ========== */
.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

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

.date-input {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-md);
  background: var(--bg-card);
  color: var(--text-primary);
  min-width: 150px;
  cursor: pointer;
}

.date-input:focus {
  outline: none;
  border-color: var(--brand-secondary);
}

.select-field select {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-md);
  background: var(--bg-card);
  color: var(--text-primary);
  min-width: 200px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235c6378' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.select-field select:focus {
  outline: none;
  border-color: var(--brand-secondary);
}

.schedule-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  overflow-x: auto;
}

.schedule-grid {
  display: flex;
  gap: 2px;
  min-width: fit-content;
  position: relative;
}

.schedule-time-column {
  display: grid;
  grid-template-rows: auto;
  grid-auto-rows: var(--schedule-row-height); /* 5 minutes slot height */
  min-width: var(--schedule-time-column-width);
  background: var(--bg-highlight);
  border-radius: var(--radius-sm);
  align-items: stretch;
  border: 1px solid transparent;
  position: sticky;
  left: 0;
  z-index: 10;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
}

.schedule-time-header {
  padding: 6px 10px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-height: 40px;
  height: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  grid-row: 1;
}

.schedule-time-slot {
  padding: 2px 4px;
  font-size: calc(10px * var(--schedule-font-scale));
  color: var(--text-secondary);
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  height: calc(var(--schedule-row-height) * 6); /* 30 minutes = 6 x 5-minute slots */
  display: flex;
  align-items: center;
  justify-content: center;
}

.schedule-shift-separator {
  min-height: 40px;
  height: auto;
  background: #e8f4f8;
  border-top: 1px solid #b0d9e8;
  border-bottom: 1px solid #b0d9e8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  line-height: 1.4;
  gap: 6px;
  box-sizing: border-box;
}

.schedule-shift-separator > div {
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  text-align: center;
  box-sizing: border-box;
  min-height: 1.4em;
}

/* Current time indicator */
.current-time-indicator {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 100;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.current-time-line {
  flex: 1;
  height: 2px;
  background: #ef4444;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.5);
}

.current-time-label {
  position: absolute;
  left: 0;
  background: #ef4444;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: translateY(-50%);
}

.current-time-dot {
  position: absolute;
  right: 0;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  transform: translate(50%, -50%);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Hover time indicator - показывает время при наведении мыши на сетку */
.hover-time-indicator {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 99;
  pointer-events: none;
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.hover-time-indicator.visible {
  opacity: 1;
}

.hover-time-line {
  flex: 1;
  height: 1px;
  background: #3b82f6;
  opacity: 0.6;
}

.hover-time-label {
  position: sticky;
  left: 0;
  background: #3b82f6;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transform: translateY(-50%);
  z-index: 11;
}

.schedule-room-column {
  display: grid;
  grid-template-rows: auto;
  grid-auto-rows: var(--schedule-row-height); /* 5 minutes slot height */
  min-width: var(--schedule-column-width);
  max-width: var(--schedule-column-width);
  width: var(--schedule-column-width);
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  align-items: stretch;
  overflow: hidden;
}

.schedule-room-header {
  padding: 6px 10px;
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-height: 40px;
  height: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  grid-row: 1;
  align-self: start;
}

.schedule-room-name {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--text-primary);
}

.schedule-room-description {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: 1.4;
}

.schedule-slot {
  border-bottom: 1px solid var(--border-color);
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s;
}

.schedule-slot.empty {
  min-height: 20px;
  height: 100%;
}

.schedule-slot.empty:hover {
  background: var(--bg-highlight);
}

.schedule-slot.occupied {
  padding: 4px 6px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-radius: 4px;
  margin: 1px;
  box-shadow: var(--shadow-soft);
  align-content: start;
  min-height: 20px;
  font-size: 10px;
}

.schedule-slot.occupied:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

/* Schedule background for appointments page (gray) */
.schedule-slot.schedule-background {
  padding: 4px 6px;
  background: #f1f5f9;
  color: #64748b;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-radius: 4px;
  margin: 1px;
  border: 1px solid #cbd5e1;
  min-height: 20px;
  font-size: 10px;
  cursor: default;
}

.schedule-slot.schedule-background:hover {
  transform: none;
}

.schedule-slot.empty-no-schedule {
  min-height: 20px;
  height: 100%;
  background: #fafafa;
  cursor: not-allowed;
}

.schedule-empty-space {
  flex: 1;
  min-height: 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.schedule-empty-space:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* Available slot for appointment creation */
.schedule-slot-available {
  min-height: 20px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}

/* Чередующиеся оттенки для расписаний (шахматная структура) */
.schedule-slot-available.schedule-odd {
  background: #eef2f5;
}

.schedule-slot-available.schedule-even {
  background: #f8fafc;
}

.schedule-slot-available:hover {
  background: #e0f2fe;
  border-color: #3b82f6;
  border-style: solid;
}

/* Кнопка для остатка частично занятого слота */
.schedule-slot-remainder {
  min-height: 10px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.schedule-slot-remainder:hover {
  background: #e0f2fe;
  border-color: #3b82f6;
  border-style: solid;
}

.remainder-plus {
  font-size: 14px;
  font-weight: bold;
  color: #94a3b8;
  line-height: 1;
}

.schedule-slot-remainder:hover .remainder-plus {
  color: #3b82f6;
}

.appointment-slot {
  min-height: 10px;
}

.schedule-slot-doctor {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.schedule-slot-time {
  font-size: 10px;
  opacity: 0.9;
  line-height: 1.2;
}

.schedule-slot-notes {
  font-size: 9px;
  opacity: 0.8;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  line-height: 1.2;
}

/* Appointment Tooltip */
.appointment-tooltip {
  position: absolute;
  z-index: 1000;
  background: #1e293b;
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  max-width: 280px;
  white-space: normal;
}

.appointment-tooltip.visible {
  opacity: 1;
}

.appointment-tooltip-patient {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  color: #f1f5f9;
}

.appointment-tooltip-time {
  color: #94a3b8;
  margin-bottom: 6px;
}

.appointment-tooltip-notes {
  border-top: 1px solid #475569;
  padding-top: 6px;
  color: #e2e8f0;
  word-break: break-word;
}

/* Appointment Card Notes in Grid */
.appointment-card-notes {
  font-size: 9px;
  color: #64748b;
  line-height: 1.3;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Schedule Tooltip */
.schedule-tooltip {
  position: fixed;
  z-index: 10000;
  background: #1e293b;
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  max-width: 280px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.schedule-tooltip.visible {
  opacity: 1;
}

.schedule-tooltip-doctor {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  color: #f1f5f9;
}

.schedule-tooltip-time {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.schedule-tooltip-notes {
  font-size: 11px;
  border-top: 1px solid #475569;
  padding-top: 6px;
  color: #e2e8f0;
  word-break: break-word;
}

/* Rooms Management */
.rooms-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.room-item {
  padding: 12px 16px;
  background: var(--bg-highlight);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border-color);
}

.room-item:hover {
  background: var(--bg-card);
  border-color: var(--brand-secondary);
  transform: translateX(4px);
}

.room-item-name {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.room-item-description {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

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

/* Custom Select for Doctors */
.custom-select {
  position: relative;
  width: 100%;
  z-index: 100;
}

/* Увеличиваем z-index когда селект активен */
.custom-select.is-open {
  z-index: 1005;
}

.custom-select.is-open .select-dropdown {
  z-index: 1006;
}

.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 42px;
}

.select-trigger:hover {
  border-color: var(--brand-secondary);
}

.select-placeholder {
  color: var(--text-secondary);
  font-size: var(--font-size-md);
}

.select-placeholder.selected {
  color: var(--text-primary);
}

.select-arrow {
  color: var(--text-secondary);
  font-size: 12px;
  transition: transform 0.2s;
}

.select-loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.select-loading-spinner .spinner {
  width: 18px;
  height: 18px;
  color: var(--brand-secondary);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 1003;
  max-height: 550px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.select-search {
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  flex-shrink: 0;
}

.select-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  outline: none;
  box-sizing: border-box;
}

.select-search input:focus {
  border-color: var(--brand-secondary);
}

.select-options {
  overflow-y: auto;
  max-height: 520px;
  flex: 1;
  min-height: 0;
}

.select-group-label {
  padding: 8px 12px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-highlight);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.select-option {
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 0.2s;
  border-bottom: 1px solid var(--border-color);
}

.select-option:last-child {
  border-bottom: none;
}

.select-option:hover {
  background: var(--bg-highlight);
}

.select-option.selected {
  background: var(--bg-highlight);
  border-left: 3px solid var(--brand-secondary);
}

.select-option.disabled {
  color: var(--text-secondary);
  cursor: not-allowed;
  text-align: center;
  padding: 20px;
}

.select-option-main {
  font-size: var(--font-size-md);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.4;
}

.select-option-sub {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: 1.3;
}

#specializationFilterOptions .select-option-main {
  padding-right: 10px;
}

/* Увеличиваем высоту выпадающего списка специальностей */
#specializationFilterDropdown {
  max-height: 600px;
}

#specializationFilterOptions {
  max-height: 550px;
}

/* Checkbox for room filter */
.select-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  margin-right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.select-checkbox.checkbox-checked {
  background: #3b82f6;
  border-color: #3b82f6;
}

.select-checkbox.checkbox-checked::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.select-option {
  display: flex;
  align-items: center;
}

/* ========== DOCTOR CARD MODAL ========== */
.doctor-row-clickable:hover {
  background-color: var(--bg-highlight);
}

.modal-content.modal-large {
  max-width: 1000px;
}

.doctor-info-section {
  margin-bottom: 32px;
  padding: 24px;
  background: var(--bg-highlight);
  border-radius: var(--radius-md);
}

.doctor-info-section h3 {
  margin: 0 0 20px 0;
  font-size: var(--font-size-lg);
  color: var(--text-primary);
  font-weight: 600;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-item.full-width {
  grid-column: 1 / -1;
}

.info-item.full-width span {
  white-space: pre-wrap;
  line-height: 1.6;
}

.info-item label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.info-item span {
  font-size: var(--font-size-md);
  color: var(--text-primary);
  font-weight: 600;
}

.info-item a {
  color: var(--brand-secondary);
  text-decoration: none;
}

.info-item a:hover {
  text-decoration: underline;
}

.doctor-appointments-section h3 {
  margin: 0 0 16px 0;
  font-size: var(--font-size-lg);
  color: var(--text-primary);
  font-weight: 600;
}

.appointments-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.appointments-table thead {
  background: var(--bg-highlight);
}

.appointments-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.appointments-table tbody tr {
  border-bottom: 1px solid var(--border-color);
}

.appointments-table tbody tr:last-child {
  border-bottom: none;
}

.appointments-table tbody tr:hover {
  background: var(--bg-highlight);
}

.appointments-table td {
  padding: 12px 16px;
  font-size: var(--font-size-md);
  color: var(--text-primary);
}

.time-range {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: 4px;
}

.no-data {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: var(--font-size-md);
}

.error-message {
  text-align: center;
  padding: 40px;
  color: var(--badge-danger);
  font-size: var(--font-size-md);
}

.patient-link {
  color: var(--brand-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
}

.patient-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

.appointment-date-link {
  color: var(--text-primary);
  text-decoration: none;
  display: block;
  transition: all 0.2s;
}

.appointment-date-link:hover {
  color: var(--brand-secondary);
}

.appointment-date-link:hover .time-range {
  color: var(--brand-secondary);
}

/* ========== EMPLOYEES PAGE STYLES ========== */
.employees-page {
  padding: 32px;
}

.employees-container {
  margin-top: 24px;
}

.employees-grid {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.employee-group-section {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-soft);
}

.group-header {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.employee-role-section {
  margin-top: 24px;
}

.role-header {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 12px 0;
}

.employees-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.employees-table thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.employees-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s;
}

.employees-table tbody tr:hover {
  background-color: var(--bg-highlight);
}

.employees-table tbody td {
  padding: 12px 16px;
  font-size: var(--font-size-md);
  color: var(--text-primary);
}

.employee-row-clickable {
  cursor: pointer;
}

.employee-name {
  font-weight: 500;
  color: var(--text-primary);
}

.no-employees {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: var(--font-size-md);
}

/* Badge variants */
.badge-success {
  background-color: #10b981;
}

.badge-primary {
  background-color: #0284c7;
}

.badge-secondary {
  background-color: #6b7280;
}

.badge-doctor {
  font-size: 16px;
  margin-left: 8px;
  display: inline-block;
  vertical-align: middle;
}

/* Employee Modal */
.employee-info-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.employee-info-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.employee-info-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brand-primary);
  display: inline-block;
}

/* Accordion для результатов приема */
.accordion-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.accordion-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.accordion-item:hover {
  border-color: #cbd5e1;
}

.accordion-item.has-data {
  border-color: #3b82f6;
  background: #eff6ff;
}

.accordion-item.has-data .accordion-header {
  background: #dbeafe;
}

.accordion-item.has-data .accordion-header span {
  color: #1e40af;
  font-weight: 600;
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background: #f8fafc;
  transition: all 0.2s ease;
}

.accordion-header:hover {
  background: #f1f5f9;
}

.accordion-header span {
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
}

.accordion-arrow {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.accordion-item.active .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 16px;
}

.accordion-item.active .accordion-content {
  max-height: 500px;
  padding: 16px;
}

.accordion-content textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s ease;
}

.accordion-content textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.accordion-content textarea::placeholder {
  color: #94a3b8;
}

/* Обертка для textarea с кнопкой расширения */
.textarea-wrapper {
  position: relative;
}

.expand-textarea-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  z-index: 1;
}

.expand-textarea-btn:hover {
  background: #f1f5f9;
  color: #3b82f6;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.expand-textarea-btn:active {
  transform: scale(0.95);
}

.expand-textarea-btn svg {
  width: 16px;
  height: 16px;
}

/* Модальное окно результатов на всю высоту */
.result-modal-fullheight {
  height: calc(100vh - 40px);
  max-height: calc(100vh - 40px);
  margin: 20px auto;
  display: flex;
  flex-direction: column;
}

.result-modal-fullheight .modal-header {
  flex-shrink: 0;
}

.result-modal-fullheight .modal-footer {
  flex-shrink: 0;
}

.result-modal-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: 20px;
  padding: 20px;
  max-height: 85vh;
  overflow: hidden;
}

/* ========== TEETH SELECTION ========== */
.teeth-selection-section {
  position: relative;
}

.teeth-type-switch {
  display: flex;
  background: white;
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.teeth-type-btn {
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.teeth-type-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.teeth-type-btn.active {
  background: #3b82f6;
  color: white;
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}

.teeth-intact-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #cbd5e1;
  background: white;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.teeth-intact-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #475569;
}

.teeth-intact-btn.active {
  background: #dcfce7;
  border-color: #22c55e;
  color: #16a34a;
}

.teeth-intact-btn.active svg {
  stroke: #16a34a;
}

.teeth-quick-btn {
  padding: 8px 16px;
  border: 1px solid #cbd5e1;
  background: white;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.teeth-quick-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #1e293b;
}

.teeth-quick-btn.selected {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
}

.teeth-clear-btn {
  margin-left: auto;
  border-color: #fca5a5;
  color: #dc2626;
}

.teeth-clear-btn:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

.teeth-diagram {
  background: white;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.teeth-diagram-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.teeth-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.teeth-row.upper-jaw {
  padding-bottom: 12px;
  border-bottom: 2px solid #e2e8f0;
}

.teeth-row.lower-jaw {
  padding-top: 12px;
}

.teeth-side {
  display: flex;
  gap: 6px;
  align-items: center;
}

.teeth-divider {
  width: 2px;
  height: 40px;
  background: #cbd5e1;
  margin: 0 8px;
}

.tooth-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.tooth-btn:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1e40af;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.tooth-btn.selected {
  background: #3b82f6;
  border-color: #2563eb;
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.tooth-btn.selected:hover {
  background: #2563eb;
  border-color: #1d4ed8;
  transform: translateY(-2px);
}

/* Стили для зубной формулы */
.formula-tooth {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  position: relative;
}

.formula-tooth:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1e40af;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.formula-tooth.selected {
  background: #3b82f6;
  border-color: #2563eb;
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.formula-tooth.selected:hover {
  background: #2563eb;
  border-color: #1d4ed8;
  transform: translateY(-2px);
}

/* Зубы с обозначениями */
.formula-tooth.has-notations {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
  font-weight: 700;
}

.formula-tooth.has-notations:hover {
  background: #fde68a;
  border-color: #d97706;
  color: #78350f;
}

.formula-tooth.has-notations.selected {
  background: #f59e0b;
  border-color: #d97706;
  color: white;
}

.formula-tooth.has-notations.selected:hover {
  background: #d97706;
  border-color: #b45309;
}

/* Индикатор наличия обозначений */
.formula-tooth.has-notations::after {
  content: '●';
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 8px;
  color: #f59e0b;
}

.formula-tooth.has-notations.selected::after {
  color: white;
}

#selectedTeethDisplay {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.selected-teeth-placeholder {
  color: #94a3b8;
  font-style: italic;
}

.selected-tooth-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.selected-tooth-tag.special {
  background: #e0e7ff;
  color: #4338ca;
}

.selected-tooth-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background: rgba(30, 64, 175, 0.2);
  border-radius: 50%;
  cursor: pointer;
  font-size: 10px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.selected-tooth-remove:hover {
  background: rgba(30, 64, 175, 0.4);
}

/* ========== TRANSACTIONS (BALANCE TAB) ========== */
.balance-section {
  padding: 20px 0;
}

.balance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.balance-display {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.balance-label {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.balance-amount {
  font-size: 36px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.balance-amount.positive {
  color: #10b981;
}

.balance-amount.negative {
  color: #ef4444;
}

.transactions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px;
}

#patientTreatmentPlansList {
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px;
}

#labTestsList {
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px;
}

#patientDocumentsList {
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px;
}

#patientTasksList {
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px;
}

#commentsList {
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px;
}

.transaction-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.2s ease;
}

.transaction-item:hover {
  box-shadow: var(--shadow-soft);
  border-color: var(--brand-secondary);
}

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

.transaction-amount {
  font-size: 24px;
  font-weight: 700;
}

.transaction-amount.positive {
  color: #10b981;
}

.transaction-amount.negative {
  color: #ef4444;
}

.transaction-datetime {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.transaction-date {
  font-size: var(--font-size-md);
  color: var(--text-primary);
  font-weight: 500;
}

.transaction-time {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.transaction-comment {
  font-size: var(--font-size-md);
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 4px;
}

.transaction-author {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  font-style: italic;
}

.no-transactions {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: var(--font-size-md);
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
}

/* Transaction Groups */
.transaction-group {
  background: var(--bg-card);
  border: 2px solid #e0e7ff;
  border-radius: var(--radius-lg);
  padding: 0;
  margin-bottom: 16px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.transaction-group:hover {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
  border-color: #c7d2fe;
}

.transaction-group-header {
  background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
  padding: 16px;
  border-bottom: 1px solid #e0e7ff;
}

.transaction-group-meta {
  margin-bottom: 12px;
}

.transaction-group-total {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #c7d2fe;
}

.transaction-group-stages {
  padding: 12px 16px;
  background: white;
}

.transaction-group-stage-item {
  padding: 12px;
  margin-bottom: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.transaction-group-stage-item:last-child {
  margin-bottom: 0;
}

.transaction-group-stage-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Standalone transactions (not in groups) */
.transaction-standalone {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.transaction-standalone:hover {
  box-shadow: var(--shadow-soft);
  border-color: var(--brand-secondary);
}

.transaction-standalone .transaction-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* Transaction Modal */
.modal-sm {
  max-width: 500px;
}

.form-vertical {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-vertical .form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-vertical label {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--text-primary);
}

.form-vertical input[type="number"],
.form-vertical textarea {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-md);
  font-family: inherit;
  transition: all 0.2s ease;
}

.form-vertical input[type="number"]:focus,
.form-vertical textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(55, 192, 116, 0.1);
}

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

/* ========== NOTIFICATION SYSTEM ========== */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.notification {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  min-width: 300px;
  max-width: 500px;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: all;
}

.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: bold;
  flex-shrink: 0;
}

.notification-message {
  flex: 1;
  font-size: var(--font-size-md);
  font-weight: 500;
  line-height: 1.4;
}

/* Success notification */
.notification-success {
  border-left: 4px solid #10b981;
}

.notification-success .notification-icon {
  background: #d1fae5;
  color: #059669;
}

.notification-success .notification-message {
  color: #065f46;
}

/* Error notification */
.notification-error {
  border-left: 4px solid #ef4444;
}

.notification-error .notification-icon {
  background: #fee2e2;
  color: #dc2626;
}

.notification-error .notification-message {
  color: #991b1b;
}

/* Warning notification */
.notification-warning {
  border-left: 4px solid #f59e0b;
}

.notification-warning .notification-icon {
  background: #fef3c7;
  color: #d97706;
}

.notification-warning .notification-message {
  color: #92400e;
}

/* Info notification */
.notification-info {
  border-left: 4px solid #3b82f6;
}

.notification-info .notification-icon {
  background: #dbeafe;
  color: #2563eb;
}

.notification-info .notification-message {
  color: #1e40af;
}

/* ========== QUICK PHRASES PANEL ========== */
#quickPhrasesPanel {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

#quickPhrasesPanel::-webkit-scrollbar {
  width: 6px;
}

#quickPhrasesPanel::-webkit-scrollbar-track {
  background: transparent;
}

#quickPhrasesPanel::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}

#quickPhrasesPanel::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

.quick-phrase-item {
  position: relative;
  overflow: hidden;
}

.quick-phrase-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #3b82f6;
  transform: scaleY(0);
  transition: transform 0.2s;
}

.quick-phrase-item:hover::before {
  transform: scaleY(1);
}

.quick-phrase-item:active {
  transform: scale(0.98);
}

/* ========== REPORTS STYLES ========== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead {
  background-color: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tbody tr {
  border-bottom: 1px solid #e2e8f0;
  transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

.data-table td {
  padding: 14px 16px;
  color: #1e293b;
}

.form-control {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ========== DYNAMIC PHONE NUMBERS ========== */
.phone-numbers-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phone-number-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e5e9f2;
}

.phone-number-item .remove-phone-btn {
  padding: 6px 10px;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.2s;
}

.phone-number-item .remove-phone-btn:hover {
  background: #b91c1c;
}

.phone-number-item input[type="tel"] {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.phone-number-item input[type="tel"]:focus {
  outline: none;
  border-color: #37c074;
}

.phone-primary-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.phone-primary-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #37c074;
}

.phone-primary-checkbox .checkbox-label {
  font-size: 13px;
  color: #475569;
  font-weight: 500;
}

.btn-remove-phone {
  padding: 6px 10px;
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-remove-phone:hover {
  background: #fecaca;
}

/* Phone Warning Styles */
.phone-warning {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  margin: 8px 0;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.phone-warning-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.phone-warning-content {
  flex: 1;
  min-width: 0;
}

.phone-warning-title {
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 4px;
}

.phone-warning-patients {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.phone-warning-patient-link {
  font-size: 13px;
  color: #b45309;
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.phone-warning-patient-link:hover {
  color: #78350f;
  text-decoration: underline;
}

.phone-warning-stage {
  font-weight: 400;
  font-size: 12px;
  opacity: 0.8;
}

.phone-warning-hint {
  font-size: 11px;
  color: #78350f;
  opacity: 0.8;
}

.btn-add-phone {
  padding: 6px 10px;
  background: #dbeafe;
  color: #2563eb;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-add-phone:hover {
  background: #bfdbfe;
}

.button-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.button-sm .button-icon {
  font-size: 14px;
}

.button-xs {
  padding: 2px 6px;
  font-size: 11px;
  min-width: auto;
  line-height: 1.2;
}

.button-xs .button-icon {
  font-size: 11px;
}

/* Mini phone type badges for patient cards */
.phone-type-badge-mini {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  margin-left: 6px;
  background: #e0f2fe;
  color: #0369a1;
}

/* Age display for patient cards */
.patient-age {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  margin-left: auto;
  background: #f0fdf4;
  color: #166534;
  white-space: nowrap;
}

/* Age display inline in patient modal */
.age-display-inline {
  font-size: 12px;
  font-weight: 400;
  color: #94a3b8;
  margin-left: 4px;
}

.patient-info {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Document status indicator */
.document-status-indicator {
  display: inline-block;
  width: 18px;
  height: 18px;
  background: #10b981;
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 18px;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
}

/* ========== DOCUMENTS STYLES ========== */
.documents-section {
  padding: 20px 0;
}

.document-item {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.document-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* Status badges for documents */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.status-completed {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.status-signed {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.status-unsigned {
  background: #fef3c7;
  color: #92400e;
}

/* Animation for slideIn/slideOut */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

/* Month selection buttons */
.month-btn {
  min-width: 42px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: white;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.month-btn:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1e40af;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.month-btn.selected {
  background: #3b82f6;
  border-color: #2563eb;
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.month-btn.selected:hover {
  background: #2563eb;
  border-color: #1d4ed8;
  transform: translateY(-1px);
}

/* ========== HELPDESK FLOATING BUTTON ========== */
.helpdesk-float-button {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 999;
  border: none;
  font-size: 38px;
  font-weight: bold;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.helpdesk-float-button:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 6px 24px rgba(102, 126, 234, 0.5);
}

.helpdesk-float-button:active {
  transform: scale(0.95);
}

/* ========== HELPDESK MODAL ========== */
#helpdeskModal .modal-content {
  max-width: 600px;
}

.helpdesk-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.helpdesk-form .form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.helpdesk-form label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.helpdesk-form textarea {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  min-height: 120px;
  resize: vertical;
  transition: all 0.2s ease;
}

.helpdesk-form textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(55, 192, 116, 0.1);
}

.helpdesk-drag-drop-area {
  padding: 24px;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #f8fafc;
}

.helpdesk-drag-drop-area:hover {
  border-color: #37c074;
  background: #f0fdf4;
}

.helpdesk-files-list {
  margin-top: 12px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 8px;
}

/* ========== BULK ACTIONS PANEL ========== */
.bulk-actions-panel {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== PLAN CHECKBOX ========== */
.plan-checkbox {
  transition: all 0.2s ease;
}

.plan-checkbox:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* ========== PLAN ORDER MODAL ========== */
.plan-order-item {
  transition: all 0.2s ease;
}

.plan-order-item:hover {
  transform: translateX(4px);
}

.plan-order-item.dragging {
  opacity: 0.5;
}

.plan-order-item:active {
  cursor: grabbing;
}

/* ========== PROCEDURES SELECTION MODAL ========== */
.add-procedure-button {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.add-procedure-button:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 4px 16px rgba(55, 192, 116, 0.45) !important;
}

.add-procedure-button:active {
  transform: translateY(0) scale(0.99);
}

/* Стили для модального окна процедур */
#proceduresSelectionModal .modal-content {
  animation: slideDownModal 0.3s ease-out;
}

@keyframes slideDownModal {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Стили для скроллбара в модальном окне */
#proceduresModalOptions::-webkit-scrollbar {
  width: 10px;
}

#proceduresModalOptions::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

#proceduresModalOptions::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

#proceduresModalOptions::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Стили для элементов процедур в модальном окне */
.service-item-modal {
  position: relative;
  overflow: visible;
}

.service-item-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, #37c074 0%, #2f8fed 100%);
  transform: scaleY(0);
  transition: transform 0.2s ease;
  border-radius: 8px 0 0 8px;
}

.service-item-modal:hover::before {
  transform: scaleY(1);
}

.category-header-modal,
.subcategory-item-modal {
  position: relative;
  overflow: hidden;
}

.category-header-modal::after,
.subcategory-item-modal::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(55, 192, 116, 0.08), rgba(47, 143, 237, 0.05), transparent);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.category-header-modal:hover::after,
.subcategory-item-modal:hover::after {
  transform: translateX(100%);
}

/* Анимация появления таблицы процедур */
#selectedProceduresTable {
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Стили для строк таблицы процедур */
#selectedProceduresBody tr {
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f1f5f9;
}

#selectedProceduresBody tr:hover {
  background-color: #f8fafc;
}

#selectedProceduresBody tr:last-child {
  border-bottom: none;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  #proceduresSelectionModal .modal-content {
    max-width: 95vw;
    max-height: 90vh;
  }
  
  .add-procedure-button {
    font-size: 14px !important;
    padding: 14px !important;
  }
  
  .service-item-modal,
  .category-header-modal {
    padding: 12px !important;
  }
}

/* ========== DOCUMENTS: NEW IDS AND CONTRACT MODALS ========== */

/* Documents button group */
.documents-button-group {
  transition: all 0.2s ease;
}

.documents-button-group:hover {
  border-color: #cbd5e1 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Limit dropdown height in contract modal */
#createContractModal .custom-select-dropdown {
  max-height: 250px !important;
  overflow-y: auto !important;
}

/* IDS Template Cards */
.ids-templates-grid {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}

.ids-templates-grid::-webkit-scrollbar {
  width: 8px;
}

.ids-templates-grid::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.ids-templates-grid::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.ids-templates-grid::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.ids-template-card {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ids-template-card:active {
  transform: scale(0.98);
}

/* IDS Search input focus */
#idsSearchInput:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Spinner for loading states */
.spinner {
  border: 3px solid #f1f5f9;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========== BUTTON LOADING STATE (opt-in via data-loading) ========== */
.button.is-loading,
button.is-loading,
a.is-loading {
  pointer-events: none;
  opacity: 0.8;
  cursor: wait;
  position: relative;
}

.button.is-loading .spinner-small,
button.is-loading .spinner-small,
a.is-loading .spinner-small {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

/* Responsive design for IDS modal */
@media (max-width: 1280px) {
  .ids-templates-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  .ids-templates-grid {
    grid-template-columns: 1fr !important;
  }
  
  .documents-button-group {
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 8px 12px !important;
  }
  
  .documents-button-group .button {
    flex: 1 1 auto;
    min-width: 120px;
  }
}

/* ========== CANCELLED APPOINTMENTS TOGGLE ========== */

/* Кнопка переключения отмененных приемов */
.cancelled-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cancelled-toggle-btn:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.cancelled-toggle-btn:hover svg {
  stroke: #dc2626;
}

.cancelled-toggle-btn.active {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #f87171;
  color: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}

.cancelled-toggle-btn.active svg {
  stroke: #dc2626;
}

.cancelled-toggle-btn .cancelled-count {
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Анимация появления отмененных карточек */
@keyframes fadeInCancelled {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.cancelled-appointment-card {
  animation: fadeInCancelled 0.3s ease-out;
}

/* Overlay контейнер */
.cancelled-appointments-overlay {
  pointer-events: none;
}

/* ===== MESSENGER LINKS / КНОПКИ МЕССЕНДЖЕРОВ ===== */

/* Кнопки мессенджеров в карточках пациентов (канбан) */
.messenger-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 500;
  border-radius: 4px;
  color: white;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
  margin-right: 4px;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.messenger-badge:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.messenger-badge:last-child {
  margin-right: 0;
}

.messenger-badge-telegram {
  background: #0088cc;
}

.messenger-badge-vk {
  background: #4a76a8;
}

.messenger-badge-whatsapp {
  background: #25d366;
}

.messenger-badge-viber {
  background: #665cac;
}

/* Контейнер кнопок мессенджеров в строке с иконкой */
.patient-messengers {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

/* Контейнер кнопок мессенджеров в модальном окне */
.messenger-links-container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

/* Стили для inline кнопок мессенджеров (в appointments и др.) */
.messenger-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 12px;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.4;
  text-decoration: none;
  transition: background-color 0.2s, transform 0.1s;
}

.messenger-btn:hover {
  transform: scale(1.02);
}

.messenger-btn svg {
  flex-shrink: 0;
}

/* ========== ARRIVAL/DEPARTURE BUTTONS ========== */
.arrival-btn,
.departure-btn {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.1s, box-shadow 0.1s;
  padding: 0;
  line-height: 1;
}

.arrival-btn {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #22c55e;
}

.arrival-btn:hover {
  background: #bbf7d0;
  transform: scale(1.15);
  box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
}

.departure-btn {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #ef4444;
}

.departure-btn:hover {
  background: #fecaca;
  transform: scale(1.15);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* Индикатор присутствия пациента */
.patient-inside-indicator {
  color: #22c55e;
  font-size: 8px;
  flex-shrink: 0;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}