:root {
  --ink: #17211c;
  --muted: #6b746d;
  --paper: #fffdf7;
  --cream: #f4efe4;
  --line: rgba(23, 33, 28, 0.12);
  --leaf: #25533d;
  --sage: #6e9076;
  --brass: #d2a75d;
  --berry: #b33f5f;
  --blue: #3d607a;
  --warn: #a66b20;
  --danger: #a23a36;
  --shadow: 0 20px 58px rgba(23, 33, 28, 0.12);
  font-family: Inter, "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(210, 167, 93, 0.18), transparent 34%),
    linear-gradient(180deg, #17211c 0 320px, #ece6da 320px 100%);
}

button,
input,
select {
  font: inherit;
}

button,
a,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

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

:focus-visible {
  outline: 3px solid rgba(179, 63, 95, 0.28);
  outline-offset: 3px;
}

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

.admin-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  align-content: start;
  gap: 22px;
  padding: 22px;
  color: #fffdf7;
  background: #111915;
  border-right: 1px solid rgba(255, 253, 247, 0.1);
}

.admin-brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  text-decoration: none;
}

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

.admin-brand strong,
.admin-brand small {
  grid-column: 2;
}

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

.admin-brand small {
  color: rgba(255, 253, 247, 0.62);
  font-weight: 800;
}

.admin-nav {
  display: grid;
  gap: 8px;
}

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

.admin-nav a:hover,
.admin-nav a.is-active {
  color: #fffdf7;
  background: rgba(255, 253, 247, 0.12);
}

.shop-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 253, 247, 0.12);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.08);
}

.shop-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.shop-card figcaption {
  display: grid;
  gap: 5px;
  padding: 14px;
}

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

.shop-card strong {
  font-size: 20px;
  line-height: 1.35;
}

.admin-main {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 20px;
  padding: 28px clamp(16px, 2.4vw, 30px) 42px;
}

.admin-topbar {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #fffdf7;
}

.eyebrow {
  margin: 0;
}

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

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

.top-actions time,
.top-actions button,
.filter-group button,
.admin-form button,
.order-actions button,
.seat-control button,
.menu-card button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 13px;
  font-weight: 950;
}

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

.top-actions button,
.admin-form button {
  border: 0;
  color: #fffdf7;
  background: var(--berry);
}

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

.metric-strip article,
.orders-panel,
.quick-panel,
.menu-panel,
.stock-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.96);
  box-shadow: var(--shadow);
}

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

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

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

.metric-strip .accent strong {
  color: var(--berry);
}

.metric-strip .warning strong {
  color: var(--warn);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(300px, 380px);
  gap: 20px;
  align-items: start;
}

.orders-panel,
.quick-panel,
.menu-panel,
.stock-panel {
  min-width: 0;
  padding: 18px;
}

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

.orders-panel .panel-head {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
}

.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,
.order-actions button,
.seat-control button,
.menu-card button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fffaf0;
}

.filter-group button:hover,
.filter-group button.is-active {
  color: #fffdf7;
  border-color: var(--leaf);
  background: var(--leaf);
}

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

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

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

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

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

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

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

.status-badge.is-pending {
  background: var(--warn);
}

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

.status-badge.is-ready {
  background: var(--leaf);
}

.status-badge.is-done {
  background: var(--muted);
}

.order-actions {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
}

.order-actions [data-action="making"] {
  color: #fffdf7;
  border-color: var(--blue);
  background: var(--blue);
}

.order-actions [data-action="ready"] {
  color: #fffdf7;
  border-color: var(--leaf);
  background: var(--leaf);
}

.order-actions [data-action="done"] {
  color: #fffdf7;
  border-color: var(--berry);
  background: var(--berry);
}

.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: 46px;
  margin-top: 4px;
}

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

.seat-control {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 8px;
  align-items: center;
}

.seat-control strong {
  display: grid;
  min-height: 52px;
  place-items: center;
  border-radius: 8px;
  color: var(--leaf);
  background: #eef4ea;
  font-size: 32px;
}

.seat-control button {
  padding: 0;
  color: #fffdf7;
  background: var(--leaf);
}

.seat-panel p,
.admin-feedback {
  color: var(--muted);
  line-height: 1.6;
}

.admin-feedback {
  min-height: 42px;
  display: flex;
  align-items: center;
  margin: 14px 0 0;
  border-radius: 8px;
  padding: 0 12px;
  background: #f1eadc;
  font-size: 14px;
  font-weight: 850;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(300px, 420px);
  gap: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  color: #fffdf7;
  background: var(--leaf);
  font-size: 13px;
  font-weight: 950;
}

.pill.muted {
  color: var(--leaf);
  background: #eef4ea;
}

.menu-admin-grid,
.stock-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

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

.menu-card,
.stock-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf8;
}

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

.menu-card header,
.stock-row header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.menu-card strong,
.stock-row strong {
  font-size: 18px;
}

.menu-card small,
.stock-row small {
  color: var(--muted);
  font-weight: 850;
}

.menu-card.is-soldout {
  opacity: 0.58;
}

.menu-card button {
  justify-self: start;
}

.menu-card.is-soldout button {
  color: #fffdf7;
  border-color: var(--berry);
  background: var(--berry);
}

.stock-meter {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #ebe3d6;
}

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

.stock-row.is-low .stock-meter i {
  background: var(--berry);
}

.restock-alert {
  display: flex;
  align-items: center;
  min-height: 46px;
  margin-top: 18px;
  border: 1px solid rgba(166, 107, 32, 0.26);
  border-radius: 8px;
  padding: 10px 12px;
  color: #754713;
  background: #fff4dc;
  font-weight: 900;
  line-height: 1.5;
}

.restock-alert.is-clear {
  color: var(--leaf);
  border-color: rgba(37, 83, 61, 0.2);
  background: #eef4ea;
}

.stock-row.is-low {
  border-color: rgba(179, 63, 95, 0.32);
  background: #fff8f7;
}

.stock-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  color: var(--leaf);
  background: #eef4ea;
  font-size: 12px;
  font-weight: 950;
}

.stock-row.is-low .stock-status {
  color: #fffdf7;
  background: var(--berry);
}

.stock-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.stock-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: #fffaf0;
  font-weight: 950;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
}

button {
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

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

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

@media (max-width: 900px) {
  body {
    background:
      linear-gradient(180deg, #17211c 0 430px, #ece6da 430px 100%);
  }

  .admin-shell {
    display: block;
  }

  .admin-rail {
    position: static;
    height: auto;
    padding: 16px;
  }

  .admin-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .shop-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) auto;
  }

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

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

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

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

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

@media (max-width: 560px) {
  .admin-nav,
  .filter-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-group {
    display: grid;
  }

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