.no-dark-mode,
.no-dark-mode .admin-wrap,
.no-dark-mode.admin-live-editor-page,
.no-dark-mode.admin-live-editor-page main {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  body:not(.no-dark-mode) {
    color-scheme: dark;
  }

  body:not(.no-dark-mode) .admin-wrap,
  body:not(.no-dark-mode).admin-live-editor-page,
  body:not(.no-dark-mode).admin-live-editor-page main {
    color: var(--ink);
    background:
      radial-gradient(circle at 20% -10%, rgba(208, 106, 121, .10), transparent 34rem),
      linear-gradient(180deg, var(--paper), #0d0c0b);
  }

  body:not(.no-dark-mode) .site-header,
  body:not(.no-dark-mode) .site-footer,
  body:not(.no-dark-mode) .admin-savebar,
  body:not(.no-dark-mode) .live-controls,
  body:not(.no-dark-mode) .live-savebar {
    background: rgba(17, 16, 15, .92);
    border-color: var(--line);
  }

  body:not(.no-dark-mode) .brand,
  body:not(.no-dark-mode) .nav-links,
  body:not(.no-dark-mode) .nav-links a,
  body:not(.no-dark-mode) .admin-wrap,
  body:not(.no-dark-mode) .admin-wrap h2,
  body:not(.no-dark-mode) .admin-wrap h3,
  body:not(.no-dark-mode) .admin-wrap h4,
  body:not(.no-dark-mode) .live-panel h3,
  body:not(.no-dark-mode) .live-panel h4,
  body:not(.no-dark-mode) .live-field label,
  body:not(.no-dark-mode) .admin-wrap label,
  body:not(.no-dark-mode) .tag-checks label {
    color: var(--ink);
  }

  body:not(.no-dark-mode) .muted,
  body:not(.no-dark-mode) .fineprint,
  body:not(.no-dark-mode) .small,
  body:not(.no-dark-mode) .menu-row-head,
  body:not(.no-dark-mode) .accounting-action-form label {
    color: var(--muted);
  }

  body:not(.no-dark-mode) .card,
  body:not(.no-dark-mode) .form-card,
  body:not(.no-dark-mode) .cms-panel,
  body:not(.no-dark-mode) .cms-repeat,
  body:not(.no-dark-mode) .summary-card,
  body:not(.no-dark-mode) .calendar-day,
  body:not(.no-dark-mode) .admin-table,
  body:not(.no-dark-mode) .menu-row,
  body:not(.no-dark-mode) .live-card-edit,
  body:not(.no-dark-mode) .admin-nav-item,
  body:not(.no-dark-mode) .live-tabs button {
    background: rgba(31, 26, 23, .94);
    border-color: var(--line);
    color: var(--ink);
    box-shadow: 0 18px 52px rgba(0, 0, 0, .24);
  }

  body:not(.no-dark-mode) .admin-table th,
  body:not(.no-dark-mode) .admin-table td {
    border-color: var(--line);
    color: var(--ink);
  }

  body:not(.no-dark-mode) input,
  body:not(.no-dark-mode) select,
  body:not(.no-dark-mode) textarea,
  body:not(.no-dark-mode) .btn.ghost,
  body:not(.no-dark-mode) .pill.ghost,
  body:not(.no-dark-mode) .icon-remove {
    background: rgba(255, 247, 237, .08);
    color: var(--ink);
    border-color: var(--line);
  }

  body:not(.no-dark-mode) input::placeholder,
  body:not(.no-dark-mode) textarea::placeholder {
    color: rgba(255, 247, 237, .54);
  }

  body:not(.no-dark-mode) .admin-nav-item.active,
  body:not(.no-dark-mode) .admin-nav-item:hover,
  body:not(.no-dark-mode) .live-tabs button.active {
    background: var(--wine);
    border-color: var(--wine);
    color: white;
  }

  body:not(.no-dark-mode) .status,
  body:not(.no-dark-mode) .booking-dot,
  body:not(.no-dark-mode) .calendar-day .num,
  body:not(.no-dark-mode) .notice {
    background: rgba(255, 247, 237, .08);
    color: var(--ink);
    border-color: var(--line);
  }

  body:not(.no-dark-mode) .header-logo-slot .brand-logo-img {
    filter: brightness(0) invert(1) sepia(.12) saturate(.7) brightness(1.08);
  }
}

.notice {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid rgba(115, 123, 97, .3);
  border-radius: 14px;
  background: rgba(115, 123, 97, .12);
  font-weight: 800;
}

.notice.error {
  border-color: rgba(185, 74, 72, .34);
  background: rgba(185, 74, 72, .12);
}

.calendar-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.calendar-date-label {
  display: none;
}

.legend-pill,
.status.reservation-upcoming,
.status.reservation-past,
.status.payment-pending,
.status.payment-check {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  font-size: .78rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.legend-pill.reservation-upcoming,
.status.reservation-upcoming,
.booking-dot.reservation-upcoming {
  border-color: rgba(72, 132, 92, .38);
  background: rgba(72, 132, 92, .14);
  color: #2f6843;
}

.legend-pill.reservation-past,
.status.reservation-past,
.booking-dot.reservation-past {
  border-color: rgba(93, 99, 106, .32);
  background: rgba(93, 99, 106, .11);
  color: #555b62;
}

.legend-pill.payment-pending,
.status.payment-pending,
.booking-dot.payment-pending {
  border-color: rgba(181, 138, 85, .46);
  background: rgba(181, 138, 85, .18);
  color: #7a5526;
}

.legend-pill.payment-check,
.status.payment-check,
.booking-dot.payment-check {
  border-color: rgba(205, 108, 45, .52);
  background: rgba(205, 108, 45, .18);
  color: #8a4318;
}

.admin-table tr.reservation-past td {
  background: rgba(93, 99, 106, .035);
}

.admin-table tr.reservation-upcoming td {
  background: rgba(72, 132, 92, .045);
}

.admin-table tr.payment-pending td {
  background: rgba(181, 138, 85, .065);
}

.admin-table tr.payment-check td {
  background: rgba(205, 108, 45, .075);
}

.calendar-day:has(.booking-dot.reservation-past) {
  border-color: rgba(93, 99, 106, .2);
}

.calendar-day:has(.booking-dot.reservation-upcoming) {
  border-color: rgba(72, 132, 92, .24);
}

.calendar-day:has(.booking-dot.payment-pending) {
  border-color: rgba(181, 138, 85, .32);
}

.calendar-day:has(.booking-dot.payment-check) {
  border-color: rgba(205, 108, 45, .38);
}

.pending-attempts {
  overflow: hidden;
}

.pending-attempts summary {
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 900;
}

.pending-attempts-body {
  padding: 0 18px 18px;
}

@media (max-width: 720px) {
  .admin-wrap {
    padding-top: 20px;
  }

  .calendar-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .calendar-toolbar h3 {
    grid-column: 1 / -1;
    text-align: center;
  }

  .calendar-toolbar .btn {
    width: 100%;
    min-width: 0;
    padding: 11px 8px;
  }

  .calendar-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    overflow: visible;
    padding: 0;
  }

  .calendar-grid > div:empty,
  .calendar-day:not(:has(.booking-dot)) {
    display: none;
  }

  .calendar-day {
    min-height: 0;
    padding: 14px;
    border-radius: 12px;
  }

  .calendar-day .num {
    display: none;
  }

  .calendar-date-label {
    display: block;
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 950;
  }

  .calendar-day .sum {
    margin: 0 0 8px;
  }

  .booking-dot {
    margin-top: 6px;
    padding: 11px 12px;
    font-size: .9rem;
    white-space: normal;
  }

  .reservation-admin-table,
  .reservation-admin-table tbody,
  .reservation-admin-table tr,
  .reservation-admin-table td {
    display: block;
    width: 100%;
    white-space: normal;
  }

  .reservation-admin-table tr:first-child {
    display: none;
  }

  .reservation-admin-table tr:not(:first-child) {
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
  }

  .reservation-admin-table td {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    padding: 11px 12px;
    overflow-wrap: anywhere;
  }

  .reservation-admin-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .75rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .reservation-admin-table td form {
    min-width: 0;
  }

  .reservation-admin-table td .btn,
  .reservation-admin-table td input,
  .reservation-admin-table td select {
    max-width: 100%;
  }
}

.media-upload {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.media-upload > div {
  flex: 1 1 auto;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 18px 0 34px;
}

.media-card {
  overflow: hidden;
  padding: 0;
}

.media-thumb {
  aspect-ratio: 4 / 3;
  background: rgba(32, 27, 23, .08);
  border-bottom: 1px solid var(--line);
}

.media-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.media-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.media-body h3 {
  margin: 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.media-path {
  font-size: .8rem;
}

.media-usage {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: .82rem;
}

.media-usage strong {
  color: var(--ink);
}

.danger {
  border-color: rgba(185, 74, 72, .48) !important;
  color: #8d2b2d !important;
}

.cms-panel {
  margin: 18px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 242, .72);
  box-shadow: 0 10px 30px rgba(43, 31, 20, .06);
}

.cms-panel h3 {
  margin: 0 0 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
  line-height: 1;
}

.cms-field.full,
.field.full {
  grid-column: 1 / -1;
}

.cms-repeat {
  margin: 14px 0;
  padding: 16px;
  border: 1px dashed rgba(32, 27, 23, .2);
  border-radius: 16px;
  background: rgba(255, 255, 255, .35);
}

.cms-panel input[type="file"] {
  margin-top: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, .45);
}

.admin-wrap label {
  display: block;
  margin-bottom: 6px;
  color: #3c332b;
  font-weight: 900;
}

.admin-savebar {
  position: sticky;
  top: 78px;
  z-index: 20;
  padding: 14px 0;
  background: rgba(247, 241, 232, .92);
  backdrop-filter: blur(18px);
}

.admin-savebar h2 {
  margin: 0;
}

.admin-editor-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 168px;
  display: grid;
  gap: 8px;
}

.admin-nav-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 250, 242, .78);
  color: var(--ink);
  padding: 12px 14px;
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.admin-nav-item.active,
.admin-nav-item:hover {
  background: var(--wine);
  border-color: var(--wine);
  color: white;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.menu-category-table {
  display: grid;
  gap: 10px;
}

.menu-row {
  display: grid;
  grid-template-columns: minmax(130px, .75fr) minmax(180px, 1fr) minmax(220px, 1.35fr) 100px minmax(130px, .75fr) 38px;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .38);
}

.menu-row-head {
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.menu-row textarea {
  min-height: 82px;
}

.menu-row input + input,
.menu-row textarea + textarea {
  margin-top: 8px;
}

.menu-row select[multiple] {
  min-height: 112px;
}

.tag-checks {
  display: grid;
  gap: 8px;
  align-content: start;
}

.tag-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .86rem;
  font-weight: 800;
  color: var(--ink);
}

.tag-checks input {
  width: auto;
  margin: 0;
}

.accounting-action-form {
  display: grid;
  gap: 8px;
  min-width: 220px;
  margin-bottom: 12px;
}

.accounting-action-form label {
  margin-bottom: -4px;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.accounting-action-form input,
.accounting-action-form select {
  border-radius: 12px;
  padding: 9px 10px;
}

.icon-remove,
.repeat-remove {
  justify-self: end;
}

.icon-remove {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(123, 40, 53, .08);
  color: var(--wine);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.repeat-remove {
  margin: 0 0 12px auto;
}

.repeat-add {
  margin-top: 8px;
}

@media (max-width: 960px) {
  .cms-panel {
    padding: 16px;
  }

  .admin-savebar,
  .admin-sidebar {
    position: static;
  }

  .admin-editor-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    display: flex;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .admin-nav-item {
    min-width: 180px;
  }

  .menu-row,
  .menu-row-head {
    grid-template-columns: 1fr;
  }

  .menu-row-head {
    display: none;
  }
}

.live-editor-wrap {
  padding: 0;
}

.admin-live-editor-page > .site-header,
.admin-live-editor-page > .site-footer {
  display: none;
}

.admin-live-editor-page main {
  min-height: 100vh;
}

.live-editor {
  display: grid;
  grid-template-columns: minmax(380px, 42vw) minmax(0, 1fr);
  min-height: 100vh;
}

.live-controls {
  height: 100vh;
  overflow: auto;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(247, 241, 232, .96);
}

.live-savebar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: -18px -18px 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 241, 232, .95);
  backdrop-filter: blur(18px);
}

.live-savebar h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.live-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 6px;
}

.live-tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 242, .9);
  color: var(--ink);
  padding: 10px 13px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.live-tabs button.active {
  background: var(--wine);
  border-color: var(--wine);
  color: white;
}

.live-panel {
  display: none;
}

.live-panel.active {
  display: block;
}

.live-panel h3,
.live-card-edit h4 {
  margin: 0 0 14px;
  font-family: Georgia, "Times New Roman", serif;
}

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

.live-field-picked {
  border-radius: 12px;
  box-shadow: 0 0 0 3px rgba(208, 106, 121, .36);
  transition: box-shadow .18s ease;
}

.live-card-edit {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .38);
}

.color-field {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 8px;
  align-items: end;
}

.color-field label {
  grid-column: 1 / -1;
}

.color-field input[type="color"] {
  height: 46px;
  padding: 4px;
}

.live-preview {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  background: #171310;
}

.live-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #201b17;
  color: white;
}

.preview-mode-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 247, 237, .2);
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
}

.preview-mode-toggle button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 247, 237, .72);
  padding: 7px 10px;
  font: inherit;
  font-size: .82rem;
  font-weight: 900;
  cursor: pointer;
}

.preview-mode-toggle button.active {
  background: #fff7ed;
  color: #201b17;
}

.admin-live-editor-page.live-preview-dark {
  color-scheme: dark;
  color: var(--ink) !important;
  background: var(--paper) !important;
}

.admin-live-editor-page.live-preview-dark .live-controls,
.admin-live-editor-page.live-preview-dark .live-savebar {
  background: rgba(17, 16, 15, .96);
  border-color: var(--line);
}

.admin-live-editor-page.live-preview-dark .live-panel h3,
.admin-live-editor-page.live-preview-dark .live-panel h4,
.admin-live-editor-page.live-preview-dark .live-field label {
  color: var(--ink) !important;
}

.admin-live-editor-page.live-preview-dark .muted,
.admin-live-editor-page.live-preview-dark .small,
.admin-live-editor-page.live-preview-dark .live-field,
.admin-live-editor-page.live-preview-dark .color-field {
  color: var(--muted) !important;
}

.admin-live-editor-page.live-preview-dark .live-tabs button,
.admin-live-editor-page.live-preview-dark .live-card-edit,
.admin-live-editor-page.live-preview-dark input,
.admin-live-editor-page.live-preview-dark textarea,
.admin-live-editor-page.live-preview-dark select {
  background: rgba(255, 247, 237, .08);
  color: var(--ink) !important;
  border-color: var(--line);
}

.admin-live-editor-page.live-preview-dark input::placeholder,
.admin-live-editor-page.live-preview-dark textarea::placeholder {
  color: rgba(255, 247, 237, .54);
}

.admin-live-editor-page.live-preview-dark .live-tabs button.active {
  background: var(--wine);
  border-color: var(--wine);
  color: white;
}

.live-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
}

@media (max-width: 980px) {
  .live-editor {
    grid-template-columns: 1fr;
  }

  .live-controls {
    height: auto;
    border-right: 0;
  }

  .live-preview {
    height: 760px;
  }
}
