/* NOTVIN — лабораторная кастомизация админки Easy!Appointments.
   Только визуальный слой: цвета, типографика, отступы, календарь.
   Не меняет бизнес-логику записи. Файл можно заменить при обновлении EA. */

@font-face {
  font-family: "Onest";
  src: url("/assets/fonts/notvin/Onest-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --notvin-navy: #1c2b3a;
  --notvin-navy-deep: #12202c;
  --notvin-copper: #a2663f;
  --notvin-copper-dark: #86512f;
  --notvin-ivory: #f7f3ea;
  --notvin-paper: #fffdf8;
  --notvin-line: #d9d2c5;
  --notvin-muted: #6f6a61;
  --notvin-success: #4f7a5a;
  --notvin-danger: #a44a37;
}

body {
  font-family: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f3eee4;
  color: #24313c;
}

h1, h2, h3, h4, h5,
.h1, .h2, .h3, .h4, .h5 {
  color: var(--notvin-navy);
  letter-spacing: -0.01em;
}

a { color: var(--notvin-copper-dark); }
a:hover { color: var(--notvin-navy); }

/* Шапка: убираем зеленый брендинг EA, оставляем спокойный navy. */
#header.navbar {
  background: var(--notvin-navy) !important;
  box-shadow: 0 2px 10px rgba(18, 32, 44, .18);
}

#header .nav-link {
  color: rgba(255, 253, 248, .82) !important;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .01em;
}

#header .nav-link:hover,
#header .nav-link.active {
  color: #fffdf8 !important;
}

#header .nav-item.active > .nav-link,
#header .nav-link.active {
  background: rgba(162, 102, 63, .85) !important;
  border-radius: 8px;
  margin-top: 4px;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

#header .dropdown-menu {
  border: 1px solid var(--notvin-line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(18, 32, 44, .16);
}

#header-logo {
  padding: .65rem .9rem !important;
}

#header-logo .notvin-brand-name {
  display: block;
  color: #fffdf8;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.2;
}

#header-logo .notvin-brand-role {
  display: block;
  color: rgba(255, 253, 248, .62);
  font-size: 11.5px;
  line-height: 1.35;
  margin-top: 2px;
}

/* Основные кнопки. */
.btn-primary,
.btn-success,
.bg-primary {
  background-color: var(--notvin-copper) !important;
  border-color: var(--notvin-copper) !important;
  color: #fffdf8 !important;
  border-radius: 8px;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-success:hover,
.btn-success:focus {
  background-color: var(--notvin-copper-dark) !important;
  border-color: var(--notvin-copper-dark) !important;
}

.btn-light {
  border: 1px solid var(--notvin-line);
  border-radius: 8px;
  background: var(--notvin-paper);
  color: var(--notvin-navy);
}

.btn-outline-secondary {
  border-radius: 8px;
}

/* Карточки, формы, модальные окна. */
.card, .modal-content, .dropdown-menu, .list-group-item {
  border-color: var(--notvin-line);
  border-radius: 12px;
}

.card {
  box-shadow: 0 2px 10px rgba(18, 32, 44, .05);
}

.modal-header {
  background: var(--notvin-navy);
  color: #fffdf8;
  border-radius: 12px 12px 0 0;
}

.modal-header .btn-close { filter: invert(1); opacity: .8; }

.form-control, .form-select {
  border-color: var(--notvin-line);
  border-radius: 8px;
  background-color: #fffefa;
}

.form-control:focus, .form-select:focus {
  border-color: var(--notvin-copper);
  box-shadow: 0 0 0 .2rem rgba(162, 102, 63, .16);
}

.form-label {
  font-size: 13.5px;
  font-weight: 550;
  color: #3d4a55;
}

/* Таблицы. */
.table {
  --bs-table-color: #24313c;
  font-size: 14px;
}

.table > :not(caption) > * > * {
  padding: .8rem .9rem;
  border-bottom-color: #e8e1d4;
}

.table thead th {
  color: var(--notvin-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom-color: var(--notvin-line);
}

/* Календарь: меньше визуального шума, выше строки, спокойные границы. */
#calendar, .fc {
  font-family: "Onest", system-ui, sans-serif;
  font-size: 13.5px;
  color: #24313c;
}

.fc .fc-toolbar-title {
  font-size: 21px;
  font-weight: 650;
  color: var(--notvin-navy);
}

.fc .fc-button-primary {
  background: var(--notvin-navy) !important;
  border-color: var(--notvin-navy) !important;
  border-radius: 8px;
}

.fc .fc-button-primary:hover,
.fc .fc-button-primary.fc-button-active {
  background: var(--notvin-copper) !important;
  border-color: var(--notvin-copper) !important;
}

.fc-theme-standard td,
.fc-theme-standard th,
.fc-theme-standard .fc-scrollgrid {
  border-color: #e6dfd2;
}

.fc .fc-col-header-cell-cushion {
  color: var(--notvin-muted);
  font-weight: 600;
  font-size: 12.5px;
  padding: 8px 4px;
}

.fc .fc-timegrid-slot {
  height: 27px;
}

.fc .fc-timegrid-slot-label-cushion {
  color: var(--notvin-muted);
  font-size: 11.5px;
}

.fc .fc-timegrid-now-indicator-line {
  border-color: var(--notvin-copper);
}

.fc .fc-event {
  border: 0;
  border-radius: 7px;
  padding: 3px 6px;
  font-size: 12px;
  box-shadow: 0 1px 3px rgba(18, 32, 44, .12);
}

.fc .fc-daygrid-event {
  border-radius: 6px;
}

#calendar .fc-timegrid-axis-cushion,
#calendar .fc-timegrid-slot-label-cushion {
  padding-right: 8px;
}

/* Правая панель/подсказки и служебные элементы. */
#footer {
  background: #efe8db !important;
  border-top-color: var(--notvin-line) !important;
  color: var(--notvin-muted);
  font-size: 11.5px;
}

#footer a { color: var(--notvin-copper-dark); }

/* Памятка для сотрудников, доступная из подвала на каждой странице. */
.notvin-help-trigger {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  padding: .35rem .65rem;
  border: 1px solid var(--notvin-line);
  border-radius: 8px;
  background: var(--notvin-paper);
  color: var(--notvin-copper-dark);
  font-size: 13px;
  font-weight: 600;
}

.notvin-help-trigger:hover {
  border-color: var(--notvin-copper);
  color: var(--notvin-navy);
}

.notvin-help-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
}

.notvin-help-trigger:focus-visible,
.notvin-help-section > summary:focus-visible {
  outline: 3px solid var(--notvin-copper);
  outline-offset: 3px;
}

#notvin-help-modal .modal-dialog {
  width: calc(100% - 1.5rem);
  max-width: 820px;
  height: calc(100% - 1.5rem);
  margin: .75rem auto;
}

#notvin-help-modal .modal-header {
  align-items: flex-start;
}

#notvin-help-modal .modal-title {
  font-size: 21px;
  line-height: 1.35;
}

#notvin-help-modal .modal-header .btn-close {
  flex-shrink: 0;
  padding: .65rem;
  margin: -.3rem -.3rem -.3rem auto;
}

.notvin-help {
  background: var(--notvin-paper);
  font-size: 14px;
  line-height: 1.6;
}

.notvin-help-intro {
  color: var(--notvin-muted);
}

.notvin-help-callout {
  padding: .85rem 1rem;
  border-left: 3px solid var(--notvin-copper);
  border-radius: 0 8px 8px 0;
  background: var(--notvin-ivory);
}

.notvin-help-callout strong {
  display: block;
  margin-bottom: .25rem;
}

.notvin-help-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1rem 0;
}

.notvin-help-status {
  padding: .3rem .6rem;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.notvin-help-status--pending { background: #f0a343; color: var(--notvin-navy-deep); }
.notvin-help-status--confirmed { background: var(--notvin-success); color: #fff; }
.notvin-help-status--cancelled { background: var(--notvin-danger); color: #fff; }

.notvin-help-section {
  margin-top: .65rem;
  border: 1px solid var(--notvin-line);
  border-radius: 9px;
  overflow-wrap: break-word;
}

.notvin-help-section > summary {
  padding: .85rem 1rem;
  color: var(--notvin-navy);
  font-weight: 600;
  cursor: pointer;
}

.notvin-help-section > summary::marker {
  color: var(--notvin-copper-dark);
}

.notvin-help-section[open] > summary {
  border-bottom: 1px solid var(--notvin-line);
}

.notvin-help-content {
  padding: 1rem;
}

.notvin-help-content p,
.notvin-help-content ol {
  margin: 0 0 .85rem;
}

.notvin-help-content ol {
  padding-left: 1.3rem;
}

.notvin-help-content li + li {
  margin-top: .55rem;
}

.notvin-help-content > :last-child {
  margin-bottom: 0;
}

.notvin-help-note {
  padding: .75rem;
  border-radius: 6px;
  background: var(--notvin-ivory);
}

.nav-tabs .nav-link.active {
  color: var(--notvin-navy);
  border-bottom-color: var(--notvin-copper);
}

.nav-tabs .nav-link { color: var(--notvin-muted); }

/* Убираем оставшиеся ярко-зеленые акценты EA. */
.text-success { color: var(--notvin-success) !important; }
.badge.bg-success { background-color: var(--notvin-success) !important; }
.bg-dark { background-color: var(--notvin-navy-deep) !important; }

.notvin-login-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 16px;
  background: var(--notvin-navy);
  color: #d7b28a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(18, 32, 44, .18);
}

/* EA theme paints .btn-primary with a green gradient; override the shorthand,
   not only background-color. */
.btn-primary,
.btn-success {
  background: var(--notvin-copper) !important;
  background-image: none !important;
  border: 1px solid var(--notvin-copper) !important;
  box-shadow: none !important;
  color: #fffdf8 !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-success:hover,
.btn-success:focus,
.btn-success:active {
  background: var(--notvin-copper-dark) !important;
  background-image: none !important;
  border-color: var(--notvin-copper-dark) !important;
  box-shadow: none !important;
}

.form-check-input:checked {
  background-color: var(--notvin-copper) !important;
  border-color: var(--notvin-copper) !important;
}

#settings-nav .nav-link {
  color: var(--notvin-muted) !important;
}

#settings-nav .nav-link:hover,
#settings-nav .nav-link.active {
  color: var(--notvin-navy) !important;
  font-weight: 600;
}

#settings-nav .nav-link.active {
  border-left: 3px solid var(--notvin-copper);
  padding-left: 10px;
}

.text-primary {
  color: var(--notvin-navy) !important;
}

/* ---- Second pass: tablet/mobile usability and a shorter appointment card. ---- */

@media (max-width: 991.98px) {
  #header .navbar-collapse {
    background: var(--notvin-navy);
    padding: .35rem .75rem .75rem;
  }

  #header .navbar-nav {
    align-items: stretch;
  }

  #header .nav-item {
    min-width: 0 !important;
    text-align: left !important;
  }

  #header .nav-link {
    padding: .7rem .75rem !important;
  }

  #calendar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start !important;
  }

  #calendar-actions .dropdown,
  #calendar-actions .btn,
  #calendar-actions .btn-group {
    margin: 0 !important;
  }

  #calendar-actions > .form-select,
  #calendar-actions > .form-control {
    flex: 1 1 220px;
    max-width: 100%;
  }

  #calendar > .container,
  #calendar .fc {
    min-width: 0;
  }

  #calendar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #calendar .fc {
    min-width: 680px;
  }

  .modal-dialog {
    margin: .65rem;
    max-width: calc(100vw - 1.3rem);
  }

  .modal-body {
    padding: 1rem;
  }

  #footer {
    flex-direction: column;
    gap: 4px;
    align-items: center !important;
    text-align: center;
  }

  #footer > div {
    margin: 0 !important;
  }
}

@media (max-width: 767.98px) {
  .fc .fc-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
  }

  .fc .fc-toolbar-chunk {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  .fc .fc-toolbar-title {
    font-size: 17px;
    width: 100%;
    text-align: center;
  }

  .fc .fc-button {
    padding: .35rem .55rem;
    font-size: 12px;
  }

  #calendar .fc {
    min-width: 560px;
  }

  .modal-dialog {
    margin: .4rem;
    max-width: calc(100vw - .8rem);
  }

  .modal-body {
    padding: .9rem;
  }

  .modal-footer {
    flex-wrap: wrap;
    gap: 6px;
  }
}

@media (max-width: 575.98px) {
  #calendar-actions {
    padding: 0 .5rem .5rem;
  }

  #calendar-actions > .form-select,
  #calendar-actions > .form-control {
    flex-basis: 100%;
  }

  #header-logo {
    padding: .55rem .7rem !important;
  }

  .fc .fc-toolbar-title {
    font-size: 16px;
  }
}

/* A shorter appointment card: this office does not use locations, meeting
   links, custom colours, customer language/address or provider timezone UI. */
#appointments-modal .mb-3:has(#appointment-color),
#appointments-modal .mb-3:has(#appointment-location),
#appointments-modal .mb-3:has(#appointment-meeting-link),
#appointments-modal .mb-3:has(#language),
#appointments-modal .mb-3:has(#address),
#appointments-modal .mb-3:has(#city),
#appointments-modal .mb-3:has(#zip-code),
#appointments-modal .mb-3:has(#timezone),
#appointments-modal .mb-3:has(.timezone-info) {
  display: none !important;
}

/* EA backend.css targets `body .modal-header` with a theme gradient. */
body .modal-header {
  background: var(--notvin-navy) !important;
  background-image: none !important;
  color: #fffdf8 !important;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
}

body .modal-header h3,
body .modal-header .modal-title {
  color: #fffdf8 !important;
}

body .modal-header .btn-close {
  filter: invert(1);
  opacity: .85;
}

/* ---- «Записи на сегодня» ---- */
#today-page .card {
  overflow: hidden;
}

#today-page .table tbody tr:last-child td {
  border-bottom: 0;
}

#today-page .badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: .35rem .5rem;
  border-radius: 6px;
}

#today-page .badge.bg-warning {
  background-color: #f0a343 !important;
}

#today-page .badge.bg-danger {
  background-color: var(--notvin-danger) !important;
  color: #fff !important;
}

#today-page .table a {
  text-decoration: none;
}

@media (max-width: 767.98px) {
  #today-page {
    padding-left: .7rem !important;
    padding-right: .7rem !important;
  }

  #today-page h2 {
    font-size: 21px;
  }

  #today-page .table {
    min-width: 620px;
  }
}

/* ---- «Записи на сегодня»: карточки на телефоне ---- */
.today-cards {
  display: grid;
  gap: 10px;
}

.today-card {
  background: var(--notvin-paper);
  border: 1px solid var(--notvin-line);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(18, 32, 44, .04);
}

.today-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.today-card__time {
  color: var(--notvin-navy);
  font-size: 17px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.today-card__name {
  font-size: 16px;
  font-weight: 600;
  color: var(--notvin-navy);
}

.today-card__phone {
  display: inline-block;
  margin-top: 2px;
  font-size: 14px;
}

.today-card__meta {
  margin-top: 8px;
  color: var(--notvin-muted);
  font-size: 12.5px;
  line-height: 1.4;
}

@media (min-width: 768px) {
  .today-cards {
    display: none;
  }
}

#today-page .today-row-actions {
  white-space: nowrap;
}

#today-page .today-row-actions .btn + .btn,
#today-page .today-row-actions form + .btn {
  margin-left: 6px;
}

.today-card__actions {
  margin-top: 10px;
}

@media (max-width: 767.98px) {
  #today-page .today-cards {
    display: grid !important;
  }
}

#today-page .today-card__note {
  margin-top: 7px;
  color: #6c757d;
  font-size: 12.5px;
  line-height: 1.45;
}

/* ==========================================================================
   Third pass: content shell, lists, settings and calendar readability.
   ========================================================================== */

.backend-page {
    max-width: 1180px;
    padding-top: 1.5rem !important;
    padding-bottom: 2.5rem;
}

#header .nav-link { font-size: 14.5px; }
#header .dropdown-item { font-size: 14px; }

#footer { border-top-color: var(--notvin-line); color: var(--notvin-muted); }

/* Calendar toolbar: the filter is a select, not a full-width white bar. */
#calendar-toolbar {
    margin-bottom: 1rem;
    padding-top: .85rem !important;
    padding-bottom: .85rem !important;
}

#calendar-toolbar #calendar-filter { max-width: 320px; }

#select-filter-item {
    height: 42px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 10px;
    background-color: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 14px;
}

#select-filter-item:focus { box-shadow: 0 0 0 3px rgba(162, 102, 63, .35); }

#calendar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

#calendar-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 14px;
}

#calendar {
    border: 1px solid var(--notvin-line);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

#calendar .fc { border: 0; }

/* Lists: one card per record instead of raw text rows. */
.results { max-height: none !important; }
.results hr { display: none; }

.results .entry {
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1px solid var(--notvin-line);
    border-radius: 12px;
    background: var(--notvin-paper);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.results .entry:hover {
    border-color: var(--notvin-copper);
    background: #fff;
    box-shadow: 0 12px 26px -22px rgba(18, 32, 44, .55);
}

.results .entry.selected {
    border-color: var(--notvin-copper);
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--notvin-copper);
}

.results .entry strong {
    display: block;
    font-size: 15.5px;
    color: var(--notvin-navy);
}

.results .entry small {
    font-size: 12.5px;
    color: var(--notvin-muted);
}

.record-details {
    margin-top: 1rem;
    padding: 22px 22px 16px;
    border: 1px solid var(--notvin-line);
    border-radius: 12px;
    background: #fff;
}

/* Settings pages: the left nav becomes a column of quiet pills. */
.backend-page .col-lg-3 .nav-link {
    display: block;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--notvin-muted);
    font-weight: 500;
}

.backend-page .col-lg-3 .nav-link:hover {
    color: var(--notvin-navy);
    background: var(--notvin-paper);
}

.backend-page .col-lg-3 .nav-link.active {
    color: #fff;
    background: var(--notvin-navy);
}

.backend-page .col-lg-9 h5 {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--notvin-line);
}

.backend-page .col-lg-9 h5:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.form-control,
.form-select {
    min-height: 40px;
    border-color: var(--notvin-line);
    border-radius: 9px;
    font-size: 14px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--notvin-copper);
    box-shadow: 0 0 0 3px rgba(162, 102, 63, .12);
}

.form-label {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--notvin-navy);
}

.form-text { font-size: 12.5px; color: var(--notvin-muted); }

.table > :not(caption) > * > * { padding: .65rem .75rem; }

.btn { border-radius: 9px; font-weight: 500; }

.btn-primary,
.btn-success {
    background-color: var(--notvin-copper-dark);
    border-color: var(--notvin-copper-dark);
}

.btn-primary:hover,
.btn-success:hover {
    background-color: var(--notvin-navy);
    border-color: var(--notvin-navy);
}

.results:empty::before {
    content: "Записей пока нет";
    display: block;
    padding: 18px 0;
    color: var(--notvin-muted);
    font-size: 14px;
}

@media (max-width: 991.98px) {
    .backend-page { padding-left: 1rem; padding-right: 1rem; }
    #calendar-toolbar #calendar-filter { max-width: none; }
}

/* Fourth pass: wider CRUD pages and compact record cards. */
@media (min-width: 992px) {
    .backend-page.container { max-width: 1180px; }
    .backend-page .record-details,
    .backend-page .filter-records {
        max-width: 920px;
        margin-left: auto;
        margin-right: auto;
    }
    .backend-page.editing .record-details { max-width: 920px; }
}

.results .entry br { display: none; }
.results .entry small { display: block; margin-top: 4px; }

/* Settings navigation uses Bootstrap col-sm-* on the settings pages. */
.backend-page .col-sm-3 .nav-link {
    display: block;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--notvin-muted);
    font-weight: 500;
}

.backend-page .col-sm-3 .nav-link:hover {
    color: var(--notvin-navy);
    background: var(--notvin-paper);
}

.backend-page .col-sm-3 .nav-link.active {
    color: #fff;
    background: var(--notvin-navy);
}

.backend-page .col-sm-9 h5 {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--notvin-line);
}

.backend-page .col-sm-9 h5:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

/* The theme had a navy-on-navy active state for the settings nav. */
#settings-nav .nav-link {
    display: block;
    padding: 10px 14px;
    border-radius: 10px;
}

#settings-nav .nav-link.active {
    color: #fff !important;
    background: var(--notvin-navy) !important;
    border-left: 0;
    padding-left: 14px;
}

/* Fifth pass: responsive admin fixes. */

/* EA still paints outline buttons with its green primary colour. */
.btn-outline-primary,
.btn-outline-success {
    color: var(--notvin-copper-dark) !important;
    border-color: var(--notvin-copper) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-success:hover,
.btn-outline-success:focus,
.btn-outline-success:active {
    color: #fff !important;
    background-color: var(--notvin-copper-dark) !important;
    border-color: var(--notvin-copper-dark) !important;
}

/* Settings navigation: on phones a long vertical list pushes the form below
   the fold. Turn it into compact wrapping chips instead. */
@media (max-width: 767.98px) {
    #settings-nav {
        margin-bottom: 1.25rem;
    }

    #settings-nav .nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    #settings-nav .nav-item {
        margin-bottom: 0 !important;
    }

    #settings-nav .nav-link {
        padding: 8px 12px;
        border-radius: 9px;
        font-size: 13.5px;
        white-space: nowrap;
    }

    .backend-page .col-sm-3 > h3 {
        margin-bottom: .75rem;
    }
}

/* Working plan table: keep the two time fields inside the viewport. */
@media (max-width: 575.98px) {
    #business-logic .working-plan {
        width: 100%;
        table-layout: fixed;
    }

    #business-logic .working-plan th,
    #business-logic .working-plan td {
        padding: .3rem .3rem;
    }

    #business-logic .working-plan th:nth-child(1),
    #business-logic .working-plan td:nth-child(1) {
        width: 42%;
    }

    #business-logic .working-plan th:nth-child(2),
    #business-logic .working-plan td:nth-child(2),
    #business-logic .working-plan th:nth-child(3),
    #business-logic .working-plan td:nth-child(3) {
        width: 29%;
    }

    #business-logic .working-plan .work-start,
    #business-logic .working-plan .work-end {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: .3rem .35rem;
        font-size: .8rem;
    }

    #business-logic .breaks.table,
    #business-logic .working-plan-exceptions.table,
    #working-plan-exceptions-breaks {
        width: 100%;
        table-layout: fixed;
        font-size: .78rem;
    }

    #business-logic .breaks.table th,
    #business-logic .breaks.table td {
        padding: .35rem .3rem;
        white-space: normal;
    }
}

@media (max-width: 767.98px) {
    #settings-nav .nav.flex-column {
        flex-direction: row !important;
        flex-wrap: wrap;
    }

    #settings-nav .nav-item {
        flex: 0 0 auto;
    }

    #settings-nav .nav-link {
        display: inline-flex;
        align-items: center;
    }
}

/* #settings-nav is the <ul> itself (flex-column utility), not a wrapper. */
@media (max-width: 767.98px) {
    #settings-nav {
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 1.25rem;
    }

    #settings-nav .nav-item {
        flex: 0 0 auto;
        margin-bottom: 0 !important;
    }

    #settings-nav .nav-link {
        display: inline-flex;
        align-items: center;
        padding: 8px 12px;
        border-radius: 9px;
        font-size: 13.5px;
        white-space: nowrap;
    }
}

/* Provider "working plan" tab uses the same table at phone widths. */
@media (max-width: 575.98px) {
    #providers-page .working-plan-view .working-plan {
        width: 100%;
        table-layout: fixed;
    }

    #providers-page .working-plan-view .working-plan th,
    #providers-page .working-plan-view .working-plan td {
        padding: .3rem .3rem;
    }

    #providers-page .working-plan-view .working-plan th:nth-child(1),
    #providers-page .working-plan-view .working-plan td:nth-child(1) {
        width: 42%;
    }

    #providers-page .working-plan-view .working-plan th:nth-child(2),
    #providers-page .working-plan-view .working-plan td:nth-child(2),
    #providers-page .working-plan-view .working-plan th:nth-child(3),
    #providers-page .working-plan-view .working-plan td:nth-child(3) {
        width: 29%;
    }

    #providers-page .working-plan-view .work-start,
    #providers-page .working-plan-view .work-end {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: .3rem .35rem;
        font-size: .8rem;
    }

    /* 12 colour swatches do not fit in one phone row. */
    .color-selection {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 6px;
    }
}

/* EA paints active pills green; keep the admin tabs in the brand palette. */
.nav-pills .nav-link {
    border-radius: 9px;
    color: var(--notvin-navy);
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    color: #fff !important;
    background-color: var(--notvin-copper-dark) !important;
    border-color: var(--notvin-copper-dark) !important;
}

@media (max-width: 767.98px) {
    #settings-nav { gap: 8px 10px; }
}

/* ==========================================================================
   Sixth pass: breathing room — логотип шапки и кластеры тулбара календаря.
   ========================================================================== */

/* Логотип не прижат к левому краю окна (navbar идёт с p-0). */
#header-logo {
    padding: .7rem 1rem .7rem 1.5rem !important;
}

/* Тулбар календаря: воздух от краёв карточки и между тремя кластерами
   (навигация+«Сегодня» | заголовок | День/Неделя/Месяц). */
.fc .fc-header-toolbar {
    padding: 14px 16px 8px;
    gap: 12px;
}

/* Плечо «prev,next today»: стрелки и «Сегодня» — раздельные кнопки. */
.fc .fc-toolbar-chunk {
    gap: 8px;
}

/* FullCalendar склеивает кнопки в сегмент (radius 0, margin -1px).
   Разлепляем: зазор 6px внутри группы, каждой кнопке свой радиус. */
.fc .fc-button-group {
    gap: 6px;
}

.fc .fc-button-group > .fc-button {
    margin-left: 0 !important;
    border-radius: 8px !important;
}

/* ==========================================================================
   Seventh pass: карточка записи — блок в сетке и поповер деталей.
   ========================================================================== */

/* Блок записи на сетке: фирменные тона по статусу (цвет из БД перекрывается). */
.fc .notvin-ev {
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 4px 9px;
    box-shadow: 0 1px 3px rgba(18, 32, 44, .2);
}

.fc .notvin-ev .fc-event-time {
    font-weight: 650;
    font-size: 11px;
    letter-spacing: .02em;
    opacity: .92;
}

.fc .notvin-ev .fc-event-title { font-weight: 500; }

.fc .notvin-ev--pending { background: #a9773f !important; }
.fc .notvin-ev--confirmed { background: #4f7a5a !important; }
.fc .notvin-ev--cancelled { background: #9c4a38 !important; }
.fc .notvin-ev--cancelled .fc-event-title { text-decoration: line-through; opacity: .85; }
.fc .notvin-ev--done { background: #45607a !important; }

.fc a.notvin-ev:hover { background-image: none; filter: brightness(1.05); }

/* Поповер деталей записи: бумажная карточка в духе сайта. */
#calendar .popover {
    max-width: 380px;
    border: 1px solid var(--notvin-line);
    border-radius: 14px;
    background: var(--notvin-paper);
    box-shadow: 0 18px 40px -18px rgba(18, 32, 44, .45);
}

#calendar .popover-header {
    background: transparent;
    border-bottom: 1px solid var(--notvin-line);
    color: var(--notvin-navy);
    font-size: 15px;
    font-weight: 650;
    padding: 12px 16px 10px;
}

#calendar .popover-body { padding: 12px 16px 14px; color: #24313c; }

#calendar .popover-body hr {
    margin: 12px 0 10px;
    border-color: var(--notvin-line);
    opacity: 1;
}

/* Шапка поповера: статус-чип + часовой пояс. */
.notvin-pop__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.notvin-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
}

.notvin-chip::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.notvin-chip--pending { background: rgba(162, 102, 63, .13); color: #86512f; }
.notvin-chip--confirmed { background: rgba(79, 122, 90, .15); color: #3d6249; }
.notvin-chip--cancelled { background: rgba(164, 74, 55, .13); color: #8f3d2e; }
.notvin-chip--done { background: rgba(28, 43, 58, .1); color: var(--notvin-navy); }

.notvin-pop__tz {
    color: var(--notvin-muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Строка времени. */
.notvin-pop__when {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 11px;
    padding: 9px 12px;
    background: #f2ecdf;
    border-radius: 9px;
    color: var(--notvin-navy);
    font-size: 13.5px;
    font-weight: 600;
}

.notvin-pop__when .far, .notvin-pop__when .fas { color: var(--notvin-copper-dark); }

/* Сетка «метка — значение». */
.notvin-pop__grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 7px 14px;
    margin: 12px 0 0;
    font-size: 13.5px;
}

.notvin-pop__grid dt { color: var(--notvin-muted); white-space: nowrap; }

.notvin-pop__grid dd {
    margin: 0;
    color: #24313c;
    overflow-wrap: anywhere;
}

.notvin-pop__grid dd a { color: var(--notvin-copper-dark); font-weight: 550; }

/* Заметки. */
.notvin-pop__notes {
    margin-top: 12px;
    padding: 8px 11px;
    background: #faf7f0;
    border-left: 3px solid #d8ccb8;
    border-radius: 0 9px 9px 0;
    color: var(--notvin-muted);
    font-size: 13px;
    line-height: 1.5;
}

/* Кнопки статуса и второстепенные действия. */
.notvin-pop__actions { display: flex; gap: 8px; margin-top: 13px; }
.notvin-pop__actions .btn { flex: 1; }

.notvin-pop__secondary { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.notvin-pop__secondary .btn {
    padding: .3rem .75rem;
    font-size: 13px;
}

.notvin-pop__secondary .btn-outline-secondary {
    border-color: var(--notvin-line);
    color: var(--notvin-muted);
}

.notvin-pop__secondary .btn-outline-secondary:hover {
    border-color: var(--notvin-muted);
    color: var(--notvin-navy);
    background: #fff;
}

/* Кнопки поповера: иконка и подпись строго в одну строку (EA делает .btn
   блочным, подпись уезжала под иконку). */
#calendar .popover .btn {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
}

#calendar .popover .btn svg { width: 13px; height: 13px; }

/* Заметки: служебная строка заявки и комментарий клиента — разные ранги. */
.notvin-pop__notes-meta { color: #99937f; font-size: 12px; line-height: 1.45; }

.notvin-pop__notes-meta + .notvin-pop__notes-text {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px dashed #e0d8c6;
}

.notvin-pop__notes-text {
    color: #334047;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.5;
}

/* ==========================================================================
   Eighth pass: страница «Клиенты» — список, детали, редактирование.
   ========================================================================== */

/* Заголовки секций — спокойный navy вместо светловатого fw-light. */
#customers h4 {
    color: var(--notvin-navy);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -.01em;
}

/* Поля формы в две колонки: пары Имя+Фамилия, Почта+Телефон, Адрес+Город,
   Индекс+Язык; широкие поля (часовой пояс, LDAP, заметки) — на всю ширину. */
#customers .record-details .row > .col-lg-6:first-child {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
    align-items: start;
}

#customers .record-details .row > .col-lg-6:first-child > h4,
#customers .record-details .row > .col-lg-6:first-child > .mb-3:has(#timezone),
#customers .record-details .row > .col-lg-6:first-child > .mb-3:has(#ldap-dn),
#customers .record-details .row > .col-lg-6:first-child > .mb-3:has(#notes) {
    grid-column: 1 / -1;
}

@media (max-width: 575.98px) {
    #customers .record-details .row > .col-lg-6:first-child {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Записи клиента: широкая карточка вместо узкой ленты 330px. */
#customers #customer-appointments { max-width: 100% !important; }

.appointment-row {
    padding: 11px 14px;
    margin-bottom: 8px;
    border: 1px solid var(--notvin-line);
    border-radius: 10px;
    background: var(--notvin-paper);
}

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

.appointment-row__when {
    margin-bottom: 3px;
    color: var(--notvin-muted);
    font-size: 12.5px;
    font-weight: 500;
}

.appointment-row a {
    color: var(--notvin-navy);
    font-size: 14px;
    font-weight: 600;
    text-decoration-color: #c6b9a5;
    text-underline-offset: .2em;
}

.appointment-row a:hover {
    color: var(--notvin-copper-dark);
    text-decoration-color: currentColor;
}

.appointment-row__tz {
    display: block;
    margin-top: 3px;
    color: var(--notvin-muted);
    font-size: 12px;
}

/* Кнопка удаления не соперничает с «Сохранить». */
#customers #delete-customer {
    border-color: rgba(164, 74, 55, .45);
    color: var(--notvin-danger);
}

#customers #delete-customer:hover {
    background: rgba(164, 74, 55, .06);
    border-color: var(--notvin-danger);
    color: var(--notvin-danger);
}
