
:root {
  color-scheme: dark;
  --ink: #e6edf3;
  --app-bg: #0b0f14;
  --panel-2: #17202a;
  --panel-3: #202b36;
  --muted: #8b98a5;
  --line: #2b3642;
  --panel: #121820;
  --soft: #0d131a;
  --blue: #4c8dff;
  --teal: #2cc7b8;
  --green: #42c97a;
  --red: #ff6b6b;
  --amber: #f4b55e;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--app-bg);
}

button, input, select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 14px 180px;
}

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

.brand-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  white-space: nowrap;
}

.primary,
.secondary,
.danger,
.ghost {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 8px;
  font-weight: 700;
}

.primary {
  background: var(--blue);
  color: #fff;
}

.secondary {
  background: #17365d;
  color: #9cc2ff;
}

.danger {
  background: #2b1518;
  color: var(--red);
}

.ghost {
  background: transparent;
  color: var(--blue);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.notice {
  padding: 12px 14px;
  margin: 12px 0;
  border-radius: 8px;
  background: #2c2416;
  color: #ffd58a;
  border: 1px solid #5b4822;
}

.login-card {
  margin: 44px auto 0;
  width: min(560px, 100%);
  padding: 22px;
}

.form-row {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.form-row label {
  color: var(--muted);
  font-size: 13px;
}

select, input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--panel);
  color: var(--ink);
}

textarea {
  width: 100%;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  resize: vertical;
  background: var(--panel);
  color: var(--ink);
}

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

.metric {
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric strong {
  display: block;
  font-size: 25px;
  line-height: 1;
  margin-bottom: 6px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
}

.chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.chip.active {
  background: #245a9c;
  color: #fff;
  border-color: #245a9c;
}

.dept-section {
  margin: 12px 0;
}

.dept-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}

.dept-head h2 {
  margin: 0;
  font-size: 17px;
}

.pickup-search-panel {
  padding: 14px;
  margin: 12px 0;
}

.pickup-search-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.pickup-search-head label {
  font-weight: 800;
}

.pickup-search-head .employee-status {
  color: var(--muted);
}

.pickup-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.pickup-dept {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.pickup-dept .dept-head {
  cursor: pointer;
  margin: 0;
  padding: 13px 14px;
  list-style: none;
  user-select: none;
}

.pickup-dept .dept-head::-webkit-details-marker {
  display: none;
}

.pickup-dept .dept-head::after {
  content: "展开";
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.pickup-dept[open] .dept-head {
  border-bottom: 1px solid var(--line);
}

.pickup-dept[open] .dept-head::after {
  content: "收起";
}

.pickup-own-dept .dept-head {
  cursor: default;
  border-bottom: 1px solid var(--line);
}

.pickup-own-dept .dept-head::after {
  content: "本部门";
}

.pickup-dept-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px 0;
}

.pickup-dept-toolbar .employee-status {
  color: var(--muted);
}

.pickup-dept .employee-grid {
  padding: 12px;
}

.employee-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.employee-card {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: left;
  display: grid;
  gap: 7px;
}

.employee-card.selected {
  border-color: var(--blue);
  background: #172b45;
}

.employee-card.disabled {
  background: #10161d;
  color: #65717e;
}

.employee-card.exception {
  border-color: #d69a3a;
  background: #2c2416;
}

.employee-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
}

.employee-meta,
.employee-status {
  font-size: 12px;
  color: var(--muted);
}

.status-picked { color: var(--green); }
.status-warn { color: var(--amber); }
.status-error { color: var(--red); }

.app-tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(13, 19, 26, 0.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.34);
  z-index: 25;
}

.app-tabs button {
  min-height: 48px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.app-tabs button.active {
  background: #245a9c;
  color: #fff;
}

.mode-card {
  padding: 14px;
  margin-bottom: 12px;
}

.date-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}

.date-tools .form-row {
  margin: 0;
}

.date-tools button {
  min-height: 42px;
  white-space: nowrap;
}

.date-tools input:disabled,
.date-tools button:disabled {
  opacity: 0.55;
}

.query-card {
  padding: 16px;
  margin: 12px 0;
}

.query-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.query-row:first-of-type {
  border-top: 0;
}

.cart-bar {
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(760px, calc(100% - 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #16202a;
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
  z-index: 30;
}

.cart-bar strong {
  font-size: 22px;
}

.pickup-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
  z-index: 40;
}

.exception-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
  z-index: 45;
}

.exception-card {
  width: min(520px, 100%);
  background: var(--panel);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.pickup-card {
  width: min(520px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--panel);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.pickup-count {
  text-align: center;
  font-size: 64px;
  line-height: 1;
  font-weight: 900;
  color: var(--teal);
  margin: 10px 0 6px;
}

.qr-box {
  min-height: 288px;
  display: grid;
  place-items: center;
  padding: 10px;
  background: #ffffff;
  border: 1px solid #d8e0e8;
  border-radius: 8px;
  color-scheme: light;
}

.qr-box img,
.qr-box svg {
  width: min(320px, 100%);
  height: auto;
  display: block;
}

.token-line {
  word-break: break-all;
  font-size: 12px;
  color: var(--muted);
  padding: 8px;
  background: var(--panel-2);
  border-radius: 8px;
}

.summary-list {
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 12px 0;
  list-style: none;
}

.summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-2);
}

.kitchen-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #090d12;
}

.kitchen-screen {
  width: min(980px, 100%);
  min-height: 620px;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 34px;
  border-radius: 10px;
  background: var(--panel-2);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.30);
  text-align: center;
}

.kitchen-screen.success {
  background: #10261b;
}

.kitchen-screen.error {
  background: #2b1518;
}

.kitchen-screen.warning {
  background: #2b2414;
}

.kitchen-title {
  font-size: 42px;
  margin: 0;
}

.kitchen-qty {
  font-size: clamp(120px, 20vw, 220px);
  line-height: 0.9;
  font-weight: 950;
  color: var(--green);
}

.kitchen-message {
  font-size: 30px;
  font-weight: 800;
}

.kitchen-stats {
  width: min(820px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  text-align: left;
}

.kitchen-stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.kitchen-stat-card h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.kitchen-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.kitchen-stat-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kitchen-stat-grid strong {
  display: block;
  margin-top: 3px;
  font-size: 30px;
  line-height: 1;
}

.kitchen-stat-date {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.scan-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.manual-scan {
  width: min(620px, 100%);
  margin: 0 auto;
  display: flex;
  gap: 8px;
}

.manual-scan input {
  min-height: 48px;
}

.admin-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 20px 14px 60px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
}

.admin-nav {
  position: sticky;
  top: 14px;
  align-self: start;
  padding: 12px;
}

.admin-nav button {
  width: 100%;
  margin: 4px 0;
  justify-content: flex-start;
}

.admin-nav button.active {
  background: #245a9c;
  color: #fff;
}

.settings-groups {
  display: grid;
  gap: 14px;
  margin: 14px 0;
}

.settings-group {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #141c25;
}

.settings-group-head {
  margin-bottom: 4px;
}

.settings-group-head h3 {
  margin: 0 0 4px;
  font-size: 17px;
  color: #b8d3ff;
}

.settings-group-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.settings-save-button {
  min-width: 140px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.switch-row:first-of-type {
  border-top: 0;
}

.switch-row input {
  width: 22px;
  min-height: 22px;
}

.admin-content {
  min-width: 0;
}

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

th {
  background: #18222d;
  color: #aeb8c2;
  font-size: 13px;
}

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

.mini-form {
  padding: 14px;
  margin-bottom: 12px;
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.menu-preview {
  padding: 16px;
  margin: 12px 0;
}

.menu-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.menu-preview-head h3 {
  margin: 0;
  font-size: 18px;
}

.menu-count {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: #17365d;
  color: #9cc2ff;
  font-size: 13px;
  font-weight: 800;
}

.menu-dish-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.menu-dish-grid li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  font-weight: 700;
}

.menu-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.menu-detail {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-2);
}

.menu-detail span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.menu-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #2c2416;
  color: #ffd58a;
}

.menu-editor textarea {
  min-height: 180px;
}

.menu-editor-preview {
  margin-top: 12px;
}


.admin-form-actions,
.row-actions,
.import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.row-actions button {
  min-height: 34px;
  padding: 6px 10px;
}

.import-card {
  margin-top: 14px;
}

.import-card textarea {
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.import-help {
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.import-result {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.import-result strong {
  margin-right: 14px;
}

.import-errors {
  max-height: 180px;
  overflow: auto;
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--red);
  font-size: 13px;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-3);
  font-size: 12px;
  font-weight: 700;
}

.management-card {
  min-height: 420px;
}

.management-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.management-head h2 {
  margin: 0 0 4px;
}

.management-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.management-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px auto auto;
  gap: 8px;
  margin-bottom: 12px;
}

.management-tools.employee-tools {
  grid-template-columns: minmax(210px, 1fr) 190px 160px 150px auto auto;
}

.management-tools.record-tools {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.management-tools.record-tools .record-keyword {
  grid-column: span 2;
}

.management-tools.record-tools button {
  align-self: end;
}

.record-date-filter {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.management-summary {
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pagination label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.pagination select {
  width: auto;
  min-width: 76px;
  min-height: 36px;
}

.pagination input {
  width: 76px;
  min-height: 36px;
}

.admin-edit-card {
  width: min(680px, 100%);
  max-height: 92vh;
  overflow: auto;
}


@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kitchen-stats {
    grid-template-columns: 1fr;
  }
  .employee-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .date-tools {
    grid-template-columns: 1fr 1fr;
  }
  .pickup-search-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .date-tools .form-row {
    grid-column: 1 / -1;
  }
  .cart-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .cart-bar button {
    width: 100%;
  }
  .admin-grid,
  .split {
    grid-template-columns: 1fr;
  }
  .management-head {
    flex-direction: column;
  }
  .management-tools,
  .management-tools.employee-tools,
  .management-tools.record-tools {
    grid-template-columns: 1fr 1fr;
  }
  .management-tools input:first-child,
  .management-tools.record-tools .record-keyword {
    grid-column: 1 / -1;
  }
  .pagination {
    justify-content: flex-start;
  }
  .admin-nav {
    position: static;
  }
  .kitchen-screen {
    min-height: 560px;
    padding: 22px;
  }
  .manual-scan {
    flex-direction: column;
  }
  .menu-dish-grid,
  .menu-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .employee-grid {
    grid-template-columns: 1fr;
  }
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }
  .brand-title {
    font-size: 21px;
  }
}

html {
  background: var(--app-bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  color-scheme: dark;
}

input::placeholder,
textarea::placeholder {
  color: #687583;
  opacity: 1;
}

input[type="checkbox"] {
  accent-color: var(--blue);
}

select option {
  background: var(--panel-2);
  color: var(--ink);
}

button,
.pill,
.chip,
.employee-card,
.panel,
input,
select,
textarea {
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:not(:disabled):active,
.employee-card:not(:disabled):active {
  transform: translateY(1px);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.employee-card:focus-visible {
  outline: 3px solid rgba(76, 141, 255, 0.28);
  outline-offset: 2px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(76, 141, 255, 0.14);
}

.primary:hover:not(:disabled) {
  background: #66a0ff;
}

.secondary:hover:not(:disabled) {
  background: #214979;
}

.danger:hover:not(:disabled) {
  background: #442029;
}

.ghost:hover:not(:disabled) {
  background: rgba(76, 141, 255, 0.10);
}

.pill:hover,
.chip:hover {
  border-color: #465667;
  background: #1b2631;
}

.panel {
  backdrop-filter: blur(12px);
}

.employee-card:hover:not(.disabled) {
  border-color: #465667;
  background: #17212c;
}

.employee-card.selected:hover {
  border-color: #6ca5ff;
  background: #1a3554;
}

.employee-card.exception:hover {
  background: #352a18;
}

tbody tr {
  transition: background-color 120ms ease;
}

tbody tr:hover {
  background: rgba(76, 141, 255, 0.055);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.qr-box svg,
.qr-box img {
  background: #ffffff;
}

.kitchen-screen.success {
  border: 1px solid #245f3e;
}

.kitchen-screen.error {
  border: 1px solid #6a2d35;
}

.kitchen-screen.warning {
  border: 1px solid #655125;
}

.status-picked,
.kitchen-screen.success .kitchen-message {
  color: #55d98a;
}

.status-warn,
.kitchen-screen.warning .kitchen-message {
  color: #ffc66d;
}

.status-error,
.kitchen-screen.error .kitchen-message {
  color: #ff7d86;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #394858 transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: #394858;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

::selection {
  background: rgba(76, 141, 255, 0.34);
  color: #ffffff;
}

