:root {
  color-scheme: light;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  --ink: #22342c;
  --muted: #586b61;
  --primary: #205b47;
  --primary-hover: #164632;
  --nav: #172e26;
  --line: #dce3dc;
  --soft: #f5f7f4;
  --white: #fff;
  --radius: 13px;
  --pad: clamp(16px, 2vw, 26px);
  color: var(--ink);
  background: var(--soft);
}
* { box-sizing: border-box; }
body, h1, h2, h3, p, fieldset { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, fieldset:disabled button { cursor: not-allowed; opacity: .5; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid #408866; outline-offset: 3px; }
h1 { font-size: clamp(1.65rem, 2.8vw, 2.25rem); letter-spacing: -.035em; font-weight: 680; line-height: 1.25; }
h2 { font-size: 1.05rem; font-weight: 680; line-height: 1.45; }
label { font-size: .82rem; font-weight: 600; color: #41564b; }
.small-note, .cell-sub { color: var(--muted); font-size: .8rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.feedback { margin-top: 10px; font-size: .85rem; overflow-wrap: anywhere; }
.feedback[data-state="error"] { color: #a13338; }
.feedback[data-state="success"] { color: var(--primary); }
.feedback[data-state="progress"] { color: var(--muted); }
input, select, textarea {
  min-width: 0; width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid #bfccc2;
  border-radius: 7px; background-color: white; color: var(--ink); font-size: .92rem;
}
input:hover:not(:disabled), select:hover:not(:disabled) { border-color: #91a497; }
input::placeholder { color: #708176; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 16px;
  border: 1px solid transparent; border-radius: 7px; font-size: .87rem; font-weight: 600; line-height: 1.4;
  white-space: nowrap; text-align: center; text-decoration: none; transition: background-color .15s, border-color .15s;
}
.primary, .confirm { background: var(--primary); color: white; }
.primary:hover:not(:disabled), .confirm:hover:not(:disabled) { background: var(--primary-hover); }
.secondary { color: #345044; background: white; border-color: #c9d3cb; }
.secondary:hover:not(:disabled) { background: #f0f5ef; border-color: #a7b7aa; }
.link-action { color: var(--primary); background: transparent; padding-inline: 4px; }
.link-action:hover { text-decoration: underline; }
.login-screen { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 24px; background: #f1f3ee; }
.login-card {
  width: min(100%, 830px); min-height: 430px; display: grid; grid-template-columns: .92fr 1.08fr;
  border: 1px solid #d8ded6; border-radius: 18px; overflow: hidden; background: white; box-shadow: 0 18px 56px #233b2510;
}
.login-art {
  padding: 37px; background-color: #211e18; background-image: linear-gradient(155deg,#15181022 15%, transparent 68%), url('/yatai-gold-wave.webp');
  background-size: cover; background-position: 52% center;
}
.login-art img { display: block; width: 115px; height: auto; }
.login-form { display: grid; align-content: center; gap: 8px; padding: clamp(24px, 4vw, 48px); }
.login-form h1 { margin-bottom: 17px; font-size: 1.7rem; }
.login-form input + label { margin-top: 7px; }
.login-form button { margin-top: 15px; }

.admin-shell { display: grid; grid-template-columns: 208px minmax(0,1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; height: 100svh;
  background: var(--nav); color: #f2f5ed; padding: 29px 14px 19px;
}
.sidebar-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; padding: 0 12px 23px; }
.sidebar-brand { width: 108px; height: auto; }
.sidebar-title { color: #c0cec4; font-size: .84rem; font-weight: 500; }
.demo-indicator { color: #e0ca9e; font-size: .75rem; }
.navigation { display: grid; gap: 5px; border-top: 1px solid #ffffff23; padding-top: 18px; }
.navigation button, .logout-button {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px; min-height: 44px; border: 0; border-radius: 7px;
  color: #d6e1d8; background: none; text-align: left; font-size: .91rem; line-height: 1.4; white-space: nowrap;
}
.sidebar svg { flex: 0 0 auto; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.navigation button:hover, .logout-button:hover { background: #233d31; }
.navigation button[aria-current] { background: #e2ebdc; color: #193b29; font-weight: 650; }
.sidebar :focus-visible { outline-color: #e4c89a; }
.logout-button { margin-top: auto; font-size: .84rem; }
.workspace { min-width: 0; width: min(100%,1440px); margin-inline: auto; padding: clamp(28px,4vw,56px) clamp(22px,4vw,56px) 64px; }
.workspace > .feedback { margin: 0 0 13px; }
.view-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 23px; }

.metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.metric {
  position: relative; isolation: isolate; overflow: hidden; display: grid; align-content: start; gap: 5px;
  padding: 22px var(--pad); min-height: 132px; border: 1px solid #d6dfd1; border-radius: var(--radius);
  background: #e7eddf; color: #243e2e;
}
.metric:first-child { background: #234c3d; color: #faf9f1; border-color: #234c3d; }
.metric::after {
  content: ""; position: absolute; right: -22px; bottom: -55px; z-index: -1; width: 140px; aspect-ratio:1; border-radius: 50%;
  border: 1px solid currentColor; box-shadow: 0 0 0 15px transparent, 0 0 0 16px currentColor, 0 0 0 31px transparent, 0 0 0 32px currentColor;
  opacity: .09; pointer-events: none;
}
.metric > span { font-size: .88rem; font-weight: 550; }
.metric strong { font-size: clamp(2.15rem,4vw,3rem); line-height: 1.12; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.metric small, .metric p { font-size: .76rem; opacity: .9; }
.panel { min-width: 0; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.panel-intro { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 15px; padding: 20px var(--pad) 17px; }
.form-panel { padding: var(--pad); }
.panel-empty { padding: 32px var(--pad); color: var(--muted); text-align: center; font-size: .88rem; }
.table-scroll { min-width: 0; overflow-x: auto; border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .87rem; }
.data-table th, .data-table td { padding: 12px var(--pad); vertical-align: middle; }
.data-table th { background: #f3f5f1; color: #516658; border-block: 1px solid #e7ebe5; white-space: nowrap; font-size: .78rem; font-weight: 600; }
.data-table td { border-bottom: 1px solid #e8ede7; overflow-wrap: anywhere; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafcf9; }
.data-table td[data-number], .customer-table td[data-label="手机号"], .customer-table td[data-label="核销码"] { font-variant-numeric: tabular-nums; }
.data-table th:last-child, .data-table td[data-label="操作"] { text-align: right; }
#view-overview .data-table { table-layout: fixed; }
#view-overview .data-table th:first-child { width: 43%; }
#view-overview .data-table th:nth-child(2), #view-overview .data-table th:nth-child(3),
#view-overview .data-table td[data-number] { text-align: right; }
#view-overview .data-table .link-action { padding-inline: 0; }
.cell-main, .cell-sub { display: block; }
.cell-sub { font-weight: 400; font-size: .75rem; margin-top: 2px; }
.data-table td:first-child { font-weight: 650; }
.field { display: grid; align-content: start; gap: 5px; min-width: 0; }
.inline-form { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.inline-form .field { width: min(100%,320px); }
.form-panel > h2 + form { margin-top: 15px; }
.filter-form { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: end; gap: 12px 18px; padding: var(--pad); border-bottom: 1px solid var(--line); }
.filter-form input, .filter-form select { height: 42px; }
.filter-actions { display: flex; gap: 8px; grid-column: 1 / -1; justify-content: flex-end; }
.filter-actions .button { min-width: 68px; }
.feedback.inset { margin: 0 var(--pad) 12px; }
.customer-table { table-layout: fixed; }
.customer-table th:nth-child(1) { width: 17%; }
.customer-table th:nth-child(2) { width: 16%; }
.customer-table th:nth-child(3) { width: 17%; }
.customer-table th:nth-child(4) { width: 15%; }
.customer-table th:nth-child(5) { width: 12%; }
.customer-table th:nth-child(6) { width: 13%; }
.customer-table th:nth-child(7) { width: 10%; }
.customer-table td, .customer-table th { padding-inline: 8px; }
.customer-table td:first-child, .customer-table th:first-child { padding-left: var(--pad); }
.customer-table td:last-child, .customer-table th:last-child { padding-right: var(--pad); }
.customer-table .button { min-height: 34px; padding: 5px 11px; font-size: .82rem; }
.customer-state { display: inline-block; white-space: nowrap; font-size: .77rem; font-weight: 600; color: var(--muted); }
.customer-state[data-state="available"],.customer-state[data-state="redeemed"],.customer-state[data-state="expired"] { padding: 2px 9px; border-radius: 20px; }
.customer-state[data-state="available"] { color: #755712; background: #f7efd6; }
.customer-state[data-state="redeemed"] { color: #255942; background: #e4f1e7; }
.customer-state[data-state="expired"] { color: #555e57; background: #edf0eb; }
.pagination { padding: 14px var(--pad); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); }
.pagination > div { display: flex; gap: 7px; }
.pagination .button { min-height: 34px; padding: 5px 11px; }
.employee-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,365px),1fr)); gap: 14px; margin-top: 16px; }
#employee-empty { margin-top: 16px; }
.employee-card { display: grid; grid-template-columns: auto minmax(0,1fr); grid-template-rows: auto auto auto auto 1fr auto; align-items: start; column-gap: 16px; padding: 18px; }
.employee-qr { grid-column: 1; grid-row: 1/span 4; width: 96px; height: 96px; padding: 0; overflow: hidden; cursor: zoom-in; background: white; border: 1px solid #dce2da; border-radius: 7px; }
.employee-qr img { display: block; width: 100%; height: 100%; object-fit: contain; }
.employee-details { display: contents; }
.employee-details h2, .employee-details p { grid-column: 2; overflow-wrap: anywhere; }
.employee-details p { margin-top: 3px; }
.employee-copy { grid-column: 1/-1; grid-row: 6; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.employee-copy .button { min-height: 36px; padding: 5px 6px; font-size: .79rem; }
.employee-copy .store-delete { grid-column: 1 / -1; justify-self: end; color: #9a3034; background: transparent; }
.store-delete:hover { text-decoration: underline; }
.danger { color: white; background: #a23439; }
.danger:hover:not(:disabled) { background: #85292d; }

#settings-controls { min-width: 0; padding: 0; border: 0; }
.settings-panels { display: grid; gap: 16px; }
.section-intro { margin-bottom: 18px; }
.section-intro p { margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)) auto; align-items: end; gap: 14px; }
.form-grid > button, .prize-row > button { min-height: 42px; }
.beijing-time { position: relative; }
.beijing-time > input { padding-right: 44px; font-variant-numeric: tabular-nums; }
.calendar-picker { position: absolute; inset: 1px 1px 1px auto; width: 40px; display: grid; place-items: center; border-radius: 6px; color: var(--primary); }
.calendar-picker:hover, .calendar-picker:focus-within { background: var(--soft); }
.calendar-picker:focus-within { outline: 2px solid var(--primary); }
.calendar-picker svg { width: 18px; height: 18px; }
.calendar-picker input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; opacity: 0; cursor: pointer; }
.calendar-picker input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.prize-rows { display: grid; }
.prize-row { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1.35fr) minmax(0,.8fr) minmax(0,.8fr) auto; align-items: end; gap: 14px; padding-block: 14px; border-top: 1px solid var(--line); }
.picture-picker { position: relative; height: 42px; display: flex; align-items: center; gap: 9px; min-width: 0; padding: 4px 10px; border: 1px solid #bfccc2; border-radius: 7px; background: #f7faf6; color: var(--primary); }
.picture-picker span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .84rem; }
.picture-picker input[type="file"] { position: absolute; inset: 0; padding: 0; border: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.picture-picker:hover { border-color: #769683; }
.picture-picker:focus-within { outline: 3px solid #408866; outline-offset: 2px; }
.prize-preview { flex: none; width: 31px; height: 31px; border-radius: 4px; object-fit: cover; }
.prize-row > button { padding-inline: 12px; font-size: .82rem; }
@media (min-width: 801px) {
  .prize-row + .prize-row label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.prize-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.prize-controls .probability-total { margin-inline-start: auto; }
.probability-total { color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; }
.probability-total[data-valid="true"] { color: var(--primary); font-weight: 600; }
#redemption-dialog, .store-dialog { width: min(92vw,450px); max-height: 88vh; overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); box-shadow: 0 16px 80px #172f242c; }
#redemption-dialog::backdrop, .store-dialog::backdrop { background: #15291f99; }
.store-dialog-identity { margin: 8px 0 16px; overflow-wrap: anywhere; font-weight: 600; }
#store-qr-large { width: min(100%, 52vh, 384px); height: auto; margin-inline: auto; image-rendering: pixelated; }
#store-qr-large:not([hidden]) { display: block; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.redemption-result { padding: 18px; border-radius: 8px; margin-top: 13px; background: #f1f5ef; }
.redemption-state { margin-bottom: 4px; color: #6f551f; font-weight: 650; font-size: .84rem; }
.redemption-state[data-status="redeemed"] { color: var(--primary); }
.redemption-state[data-status="expired"] { color: #5d665f; }
.redemption-result h2 { font-size: 1.19rem; overflow-wrap: anywhere; }
.redemption-result dl { display: grid; gap: 7px; margin: 12px 0; }
.redemption-result dl > div { display: grid; grid-template-columns: 5rem minmax(0,1fr); gap: 10px; }
.redemption-result dt { color: var(--muted); font-size: .84rem; }
.redemption-result dd { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }

@media (max-width: 1080px) {
  .admin-shell { grid-template-columns: 174px minmax(0,1fr); }
  .workspace { padding-inline: 22px; }
  .settings-panels { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .admin-shell { display: block; }
  .sidebar { z-index: 3; height: auto; padding: 8px 16px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; }
  .sidebar-heading { padding: 0; flex-direction: row; align-items: center; gap: 12px; }
  .sidebar-brand { width: 72px; }
  .sidebar-title { font-size: .8rem; }
  .logout-button { margin: 0; min-height: 38px; padding: 6px; font-size: .8rem; gap: 6px; }
  .navigation { grid-row: 2; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); padding-top: 7px; }
  .navigation button { padding: 8px 4px; min-height: 40px; gap: 6px; justify-content: center; font-size: .86rem; }
  .workspace { padding: 25px 16px 48px; }
  .metrics { gap: 10px; margin-bottom: 16px; }
  .view-heading { margin-bottom: 17px; }
  input, select, textarea { font-size: 1rem; }
}
@media (max-width: 640px) {
  .login-card { display: block; min-height: 0; max-width: 400px; }
  .login-art { padding: 22px 24px; height: 108px; background-position: center 72%; }
  .login-art img { width: 95px; }
  .login-form { padding: 24px; }
  .login-form h1 { font-size: 1.42rem; margin-bottom: 10px; }
  .filter-form { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px 12px; }
  .filter-actions .button, .inline-form .button { min-height: 42px; }
  .metric { padding: 15px; min-height: 104px; }
  #view-overview .data-table th:first-child { width: 36%; }
  #view-overview .data-table th:last-child { width: 24%; }
  #view-overview .data-table td, #view-overview .data-table th { padding: 9px 4px; }
  #view-overview .data-table :is(td,th):first-child { padding-left: 12px; }
  #view-overview .data-table :is(td,th):last-child { padding-right: 12px; }
  #view-overview .data-table th { font-size: .72rem; }
  #view-overview .data-table .link-action { font-size: .77rem; min-height: 40px; }
  .form-grid { grid-template-columns: 1fr; gap: 10px; }
  .form-grid > button { justify-self: end; }
  .prize-row { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px 12px; }
  .prize-row > .field:first-child, .prize-image-field { grid-column: 1 / -1; }
  .prize-row > button { grid-column: 2; justify-self: end; min-height: 36px; }
}
@media (max-width:720px), (min-width:801px) and (max-width:1080px) {
  .customer-table, .customer-table tbody { display: block; }
  .customer-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .customer-table tbody tr { padding: 12px var(--pad); border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
  .customer-table tbody tr:last-child { border-bottom: 0; }
  .customer-table tbody td, .customer-table tbody td:first-child, .customer-table tbody td:last-child {
    display: grid; grid-template-columns: 5.8rem minmax(0,1fr); gap: 10px; align-items: center; text-align: left; border: 0; padding: 2px 0;
  }
  .customer-table td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 450; }
  .customer-table td[data-label="操作"] .button { justify-self: start; min-height: 40px; }
  .customer-state { justify-self: start; }
}
@media (max-width:440px) {
  .sidebar { padding-inline: 12px; }
  .navigation button svg { display: none; }
  .workspace { padding-inline: 12px; }
  .employee-qr { width: 86px; height: 86px; }
  .employee-card { padding: 13px; column-gap: 11px; }
  .inline-form .field { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
