:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #6f6761;
  --line: #eadbd0;
  --paper: #fffaf6;
  --surface: #ffffff;
  --brand: #a64207;
  --brand-dark: #733004;
  --gold: #d0a475;
  --amber: #f1c45d;
  --green: #1fb66a;
  --blue: #28536b;
  --danger: #a33021;
  --shadow: 0 18px 45px rgba(55, 38, 24, 0.09);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: #f7f8f8;
  color: var(--ink);
  font-family:
    "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 82px;
  padding: 0 5vw;
  border-top: 3px solid var(--brand);
  border-bottom: 1px solid #d7c0ae;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 310px;
}

.brand-logo {
  display: block;
  width: min(330px, 32vw);
  height: auto;
  max-height: 58px;
  object-fit: contain;
}

.top-tabs {
  display: flex;
  align-items: stretch;
  gap: 10px;
  height: 82px;
}

.top-tabs a {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 4px solid transparent;
  color: #342118;
  font-size: 20px;
  text-decoration: none;
  white-space: nowrap;
}

.top-tabs a.active {
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 700;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-left: auto;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #3e2519;
  font-weight: 700;
}

.icon-button:hover {
  border-color: var(--line);
  background: var(--paper);
}

.icon-button.dark {
  margin-left: 0;
  border-color: #4b3d34;
  background: #201b18;
  color: white;
}

main {
  padding: 52px 5vw 62px;
}

.intro {
  margin: 0 auto 42px;
  max-width: 1320px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.intro h1 {
  margin: 0;
  font-size: 44px;
  line-height: 1.15;
  font-weight: 800;
}

.intro p:last-child {
  margin: 14px 0 0;
  color: #3b2b23;
  font-size: 18px;
}

.context-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(680px, 100%);
  min-height: 54px;
  margin-top: 24px;
  padding: 12px 16px;
  border: 1px solid #dfcabb;
  border-radius: 8px;
  background: #fffdfb;
  color: #5d4538;
}

.context-banner strong,
.context-banner span {
  display: block;
}

.context-banner.ready {
  border-color: rgba(31, 182, 106, 0.28);
  background: #f5fbf7;
}

.context-banner.ready strong {
  color: #116e41;
}

.context-banner.blocked strong {
  color: var(--brand);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 28px;
  max-width: 1320px;
  margin: 0 auto;
  min-width: 0;
}

.left-column {
  display: grid;
  align-content: start;
  gap: 24px;
  min-width: 0;
}

.panel,
.selection-panel,
.manager-panel {
  border: 1px solid #efe2d9;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 28px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.section-title.compact {
  margin-bottom: 8px;
}

.title-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #d9a47d;
  border-radius: 7px;
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
}

h2,
h3 {
  margin: 0;
}

.section-title h2 {
  font-size: 22px;
}

label {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  color: #33241d;
  font-size: 16px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #dfbca4;
  border-radius: 6px;
  background: #fffdfb;
  color: var(--ink);
  outline: 0;
}

input {
  height: 44px;
  padding: 0 14px;
}

textarea {
  min-height: 160px;
  resize: vertical;
  padding: 12px 14px;
  line-height: 1.6;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(166, 66, 7, 0.12);
}

.segmented,
.category-tabs {
  display: flex;
  gap: 8px;
  padding: 5px;
  border: 1px solid #ecd7c7;
  border-radius: 8px;
  background: #fff7ef;
}

.segmented button,
.category-tabs button {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5d4538;
  font-weight: 700;
  white-space: nowrap;
}

.segmented button.active,
.category-tabs button.active {
  background: var(--brand);
  color: #fff;
}

.selection-panel {
  padding: 32px;
  min-width: 0;
}

.selection-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.selection-head p {
  margin: 0;
  color: #4a372d;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: #f3f6f2;
  color: #6b675f;
  font-size: 14px;
  white-space: nowrap;
}

.live-pill span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(31, 182, 106, 0.13);
}

.category-tabs {
  width: fit-content;
  max-width: 100%;
  margin: 6px 0 24px;
  overflow-x: auto;
}

.category-tabs button {
  flex: 0 0 auto;
  padding: 0 18px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 22px;
  min-width: 0;
}

.card-option {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 230px;
  padding: 26px 28px;
  overflow: hidden;
  border: 2px solid #141414;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 42%),
    #171716;
  color: #fff;
  text-align: left;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.16);
}

.card-option::after {
  content: "";
  position: absolute;
  right: 28px;
  top: 28px;
  width: 22px;
  height: 22px;
  border: 2px solid var(--amber);
  border-radius: 50%;
  box-shadow:
    inset -4px 0 0 rgba(241, 196, 93, 0.45),
    inset -8px 0 0 rgba(241, 196, 93, 0.22);
}

.card-option:hover:not(:disabled) {
  border-color: var(--amber);
  transform: translateY(-2px);
}

.card-option.selected {
  border-color: var(--amber);
  box-shadow:
    0 0 0 4px rgba(241, 196, 93, 0.32),
    0 18px 32px rgba(0, 0, 0, 0.18);
}

.card-option.reserved {
  border-color: #9a9a9a;
  color: rgba(255, 255, 255, 0.62);
  cursor: not-allowed;
  filter: grayscale(0.9);
}

.card-option.reserved::before {
  content: "已被他人定制";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(18, 18, 18, 0.74);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

.card-strip {
  width: 164px;
  height: 28px;
  background: #d8d8d6;
}

.card-label {
  align-self: end;
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.card-number {
  width: 100%;
  max-width: 100%;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 22px;
  line-height: 1.42;
  letter-spacing: 0;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  text-shadow: 0 1px 0 #000;
}

.card-tier {
  align-self: end;
  color: rgba(255, 255, 255, 0.78);
  font-size: 16px;
  text-transform: uppercase;
}

.status-badge {
  position: absolute;
  right: 22px;
  bottom: 20px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 182, 106, 0.16);
  color: #89e7b5;
  font-size: 12px;
  font-weight: 700;
}

.empty-state {
  min-height: 120px;
  margin: 0;
  display: grid;
  place-items: center;
  border: 1px dashed #d8b99f;
  border-radius: 8px;
  color: var(--muted);
}

.confirm-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  margin-top: 32px;
}

.selected-summary {
  color: var(--muted);
  font-weight: 700;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 0 22px;
  border-radius: 7px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--gold);
  background: var(--gold);
  color: #fff;
}

.primary-button:not(:disabled):hover {
  background: #bd8f60;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

.secondary-button {
  border: 1px solid #d6a07c;
  background: #fff8f2;
  color: var(--brand);
}

.secondary-button:hover {
  background: #ffeede;
}

a.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.full {
  width: 100%;
}

.site-footer {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 46px 20px 54px;
  border-top: 1px solid #d7c0ae;
  background: #ececec;
  color: #9a908a;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4a403b;
}

.footer-logo {
  display: block;
  width: min(320px, 72vw);
  height: auto;
  filter: grayscale(1);
  opacity: 0.58;
}

.site-footer strong {
  color: #9b918c;
  font-size: 30px;
}

.site-footer p {
  margin: 0;
  color: #9a754b;
}

.manager-dialog {
  width: min(420px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.manager-dialog::backdrop {
  background: rgba(17, 15, 13, 0.46);
}

.login-card {
  position: relative;
  padding: 30px;
}

.close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid #eadbd0;
  border-radius: 8px;
  background: #fff;
}

.login-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.manager-shell {
  position: fixed;
  inset: 20px;
  z-index: 50;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
  overflow: auto;
  padding: 24px;
  border: 1px solid #e8d8ca;
  border-radius: 8px;
  background: #fffdfb;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.manager-toolbar,
.manager-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.manager-toolbar h2 {
  font-size: 28px;
}

.staff-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-left: 8px;
  padding: 0 10px;
  border: 1px solid #e4c7b1;
  border-radius: 999px;
  background: #fff7ef;
  color: var(--brand);
  font-size: 14px;
  vertical-align: middle;
}

.manager-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(280px, 0.85fr) minmax(360px, 1.3fr);
  gap: 18px;
}

.manager-panel {
  padding: 20px;
}

.manager-panel h3 {
  margin-bottom: 14px;
  color: #2b211b;
  font-size: 18px;
}

.qr-preview {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.qr-preview img {
  width: min(230px, 100%);
  height: auto;
  justify-self: center;
  border: 1px solid #eadbd0;
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.qr-code-label {
  color: #3a2920;
  font-weight: 800;
  text-align: center;
}

.readonly-link {
  font-size: 13px;
}

.qr-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qr-actions .secondary-button {
  flex: 1;
  min-height: 40px;
  padding: 0 10px;
}

.manager-tables {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
  gap: 18px;
  min-height: 0;
}

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

.table-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid #eadbd0;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0e3d9;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #fff6ee;
  color: #5c3321;
  z-index: 1;
}

td button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #d9b093;
  border-radius: 6px;
  background: #fff8f2;
  color: var(--brand);
  font-weight: 700;
}

.status-available {
  color: var(--green);
  font-weight: 800;
}

.status-reserved {
  color: var(--danger);
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  max-width: calc(100% - 32px);
  padding: 13px 18px;
  border-radius: 8px;
  background: #1f1915;
  color: #fff;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .site-header {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 18px 0;
  }

  .brand {
    min-width: auto;
  }

  .brand-logo {
    width: min(290px, 70vw);
  }

  .top-tabs {
    order: 3;
    width: 100%;
    height: 52px;
    overflow-x: auto;
  }

  .top-tabs a {
    padding: 0 12px;
    font-size: 16px;
  }

  main {
    padding: 34px 18px 48px;
  }

  .intro h1 {
    font-size: 34px;
  }

  .workspace,
  .manager-grid,
  .manager-tables {
    grid-template-columns: 1fr;
  }

  .selection-head,
  .context-banner,
  .confirm-row,
  .manager-toolbar,
  .manager-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .manager-shell {
    inset: 10px;
    padding: 16px;
  }
}

@media (max-width: 560px) {
  .brand-logo {
    width: min(245px, 68vw);
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .panel,
  .selection-panel {
    padding: 20px;
  }

  .segmented {
    flex-direction: column;
  }

  .card-option {
    min-height: 210px;
    padding: 22px;
  }

  .card-number {
    font-size: 18px;
    letter-spacing: 0;
  }

  .site-footer strong {
    font-size: 24px;
  }
}
