:root {
  --ink: #171a18;
  --panel: #fffaf0;
  --cream: #f7f1e4;
  --paper: #f1eadc;
  --line: #d9d0c1;
  --muted: #756e64;
  --brass: #d9b862;
  --moss: #2f6a55;
  --blue: #354d68;
  --brick: #b2493d;
  --plum: #695c8d;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  width: 100%;
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(47, 106, 85, 0.12), transparent 36%),
    linear-gradient(180deg, #1b201e 0 290px, var(--paper) 290px);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select {
  cursor: pointer;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

:focus-visible {
  outline: 3px solid rgba(217, 184, 98, 0.45);
  outline-offset: 3px;
}

.admin-shell {
  min-width: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.admin-rail {
  min-width: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: 22px;
  padding: 22px;
  color: var(--cream);
  background: #171c1a;
  border-right: 1px solid rgba(255, 247, 231, 0.1);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.admin-brand span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink);
  background: var(--brass);
  font-weight: 950;
}

.admin-brand strong {
  font-size: 18px;
}

.admin-nav {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 8px;
}

.admin-nav a {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 12px;
  color: rgba(255, 247, 231, 0.72);
  text-decoration: none;
  font-weight: 900;
}

.admin-nav a:hover,
.admin-nav a:focus-visible,
.admin-nav a.is-active {
  color: var(--ink);
  background: var(--brass);
}

.studio-card {
  align-self: end;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 247, 231, 0.12);
  border-radius: 8px;
  background: rgba(255, 247, 231, 0.08);
}

.studio-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 4;
  object-fit: cover;
}

.studio-card figcaption {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.studio-card span,
.eyebrow {
  color: var(--brass);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.studio-card strong {
  font-size: 19px;
}

.admin-main {
  min-width: 0;
  display: grid;
  gap: 20px;
  align-content: start;
  padding: 28px clamp(18px, 3vw, 40px) 40px;
}

.admin-topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--cream);
}

.eyebrow {
  margin: 0;
}

.admin-topbar h1,
.panel-head h2 {
  margin: 6px 0 0;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.08;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions time,
.top-actions button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 950;
}

.top-actions time {
  color: rgba(255, 247, 231, 0.78);
  background: rgba(255, 247, 231, 0.08);
}

.top-actions button,
.admin-form button {
  border: 0;
  color: var(--ink);
  background: var(--brass);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-strip article,
.schedule-panel,
.booking-panel,
.team-panel {
  border: 1px solid rgba(23, 26, 24, 0.1);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.96);
  box-shadow: 0 18px 54px rgba(23, 26, 24, 0.1);
}

.metric-strip article {
  min-height: 110px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
}

.metric-strip span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.metric-strip strong {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1;
}

.admin-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 20px;
  align-items: start;
}

.schedule-panel,
.booking-panel,
.team-panel {
  min-width: 0;
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-head.compact {
  margin-bottom: 14px;
}

.panel-head h2 {
  color: var(--ink);
  font-size: clamp(24px, 2.4vw, 34px);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-group button,
.appointment-actions button,
.queue-actions button,
.admin-form button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 12px;
  font-weight: 950;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.filter-group button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fffdf8;
}

.filter-group button:hover,
.filter-group button:focus-visible,
.filter-group button.is-active {
  border-color: var(--moss);
  color: var(--cream);
  background: var(--moss);
}

.schedule-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.appointment-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 98px minmax(170px, auto);
  gap: 12px;
  align-items: center;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffdf8;
}

.appointment-row time {
  color: var(--moss);
  font-size: 20px;
  font-weight: 950;
}

.appointment-main {
  min-width: 0;
}

.appointment-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
}

.appointment-main span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-badge {
  justify-self: start;
  min-width: 76px;
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--cream);
  background: var(--blue);
  font-size: 12px;
  font-style: normal;
  font-weight: 950;
  text-align: center;
}

.status-badge.is-arrived {
  background: var(--moss);
}

.status-badge.is-complete {
  background: var(--blue);
}

.status-badge.is-cancelled {
  background: var(--brick);
}

.status-badge.is-wait {
  background: var(--plum);
}

.appointment-actions,
.queue-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.appointment-actions button,
.queue-actions button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #f7f0e3;
}

.appointment-actions [data-action="arrive"],
.queue-actions [data-queue-action="promote"] {
  color: var(--cream);
  border-color: var(--moss);
  background: var(--moss);
}

.appointment-actions [data-action="cancel"],
.queue-actions [data-queue-action="remove"] {
  color: var(--cream);
  border-color: var(--brick);
  background: var(--brick);
}

.appointment-actions button:hover,
.queue-actions button:hover,
.admin-form button:hover,
.top-actions button:hover {
  transform: translateY(-2px);
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.admin-form input,
.admin-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fffdf8;
  font-weight: 850;
}

.admin-form button {
  min-height: 44px;
  margin-top: 2px;
}

.waitlist-panel {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.waitlist,
.team-grid {
  display: grid;
  gap: 10px;
}

.queue-row,
.team-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffdf8;
}

.queue-row {
  display: grid;
  gap: 10px;
}

.queue-row strong,
.team-card strong {
  display: block;
  font-size: 17px;
}

.queue-row span,
.team-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-feedback {
  min-height: 40px;
  display: flex;
  align-items: center;
  margin: 14px 0 0;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: #efe7d8;
  font-size: 14px;
  font-weight: 850;
}

.team-panel {
  display: grid;
  gap: 16px;
}

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

.team-card {
  display: grid;
  gap: 12px;
}

.team-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4dbcb;
}

.team-meter i {
  width: var(--load);
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--moss);
}

@media (max-width: 1180px) {
  .admin-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

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

  .booking-panel {
    max-width: none;
  }
}

@media (max-width: 880px) {
  body {
    background:
      linear-gradient(180deg, #1b201e 0 420px, var(--paper) 420px);
  }

  .admin-shell {
    display: block;
  }

  .admin-rail {
    position: static;
    width: 100vw;
    max-width: 100vw;
    height: auto;
    grid-template-columns: 1fr;
    padding: 16px;
    overflow: hidden;
  }

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

  .admin-nav a {
    justify-content: center;
  }

  .studio-card {
    display: none;
  }

  .admin-main {
    padding: 18px 14px 34px;
  }

  .admin-topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .filter-group {
    width: 100%;
  }

  .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 94px;
  }

  .metric-strip,
  .team-grid {
    grid-template-columns: 1fr;
  }

  .appointment-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .status-badge,
  .appointment-actions {
    grid-column: 1 / -1;
  }

  .appointment-actions {
    justify-content: stretch;
  }

  .appointment-actions button {
    flex: 1 1 0;
  }
}

@media (max-width: 520px) {
  .admin-brand strong {
    font-size: 16px;
  }

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

  .queue-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
