:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --surface-strong: #111827;
  --ink: #17212b;
  --ink-soft: #4b5563;
  --muted: #7b8794;
  --line: #e3e8e7;
  --line-strong: #ccd5d3;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --accent-soft: #e6f3f1;
  --accent-line: #b8ddd8;
  --success: #237a57;
  --success-soft: #e7f5ee;
  --danger: #b5475a;
  --danger-soft: #fbecef;
  --warning: #a86516;
  --warning-soft: #fdf3e3;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 8px 24px rgba(17, 24, 39, 0.045);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", ui-sans-serif, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* Login */
.login-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: #eef2f1;
}

.login-shell {
  display: grid;
  width: min(960px, 100%);
  min-height: 560px;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 22px 60px rgba(17, 24, 39, .09);
}

.login-visual { overflow: hidden; background: #f6efe3; }
.login-visual img { display: block; width: 100%; height: 100%; object-fit: cover; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 52px 48px; }
.login-heading { margin-bottom: 30px; }
.login-heading h1 { margin-top: 10px; font-size: 28px; letter-spacing: -.02em; }
.login-heading p { margin-top: 8px; color: var(--muted); }
.login-panel .field + .field { margin-top: 18px; }
.login-panel .button { margin-top: 26px; }

/* Shared controls */
.field { display: flex; flex-direction: column; gap: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.field--wide { grid-column: 1 / -1; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  color: var(--ink);
  background: var(--surface);
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}
input::placeholder, textarea::placeholder { color: #9ca6ad; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
textarea { resize: vertical; }

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 120ms ease;
}
.button:active { transform: translateY(1px); }
.button svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button--primary { border-color: var(--accent); color: #fff; background: var(--accent); }
.button--primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
.button--secondary { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.button--secondary:hover { border-color: #adb9b7; background: var(--surface-soft); }
.button--quiet { border-color: transparent; color: var(--muted); background: transparent; }
.button--quiet:hover { color: var(--ink); background: var(--surface-soft); }
.button--block { width: 100%; }
.button:focus-visible, .nav-button:focus-visible, .modal-close:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(15, 118, 110, .18);
  outline-offset: 2px;
}

/* Compatibility for buttons rendered by the admin data templates. */
.primary-button, .secondary-button, .ghost-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}
.primary-button { border-color: var(--accent); color: #fff; background: var(--accent); }
.secondary-button { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.ghost-button { border-color: transparent; color: var(--muted); background: transparent; }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button:hover { background: var(--surface-soft); }
.ghost-button:hover { color: var(--ink); background: var(--surface-soft); }

/* App shell */
.app-shell { min-height: 100dvh; }
.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
}
.brand-lockup, .topbar-actions, .admin-identity, .topbar-left { display: flex; align-items: center; }
.topbar-left { gap: 12px; }
.brand-lockup { gap: 11px; }
.brand-lockup strong { display: block; font-size: 15px; line-height: 1.25; }
.brand-lockup span { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; }
.brand-mark {
  width: 38px;
  height: 38px;
  padding: 3px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line);
}
.mobile-nav-toggle, .mobile-page-title { display: none; }
.mobile-nav-close { display: none; }
.mobile-nav-toggle {
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
}
.mobile-nav-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.topbar-actions { gap: 12px; }
.environment-badge {
  padding: 4px 8px;
  border-radius: 5px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
}
.admin-identity { gap: 8px; }
.admin-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 7px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
}
.admin-name { color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.app-body { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100dvh - 64px); }
.mobile-nav-backdrop { display: none; }

/* Sidebar */
.sidebar {
  position: sticky;
  top: 64px;
  height: calc(100dvh - 64px);
  padding: 20px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.nav-section + .nav-section { margin-top: 22px; }
.nav-caption { padding: 0 10px 8px; color: #9aa4aa; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.nav-button {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  color: #59636c;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  background: transparent;
  transition: color 180ms ease, background-color 180ms ease;
}
.nav-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-button:hover { color: var(--ink); background: var(--surface-soft); }
.nav-button.active { color: var(--accent-dark); background: var(--accent-soft); }
.nav-button.active::before {
  position: absolute;
  top: 50%;
  left: -12px;
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  content: "";
  transform: translateY(-50%);
}

/* Workspace and pages */
.workspace { width: 100%; min-width: 0; max-width: 1480px; padding: 32px 36px 52px; }
.page { display: none; }
.page.active { display: block; animation: page-in 180ms ease-out both; }
.page-heading { display: flex; width: 100%; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading h1 { margin-top: 8px; font-size: 28px; letter-spacing: -.025em; }
.page-heading p { margin-top: 7px; color: var(--muted); }
.page-heading > div:first-child { min-width: 0; }
.heading-actions { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; gap: 10px; margin-left: auto; }

/* Dashboard */
.summary-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.summary-card {
  grid-column: span 4;
  min-height: 116px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.summary-card--primary, .summary-card--featured { grid-column: span 6; background: var(--surface-strong); border-color: var(--surface-strong); }
.summary-card--accent { grid-column: span 3; background: var(--accent-soft); border-color: var(--accent-line); }
.summary-card--compact { grid-column: span 3; }
.summary-card--third { grid-column: span 4; }
.summary-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.summary-card strong { display: block; margin-top: 17px; font-size: 30px; font-weight: 720; line-height: 1; font-variant-numeric: tabular-nums; }
.summary-card--primary span, .summary-card--primary strong, .summary-card--featured span, .summary-card--featured strong { color: #fff; }
.summary-card--primary span, .summary-card--featured span { color: rgba(255,255,255,.62); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 16px; align-items: start; }

/* Panels and tables */
.panel { margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel--table { overflow: visible; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { font-size: 15px; letter-spacing: -.01em; }
.panel-heading p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.panel--table > .table-wrap { border: 0; border-radius: 0; }
.table-wrap { width: 100%; overflow-x: auto; background: var(--surface); }
.table-meta { margin: 0; padding: 11px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; background: var(--surface-soft); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th, td { padding: 13px 16px; border-bottom: 1px solid #edf1f0; text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: #7b858d; background: #fafcfb; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
tbody tr { transition: background-color 150ms ease; }
tbody tr:hover { background: #fafcfb; }
tbody tr:last-child td { border-bottom: 0; }
td strong { font-size: 13px; }
.muted { margin-top: 3px; color: var(--muted); font-size: 11px; }
.mono { max-width: 250px; overflow: hidden; color: #5b6570; font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; text-overflow: ellipsis; }
.row-actions { display: flex; align-items: center; gap: 4px; }
.row-actions .button { min-height: 30px; padding: 0 8px; font-size: 11px; }
.edit-prize { color: var(--accent-dark); }
.delete-prize { color: var(--danger); }
.tag { display: inline-flex; min-height: 23px; align-items: center; padding: 0 8px; border-radius: 5px; color: #5b6570; background: #f0f3f3; font-size: 11px; font-weight: 650; }
.tag.win { color: var(--success); background: var(--success-soft); }
.tag.lose { color: #68737c; background: #f0f3f3; }
.tag.off { color: var(--danger); background: var(--danger-soft); }
.table-image { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 7px; object-fit: cover; background: var(--surface-soft); }
.coupon-qr-link { min-height: 32px; padding: 0 9px; font-size: 11px; }

/* Quick actions and hierarchy */
.panel--insight { padding-bottom: 8px; }
.quick-action-list { display: grid; gap: 8px; padding: 12px; }
.quick-action {
  display: flex;
  width: 100%;
  min-height: 62px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-align: left;
  background: var(--surface);
  transition: border-color 180ms ease, background-color 180ms ease, transform 120ms ease;
}
.quick-action:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.quick-action:active { transform: translateY(1px); }
.quick-action span { font-size: 13px; font-weight: 650; }
.quick-action small { color: var(--muted); font-size: 11px; }
.detail-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.detail-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.detail-card--wide { grid-column: 1 / -1; }
.detail-card h2 { font-size: 15px; }
.detail-card p { margin-top: 8px; color: var(--muted); font-size: 12px; }
.detail-card .detail-value { display: block; margin-top: 10px; color: var(--ink); font-size: 22px; font-weight: 700; }
.detail-card .button { margin-top: 16px; }
.detail-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.detail-card-actions .button { margin-top: 0; }
.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.metric span { color: var(--muted); font-size: 11px; font-weight: 700; }
.metric strong { display: block; margin-top: 9px; font-size: 22px; font-variant-numeric: tabular-nums; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.form-actions .button { min-width: 112px; }
.check-group { display: flex; flex-wrap: wrap; gap: 20px; }
.check-inline { display: flex; flex-direction: row; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 600; white-space: nowrap; }
.check-inline input { width: 15px; min-height: 15px; accent-color: var(--accent); }
.filter-bar { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.filter-bar input { max-width: 420px; }
.form-error { margin-top: 14px; color: var(--danger); font-size: 12px; }

/* Empty and toast */
.empty-state { display: grid; min-height: 180px; place-content: center; gap: 6px; padding: 28px; text-align: center; }
.empty-state strong { font-size: 14px; }
.empty-state span { color: var(--muted); font-size: 12px; }
.toast {
  position: fixed;
  z-index: 200;
  top: 18px;
  right: 22px;
  max-width: min(400px, calc(100vw - 32px));
  padding: 11px 14px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--surface-strong);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.toast.error { background: var(--danger); }

/* Modals */
.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, .42);
  backdrop-filter: blur(4px);
}
.modal-card {
  display: flex;
  width: min(700px, 100%);
  max-height: min(88vh, 820px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(17, 24, 39, .18);
  animation: modal-in 180ms ease-out both;
}
.modal-card--wide { width: min(980px, 100%); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin-top: 6px; font-size: 19px; letter-spacing: -.02em; }
.modal-header p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.modal-close {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
  font-size: 22px;
  line-height: 1;
}
.modal-close:hover { color: var(--ink); background: var(--surface-soft); }
.modal-body { overflow-y: auto; padding: 24px; }
.user-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.user-summary > div { padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.user-summary > div.wide { grid-column: 1 / -1; }
.user-summary span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.user-summary strong { display: block; margin-top: 6px; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.chance-adjust { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.chance-adjust .field { flex: 0 0 180px; }
.chance-adjust-actions { display: flex; gap: 8px; }

@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes sheet-in { from { opacity: .6; transform: translateY(100%); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1240px) {
  .summary-card--primary, .summary-card--featured { grid-column: span 6; }
  .summary-card--accent, .summary-card--compact, .summary-card--third { grid-column: span 3; }
}

@media (max-width: 1040px) {
  .app-body { grid-template-columns: 208px minmax(0, 1fr); }
  .workspace { padding: 26px 24px 44px; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .login-view { padding: 20px; }
  .login-shell { min-height: 0; grid-template-columns: 1fr; }
  .login-visual { min-height: 220px; }
  .login-panel { padding: 36px 30px 40px; }
}

@media (max-width: 760px) {
  .topbar { min-height: 60px; padding: 0 16px; }
  .topbar-left { gap: 9px; }
  .mobile-nav-toggle { display: flex; }
  .topbar .brand-lockup > div { display: none; }
  .topbar .brand-mark { width: 32px; height: 32px; }
  .mobile-page-title { display: block; margin-left: 2px; font-size: 15px; font-weight: 700; }
  .environment-badge, .admin-name { display: none; }
  .app-body { display: block; min-height: calc(100dvh - 60px); }
  .sidebar {
    position: fixed;
    z-index: 60;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(286px, 86vw);
    height: 100dvh;
    padding: 22px 14px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: var(--surface);
    transform: translateX(-102%);
    transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
  }
  .mobile-nav-close {
    position: absolute;
    top: 16px;
    right: 14px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    background: var(--surface);
    font-size: 22px;
    line-height: 1;
  }
  body.mobile-nav-open .sidebar { transform: translateX(0); }
  .mobile-nav-backdrop {
    position: fixed;
    z-index: 55;
    inset: 0;
    display: block;
    background: rgba(17, 24, 39, .36);
  }
  .nav-section + .nav-section { margin-top: 22px; }
  .nav-caption { display: block; }
  .nav-button { width: 100%; min-height: 44px; padding: 0 10px; }
  .nav-button.active::before { display: block; }
  .workspace { padding: 22px 16px 40px; }
  .page-heading { align-items: flex-start; gap: 14px; }
  .page-heading h1 { font-size: 24px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-card, .summary-card--primary, .summary-card--featured, .summary-card--accent, .summary-card--compact, .summary-card--third { grid-column: span 1; }
  .summary-card--primary, .summary-card--featured { grid-column: 1 / -1; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-stack { grid-template-columns: 1fr; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .filter-bar input { max-width: none; grid-column: 1 / -1; }
  .filter-bar .check-inline { grid-column: 1; align-self: center; }
  .filter-bar .button { grid-column: 2; min-width: 92px; }
  .form-grid, .modal-body { grid-template-columns: 1fr; }
  .field--wide, .form-actions { grid-column: 1 / -1; }
  .form-actions .button { flex: 1; min-width: 0; }
  .user-summary { grid-template-columns: 1fr; }
  .chance-adjust { align-items: stretch; flex-direction: column; }
  .chance-adjust .field { flex-basis: auto; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal-card, .modal-card--wide {
    width: 100%;
    max-height: 92dvh;
    border-radius: 14px 14px 0 0;
    animation: sheet-in 220ms cubic-bezier(.2, .8, .2, 1) both;
  }
  .modal-header { padding: 20px 18px 14px; }
  .modal-body { padding: 18px; }
  .table-wrap { background: transparent; }
  .panel--table > .table-wrap { background: transparent; }
  table, thead, tbody, tr, th, td { display: block; width: 100%; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; padding: 12px; }
  tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(17, 24, 39, .045);
  }
  td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px solid #edf1f0;
    white-space: normal;
  }
  td:last-child { border-bottom: 0; }
  td::before {
    content: attr(data-label);
    flex: 0 0 76px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }
  td > * { min-width: 0; }
  td .mono { max-width: none; white-space: normal; word-break: break-all; }
  .row-actions { justify-content: flex-end; flex-wrap: wrap; }
  .table-image { flex: 0 0 auto; }
}

@media (max-width: 560px) {
  .login-view { padding: 12px; }
  .login-panel { padding: 30px 22px 34px; }
  .topbar-actions { gap: 4px; }
  .page-heading { flex-direction: column; }
  .page-heading .button { width: 100%; }
  .metric-strip { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 0; }
  .modal-header, .modal-body { padding-right: 18px; padding-left: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* WeUI component layer with the Lanlidou admin theme. */
.button.weui-btn {
  position: relative;
  width: auto;
  flex: 0 1 auto;
  overflow: hidden;
  height: 44px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, .06), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.button--block.weui-btn { width: 100%; }
.button.weui-btn::after { display: none; }
.button--primary.weui-btn {
  border-color: #0e6d66;
  background: linear-gradient(180deg, #16857b 0%, #0f766e 100%);
  box-shadow: 0 2px 4px rgba(15, 118, 110, .22), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.button--primary.weui-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(15, 118, 110, .2), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.button--secondary.weui-btn,
.button--quiet.weui-btn {
  box-shadow: 0 1px 2px rgba(17, 24, 39, .05), inset 0 1px 0 #fff;
}
.button--secondary.weui-btn:hover {
  border-color: var(--accent-line);
  background: linear-gradient(180deg, #ffffff 0%, #f1f8f7 100%);
}
.button--quiet.weui-btn { box-shadow: none; }
.button.weui-btn:active {
  transform: translateY(1px) scale(.99);
  box-shadow: inset 0 2px 5px rgba(17, 24, 39, .12);
}

@media (max-width: 760px) {
  .button.weui-btn { height: 46px; min-height: 46px; }
  .form-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .form-actions .button.weui-btn { width: 100%; }
}

/* Survey */
.modal-card--survey { width: min(920px, 100%); max-height: min(90vh, 880px); }
.modal-header--survey { padding: 24px 28px 20px; }
.survey-form { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.survey-form__body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 28px 28px; background: var(--surface-soft); }
.survey-form__footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 28px; border-top: 1px solid var(--line); background: var(--surface); }
.survey-form__footer .button,
.survey-editor-head .button { width: auto; min-width: 112px; margin: 0; }

.survey-block + .survey-block { margin-top: 22px; }
.survey-block__heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.survey-block__heading h3, .survey-editor-head h3 { font-size: 15px; }
.survey-block__heading p, .survey-editor-head p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.survey-basic-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.survey-switch-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.survey-switch-field__copy strong { display: block; font-size: 13px; }
.survey-switch-field__copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.survey-toggle { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.survey-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.survey-toggle__track {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 20px;
  flex: 0 0 auto;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: #cbd5d1;
  transition: background-color 180ms ease;
}
.survey-toggle__thumb {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(17, 24, 39, .18);
  transform: translateX(0);
  transition: transform 180ms ease;
}
.survey-toggle input:checked + .survey-toggle__track { background: var(--accent); }
.survey-toggle input:checked + .survey-toggle__track .survey-toggle__thumb { transform: translateX(16px); }
.survey-toggle input:focus-visible + .survey-toggle__track { box-shadow: 0 0 0 3px rgba(15, 118, 110, .15); }
.survey-toggle__label { color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.survey-toggle--compact .survey-toggle__track { width: 32px; height: 18px; }
.survey-toggle--compact .survey-toggle__thumb { width: 14px; height: 14px; }
.survey-toggle--compact input:checked + .survey-toggle__track .survey-toggle__thumb { transform: translateX(14px); }

.survey-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.survey-editor-head .button { min-height: 36px; min-width: 0; padding: 0 12px; }
.survey-editor-head .button svg { width: 15px; height: 15px; }
.survey-question-list { display: grid; gap: 12px; }
.survey-question-editor {
  padding: 18px 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(17, 24, 39, .03);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.survey-question-editor:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(15, 118, 110, .08); }
.survey-question-editor__top { display: grid; grid-template-columns: 36px minmax(0, 1.35fr) minmax(220px, .65fr); gap: 14px; align-items: start; }
.survey-question-editor__index {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 800;
}
.survey-question-editor__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.survey-question-editor__toggles { display: flex; align-items: center; gap: 18px; }
.survey-remove-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--danger);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
}
.survey-remove-button:hover { border-color: #efd4da; background: var(--danger-soft); }
.survey-remove-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.survey-empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
}
.survey-empty-state__icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 12px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 18px;
  font-weight: 800;
}
.survey-empty-state strong { font-size: 14px; }
.survey-empty-state span { color: var(--muted); font-size: 12px; }

.survey-answer-summary {
  display: -webkit-box;
  overflow: hidden;
  max-width: 420px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.survey-response-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.survey-response-meta > div { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.survey-response-meta span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.survey-response-meta strong { display: block; margin-top: 5px; overflow-wrap: anywhere; font-size: 13px; }
.survey-answer-list { display: grid; gap: 10px; }
.survey-answer-item { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.survey-answer-item h3 { font-size: 13px; }
.survey-answer-item p { margin-top: 7px; color: var(--ink-soft); line-height: 1.65; white-space: pre-wrap; }

@media (max-width: 900px) {
  .survey-basic-grid { grid-template-columns: 1fr; }
  .survey-question-editor__top { grid-template-columns: 32px minmax(0, 1fr); }
  .survey-question-editor__question, .survey-question-editor__description { grid-column: 2; }
}

@media (max-width: 640px) {
  .survey-form__body { padding: 18px; }
  .survey-form__footer { padding: 14px 18px; }
  .survey-editor-head { align-items: flex-start; flex-direction: column; }
  .survey-question-editor__bottom { align-items: flex-start; flex-direction: column; }
  .survey-response-meta { grid-template-columns: 1fr; }
}
