.admin-page {
  min-height: 100vh;
  background: var(--cream);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px max(4vw, 24px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.admin-shell {
  width: min(1160px, calc(100% - 40px));
  margin: 42px auto 72px;
}

.login-panel {
  max-width: 520px;
  margin: 52px auto;
}

.dashboard-top,
.panel-heading,
.service-row,
.time-off-row,
.booking-row,
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-top {
  margin-bottom: 22px;
}

.dashboard-top h1,
.admin-panel h1,
.admin-panel h2 {
  margin: 0;
  font: 500 30px var(--serif);
}

.dashboard-top h1,
.admin-panel h1 {
  font-size: clamp(34px, 5vw, 46px);
}

.admin-tabs {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin: 0 0 22px;
  padding: 6px;
  border: 1px solid var(--line);
  background: rgba(250, 247, 242, .96);
  box-shadow: 0 8px 24px rgba(48, 39, 33, .06);
  scrollbar-width: none;
}

.admin-tabs::-webkit-scrollbar {
  display: none;
}

.admin-tab {
  flex: 1 0 auto;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: var(--soft);
  font: 600 13px var(--sans);
  white-space: nowrap;
}

.admin-tab:hover,
.admin-tab:focus-visible {
  background: white;
  color: var(--ink);
}

.admin-tab.is-active {
  background: var(--clay);
  color: white;
}

.tab-count {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  margin-left: 5px;
  padding: 0 6px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
  font-size: 11px;
}

.admin-tab:not(.is-active) .tab-count {
  background: var(--line);
  color: var(--ink);
}

.admin-tab-panel[hidden] {
  display: none;
}

.admin-panel {
  margin: 0 0 24px;
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.settings-narrow {
  max-width: 640px;
}

.panel-heading {
  align-items: flex-start;
  margin-bottom: 22px;
}

.panel-heading h2 {
  font-size: 28px;
}

.panel-heading p,
.admin-panel p {
  color: var(--soft);
  line-height: 1.55;
}

.panel-heading p {
  max-width: 720px;
  margin: 6px 0 0;
  font-size: 14px;
}

.admin-panel label {
  display: block;
  color: var(--soft);
  font-size: 13px;
}

.admin-panel label + label {
  margin-top: 14px;
}

.admin-panel input,
.admin-panel select,
.admin-panel textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: white;
  color: var(--ink);
  font: inherit;
}

.admin-panel textarea {
  min-height: 180px;
  resize: vertical;
}

.admin-panel input:focus,
.admin-panel select:focus,
.admin-panel textarea:focus {
  border-color: var(--clay);
  outline: 2px solid rgba(164, 94, 66, .16);
  outline-offset: 1px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-grid label + label {
  margin-top: 0;
}

.form-grid > .admin-status {
  grid-column: 1 / -1;
  margin: 0;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.checkbox-row input {
  width: auto !important;
  margin: 0 !important;
}

.form-actions,
.row-actions,
.history-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.form-actions {
  margin-top: 18px;
}

.align-end {
  align-self: end;
}

.row-actions button,
.hours-row > button {
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--clay);
  font: 600 13px var(--sans);
}

.row-actions button:hover,
.row-actions button:focus-visible,
.hours-row > button:hover,
.hours-row > button:focus-visible {
  background: rgba(164, 94, 66, .08);
}

.danger-text {
  color: #9b2f2f !important;
}

.admin-status {
  min-height: 1.4em;
  color: var(--soft);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.admin-status:empty {
  display: none;
}

.admin-status.is-error {
  color: #9b2f2f;
}

.admin-status.is-success {
  color: #48734b;
}

.dashboard-message {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid currentColor;
  background: var(--paper);
}

.dashboard-message:not(:empty) {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  width: min(420px, calc(100% - 40px));
  margin: 0;
  box-shadow: 0 12px 32px rgba(48, 39, 33, .18);
}

.service-list,
.hours-list,
.time-off-list,
.booking-list,
.history-list {
  display: grid;
  gap: 10px;
}

.service-row,
.time-off-row,
.booking-row,
.history-row {
  padding: 15px;
  border: 1px solid var(--line);
  background: var(--cream);
}

.service-row strong,
.time-off-row strong,
.booking-row strong,
.history-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.service-row span,
.time-off-row span,
.booking-row span,
.history-row span {
  color: var(--soft);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.booking-copy,
.history-main {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.booking-copy a {
  color: inherit;
}

.booking-day {
  display: grid;
  gap: 8px;
}

.booking-day + .booking-day {
  margin-top: 12px;
}

.booking-day h3 {
  margin: 8px 0 2px;
  color: var(--clay);
  font: 600 13px var(--sans);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hours-row {
  display: grid;
  grid-template-columns: 150px minmax(300px, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--cream);
}

.hours-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hours-controls label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 88px;
}

.hours-controls input {
  width: 116px;
  margin: 0;
  padding: 8px;
}

.hours-controls input[type="checkbox"] {
  width: auto;
}

.hours-controls.closed {
  opacity: .5;
}

.time-off-list {
  margin-top: 22px;
}

.edit-form {
  margin-top: 20px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.history-filters {
  display: grid;
  grid-template-columns: minmax(180px, .35fr) minmax(240px, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.history-note {
  margin: 0 0 18px;
  font-size: 13px;
}

.history-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.status-badge.is-completed {
  background: #e4efe5;
  color: #38623b;
}

.status-badge.is-cancelled {
  background: #f4e3df;
  color: #8a392e;
}

.status-badge.is-no-show {
  background: #ece7df;
  color: #62584b;
}

.erased-data {
  font-style: italic;
}

.empty-state {
  margin: 0;
  padding: 18px 4px;
  color: var(--soft);
  font-size: 14px;
}

@media (min-width: 701px) and (max-width: 1024px) {
  .admin-shell {
    width: min(940px, calc(100% - 32px));
    margin-top: 32px;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hours-row {
    grid-template-columns: 130px 1fr auto;
  }

  .history-row {
    align-items: flex-start;
  }
}

@media (max-width: 700px) {
  .admin-header {
    align-items: flex-start;
    padding: 14px 16px;
  }

  .admin-header .brand {
    font-size: 20px;
  }

  .admin-header .brand span {
    font-size: 9px;
  }

  .admin-header .quiet-link {
    padding-top: 5px;
    font-size: 13px;
    white-space: nowrap;
  }

  .admin-shell {
    width: calc(100% - 24px);
    margin: 24px auto 52px;
  }

  .login-panel {
    margin: 28px auto;
  }

  .dashboard-top {
    align-items: center;
  }

  .dashboard-top h1 {
    font-size: 34px;
  }

  .admin-tabs {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
    border-right: 0;
    border-left: 0;
  }

  .admin-tab {
    flex: 0 0 auto;
    padding: 10px 14px;
  }

  .admin-panel {
    padding: 18px;
  }

  .panel-heading,
  .service-row,
  .time-off-row,
  .booking-row,
  .history-row {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-heading .button {
    width: 100%;
  }

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

  .align-end {
    align-self: stretch;
  }

  .form-actions .button,
  .form-actions .text-button {
    flex: 1 1 auto;
  }

  .hours-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .hours-controls {
    display: grid;
    grid-template-columns: 1fr auto 12px auto;
    width: 100%;
  }

  .hours-controls input {
    width: 100px;
  }

  .hours-row > button {
    width: 100%;
    border: 1px solid var(--line);
    background: white;
  }

  .row-actions,
  .history-actions {
    width: 100%;
  }

  .row-actions button,
  .history-actions button {
    flex: 1 1 140px;
    border: 1px solid var(--line);
    background: white;
  }

  .settings-narrow {
    max-width: none;
  }
}

@media (max-width: 420px) {
  .admin-header .brand span {
    display: none;
  }

  .hours-controls {
    grid-template-columns: 1fr 1fr;
  }

  .hours-controls label {
    grid-column: 1 / -1;
  }

  .hours-controls > span {
    display: none;
  }

  .hours-controls input {
    width: 100%;
  }
}

@media (pointer: coarse) {
  .button,
  .text-button,
  .row-actions button,
  .hours-row > button {
    min-height: 44px;
  }
}
