/* ===== Dental CRM — стили ===== */

/* Кнопка мессенджера MAX (фирменный фиолетово-синий градиент) */
.btn-max {
  background: linear-gradient(135deg, #6d5dfc, #4a6cf7);
  color: #fff;
  border: none;
}

.btn-max:hover {
  filter: brightness(1.06);
  color: #fff;
}

/* ===== Зубная карта: кнопка «новая карта» и архив ===== */
.new-chart-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.new-chart-form .input-sm {
  padding: 6px 10px;
  border: 1px solid #d4dbe6;
  border-radius: 8px;
  font-size: 13px;
  min-width: 180px;
}
.chart-archive {
  border: 1px solid #e4e9f1;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fafbfd;
  overflow: hidden;
}
.chart-archive > summary {
  cursor: pointer;
  padding: 12px 14px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  user-select: none;
}
.chart-archive > summary::-webkit-details-marker {
  display: none;
}
.chart-archive > summary::before {
  content: '▸';
  color: #7d8aa5;
  transition: transform 0.15s;
}
.chart-archive[open] > summary::before {
  transform: rotate(90deg);
}
.chart-archive[open] > summary {
  background: #f1f5fb;
  border-bottom: 1px solid #e4e9f1;
}
.chart-archive-body {
  padding: 14px;
}
.archive-section {
  margin-bottom: 14px;
}
.archive-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: #48566b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.archive-teeth {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.archive-tooth {
  display: inline-flex;
  min-width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-weight: 600;
  font-size: 13px;
  padding: 0 6px;
}
.archive-notes {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: #48566b;
}
.archive-notes li {
  margin-bottom: 4px;
}
.table-compact th,
.table-compact td {
  padding: 6px 8px;
  font-size: 13px;
}

/* Зубная карта внутри архивного снимка — только для просмотра */
.archive-board {
  background: linear-gradient(180deg, #f7fbff 0%, #eef5fb 100%);
  border: 1px solid #e4e9f1;
  border-radius: 12px;
  padding: 14px 6px;
  margin-bottom: 6px;
}
.archive-board .tooth2 {
  cursor: default;
}
.archive-board .tooth2:hover .tooth-path {
  fill: var(--tooth-fill, #7c8aa0);
}

/* ===== Бейдж первичного / повторного пациента ===== */
.badge-primary {
  background: #7c3aed;
  color: #fff;
}
.badge-returning {
  background: #0fb5ae;
  color: #fff;
}

/* Матрица процентов врачей за услугу */
.doctor-rates {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 4px 0 6px;
}
.doctor-rates legend {
  font-weight: 700;
  color: #334155;
  padding: 0 6px;
}
.rate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px 16px;
}
.rate-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed #eef2f7;
}
.rate-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.rate-input {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: #64748b;
}
.rate-input input {
  width: 90px;
  text-align: right;
}

/* ===== Зарплатный отчёт ===== */
.payroll-filter {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.payroll-filter label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}
.payroll-filter input,
.payroll-filter select {
  width: auto;
  min-width: 160px;
}
.payroll-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.chip-link {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: #eef1f7;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.chip-link:hover {
  background: #e2e8f0;
  text-decoration: none;
}
.chip-link.active {
  background: #4f46e5;
  color: #fff;
}
.payroll-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 10px;
}
.ptotal {
  background: #f7f8fd;
  border: 1px solid #e6e9f0;
  border-radius: 12px;
  padding: 16px 18px;
}
.ptotal-label {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 6px;
}
.ptotal-value {
  font-size: 22px;
  font-weight: 700;
}
.ptotal-accent {
  background: linear-gradient(120deg, #ecfdf5, #d1fae5);
  border-color: #a7f3d0;
}
.ptotal-accent .ptotal-value {
  color: #15803d;
}

/* ===== Обзвон / напоминания ===== */
.btn-success {
  background: #16a34a;
  color: #fff;
}
.btn-success:hover {
  background: #15803d;
  color: #fff;
}
.reminder-done {
  background: #f0fdf4 !important;
}
.called-badge {
  display: inline-block;
  background: #dcfce7;
  color: #15803d;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.phone-link {
  font-weight: 600;
  white-space: nowrap;
}
.link-text {
  color: var(--text);
  font-weight: 600;
}
.link-text:hover {
  color: var(--primary);
}

/* ===== Баннер обзвона на дашборде ===== */
.remind-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  margin-bottom: 22px;
  border-radius: 14px;
  background: linear-gradient(120deg, #fff7ed, #ffedd5);
  border: 1px solid #fed7aa;
  color: #9a3412;
  text-decoration: none;
  transition: 0.15s;
}
.remind-banner:hover {
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.18);
  transform: translateY(-1px);
}
.remind-ico {
  font-size: 26px;
  line-height: 1;
}
.remind-text {
  flex: 1;
  font-weight: 500;
}
.remind-text b {
  font-weight: 800;
}
.remind-go {
  font-weight: 700;
  white-space: nowrap;
  color: #c2410c;
}

/* ===== Печать отчётов ===== */

@media print {
  .sidebar,
  .sidebar-overlay,
  .topbar,
  .no-print {
    display: none !important;
  }
  .content {
    margin-left: 0 !important;
  }
  .page-body {
    padding: 0 !important;
  }
  .card {
    box-shadow: none !important;
    border: 1px solid #e6e9f0;
    page-break-inside: avoid;
  }
  body {
    background: #fff;
  }
}

:root {
  --primary: #4f8cff;
  --primary-d: #3a73e0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #8a94a6;
  --border: #e6e9f0;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(30, 41, 59, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ===== Layout ===== */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background: #0f172a;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 22px;
  font-size: 20px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand-logo {
  font-size: 26px;
}
.brand-name b {
  color: var(--primary);
}

.nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: #cbd5e1;
  font-weight: 500;
}
.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
  color: #fff;
}
.nav-link.active {
  background: var(--primary);
  color: #fff;
}
.nav-link .ico {
  font-size: 18px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.user-card {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
}
.user-name {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}
.user-role {
  color: var(--muted);
  font-size: 12px;
}
.logout {
  display: block;
  color: #f87171;
  font-size: 14px;
}

.content {
  flex: 1;
  margin-left: 250px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 30px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-title {
  font-size: 22px;
}
.topbar-date {
  color: var(--muted);
}
.page-body {
  padding: 26px 30px;
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 22px;
}
.card.narrow {
  max-width: 640px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}
.card-header h2 {
  font-size: 18px;
}
.muted {
  color: var(--muted);
}
.mb0 {
  margin-bottom: 0;
}

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-ico {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
}
.stat-label {
  color: var(--muted);
  font-size: 13px;
}

/* ===== Tables ===== */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}
.table tbody tr:hover {
  background: #fafbfe;
}
.table tr.clickable {
  cursor: pointer;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}
.btn:hover {
  text-decoration: none;
  opacity: 0.92;
}
.btn-sm {
  padding: 7px 13px;
  font-size: 13px;
}
.btn-block {
  width: 100%;
  justify-content: center;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-d);
  color: #fff;
}
.btn-secondary {
  background: #eef1f7;
  color: #475569;
}
.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
}
.link {
  font-size: 17px;
}
.link-danger {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
}
.inline {
  display: inline;
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.badge-soft {
  background: #eef1f7;
  color: #475569;
}
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* ===== Alerts ===== */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-weight: 500;
}
.alert-success {
  background: #dcfce7;
  color: #166534;
}
.alert-danger {
  background: #fee2e2;
  color: #991b1b;
}

/* ===== Forms ===== */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.form label,
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
}
.form label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
input,
select,
textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  width: 100%;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
}
input[type='color'] {
  padding: 4px;
  height: 42px;
}
input[type='checkbox'] {
  width: auto;
}
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.search-bar,
.schedule-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.search-bar input {
  max-width: 340px;
}
.schedule-bar input[type='date'],
.schedule-bar select {
  max-width: 200px;
}

/* ===== Login ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #4f8cff, #6c5ce7);
}
.login-box {
  background: #fff;
  padding: 38px;
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.login-brand {
  text-align: center;
  margin-bottom: 24px;
}
.login-brand .brand-logo {
  font-size: 44px;
}
.login-brand h1 {
  margin: 8px 0 4px;
}
.login-brand h1 b {
  color: var(--primary);
}
.login-brand p {
  color: var(--muted);
  font-size: 13px;
}
.login-form {
  gap: 16px;
}
.login-hint {
  margin-top: 22px;
  padding: 14px;
  background: #f4f6fb;
  border-radius: 10px;
  font-size: 13px;
  color: #475569;
}
.login-hint code {
  background: #e2e8f0;
  padding: 1px 6px;
  border-radius: 4px;
}

/* ===== Patient header ===== */
.patient-head {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.patient-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Dental chart ===== */
.legend {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}
.legend .lg {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  margin-right: 4px;
  vertical-align: middle;
  border: 1px solid var(--border);
}
/* ===== Анатомическая зубная карта (челюсть) ===== */
.jaw {
  position: relative;
  background: radial-gradient(ellipse at 50% 50%, #fff 0%, #fbe9ec 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 30px 16px;
  margin-top: 12px;
  overflow-x: auto;
}
.arch {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 4px;
  min-width: 760px;
  padding: 0 10px;
}
.arch-lower {
  align-items: flex-start;
}
.jaw-gap {
  height: 26px;
}
.jaw-label {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 4px 0;
}
.jaw-side {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.jaw-side-r {
  left: 10px;
}
.jaw-side-l {
  right: 10px;
}

.tooth {
  position: relative;
  width: 38px;
  height: 64px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: 0.12s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0;
  transform-origin: bottom center;
}
.arch-lower .tooth {
  justify-content: flex-start;
  transform-origin: top center;
}
.tooth:hover {
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.18));
  z-index: 5;
}

/* Коронка зуба — рисуем форму через border-radius */
.tooth-crown {
  width: 30px;
  height: 40px;
  background: #ffffff;
  border: 2px solid #cfd6e4;
  border-radius: 48% 48% 42% 42% / 60% 60% 40% 40%;
  box-shadow: inset 0 -6px 8px rgba(0, 0, 0, 0.04);
  transition: 0.12s;
}
.arch-lower .tooth-crown {
  border-radius: 42% 42% 48% 48% / 40% 40% 60% 60%;
}
/* Моляры шире, резцы уже */
.tooth-molar .tooth-crown {
  width: 36px;
  height: 38px;
  border-radius: 42% 42% 38% 38% / 55% 55% 45% 45%;
}
.tooth-premolar .tooth-crown {
  width: 30px;
  height: 40px;
}
.tooth-canine .tooth-crown {
  width: 26px;
  height: 46px;
  border-radius: 50% 50% 40% 40% / 70% 70% 30% 30%;
}
.tooth-incisor .tooth-crown {
  width: 24px;
  height: 44px;
  border-radius: 30% 30% 40% 40% / 50% 50% 50% 50%;
}

.tooth-num {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  margin-top: 3px;
}
.arch-lower .tooth-num {
  margin-top: 0;
  margin-bottom: 3px;
  order: -1;
}
.tooth-badge {
  position: absolute;
  top: -2px;
  right: 0;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  z-index: 6;
}
.tooth:hover .tooth-crown {
  border-color: var(--primary);
}
.tooth.tooth-done .tooth-crown {
  background: #dcfce7;
  border-color: #4ade80;
}
.tooth.tooth-progress .tooth-crown {
  background: #fef9c3;
  border-color: #facc15;
}
.tooth.tooth-planned .tooth-crown {
  background: #dbeafe;
  border-color: #60a5fa;
}

/* ===== Timeline (schedule) ===== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.timeline-item {
  display: flex;
  gap: 16px;
  align-items: center;
  background: #f8fafc;
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 12px 16px;
}
.timeline-time {
  font-weight: 700;
  min-width: 56px;
  text-align: center;
}
.timeline-time small {
  color: var(--muted);
  font-weight: 500;
}
.timeline-body {
  flex: 1;
}
.timeline-title {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.timeline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal.hidden {
  display: none;
}
.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
}

/* Кнопка-гамбургер (видна только на мобильных) */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
  padding: 4px 8px;
  margin-right: 4px;
}
/* Затемнение под открытым меню */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 90;
}
.sidebar-overlay.show {
  display: block;
}
body.no-scroll {
  overflow: hidden;
}

@media (max-width: 900px) {
  /* Сайдбар уезжает за экран, выезжает по кнопке */
  .sidebar {
    width: 250px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 100;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
  }
  /* На мобильных показываем полные подписи в меню */
  .brand-name,
  .nav-link span,
  .user-meta,
  .logout {
    display: inline;
  }
  .content {
    margin-left: 0;
  }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
  }
  .topbar {
    gap: 8px;
  }
  .page-title {
    font-size: 18px;
  }
  .page-body {
    padding: 16px 14px;
  }
  .dental-chart,
  .form-row {
    grid-template-columns: 1fr;
  }
  /* Широкие таблицы — горизонтальная прокрутка вместо «разъезда» */
  .card {
    padding: 16px;
  }
  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .topbar-date {
    display: none;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Combobox с поиском пациента ===== */
.combo {
  position: relative;
}
.combo-input {
  width: 100%;
}
.combo-list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 260px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px;
}
.combo-item {
  padding: 9px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 14px;
}
.combo-item:hover {
  background: var(--bg);
}
.combo-new {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  color: var(--primary);
  font-weight: 600;
}

/* ===== Сетка расписания (день) ===== */
.schedule-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.schedule-bar input[type='date'],
.schedule-bar select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
}
.schedule-legend {
  font-size: 13px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.slot-free-demo {
  display: inline-block;
  width: 26px;
  height: 16px;
  border-radius: 5px;
  background: #eef6ff;
  border: 1px dashed var(--primary);
}
.sched-grid-wrap {
  overflow-x: auto;
}
.sched-grid {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}
.sched-grid th,
.sched-grid td {
  border: 1px solid var(--border);
}
.sched-grid thead th {
  background: var(--bg);
  padding: 10px 8px;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}
.sched-grid .time-col {
  width: 64px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  background: #fafbfe;
  white-space: nowrap;
}
.doc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.doc-head-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}
.doc-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}
.doc-spec {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.slot {
  height: 34px;
  vertical-align: top;
  padding: 4px 6px;
  transition: background 0.15s;
}

.slot-free {
  background: #eef6ff;
  cursor: pointer;
  text-align: center;
}
.slot-free:hover {
  background: #d9ebff;
}
.slot-plus {
  color: var(--primary);
  font-weight: 700;
  font-size: 18px;
  opacity: 0.5;
}
.slot-off {
  background: repeating-linear-gradient(45deg, #f3f4f7, #f3f4f7 6px, #eceef3 6px, #eceef3 12px);
}
.slot-busy {
  cursor: pointer;
  background: #fff;
}
.slot-busy:hover {
  background: #f8fafc;
}
.slot-patient {
  font-weight: 600;
  font-size: 13px;
}
.slot-meta {
  font-size: 11px;
  margin: 2px 0 4px;
}

/* ===== Таблица графиков ===== */
.sched-table .sched-cell {
  white-space: nowrap;
}
.shift-badge {
  display: inline-block;
  background: #eef6ff;
  color: var(--primary-d);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 12px;
  margin: 1px 2px;
}

/* ===== Редактор графика врача ===== */
.day-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.day-name {
  width: 130px;
  font-weight: 600;
  padding-top: 8px;
}
.day-shifts {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.shift-input {
  display: flex;
  align-items: center;
  gap: 6px;
}
.shift-input input[type='time'] {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.link-danger {
  background: none;
  border: none;
  color: #dc3545;
  cursor: pointer;
  font-size: 15px;
}

/* ===== Новая зубная карта (2 ряда, SVG) ===== */
.chart-card {
  background: linear-gradient(180deg, #f7fbff 0%, #eef5fb 100%);
}
.chart-filters {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 6px 0 18px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #475569;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.chip input {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}

.teeth-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 0;
}
.teeth-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  min-width: 760px;
  padding: 0 12px;
}
.jaw-divider {
  display: flex;
  justify-content: space-between;
  max-width: 760px;
  margin: 2px auto;
  width: 100%;
  padding: 0 16px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.tooth2 {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  width: 44px;
  flex: 0 0 auto;
}
.tooth2-shape {
  position: relative;
  display: block;
  width: 44px;
  height: 52px;
}
.row-lower .tooth2-shape {
  transform: scaleY(-1);
}
.tooth-svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.12));
}
.tooth-path {
  fill: var(--tooth-fill, #7c8aa0);
  stroke: #5f6b7e;
  stroke-width: 1.5;
  transition: 0.15s;
}

/* ===== Клинический статус зуба (цвет коронки по диагнозу) ===== */
.tooth2-clin {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: 700;
  color: var(--tooth-ink, #1f2d3d);
  pointer-events: none;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
  z-index: 2;
}
.row-lower .tooth2-clin {
  transform: translate(-50%, -50%) scaleY(-1);
}
.tooth2.clin-extracted .tooth2-shape,
.tooth2.clin-missing .tooth2-shape {
  opacity: 0.55;
}

/* ===== Легенда клинических статусов ===== */
.clin-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
}
.clin-legend .lg {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  vertical-align: -2px;
  margin-right: 3px;
}

/* ===== Блок выбора состояния зуба в модалке ===== */
.tooth-status-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.tooth-status-title {
  font-weight: 600;
  margin-bottom: 10px;
}
.status-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.status-opt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.status-opt:hover {
  border-color: #9fb0c9;
}
.status-opt .status-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--s-color, #ccc);
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.status-opt.active {
  background: var(--s-color, #eef);
  color: var(--s-ink, #1f2d3d);
  border-color: var(--s-color, #9fb0c9);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.tooth2:hover .tooth-path {
  fill: #5a6a82;
}

.tooth2.tooth-done .tooth-path {
  fill: #ef5777;
  stroke: #d63a5c;
}
.tooth2.tooth-progress .tooth-path {
  fill: #f6c945;
  stroke: #e0ad1f;
}
.tooth2.tooth-planned .tooth-path {
  fill: #38c0e8;
  stroke: #1fa2cc;
}

.tooth2-num {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.row-lower .tooth2-num {
  transform: translate(-50%, -50%) scaleY(-1);
}
.tooth2-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid #fff;
}
.row-lower .tooth2-badge {
  transform: scaleY(-1);
  top: auto;
  bottom: -3px;
}

/* Легенда — обновлённые цвета под карту */
.lg.tooth-done {
  background: #ef5777;
}
.lg.tooth-progress {
  background: #f6c945;
}
.lg.tooth-planned {
  background: #38c0e8;
}

/* ===== Месячный календарь записей ===== */
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cal-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cal-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #eef1f7;
  color: #475569;
  font-size: 20px;
  line-height: 1;
  text-decoration: none;
}
.cal-arrow:hover {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}
.cal-month {
  font-size: 18px;
  margin-left: 6px;
}

.calendar {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-head .cal-hcell {
  padding: 10px 8px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.cal-cell {
  min-height: 118px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fff;
}
.cal-cell:nth-child(7n) {
  border-right: none;
}
.cal-out {
  background: #fafbfe;
}
.cal-out .cal-date span {
  color: #c2cad8;
}
.cal-today {
  background: #eef6ff;
}
.cal-today .cal-date span {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: #334155;
  font-size: 14px;
  min-height: 24px;
}
.cal-add {
  opacity: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  text-decoration: none;
  transition: 0.12s;
}
.cal-cell:hover .cal-add {
  opacity: 1;
}
.cal-add:hover {
  text-decoration: none;
  background: var(--primary-d);
}
.cal-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-event {
  display: flex;
  flex-direction: column;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 12px;
  color: #1f2937;
  text-decoration: none;
  line-height: 1.25;
  overflow: hidden;
}
.cal-event:hover {
  text-decoration: none;
  filter: brightness(0.96);
}
.cal-event-time {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
}
.cal-event-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-more {
  font-size: 11px;
  color: var(--muted);
  padding-left: 4px;
}

@media (max-width: 720px) {
  .cal-cell {
    min-height: 84px;
  }
  .cal-event-name {
    font-size: 11px;
  }
}

/* ===== Быстрые шаблоны диагнозов в карточке пациента ===== */
.quickfill {
  background: #f6f8fc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.quickfill-title {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}
.quickfill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.qchip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.qchip:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}
.qchip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 140, 255, 0.35);
}
/* ===== Быстрые шаблоны диагнозов в карточке пациента ===== */
.quickfill {
  background: #f6f8fc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.quickfill-title {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}
.quickfill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.qchip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.qchip:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}
.qchip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 140, 255, 0.35);
}

/* ===== Комментарий к зубу (в модалке лечения) ===== */
.tooth-note-box {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

/* ===== Индикатор комментария на зубе ===== */
.tooth2-note {
  position: absolute;
  top: -6px;
  left: -4px;
  font-size: 12px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
  pointer-events: none;
}
.row-lower .tooth2-note {
  transform: scaleY(-1);
}
.tooth2.has-note .tooth-path {
  stroke: #f59e0b;
  stroke-width: 2.5;
}

/* ===== Загрузка файлов / снимков пациента ===== */
.upload-panel {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 18px;
}
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 22px 16px;
  border: 2px dashed #c4cfe3;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8faff, #eef3fc);
  cursor: pointer;
  transition: 0.18s;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: #eaf1ff;
}
.dropzone.has-file {
  border-style: solid;
  border-color: #22c55e;
  background: #f0fdf4;
}
.dropzone input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.dropzone-ico {
  font-size: 34px;
  line-height: 1;
}
.dropzone-text {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}
.dropzone-text b {
  color: var(--primary);
}
.dropzone-hint {
  font-size: 12px;
  color: var(--muted);
}
.upload-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}
.upload-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}
.upload-field select,
.upload-field input[type='text'] {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  font-weight: 400;
}
.upload-submit {
  align-self: flex-start;
}
@media (max-width: 640px) {
  .upload-panel {
    grid-template-columns: 1fr;
  }
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.file-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.file-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 130px;
  background: #f1f4f9;
  overflow: hidden;
}
.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.file-ico {
  font-size: 44px;
}
.file-meta {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.file-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

/* ===== Действия в строке таблицы (редактировать / удалить) ===== */
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.row-actions .inline {
  display: inline;
  margin: 0;
}
.row-actions .link-danger {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
  opacity: 0.75;
  transition: 0.15s;
}
.row-actions .link-danger:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* ===== Зона удаления записи (в форме редактирования) ===== */
.form-danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px dashed #f1c0c0;
  border-radius: 12px;
  background: #fdf4f4;
}
.form-danger-zone .inline {
  margin: 0;
}

/* ===================================================================== */
/* ===== Современный дашборд ============================================ */
/* ===================================================================== */

/* Приветственный баннер */
.hero-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 26px 28px;
  margin-bottom: 22px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(120deg, #4f46e5 0%, #7c3aed 50%, #2563eb 100%);
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.28);
  position: relative;
  overflow: hidden;
}
.hero-banner::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -60px;
  width: 220px;
  height: 220px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}
.hero-text h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
}
.hero-text p {
  margin: 0;
  opacity: 0.92;
  text-transform: capitalize;
}
.hero-actions {
  display: flex;
  gap: 10px;
  position: relative;
  z-index: 1;
}
.btn-light {
  background: #fff;
  color: #4f46e5;
  font-weight: 600;
}
.btn-light:hover {
  background: #f1f1ff;
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Дополнительная подпись в KPI-карточке */
.stat-sub {
  margin-top: 3px;
  font-size: 12px;
  color: #16a34a;
  font-weight: 600;
}
.stat-card {
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(31, 41, 55, 0.12);
}

/* Двухколоночная раскладка */
.dash-cols {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  align-items: start;
}
.dash-main,
.dash-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Мини-график выручки */
.bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  height: 170px;
  padding: 10px 4px 0;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
}
.bar-value {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  height: 14px;
}
.bar {
  width: 70%;
  max-width: 40px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #818cf8, #4f46e5);
  transition: filter 0.15s ease;
}
.bar:hover {
  filter: brightness(1.1);
}
.bar-today {
  background: linear-gradient(180deg, #34d399, #059669);
}
.bar-label {
  font-size: 12px;
  color: var(--muted);
}

/* Пустое состояние */
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
}
.empty-ico {
  font-size: 40px;
  margin-bottom: 8px;
}

/* Список статусов */
.status-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.status-list li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-bar {
  flex: 1;
  height: 8px;
  background: #eef0f6;
  border-radius: 999px;
  overflow: hidden;
}
.status-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
}

/* Ближайшие приёмы */
.upcoming-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.upcoming-list li + li {
  border-top: 1px solid var(--border);
}
.upcoming-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 4px;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
}
.upcoming-item:hover {
  background: #f7f8fd;
}
.up-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 46px;
  padding: 6px 0;
  border-radius: 10px;
  background: #eef2ff;
  color: #4f46e5;
  line-height: 1.1;
}
.up-date small {
  font-size: 11px;
  opacity: 0.8;
}
.up-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.up-name {
  font-weight: 600;
}
.up-doc {
  font-size: 12px;
  color: var(--muted);
}

/* Быстрые действия */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  border-radius: 12px;
  background: #f7f8fd;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text, #1f2937);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.quick-btn:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  transform: translateY(-2px);
}
.quick-btn span {
  font-size: 13px;
}
.quick-btn:first-child {
  font-size: 22px;
}

/* Кнопка-ссылка удаления в таблицах */
.link-danger {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 2px 4px;
  opacity: 0.7;
}
.link-danger:hover {
  opacity: 1;
}

/* Адаптив дашборда */
@media (max-width: 900px) {
  .dash-cols {
    grid-template-columns: 1fr;
  }
  .hero-text h1 {
    font-size: 22px;
  }
}

/* ===== Дополнения: склад, аналитика, аудит, поиск, планы ===== */
.topbar-search {
  flex: 1;
  max-width: 420px;
  margin: 0 16px;
}
.topbar-search input {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  font-size: 14px;
}
.topbar-search input:focus {
  outline: none;
  border-color: #0ea5e9;
  background: #fff;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}
.stats-row .stat-card {
  flex: 1 1 150px;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.stats-row .stat-card .stat-label {
  color: #64748b;
  font-size: 13px;
}
.stats-row .stat-card .stat-value {
  font-size: 22px;
  font-weight: 700;
}
.stat-card.stat-warn {
  border-color: #f59e0b;
  background: #fffbeb;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.qty-low {
  color: #b91c1c;
  font-weight: 600;
}
.badge-danger {
  background: #fee2e2;
  color: #b91c1c;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 11px;
  margin-left: 4px;
}
.inline-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #64748b;
  font-size: 13px;
}
.inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 13px;
}

.pagination {
  display: flex;
  gap: 6px;
  padding: 14px;
  flex-wrap: wrap;
}
.page-link {
  padding: 5px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #334155;
  text-decoration: none;
}
.page-link.active {
  background: #0ea5e9;
  color: #fff;
  border-color: #0ea5e9;
}

.modal.open {
  display: flex !important;
}
.move-form {
  gap: 4px;
}
.link {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
}
.link-danger {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: #b91c1c;
}

@media (max-width: 700px) {
  .topbar-search {
    display: none;
  }
}

/* ===================== Нужды (Needs) ===================== */
.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) {
  .grid-2-1 {
    grid-template-columns: 1fr;
  }
}

/* Сегментированный переключатель фильтров */
.seg {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
}
.seg-btn.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.needs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 0;
}
.need-item {
  display: flex;
  align-items: stretch;
  gap: 12px;
  background: #fff;
  border: 1px solid #e9eef5;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.need-item:hover {
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
}
.need-item.is-done {
  opacity: 0.62;
}
.need-bar {
  width: 6px;
  flex: 0 0 6px;
}
.need-body {
  flex: 1;
  padding: 12px 4px 12px 0;
  min-width: 0;
}
.need-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.need-title {
  font-weight: 700;
  color: #1e293b;
  font-size: 15px;
}
.need-item.is-done .need-title {
  text-decoration: line-through;
}
.need-details {
  margin-top: 6px;
  color: #475569;
  font-size: 14px;
  white-space: pre-wrap;
}
.need-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: #94a3b8;
  font-size: 12px;
}
.need-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px;
  border-left: 1px solid #f1f5f9;
  white-space: nowrap;
}

/* Цветовой акцент карточки по срочности */
.need-item.urg-urgent {
  border-color: #f5c2c5;
}
.need-item.urg-fast {
  border-color: #ffe0b3;
}

/* Выбор срочности в форме */
.urgency-pick {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.urg-opt {
  cursor: pointer;
}
.urg-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.urg-chip {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  color: #475569;
  background: #f1f5f9;
  border: 2px solid transparent;
  transition: all 0.12s;
}
.urg-opt input:checked + .urg-chip {
  color: #fff;
  background: var(--c);
  border-color: var(--c);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}
.hint {
  font-size: 12px;
  margin-top: 8px;
}
.req {
  color: #dc2626;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.form-group label {
  font-weight: 600;
  font-size: 14px;
  color: #334155;
}
