:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --ink: #1d2528;
  --muted: #637073;
  --line: #d9dedb;
  --panel: #ffffff;
  --accent: #0f7b6c;
  --accent-2: #d34f30;
  --soft: #e8f2ef;
  --warning: #fff4df;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f7f6f2 0%, #edf3f1 100%);
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans TC", Arial, sans-serif;
  font-size: 15px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
  min-height: 38px;
  padding: 0 14px;
}

.menu-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  min-height: auto;
  padding: 0;
  text-align: left;
  width: 100%;
}

.menu-toggle span {
  font-size: 24px;
  font-weight: 900;
}

.menu-toggle small {
  color: var(--muted);
  font-weight: 800;
}

a {
  color: inherit;
}

button:hover {
  filter: brightness(0.96);
}

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

.danger-button {
  background: #b53d2f;
}

.secondary-button {
  background: #e8eeec;
  color: var(--ink);
}

.small-button {
  border-radius: 7px;
  font-size: 13px;
  min-height: 30px;
  padding: 0 10px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  margin-top: 8px;
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

label {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.shell {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.eyebrow {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.15;
  margin-bottom: 0;
}

h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 40px rgba(30, 48, 54, 0.08);
  margin-top: 12px;
  padding: 16px;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0;
}

.user-badge,
.pill {
  background: var(--soft);
  border: 1px solid #cfe2dd;
  border-radius: 999px;
  color: #0d655b;
  font-size: 13px;
  font-weight: 800;
  padding: 6px 10px;
  white-space: nowrap;
}

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

.link-button {
  align-items: center;
  background: #253235;
  border-radius: 8px;
  color: white;
  display: inline-flex;
  font-size: 14px;
  font-weight: 800;
  min-height: 40px;
  padding: 0 14px;
  text-decoration: none;
}

.login-grid,
.section-head,
.two-col,
.creator-grid,
.order-layout {
  display: grid;
  gap: 12px;
}

.login-grid {
  align-items: end;
  grid-template-columns: 1fr 1.1fr;
}

.form {
  display: grid;
  gap: 10px;
}

.section-head {
  align-items: start;
  grid-template-columns: 1fr auto;
  margin-bottom: 12px;
}

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

.dropzone {
  align-content: center;
  background: #f8fbfa;
  border: 1px dashed #8fb9b0;
  border-radius: 8px;
  color: var(--accent);
  display: grid;
  min-height: 130px;
  padding: 18px;
  text-align: center;
}

.dropzone input {
  display: none;
}

.dropzone span {
  font-size: 16px;
}

.dropzone small {
  color: var(--muted);
  display: block;
  margin-top: 8px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.menu-editor {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.published-details {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.published-label {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 10px;
}

.compact-head {
  margin-bottom: 12px;
}

.published-item {
  align-items: center;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 9px 11px;
}

.published-item span {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.menu-list {
  display: grid;
  gap: 8px;
}

.menu-row {
  align-items: center;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1.2fr 120px 140px;
  padding: 10px;
}

.saved-menu-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.menu-library-layout {
  display: grid;
  gap: 12px;
  grid-template-columns: 280px minmax(0, 1fr);
}

.menu-library-list {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  max-height: 520px;
  overflow: auto;
  padding: 8px;
}

.menu-library-tab {
  background: #fbfcfb;
  border: 1px solid transparent;
  color: var(--ink);
  display: grid;
  gap: 4px;
  justify-items: start;
  min-height: auto;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.menu-library-tab.active {
  background: var(--soft);
  border-color: #bdd8d1;
}

.menu-library-tab strong {
  font-size: 15px;
}

.menu-library-tab span {
  color: var(--muted);
  font-size: 12px;
}

.menu-library-editor {
  min-width: 0;
}

.editor-actions {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.editor-item-list {
  max-height: 480px;
  overflow: auto;
  padding-right: 4px;
}

.saved-menu-list::-webkit-scrollbar {
  width: 8px;
}

.saved-menu-list::-webkit-scrollbar-thumb {
  background: #c8d4d0;
  border-radius: 999px;
}

.saved-menu {
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
}

.saved-menu-toggle {
  align-items: center;
  background: transparent;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  min-height: auto;
  padding: 0;
  text-align: left;
  width: 100%;
}

.saved-menu-toggle:hover {
  filter: none;
}

.saved-menu-toggle span {
  font-size: 16px;
  font-weight: 900;
}

.saved-menu-toggle small {
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}

.saved-menu-body {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
}

.saved-item {
  grid-template-columns: minmax(220px, 1.3fr) 100px 130px 104px;
}

.split-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.align-end {
  justify-content: flex-end;
}

.order-layout {
  align-items: start;
  grid-template-columns: 300px 1fr;
}

.order-item {
  align-items: center;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 90px 110px;
  padding: 11px;
}

.item-title {
  color: var(--ink);
  font-weight: 800;
}

.item-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.qty {
  align-items: center;
  display: flex;
  gap: 8px;
}

.qty button {
  border-radius: 999px;
  min-height: 30px;
  padding: 0;
  width: 30px;
}

.qty output {
  min-width: 24px;
  text-align: center;
}

.order-aside {
  align-self: start;
  background: var(--warning);
  border: 1px solid #f1d59d;
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 12px;
  position: sticky;
  top: 12px;
}

.my-order {
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.my-order-list {
  display: grid;
  gap: 8px;
}

.my-order-row {
  display: grid;
  gap: 3px;
  grid-template-columns: 1fr auto;
}

.my-order-row small {
  color: var(--muted);
  grid-column: 1 / -1;
}

.my-order-total {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
}

.check-row {
  align-items: flex-start;
  background: #fffaf0;
  border: 1px solid #edd7a8;
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 10px;
  grid-template-columns: 18px 1fr;
  padding: 10px;
}

.check-row input {
  margin: 2px 0 0;
  width: 18px;
}

.check-row span {
  display: grid;
  gap: 3px;
  font-weight: 900;
}

.check-row small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.publish-box {
  align-items: center;
  background: var(--soft);
  border: 1px solid #cfe2dd;
  border-radius: 8px;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr auto;
  padding: 12px;
}

.summary-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 12px;
}

.metric {
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.metric strong {
  display: block;
  font-size: 22px;
  margin-top: 6px;
}

.report-block {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.report-toolbar {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1fr) 190px 190px auto;
  margin-bottom: 12px;
}

.overage-text {
  color: #b53d2f;
  font-weight: 900;
}

.ranking-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.rank-row {
  align-items: center;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 32px 1fr auto;
  padding: 8px 10px;
}

.rank-row span {
  align-items: center;
  background: var(--accent-2);
  border-radius: 999px;
  color: white;
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.rank-row strong {
  min-width: 0;
}

.rank-row em {
  color: var(--accent);
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

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

@media (max-width: 820px) {
  .topbar,
  .section-head {
    align-items: stretch;
    display: grid;
  }

  .login-grid,
  .two-col,
  .creator-grid,
  .summary-cards,
  .publish-box,
  .report-toolbar {
    grid-template-columns: 1fr;
  }

  .order-layout {
    display: flex;
    flex-direction: column;
    padding-bottom: 72px;
  }

  .order-aside {
    order: 0;
    position: static;
    width: 100%;
  }

  #orderItems {
    order: 1;
    width: 100%;
  }

  .order-aside button[type="submit"] {
    bottom: 12px;
    box-shadow: 0 10px 28px rgba(17, 43, 48, 0.22);
    left: 14px;
    position: fixed;
    right: 14px;
    z-index: 20;
  }

  .top-actions {
    align-items: stretch;
    display: grid;
  }

  .menu-row,
  .saved-item,
  .order-item {
    grid-template-columns: 1fr;
  }

  .menu-library-layout {
    grid-template-columns: 1fr;
  }

  .menu-library-list {
    max-height: 220px;
  }

  .saved-menu-toggle {
    align-items: flex-start;
    display: grid;
    gap: 6px;
  }
}
