:root {
  --bg: #faf6f1;
  --card: rgba(255, 252, 248, 0.92);
  --card-strong: rgba(244, 233, 221, 0.96);
  --line: rgba(96, 66, 48, 0.12);
  --text: #2d211d;
  --muted: #75615a;
  --accent: #b88a60;
  --accent-deep: #966844;
  --green: #3e7a5a;
  --amber: #ad7d1e;
  --red: #b35e5e;
  --blue: #54739d;
  --shadow: 0 24px 60px rgba(70, 46, 34, 0.1);
  --shadow-soft: 0 14px 28px rgba(70, 46, 34, 0.08);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-pill: 999px;
  --container: 1280px;
  --heading-font: "Instrument Serif", "Times New Roman", serif;
  --body-font: "Manrope", "Avenir Next", sans-serif;
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body-font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 30%),
    radial-gradient(circle at right 18%, rgba(230, 204, 181, 0.3), transparent 20%),
    linear-gradient(180deg, #fffcf8 0%, #f4ece3 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.container {
  width: min(calc(100% - 1.5rem), var(--container));
  margin: 0 auto;
}

.admin-page {
  padding: 1rem 0 3rem;
}

.admin-header {
  padding: 1rem 0 2rem;
}

.admin-header-inner {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.8rem;
  padding: 0 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 250, 245, 0.76);
  color: var(--muted);
  box-shadow: var(--shadow-soft);
}

.eyebrow {
  margin: 1.1rem 0 0;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--accent-deep);
}

.admin-header h1,
.panel-head h2,
.modal-head h2 {
  margin: 0.8rem 0 0;
  font-family: var(--heading-font);
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.admin-header h1 {
  max-width: 10ch;
  font-size: clamp(3rem, 6vw, 5.3rem);
}

.admin-intro {
  max-width: 720px;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: end;
  align-items: center;
}

.button,
.button-secondary,
.chip,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.2rem;
  padding: 0 1.25rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.button {
  background: linear-gradient(135deg, #c89a70, #a8794f);
  color: #fff9f3;
  box-shadow: 0 16px 28px rgba(154, 107, 68, 0.22);
}

.button-secondary,
.chip,
.icon-button {
  background: rgba(255, 250, 245, 0.82);
  color: var(--text);
  border-color: var(--line);
}

.button:hover,
.button-secondary:hover,
.chip:hover,
.icon-button:hover {
  transform: translateY(-2px);
}

.chip {
  min-height: 2.7rem;
  padding: 0 1rem;
}

.chip.is-active {
  background: rgba(244, 232, 221, 0.98);
  border-color: rgba(184, 138, 96, 0.3);
}

.admin-layout {
  display: grid;
  gap: 1.25rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.stat-card,
.panel,
.modal-card {
  border: 1px solid rgba(110, 76, 54, 0.08);
  border-radius: var(--radius-xl);
  background: var(--card);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 1.35rem;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-card strong {
  display: block;
  margin-top: 0.45rem;
  font-size: 2.3rem;
}

.stat-card p {
  margin: 0.7rem 0 0;
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 1rem;
}

.primary-column,
.sidebar-column {
  display: grid;
  gap: 1rem;
}

.panel {
  padding: 1.4rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1.2rem;
}

.toolbar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
}

.bookings-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.bookings-table th,
.bookings-table td {
  padding: 1rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.bookings-table th {
  color: var(--muted);
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bookings-table tbody tr {
  cursor: pointer;
  transition: background-color 180ms ease;
}

.bookings-table tbody tr:hover {
  background: rgba(252, 246, 240, 0.72);
}

.bookings-table tbody tr.is-selected {
  background: rgba(244, 232, 221, 0.74);
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.25rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-confirmed {
  background: rgba(62, 122, 90, 0.12);
  color: var(--green);
}

.status-pending {
  background: rgba(173, 125, 30, 0.12);
  color: var(--amber);
}

.status-cancelled {
  background: rgba(179, 94, 94, 0.12);
  color: var(--red);
}

.status-completed {
  background: rgba(84, 115, 157, 0.12);
  color: var(--blue);
}

.upcoming-list,
.mini-grid,
.automation-list {
  display: grid;
  gap: 0.9rem;
}

.upcoming-item,
.mini-card,
.detail-card {
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 249, 243, 0.88);
  border: 1px solid rgba(110, 76, 54, 0.08);
}

.upcoming-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
}

.upcoming-time strong,
.detail-top strong {
  display: block;
}

.upcoming-time span,
.upcoming-item p,
.mini-card p,
.detail-top span,
.detail-list dt,
.detail-list dd,
.automation-list li {
  color: var(--muted);
}

.upcoming-item h3,
.mini-card strong {
  margin: 0;
  font-size: 1rem;
}

.upcoming-item p {
  margin: 0.2rem 0 0;
}

.detail-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.detail-list {
  display: grid;
  gap: 0.8rem;
  margin: 1.2rem 0 0;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  flex: 0 0 110px;
}

.detail-list dd {
  margin: 0;
  text-align: right;
  color: var(--text);
  font-weight: 600;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.2rem;
}

.mini-card strong {
  display: block;
}

.mini-card p {
  margin: 0.45rem 0 0;
}

.automation-list {
  margin: 0;
  padding-left: 1.15rem;
}

.automation-list li::marker {
  color: var(--accent);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(32, 22, 18, 0.38);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 40;
}

.modal-card {
  width: min(100%, 640px);
  padding: 1.4rem;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.icon-button {
  width: 3rem;
  padding: 0;
  font-size: 1.4rem;
}

.modal-detail {
  padding: 0;
  border: 0;
  background: transparent;
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .header-actions {
    justify-content: start;
  }
}

@media (max-width: 900px) {
  .panel-head,
  .upcoming-item,
  .detail-top {
    display: grid;
    grid-template-columns: 1fr;
  }

  .bookings-table {
    min-width: 0;
  }

  .bookings-table thead {
    display: none;
  }

  .bookings-table,
  .bookings-table tbody,
  .bookings-table tr,
  .bookings-table td {
    display: block;
    width: 100%;
  }

  .bookings-table tbody {
    display: grid;
    gap: 0.9rem;
  }

  .bookings-table tbody tr {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 249, 243, 0.88);
    box-shadow: var(--shadow-soft);
  }

  .bookings-table tbody tr.is-selected {
    background: rgba(244, 232, 221, 0.74);
  }

  .bookings-table td {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0;
    white-space: normal;
    border-bottom: 1px solid var(--line);
  }

  .bookings-table td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .bookings-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 700;
  }

  .upcoming-item .status,
  .detail-top .status {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .admin-page {
    padding-bottom: 2rem;
  }

  .panel,
  .progress-card,
  .stat-card,
  .modal-card {
    border-radius: 22px;
  }

  .header-actions,
  .detail-actions,
  .toolbar {
    justify-content: start;
    width: 100%;
  }

  .header-actions > *,
  .detail-actions > *,
  .toolbar > *,
  .button,
  .button-secondary {
    width: 100%;
  }

  .detail-list div {
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 0.55rem;
  }

  .detail-list dd {
    text-align: left;
  }

  .details-panel,
  .detail-card {
    padding: 0.95rem;
  }

  .detail-top {
    gap: 0.55rem;
  }

  .detail-list {
    gap: 0.5rem;
    margin-top: 0.85rem;
  }

  .detail-list dt,
  .detail-list dd {
    font-size: 0.92rem;
    line-height: 1.35;
  }

  .detail-actions {
    gap: 0.55rem;
    margin-top: 0.9rem;
  }

  .detail-actions .button,
  .detail-actions .button-secondary {
    min-height: 2.8rem;
    padding: 0 0.9rem;
  }

  .modal-card {
    padding: 1rem;
  }
}

@media (max-width: 540px) {
  .container {
    width: min(calc(100% - 1rem), var(--container));
  }

  .panel,
  .stat-card {
    padding: 1rem;
  }

  .details-panel {
    padding: 0.85rem;
  }

  .detail-card {
    padding: 0.8rem;
    border-radius: 18px;
  }

  .detail-top strong {
    font-size: 0.98rem;
  }

  .detail-top span {
    font-size: 0.88rem;
  }

  .detail-list {
    margin-top: 0.7rem;
  }

  .detail-list div {
    gap: 0.18rem;
    padding-bottom: 0.45rem;
  }

  .detail-list dt,
  .detail-list dd {
    font-size: 0.88rem;
  }

  .detail-actions {
    margin-top: 0.75rem;
    gap: 0.45rem;
  }

  .detail-actions .button,
  .detail-actions .button-secondary {
    min-height: 2.6rem;
    font-size: 0.9rem;
  }

  .bookings-table td {
    flex-direction: column;
    gap: 0.35rem;
  }

  .status {
    white-space: normal;
  }
}
