:root {
  --ink: #172033;
  --muted: #687384;
  --line: #e5e9ef;
  --bg: #eef1f4;
  --paper: #ffffff;
  --green: #18a66a;
  --green-dark: #0f8656;
  --blue: #2f73d8;
  --navy: #24334d;
  --amber: #f2a93b;
  --coral: #eb6b52;
  --soft-green: #eaf8f1;
  --soft-amber: #fff5e4;
  --shadow: 0 18px 45px rgba(24, 36, 55, .12);
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  letter-spacing: 0;
}

body {
  margin: 0;
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

input,
select,
textarea {
  color: var(--ink);
  background-color: #fff;
  caret-color: var(--ink);
}

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

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

.mobile-body {
  min-height: 100vh;
  background: #f4f6f8;
}

.phone-page {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 26px;
  background: linear-gradient(180deg, #fffaf2 0%, #f7f8fa 34%, #f7f8fa 100%);
}

.merchant-page {
  background: linear-gradient(180deg, #f3f8ff 0%, #f7f8fa 36%, #f7f8fa 100%);
}

.mobile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 2px 14px;
}

.mobile-top h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 800;
}

.mobile-top p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-mark {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #fff;
  color: var(--green-dark);
  font-weight: 800;
}

.top-mark.blue {
  color: var(--blue);
}

.store-card,
.ticket-card,
.take-card,
.queue-panel {
  border: 1px solid rgba(229, 233, 239, .86);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(31, 47, 70, .08);
}

.store-card {
  padding: 18px;
}

.store-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.store-logo {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--coral), var(--amber));
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.store-line h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.store-line p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.metric-box {
  min-height: 88px;
  padding: 15px;
  border-radius: 16px;
  background: #f6f8fa;
}

.metric-box strong {
  display: block;
  font-size: 31px;
  line-height: 1;
  color: var(--green-dark);
  font-family: Arial, sans-serif;
}

.metric-box span {
  display: block;
  margin-top: 11px;
  color: var(--muted);
  font-size: 13px;
}

.ticket-card {
  margin-top: 14px;
  overflow: hidden;
  border-color: rgba(24, 166, 106, .35);
}

.ticket-head {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: var(--soft-green);
  color: #31564a;
  font-size: 15px;
  font-weight: 700;
}

.ticket-body {
  padding: 24px 18px 22px;
  text-align: center;
}

.ticket-body strong {
  display: block;
  font-size: 64px;
  line-height: 1;
  font-family: Arial, sans-serif;
}

.ticket-body p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.progress {
  height: 12px;
  margin-top: 20px;
  border-radius: 999px;
  background: #ecf0f3;
  overflow: hidden;
}

.progress i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width .2s ease;
}

.take-card {
  margin-top: 14px;
  padding: 22px 18px;
}

.take-card strong {
  display: block;
  font-size: 20px;
}

.take-card p {
  margin: 9px 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.primary-btn,
.merchant-actions button,
.light-btn,
.danger-btn {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.primary-btn {
  width: 100%;
  box-shadow: 0 12px 24px rgba(24, 166, 106, .24);
}

.primary-btn:disabled,
.merchant-actions button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

.ghost-btn {
  margin-top: 14px;
}

.blue-btn {
  background: var(--blue);
  box-shadow: 0 12px 24px rgba(47, 115, 216, .24);
}

.small {
  width: auto;
  min-height: 40px;
  border-radius: 12px;
  box-shadow: none;
  white-space: nowrap;
}

.danger-btn {
  width: auto;
  min-height: 40px;
  border: 1px solid #ffd2c9;
  background: #fff0ed;
  color: #b23b29;
}

.light-btn {
  width: auto;
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: #304058;
}

.wide-link {
  width: 100%;
  margin-top: 10px;
}

.info-list {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.info-list div {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-size: 13px;
}

.info-list span,
.bottom-note {
  color: var(--muted);
}

.bottom-note {
  margin: 16px 16px 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
}

.my-summary {
  margin-bottom: 14px;
}

.my-ticket-list {
  display: grid;
  gap: 12px;
}

.my-ticket-empty,
.my-ticket-item {
  border: 1px solid rgba(229, 233, 239, .9);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(31, 47, 70, .07);
}

.my-ticket-empty {
  padding: 22px 18px;
}

.my-ticket-empty strong {
  display: block;
  font-size: 19px;
}

.my-ticket-empty p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.my-ticket-item {
  padding: 16px;
}

.my-ticket-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.my-ticket-head strong {
  display: block;
  font-size: 16px;
  line-height: 1.35;
}

.my-ticket-head span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  min-width: 58px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--soft-green);
  color: var(--green-dark);
  font-size: 12px;
  white-space: nowrap;
}

.status-2 {
  background: #eef4ff;
  color: var(--blue);
}

.status-3,
.status-5 {
  background: #fff0ed;
  color: #b23b29;
}

.status-4 {
  background: #f0f2f5;
  color: #596579;
}

.my-ticket-no {
  margin-top: 16px;
  padding: 18px 14px;
  border-radius: 16px;
  background: var(--soft-green);
  text-align: center;
}

.my-ticket-no span {
  display: block;
  color: #407064;
  font-size: 13px;
  font-weight: 700;
}

.my-ticket-no strong {
  display: block;
  margin-top: 6px;
  color: var(--green-dark);
  font-family: Arial, sans-serif;
  font-size: 48px;
  line-height: 1;
}

.my-ticket-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.my-ticket-grid div {
  min-height: 64px;
  padding: 10px 8px;
  border-radius: 12px;
  background: #f6f8fa;
}

.my-ticket-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.my-ticket-grid strong {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-family: Arial, sans-serif;
  font-size: 19px;
}

.ticket-link {
  width: 100%;
  margin-top: 12px;
}

.mini-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 4px;
}

.mini-stat-grid div {
  min-height: 82px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.mini-stat-grid strong {
  display: block;
  font-size: 29px;
  line-height: 1;
  color: var(--blue);
  font-family: Arial, sans-serif;
}

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

.calling-panel {
  margin-top: 14px;
  padding: 22px;
  border-radius: 22px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 14px 32px rgba(36, 51, 77, .22);
}

.calling-panel p {
  margin: 0;
  color: rgba(255, 255, 255, .72);
  font-size: 14px;
}

.calling-panel > strong {
  display: block;
  margin-top: 14px;
  font-size: 72px;
  line-height: 1;
  font-family: Arial, sans-serif;
}

.calling-panel div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  color: rgba(255, 255, 255, .82);
  font-size: 13px;
}

.merchant-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.merchant-actions .wide {
  grid-column: span 2;
  min-height: 62px;
}

.merchant-actions button:not(.primary-btn) {
  background: #fff;
  color: #26364e;
  border: 1px solid var(--line);
  box-shadow: none;
}

.queue-panel {
  margin-top: 14px;
  padding: 16px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel-title strong {
  font-size: 17px;
}

.panel-title span,
.queue-row span {
  color: var(--muted);
  font-size: 13px;
}

.queue-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #eff1f4;
}

.queue-row:first-child {
  border-top: 0;
}

.admin-body {
  min-width: 1180px;
  background: var(--bg);
}

.admin-shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  width: min(1440px, calc(100vw - 64px));
  min-height: calc(100vh - 64px);
  margin: 32px auto;
  border-radius: 22px;
  overflow: hidden;
  background: #f6f8fb;
  box-shadow: var(--shadow);
}

.admin-side {
  padding: 26px 20px;
  background: var(--navy);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.brand span {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--green);
  font-size: 14px;
}

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

.admin-side a {
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 12px;
  color: rgba(255, 255, 255, .72);
  font-size: 15px;
  margin-bottom: 10px;
}

.admin-side a.active {
  background: #34435e;
  color: #fff;
}

.admin-main {
  padding: 28px;
}

.admin-topbar,
.qr-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.admin-topbar h1,
.qr-header h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
}

.admin-topbar p,
.qr-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.admin-stat-grid div {
  min-height: 120px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.admin-stat-grid span {
  color: var(--muted);
  font-size: 14px;
}

.admin-stat-grid strong {
  display: block;
  margin-top: 12px;
  font-size: 34px;
  line-height: 1;
  font-family: Arial, sans-serif;
}

.admin-stat-grid div:nth-child(1) strong {
  color: var(--green);
}

.admin-stat-grid div:nth-child(2) strong {
  color: var(--blue);
}

.admin-stat-grid div:nth-child(3) strong {
  color: #c47a10;
}

.admin-stat-grid div:nth-child(4) strong {
  color: var(--coral);
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.form-card,
.merchants-card,
.danger-zone {
  margin-bottom: 22px;
}

.notice {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(24, 166, 106, .24);
  border-radius: 14px;
  background: var(--soft-green);
  color: var(--green-dark);
  font-weight: 800;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid #eff1f4;
}

.section-title h2 {
  margin: 0;
  font-size: 20px;
}

.section-title p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.admin-form {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr minmax(120px, 160px) minmax(140px, 180px) minmax(140px, 180px) auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
}

.admin-form.settings-form {
  grid-template-columns: 1.2fr 1fr 1fr auto;
}

.admin-form.import-form {
  grid-template-columns: 1fr auto;
}

.auto-stall-box {
  min-height: 42px;
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 0 12px;
  border: 1px dashed rgba(24, 166, 106, .36);
  border-radius: 12px;
  background: var(--soft-green);
}

.auto-stall-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.auto-stall-box strong {
  color: var(--green-dark);
  font-family: Arial, sans-serif;
  font-size: 18px;
  line-height: 1;
}

.admin-form.edit-form {
  grid-template-columns: repeat(3, 1fr);
}

.admin-form.edit-form button {
  width: fit-content;
}

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

.admin-form label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-form input,
.admin-form select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  padding: 0 12px;
  background: #fff;
}

.admin-form input[readonly] {
  color: var(--muted);
  background: #f6f8fa;
}

.admin-form input:focus,
.admin-form select:focus {
  border-color: rgba(24, 166, 106, .5);
  box-shadow: 0 0 0 3px rgba(24, 166, 106, .1);
}

.table-toolbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #eff1f4;
}

.table-toolbar.search-form {
  gap: 10px;
  justify-content: flex-start;
}

.table-toolbar.search-form select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 10px;
  background: #fff;
}

.table-toolbar.search-form span {
  margin-left: auto;
}

.bulk-toolbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid #eff1f4;
  background: #fbfcfd;
}

.table-toolbar input {
  width: 300px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  outline: none;
  padding: 0 12px;
  background: #f3f5f7;
}

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

.admin-row {
  display: grid;
  grid-template-columns: 2fr .8fr .8fr .7fr .8fr 1.4fr;
  align-items: center;
  min-height: 58px;
  padding: 0 16px;
  border-top: 1px solid #eff1f4;
  font-size: 14px;
}

.admin-row.merchant-manage-row {
  grid-template-columns: 2.2fr .9fr .55fr .9fr .75fr 1.35fr;
}

.admin-row.logs-row {
  grid-template-columns: 1.15fr 1.8fr .7fr .8fr .7fr;
}

.admin-row:first-child {
  border-top: 0;
}

.admin-head {
  min-height: 44px;
  color: #8a93a1;
  background: #fbfcfd;
  font-size: 13px;
  font-weight: 700;
}

.merchant-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.merchant-cell i {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--soft-amber);
  color: #b26d12;
  font-style: normal;
  font-weight: 900;
}

.status-on,
.status-off {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
}

.status-on {
  background: var(--soft-green);
  color: var(--green-dark);
}

.status-off {
  background: #eef1f4;
  color: var(--muted);
}

.text-link {
  color: var(--blue);
  font-weight: 800;
  margin-right: 10px;
}

.text-danger {
  border: 0;
  background: transparent;
  color: #b23b29;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}

.inline-form {
  display: inline;
}

.pager {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 16px;
  border-top: 1px solid #eff1f4;
}

.pager a,
.pager span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: #304058;
  font-weight: 800;
}

.pager a.disabled {
  pointer-events: none;
  opacity: .5;
}

.admin-flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 24px;
}

.admin-flow div {
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.admin-flow strong {
  display: block;
  margin-bottom: 10px;
}

.admin-flow span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.qr-shell {
  width: min(1500px, calc(100vw - 64px));
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.qr-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
}

.qr-poster {
  min-height: 305px;
  padding: 22px;
  text-align: center;
  background: linear-gradient(180deg, #fff9ef 0%, #fff9ef 74%, #fff 74%, #fff 100%);
}

.qr-poster h2 {
  margin: 0;
  font-size: 26px;
}

.qr-poster p {
  margin: 8px 0 12px;
  color: var(--muted);
}

.qr-poster img {
  width: 180px;
  height: 180px;
  object-fit: contain;
  border: 1px solid var(--ink);
  background: #fff;
}

.qr-poster span {
  display: block;
  max-width: 310px;
  margin-top: 10px;
  margin-left: auto;
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  text-align: center;
}

.qr-meta {
  padding: 16px 18px 18px;
  display: grid;
  gap: 8px;
}

.qr-meta span {
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.single-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 32px;
}

.single-qr-card {
  width: 420px;
}

.single-qr-card .qr-poster img {
  width: 240px;
  height: 240px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #f3f8ff 0%, #eef1f4 100%);
}

.login-card {
  width: min(440px, 100%);
  padding: 30px;
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.login-brand span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

.login-card h1 {
  margin: 0;
  font-size: 28px;
}

.login-card p {
  margin: 10px 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 8px;
}

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

.login-form input {
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  padding: 0 14px;
}

.login-help {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  padding: 14px;
  border-radius: 14px;
  background: #f6f8fa;
  color: var(--muted);
  font-size: 13px;
}

.login-help strong {
  color: var(--ink);
}

.empty-state {
  width: min(520px, calc(100vw - 40px));
  margin: 16vh auto 0;
  padding: 34px;
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
}

.empty-state h1 {
  margin: 0 0 12px;
}

.empty-state p {
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 720px) {
  .mobile-body {
    background: #f7f8fa;
  }

  .phone-page {
    width: 100%;
  }
}

@media print {
  body {
    background: #fff;
  }

  .admin-toolbar,
  .admin-side {
    display: none;
  }

  .admin-shell.qr-shell {
    display: block;
    width: 100%;
    margin: 0;
    box-shadow: none;
  }

  .qr-shell .admin-main {
    padding: 0;
  }

  .qr-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
