/* ============================================================
   Общие стили для ЛК и панели консультанта
   ============================================================ */

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

:root {
  --c-bg:        #f5f5f0;
  --c-surface:   #ffffff;
  --c-border:    #e8e6e1;
  --c-primary:   #2a5e8a;
  --c-primary-h: #1e4a6e;
  --c-accent:    #e07b3a;
  --c-accent-h:  #c96a2a;
  --c-text:      #1a1a1a;
  --c-muted:     #6b6b6b;
  --c-success:   #2d7d46;
  --c-warning:   #b45309;
  --c-danger:    #b91c1c;
  --c-paid:      #166534;
  --radius:      10px;
  --shadow:      0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
  --shadow-lg:   0 4px 24px rgba(0,0,0,.12);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.55;
  font-size: 15px;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 56px 1fr;
  min-height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-logo {
  font-weight: 700;
  font-size: 16px;
  color: var(--c-primary);
  letter-spacing: -.3px;
}
.topbar-logo span { color: var(--c-accent); }

.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--c-muted);
}

.sidebar {
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--c-text);
  font-size: 14px;
  cursor: pointer;
  border-radius: 0;
  transition: background .15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar-item:hover { background: var(--c-bg); }
.sidebar-item.active {
  background: #e8f0f7;
  color: var(--c-primary);
  font-weight: 600;
  border-right: 3px solid var(--c-primary);
}
.sidebar-item .icon { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted);
  padding: 16px 20px 4px;
}

.sidebar-spacer { flex: 1; }

.main-content {
  padding: 28px 32px;
  overflow-y: auto;
  max-height: calc(100vh - 56px);
}

/* ---------- Cards ---------- */

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

.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
}

.card-body { padding: 20px 22px; }

/* ---------- Stats grid ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.stat-label { font-size: 12px; color: var(--c-muted); margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--c-muted); margin-top: 4px; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  line-height: 1.6;
}
.badge-pending  { background: #fef9c3; color: #854d0e; }
.badge-paid     { background: #dcfce7; color: #166534; }
.badge-done     { background: #dbeafe; color: #1e40af; }
.badge-cancelled{ background: #f3f4f6; color: #6b7280; }
.badge-warning  { background: #ffedd5; color: #9a3412; }
.badge-info     { background: #e0f2fe; color: #0c4a6e; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary   { background: var(--c-primary); color: #fff; }
.btn-primary:hover:not(:disabled)   { background: var(--c-primary-h); }
.btn-accent    { background: var(--c-accent); color: #fff; }
.btn-accent:hover:not(:disabled)    { background: var(--c-accent-h); }
.btn-outline   { background: transparent; border: 1px solid var(--c-border); color: var(--c-text); }
.btn-outline:hover:not(:disabled)   { background: var(--c-bg); }
.btn-ghost     { background: transparent; color: var(--c-primary); padding: 6px 10px; }
.btn-ghost:hover:not(:disabled)     { background: #e8f0f7; }
.btn-danger    { background: #fee2e2; color: var(--c-danger); }
.btn-danger:hover:not(:disabled)    { background: #fecaca; }
.btn-sm        { padding: 6px 12px; font-size: 13px; }
.btn-lg        { padding: 12px 24px; font-size: 15px; }
.btn-full      { width: 100%; }

/* ---------- Forms ---------- */

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-muted);
  margin-bottom: 5px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--c-border);
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  background: var(--c-surface);
  color: var(--c-text);
  transition: border-color .15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(42,94,138,.1);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--c-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--c-danger); margin-top: 4px; }

/* ---------- Table ---------- */

.table-wrap { overflow-x: auto; }
table, .data-table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 14px;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
}
tbody td {
  padding: 12px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafa; }

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--c-border);
  margin-bottom: 22px;
}
.tab-btn {
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: none;
  color: var(--c-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--c-text); }
.tab-btn.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }

/* ---------- Booking card ---------- */

.booking-card {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--c-surface);
  transition: box-shadow .15s;
}
.booking-card:hover { box-shadow: var(--shadow-lg); }

.booking-card + .booking-card { margin-top: 10px; }

.booking-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.booking-title { font-weight: 600; font-size: 15px; }
.booking-date  { font-size: 13px; color: var(--c-muted); margin-top: 2px; }
.booking-meta  { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.booking-meta-item {
  font-size: 13px;
  color: var(--c-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.booking-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--c-border);
}

/* ---------- Meeting format selector ---------- */

.format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.format-option {
  border: 2px solid var(--c-border);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.format-option:hover { border-color: var(--c-primary); background: #f0f6fc; }
.format-option.selected { border-color: var(--c-primary); background: #e8f0f7; }
.format-option .fmt-icon { font-size: 24px; margin-bottom: 6px; }
.format-option .fmt-label { font-size: 13px; font-weight: 500; }

/* ---------- Slot picker ---------- */

.slot-picker { }
.slot-days {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 14px;
}
.day-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  border: 1px solid var(--c-border);
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  background: var(--c-surface);
  transition: all .15s;
  text-align: center;
  min-width: 64px;
}
.day-btn:hover { border-color: var(--c-primary); }
.day-btn.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.day-btn .day-num { font-weight: 700; font-size: 16px; display: block; }
.day-btn .day-name { font-size: 11px; opacity: .8; }

.time-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.time-slot {
  padding: 8px 16px;
  border: 1px solid var(--c-border);
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
  background: var(--c-surface);
  transition: all .15s;
}
.time-slot:hover { border-color: var(--c-primary); color: var(--c-primary); }
.time-slot.selected { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.time-slot.booked { opacity: .35; cursor: not-allowed; text-decoration: line-through; }

/* ---------- Auth page ---------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg);
  padding: 24px;
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}
.auth-logo h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-primary);
}
.auth-logo h1 span { color: var(--c-accent); }
.auth-logo p { font-size: 13px; color: var(--c-muted); margin-top: 4px; }

.auth-tabs {
  display: flex;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  padding: 8px;
  font-size: 13px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--c-muted);
  transition: all .15s;
}
.auth-tab.active { background: var(--c-primary); color: #fff; font-weight: 600; }

.auth-divider {
  text-align: center;
  font-size: 12px;
  color: var(--c-muted);
  margin: 16px 0;
  position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--c-border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

/* ---------- Alert / Toast ---------- */

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-error   { background: #fee2e2; color: var(--c-danger); border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: var(--c-success); border: 1px solid #86efac; }
.alert-info    { background: #e0f2fe; color: #0c4a6e; border: 1px solid #7dd3fc; }
.alert-warning { background: #ffedd5; color: var(--c-warning); border: 1px solid #fdba74; }

/* ---------- Empty state ---------- */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--c-muted);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }
.empty-state .empty-hint { font-size: 13px; margin-top: 6px; }

/* ---------- Modal ---------- */

.modal-backdrop,
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--c-surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-weight: 600; font-size: 16px; }
.modal-close {
  border: none; background: none; cursor: pointer;
  font-size: 20px; color: var(--c-muted); padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--c-bg); }
.modal-body { padding: 20px 22px; }
.modal-footer {
  padding: 14px 22px 18px;
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Consultant-specific ---------- */

.client-contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  font-size: 14px;
}
.client-contact-row a { color: var(--c-primary); font-weight: 500; }

.slot-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.week-day-col { }
.week-day-header {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  padding: 6px 0;
  margin-bottom: 4px;
}
.week-slot {
  padding: 4px 6px;
  font-size: 12px;
  text-align: center;
  border: 1px solid var(--c-border);
  border-radius: 5px;
  margin-bottom: 4px;
  cursor: pointer;
  background: var(--c-surface);
}
.week-slot:hover { background: #f0f6fc; }
.week-slot.booked { background: #fef9c3; border-color: #fde047; }
.week-slot.blocked { background: #f3f4f6; color: var(--c-muted); cursor: default; }

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 56px auto 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--c-border);
    flex-direction: row;
    padding: 8px;
    overflow-x: auto;
    gap: 0;
  }
  .sidebar-item {
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    font-size: 11px;
    min-width: 60px;
  }
  .sidebar-item .icon { font-size: 20px; }
  .sidebar-item.active { border-right: none; border-bottom: 2px solid var(--c-primary); }
  .sidebar-section, .sidebar-spacer { display: none; }
  .main-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .slot-week-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Spinner ---------- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 10px;
  color: var(--c-muted);
  font-size: 14px;
}

/* ---------- Notification dot ---------- */
.notif-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--c-accent);
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
}
