:root {
  --bg: #f6f4f0;
  --panel: #ffffff;
  --panel-soft: #fbf7f1;
  --ink: #221b15;
  --muted: #847668;
  --line: #eadfd2;
  --brand: #65421d;
  --brand-dark: #1d1c1d;
  --accent: #ff9e33;
  --green: #46776b;
  --blue: #586ea7;
  --danger: #b9473d;
  --shadow: 0 16px 40px rgba(55, 38, 23, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--bg);
}

body {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 158, 51, 0.11), transparent 32rem),
    linear-gradient(225deg, rgba(70, 119, 107, 0.12), transparent 30rem),
    var(--bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.hidden {
  display: none !important;
}

.login-view {
  display: grid;
  min-height: 100vh;
  padding: 28px;
  place-items: center;
}

.login-panel {
  width: min(100%, 456px);
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-panel h1 {
  margin: 24px 0 10px;
  font-size: 30px;
  letter-spacing: 0;
}

.login-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

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

.login-form span,
.form-row span {
  color: #5f5246;
  font-size: 13px;
  font-weight: 900;
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 900;
}

.shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px;
  overflow: hidden;
  border-right: 1px solid rgba(234, 223, 210, 0.82);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-brand {
  margin-bottom: 26px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand), var(--accent));
  font-size: 22px;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(101, 66, 29, 0.18);
}

.brand-mark-image {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.brand-name {
  color: var(--brand);
  font-size: 18px;
  font-weight: 950;
}

.brand-sub,
.eyebrow,
.table-note,
.cell-sub {
  color: var(--muted);
}

.brand-sub,
.eyebrow {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.nav {
  display: grid;
  flex: 1 1 auto;
  gap: 8px;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding-right: 4px;
}

.nav::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  color: #64594f;
  background: transparent;
  text-align: left;
  font-weight: 900;
}

.nav-button:hover {
  background: rgba(255, 247, 237, 0.8);
}

.nav-button.active {
  color: var(--brand);
  background: #fff4e5;
  box-shadow: inset 0 0 0 1px rgba(255, 158, 51, 0.24);
}

.nav-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(101, 66, 29, 0.08);
  border-radius: 12px;
  color: #fffaf2;
  background: linear-gradient(145deg, #242225, #514131);
  box-shadow: 0 8px 18px rgba(29, 28, 29, 0.1);
  transition: background 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.nav-icon-svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.nav-button.active .nav-icon {
  color: #1d1c1d;
  background: linear-gradient(145deg, #ffb663, var(--accent));
  box-shadow: 0 10px 20px rgba(255, 158, 51, 0.24);
}

.nav-button:hover .nav-icon {
  transform: translateY(-1px);
}

.nav-section {
  display: grid;
  gap: 6px;
}

.nav-section + .nav-section {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-section-title {
  padding: 0 12px 2px;
  color: rgba(255, 250, 242, 0.38);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.sidebar-note {
  display: none;
  flex: 0 0 auto;
  margin-top: 16px;
  padding: 18px;
  border-radius: 22px;
  color: #fffaf2;
  background: linear-gradient(145deg, #1d1c1d, #65421d);
  box-shadow: var(--shadow);
}

.sidebar-note-title {
  font-weight: 950;
}

.sidebar-note-copy {
  margin-top: 10px;
  color: rgba(255, 250, 242, 0.78);
  font-size: 13px;
  line-height: 1.7;
}

@media (min-width: 861px) and (min-height: 1360px) {
  .sidebar-note {
    display: block;
  }
}

.main {
  min-width: 0;
  padding: 28px;
}

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

h1,
h2 {
  margin: 0;
  color: var(--brand);
  letter-spacing: 0;
}

.topbar h1 {
  margin-top: 4px;
  font-size: 32px;
  line-height: 1.15;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-top: 10px;
  padding: 0 12px;
  border-radius: 999px;
  color: #7a4a1d;
  background: #fff0d8;
  font-size: 12px;
  font-weight: 900;
}

.connection-status.online {
  color: var(--green);
  background: #e8f4ef;
}

.connection-status.offline {
  color: var(--danger);
  background: #fff0ee;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-user {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--brand);
  background: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.field,
.control,
.search-input {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.control {
  width: auto;
  min-width: 176px;
}

textarea.field {
  min-height: 96px;
  padding-top: 12px;
  resize: vertical;
}

.field:focus,
.control:focus,
.search-input:focus {
  border-color: rgba(255, 158, 51, 0.65);
  box-shadow: 0 0 0 3px rgba(255, 158, 51, 0.12);
}

.primary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 14px;
  border: 0;
  font-weight: 950;
  white-space: nowrap;
}

.primary-button {
  color: #fff;
  background: var(--brand-dark);
  box-shadow: 0 12px 26px rgba(29, 28, 29, 0.16);
}

.ghost-button {
  color: var(--brand);
  border: 1px solid #dccbbb;
  background: rgba(255, 255, 255, 0.84);
}

.danger-button {
  color: var(--danger);
  border: 1px solid #efc3bd;
  background: #fff5f4;
}

.content {
  display: grid;
  gap: 18px;
}

.card,
.hero-panel,
.module-toolbar,
.panel {
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.hero-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  min-height: 190px;
  padding: 26px;
  overflow: hidden;
  color: #fffaf2;
  background:
    linear-gradient(135deg, rgba(255, 158, 51, 0.35), transparent 45%),
    linear-gradient(145deg, #1d1c1d, #65421d);
}

.hero-kicker {
  color: rgba(255, 250, 242, 0.68);
  font-size: 12px;
  font-weight: 950;
}

.hero-title {
  max-width: 620px;
  margin-top: 12px;
  font-size: 30px;
  font-weight: 950;
  line-height: 1.25;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 110px);
  gap: 12px;
}

.hero-metrics div {
  min-height: 92px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
}

.hero-metrics strong {
  display: block;
  font-size: 26px;
}

.hero-metrics span {
  color: rgba(255, 250, 242, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.stats-grid,
.dashboard-grid,
.module-grid,
.form-grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card,
.module-card,
.panel {
  padding: 20px;
}

.stat-label,
.table-note,
.cell-sub,
.field-hint {
  font-size: 13px;
  line-height: 1.55;
}

.stat-value {
  margin: 10px 0 4px;
  color: var(--brand-dark);
  font-size: 32px;
  font-weight: 950;
}

.module-card {
  min-height: 140px;
}

.module-title,
.panel-title,
.toolbar-title,
.strong {
  color: var(--brand);
  font-weight: 950;
}

.module-title,
.panel-title,
.toolbar-title {
  font-size: 18px;
}

.module-copy {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.75;
}

.module-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
}

.toolbar-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.scan-panel {
  margin-bottom: 18px;
  padding: 20px;
}

.scan-head,
.scan-lookup,
.scan-member-card,
.scan-submit {
  display: flex;
  align-items: center;
  gap: 14px;
}

.scan-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.scan-lookup {
  margin-bottom: 14px;
}

.scan-code-input {
  flex: 1;
  min-width: 320px;
  font-size: 18px;
  font-weight: 900;
}

.scan-empty,
.scan-member-card {
  min-height: 68px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(234, 223, 210, 0.82);
  border-radius: 18px;
  background: #fffaf4;
}

.scan-member-card {
  justify-content: space-between;
}

.scan-empty {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-weight: 850;
}

.scan-points-grid {
  display: grid;
  grid-template-columns: 220px 180px minmax(0, 1fr);
  gap: 14px;
}

.scan-points-grid .wide {
  grid-column: span 3;
}

.quick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-chip {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255, 158, 51, 0.28);
  border-radius: 999px;
  color: var(--brand);
  background: #fff4e5;
  font-size: 13px;
  font-weight: 950;
}

.quick-chip:hover {
  background: #ffe8c7;
}

.coupon-type-presets {
  display: grid;
  gap: 10px;
}

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

.coupon-type-chip {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 158, 51, 0.26);
  border-radius: 18px;
  color: #fffaf2;
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
}

.coupon-type-chip strong {
  overflow: hidden;
  color: #fffaf2;
  font-size: 15px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coupon-type-chip span,
.coupon-type-chip em {
  overflow: hidden;
  color: rgba(255, 250, 242, 0.68);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coupon-type-chip.active {
  border-color: #ffbd73;
  color: #18191d;
  background: #ffbd73;
}

.coupon-type-chip.active strong,
.coupon-type-chip.active span,
.coupon-type-chip.active em {
  color: #18191d;
}

.coupon-issue-form {
  grid-template-columns: 1fr;
}

.coupon-issue-controls {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(180px, 220px) minmax(160px, 220px) minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.coupon-issue-controls .form-row {
  min-width: 0;
}

.coupon-issue-submit {
  min-width: 112px;
  min-height: 44px;
  padding: 0 18px;
  white-space: nowrap;
}

.coupon-issue-preview {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-height: 78px;
  padding: 12px;
}

.coupon-issue-preview div {
  display: grid;
  gap: 6px;
  min-width: 0;
  min-height: 78px;
  padding: 10px 12px;
  align-content: center;
}

.coupon-issue-preview strong {
  display: block;
  overflow: visible;
  font-size: 22px;
  line-height: 1.12;
  overflow-wrap: anywhere;
  white-space: normal;
}

.scan-empty.compact {
  min-height: 52px;
  margin: 0;
  grid-column: 1 / -1;
}

.coupon-redeem-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 14px;
  color: rgba(255, 250, 242, 0.52);
  font-size: 12px;
  font-weight: 950;
}

.coupon-redeem-divider::before,
.coupon-redeem-divider::after {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
  content: "";
}

.coupon-member-card {
  justify-content: flex-start;
}

.coupon-member-card .icon-button {
  margin-left: auto;
}

.coupon-redeem-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: -2px 0 16px;
}

.coupon-redeem-item {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  color: #fffaf2;
  background: rgba(255, 255, 255, 0.09);
  text-align: left;
}

.coupon-redeem-item:hover {
  border-color: rgba(255, 189, 115, 0.72);
  background: rgba(255, 189, 115, 0.16);
}

.coupon-redeem-item.active {
  border-color: #ffbd73;
  background: #ffbd73;
}

.coupon-redeem-item strong,
.coupon-redeem-item span,
.coupon-redeem-item em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coupon-redeem-item strong {
  color: inherit;
  font-size: 15px;
  font-weight: 950;
}

.coupon-redeem-item span {
  color: rgba(255, 250, 242, 0.68);
  font-size: 12px;
  font-weight: 850;
}

.coupon-redeem-item em {
  color: #ffbd73;
  font-size: 13px;
  font-style: normal;
  font-weight: 950;
}

.coupon-redeem-item.active strong,
.coupon-redeem-item.active span,
.coupon-redeem-item.active em {
  color: #18191d;
}

.coupon-success-banner {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid rgba(110, 231, 183, 0.36);
  border-radius: 18px;
  color: #ecfdf5;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.28), rgba(20, 83, 45, 0.32));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.coupon-success-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #123222;
  background: #86efac;
  font-size: 22px;
  font-weight: 950;
}

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

.coupon-success-banner strong {
  font-size: 16px;
  line-height: 1.2;
  font-weight: 950;
}

.coupon-success-banner span {
  margin-top: 3px;
  color: rgba(236, 253, 245, 0.82);
  font-size: 13px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.scan-preview {
  display: grid;
  grid-column: span 2;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-height: 72px;
  padding: 12px;
  border-radius: 18px;
  background: #1d1c1d;
  color: #fffaf2;
}

.redemption-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 140px;
  gap: 14px;
  align-items: end;
}

.redemption-grid .wide {
  grid-column: span 2;
}

.redemption-preview {
  display: grid;
  grid-column: span 2;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-height: 78px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.24);
}

.redemption-preview div {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
}

.redemption-preview strong {
  display: block;
  color: #ffbd73;
  font-size: 22px;
  line-height: 1.1;
}

.redemption-preview span {
  color: rgba(255, 250, 242, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.redemption-preview > span {
  grid-column: 1 / -1;
  align-self: center;
}

.redemption-submit {
  align-self: stretch;
}

.redemption-submit .primary-button {
  width: 100%;
  min-height: 78px;
  color: #18191d;
  background: var(--accent);
  box-shadow: none;
}

.scan-preview > span {
  grid-column: 1 / -1;
  align-self: center;
  color: rgba(255, 250, 242, 0.72);
  font-size: 13px;
  font-weight: 850;
}

.scan-preview div {
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
}

.scan-preview strong {
  display: block;
  color: var(--accent);
  font-size: 22px;
  line-height: 1.1;
}

.scan-preview span {
  color: rgba(255, 250, 242, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.scan-preview .scan-active-hint {
  grid-column: 1 / -1;
  display: block;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 189, 115, 0.14);
  color: #ffd8a8;
  font-size: 13px;
  line-height: 1.35;
}

.coupon-issue-preview {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 78px;
}

.coupon-issue-preview div {
  min-height: 78px;
  padding: 10px 12px;
}

.coupon-issue-preview strong {
  overflow: visible;
  font-size: 22px;
  line-height: 1.12;
  overflow-wrap: anywhere;
  white-space: normal;
}

.coupon-status-preview {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
  padding: 14px;
}

.coupon-status-preview.empty {
  grid-template-columns: 1fr;
}

.coupon-status-preview .coupon-status-item {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.09);
}

.coupon-status-preview .coupon-status-item.primary {
  border-color: rgba(255, 189, 115, 0.34);
  background: rgba(255, 189, 115, 0.14);
}

.coupon-status-preview .coupon-status-item span {
  order: 1;
  color: rgba(255, 250, 242, 0.58);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 950;
}

.coupon-status-preview .coupon-status-item strong {
  order: 2;
  min-width: 0;
  color: #fffaf2;
  font-size: 18px;
  line-height: 1.28;
  font-weight: 950;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.coupon-status-preview .coupon-status-item.primary strong {
  color: #ffbd73;
}

.coupon-redeem-form {
  grid-template-columns: 1fr;
}

.coupon-redeem-controls {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(260px, 420px) auto;
  align-items: end;
  justify-content: start;
  gap: 12px;
}

.coupon-store-row {
  min-width: 0;
}

.coupon-redeem-submit {
  min-width: 112px;
  min-height: 44px;
  padding: 0 18px;
  white-space: nowrap;
}

.scan-submit {
  justify-content: flex-end;
}

.search-input {
  width: 260px;
}

.count-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--brand);
  background: #f6eadb;
  font-size: 12px;
  font-weight: 950;
}

.badge.green {
  color: var(--green);
  background: #e8f4ef;
}

.badge.amber {
  color: #8a551d;
  background: #fff0d8;
}

.badge.blue {
  color: var(--blue);
  background: #e8eefb;
}

.badge.danger {
  color: var(--danger);
  background: #fff0ee;
}

.badge.muted {
  color: #777;
  background: #f0eeeb;
}

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

.table-wrap {
  overflow: auto;
}

.table-wrap.compact table {
  min-width: 0;
}

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

.compact table {
  min-width: 100%;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

td {
  color: #342b22;
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

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

.inline-error {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(210, 70, 70, 0.18);
  border-radius: 14px;
  color: var(--danger);
  background: #fff2f0;
  font-weight: 900;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 4px 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.table-pager .ghost-button {
  min-height: 34px;
}

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

.icon-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #51483f;
  background: #fff;
  font-size: 13px;
  font-weight: 900;
}

.icon-button:hover {
  border-color: #d8c4af;
  background: #fff8ef;
}

.icon-button.accent-action,
.open-tata-button {
  border-color: #f59f44;
  background: #fff2dc;
  color: #7a3f00;
}

.icon-button.accent-action:hover,
.open-tata-button:hover {
  border-color: #e88416;
  background: #ffdca8;
}

.danger-text {
  color: var(--danger);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(29, 28, 29, 0.36);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(680px, 100%);
  height: 100%;
  padding: 26px;
  overflow: auto;
  background: var(--bg);
  box-shadow: -24px 0 60px rgba(29, 28, 29, 0.16);
}

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

.drawer-head h2 {
  margin-top: 4px;
  font-size: 26px;
}

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

.form-row.wide {
  grid-column: 1 / -1;
}

.field-hint {
  color: var(--muted);
}

.drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.participant-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255, 158, 51, 0.12), transparent 45%),
    #fff;
}

.participant-summary h3 {
  margin: 4px 0 6px;
  color: #1d1c1d;
  font-size: 20px;
  line-height: 1.25;
}

.participant-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.participant-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.muted-count {
  color: #6f665c;
  background: #f0eeeb;
}

.participant-member {
  min-width: 148px;
}

.participant-note {
  margin-top: 12px;
}

.member-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 16px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.member-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #fff;
  background: var(--brand);
  font-size: 22px;
  font-weight: 950;
}

.member-avatar-image {
  display: block;
  object-fit: cover;
}

.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 50;
  display: none;
  padding: 14px 18px;
  border-radius: 14px;
  color: #fff;
  background: var(--brand-dark);
  box-shadow: var(--shadow);
  font-weight: 900;
}

.toast.show {
  display: block;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.table-image {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: #f6f2ed;
  font-size: 12px;
  font-weight: 900;
}

.table-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-upload-box {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.image-upload-preview {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px dashed #d9c7b6;
  border-radius: 16px;
  color: var(--muted);
  background: #faf7f2;
  font-size: 13px;
  font-weight: 900;
}

.image-upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-upload-body {
  display: grid;
  gap: 10px;
  align-content: start;
}

.image-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.multi-image-upload-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.multi-image-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 10px;
  min-height: 92px;
  padding: 10px;
  border: 1px dashed #d9c7b6;
  border-radius: 16px;
  color: var(--muted);
  background: #faf7f2;
  font-size: 13px;
  font-weight: 900;
}

.multi-image-preview.empty {
  display: grid;
  place-items: center;
}

.multi-image-preview img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  background: #efe8dc;
}

.upload-picker {
  position: relative;
  overflow: hidden;
}

.upload-picker input,
.table-import-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.table-import-picker,
.table-export-link,
.import-template-link {
  position: relative;
  min-width: 104px;
}

.article-import-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.article-fetch-button {
  min-width: 148px;
}

.member-scan-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.member-scan-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.member-scan-result {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

/* Visual hierarchy refresh */
:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --panel-soft: #f7faf8;
  --ink: #18191d;
  --muted: #69717d;
  --line: #e2e7ec;
  --brand: #5d4025;
  --brand-dark: #17181c;
  --accent: #ff9e33;
  --green: #2f7d68;
  --blue: #486db5;
  --purple: #7357b8;
  --danger: #c64a3f;
  --shadow: 0 18px 44px rgba(24, 25, 29, 0.08);
  --shadow-soft: 0 8px 22px rgba(24, 25, 29, 0.06);
}

body {
  background:
    radial-gradient(circle at 78% 8%, rgba(72, 109, 181, 0.14), transparent 26rem),
    linear-gradient(180deg, #f8fafb 0%, var(--bg) 46rem);
}

.shell {
  grid-template-columns: 288px minmax(0, 1fr);
}

.sidebar {
  padding: 22px 18px;
  border-right: 0;
  color: rgba(255, 250, 242, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 158, 51, 0.11), transparent 18rem),
    #17181c;
  box-shadow: 14px 0 42px rgba(24, 25, 29, 0.1);
}

.sidebar .brand-name {
  color: #fffaf2;
}

.sidebar .brand-sub {
  color: rgba(255, 250, 242, 0.54);
}

.brand-mark {
  border-radius: 16px;
  border: 1px solid rgba(255, 158, 51, 0.2);
  background: #17181c;
  color: var(--accent);
  box-shadow: 0 14px 30px rgba(24, 25, 29, 0.18);
}

.nav {
  gap: 6px;
  max-height: none;
  padding-right: 0;
}

.nav-button {
  min-height: 44px;
  padding: 0 12px;
  color: rgba(255, 250, 242, 0.68);
  border-radius: 14px;
  font-size: 14px;
}

.nav-button:hover {
  color: #fffaf2;
  background: rgba(255, 255, 255, 0.07);
}

.nav-button.active {
  color: #fffaf2;
  background:
    linear-gradient(90deg, rgba(255, 158, 51, 0.24), rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

.nav-icon {
  width: 31px;
  height: 31px;
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 250, 242, 0.84);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.nav-button.active .nav-icon {
  color: #1d1c1d;
  background: var(--accent);
}

.sidebar-note {
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.main {
  justify-self: center;
  width: min(100%, 1560px);
  padding: 24px 30px 42px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  align-items: center;
  min-height: 88px;
  margin: -24px -30px 24px;
  padding: 18px 30px;
  border-bottom: 1px solid rgba(226, 231, 236, 0.82);
  background: rgba(248, 250, 251, 0.86);
  backdrop-filter: blur(18px);
}

.topbar h1 {
  color: var(--ink);
  font-size: 30px;
}

.eyebrow,
.toolbar-kicker,
.scan-kicker,
.focus-kicker {
  color: #87909d;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.connection-status {
  min-height: 28px;
  margin-top: 8px;
  color: #7a4a1d;
  background: #fff0d8;
}

.admin-user,
.field,
.control,
.search-input,
.ghost-button {
  border-color: #dce4eb;
  background: rgba(255, 255, 255, 0.92);
}

.primary-button {
  background: #18191d;
  box-shadow: 0 12px 26px rgba(24, 25, 29, 0.16);
}

.content {
  gap: 20px;
}

.card,
.module-toolbar,
.panel {
  border: 1px solid rgba(226, 231, 236, 0.88);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
}

.hero-panel {
  border: 0;
  border-radius: 28px;
  box-shadow: 0 28px 70px rgba(24, 25, 29, 0.18);
}

.command-hero {
  position: relative;
  align-items: stretch;
  min-height: 300px;
  padding: 32px;
  background:
    linear-gradient(145deg, rgba(47, 125, 104, 0.78), transparent 46%),
    linear-gradient(135deg, #17181c 0%, #242833 52%, #5d4025 100%);
}

.command-hero::after {
  position: absolute;
  right: -80px;
  bottom: -100px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: rgba(255, 158, 51, 0.16);
  content: "";
}

.hero-main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  max-width: 720px;
}

.hero-title {
  max-width: 720px;
  margin-top: 14px;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1.04;
}

.hero-copy {
  max-width: 640px;
  margin-top: 18px;
  color: rgba(255, 250, 242, 0.72);
  font-size: 15px;
  line-height: 1.8;
}

.hero-actions,
.focus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-action {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #fffaf2;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 950;
}

.hero-action.primary {
  color: #1d1c1d;
  border-color: transparent;
  background: var(--accent);
}

.original-hub-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 190px;
  padding: 28px;
  color: #fffaf2;
  border: 0;
  background:
    linear-gradient(135deg, rgba(255, 158, 51, 0.26), transparent 48%),
    linear-gradient(145deg, #17181c, #273139 56%, #5d4025);
  box-shadow: 0 28px 70px rgba(24, 25, 29, 0.16);
}

.original-hub-title {
  margin-top: 10px;
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 950;
  line-height: 1.06;
}

.original-hub-copy {
  max-width: 760px;
  margin-top: 14px;
  color: rgba(255, 250, 242, 0.72);
  line-height: 1.8;
}

.original-entry-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.original-entry-card {
  display: flex;
  flex-direction: column;
  min-height: 230px;
  padding: 22px;
}

.original-entry-card .module-copy {
  flex: 1;
}

.original-entry-featured {
  color: #fffaf2;
  border-color: transparent;
  background:
    linear-gradient(145deg, rgba(255, 158, 51, 0.42), transparent 58%),
    #18191d;
}

.original-entry-featured .module-title {
  color: #fffaf2;
}

.original-entry-featured .module-copy {
  color: rgba(255, 250, 242, 0.72);
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.studio-page {
  display: grid;
  gap: 18px;
}

.studio-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 104px;
  padding: 20px 22px;
  border: 1px solid rgba(226, 231, 236, 0.88);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
}

.studio-back {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid #dce4eb;
  border-radius: 50%;
  color: #18191d;
  background: #fff;
}

.studio-back svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.studio-title {
  margin-top: 5px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 950;
  line-height: 1.1;
}

.studio-copy {
  max-width: 760px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.7;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(430px, 0.88fr) minmax(450px, 1.12fr);
  gap: 18px;
  align-items: start;
}

.studio-job-status {
  margin: 16px 0 18px;
  padding: 13px 16px;
  border: 1px solid rgba(255, 158, 51, 0.32);
  border-radius: 16px;
  color: #5f3a12;
  background: #fff7e8;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.5;
}

.studio-job-status small {
  display: block;
  margin-top: 6px;
  color: inherit;
  opacity: 0.76;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.studio-job-status.status-succeeded {
  border-color: rgba(51, 148, 93, 0.26);
  color: #23653d;
  background: #effaf3;
}

.studio-job-status.status-failed {
  border-color: rgba(198, 74, 63, 0.24);
  color: var(--danger);
  background: #fff2f0;
}

.studio-control,
.studio-preview {
  padding: 20px;
}

.original-image-form {
  display: grid;
  gap: 18px;
}

.studio-prompt {
  min-height: 180px;
  padding: 16px;
  border-radius: 18px;
  line-height: 1.7;
}

.prompt-examples {
  display: grid;
  gap: 10px;
}

.prompt-chip {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid #e6d6c5;
  border-radius: 14px;
  color: #5d4025;
  background: #fff8ef;
  text-align: left;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.45;
}

.prompt-chip:hover {
  background: #ffefd8;
}

.original-size-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.studio-presets {
  margin-top: 0;
}

.original-controls {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.studio-submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.studio-generate {
  min-width: 160px;
  min-height: 48px;
}

.studio-preview {
  position: sticky;
  top: 112px;
}

.studio-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.studio-error {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  padding: 13px 15px;
  border: 1px solid rgba(198, 74, 63, 0.22);
  border-radius: 16px;
  color: var(--danger);
  background: #fff2f0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.studio-error strong {
  color: var(--danger);
  font-size: 15px;
  font-weight: 950;
}

.studio-error span {
  overflow-wrap: anywhere;
}

.studio-warning {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(186, 121, 36, 0.28);
  border-radius: 14px;
  color: #7a4d13;
  background: #fff8ec;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.studio-warning strong {
  color: #5d390f;
  font-size: 14px;
  font-weight: 950;
}

.studio-warning span {
  overflow-wrap: anywhere;
}

.original-image-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-height: 500px;
  padding: 14px;
  border: 1px solid #dce4eb;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 158, 51, 0.08), transparent 38%),
    #f7f9fb;
}

.original-image-result.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  border-style: dashed;
}

.original-image-result img {
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(226, 231, 236, 0.8);
}

.original-image-meta {
  display: grid;
  gap: 10px;
  align-content: start;
  color: var(--muted);
}

.original-image-meta strong {
  color: var(--brand);
  font-size: 22px;
}

.original-image-meta code {
  display: block;
  overflow-wrap: anywhere;
  padding: 12px;
  border-radius: 12px;
  color: var(--brand-dark);
  background: #fff;
}

.studio-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 360px;
  text-align: center;
}

.studio-empty-icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 24px;
  color: #18191d;
  background: var(--accent);
  font-size: 22px;
  font-weight: 950;
}

.studio-empty strong {
  color: var(--ink);
  font-size: 20px;
}

.studio-empty span {
  line-height: 1.7;
}

.hero-metrics {
  position: relative;
  z-index: 1;
  align-self: flex-end;
  grid-template-columns: 150px;
}

.hero-metrics div {
  min-height: 104px;
  padding: 18px;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(12px);
}

.hero-metrics strong {
  font-size: 34px;
}

.dashboard-focus {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
  gap: 18px;
}

.focus-card {
  padding: 24px;
  border-left: 5px solid var(--accent);
}

.focus-title {
  margin-top: 10px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 950;
}

.focus-copy {
  max-width: 720px;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.75;
}

.focus-strip {
  display: grid;
  gap: 14px;
}

.focus-strip .stat-card {
  min-height: 0;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  position: relative;
  min-height: 148px;
  overflow: hidden;
  padding: 22px;
}

.stat-card::after {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: rgba(105, 113, 125, 0.12);
  content: "";
}

.stat-card.tone-green::after {
  background: rgba(47, 125, 104, 0.16);
}

.stat-card.tone-amber::after {
  background: rgba(255, 158, 51, 0.2);
}

.stat-card.tone-blue::after {
  background: rgba(72, 109, 181, 0.16);
}

.stat-card.tone-purple::after {
  background: rgba(115, 87, 184, 0.16);
}

.stat-card.tone-danger::after {
  background: rgba(198, 74, 63, 0.16);
}

.stat-label {
  color: #737c89;
  font-weight: 950;
}

.stat-value {
  margin-top: 14px;
  color: var(--ink);
  font-size: 38px;
  line-height: 1;
}

.dashboard-grid {
  grid-template-columns: 1.1fr 1fr 1fr;
}

.module-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-card {
  min-height: 164px;
  padding: 22px;
}

.module-dot {
  width: 34px;
  height: 8px;
  margin-bottom: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--green));
}

.module-title,
.panel-title,
.toolbar-title {
  color: var(--ink);
}

.module-toolbar {
  align-items: center;
  padding: 18px 20px;
}

.toolbar-kicker {
  margin-bottom: 6px;
}

.toolbar-title {
  font-size: 22px;
}

.toolbar-note {
  max-width: 760px;
  color: var(--muted);
}

.count-pill {
  color: #1d1c1d;
  background: #ffe5bf;
}

.scan-panel {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 0;
  color: #fffaf2;
  background:
    linear-gradient(135deg, rgba(255, 158, 51, 0.24), transparent 48%),
    linear-gradient(145deg, #18191d, #28313a);
  box-shadow: 0 24px 64px rgba(24, 25, 29, 0.18);
}

.scan-panel .toolbar-title,
.scan-panel .toolbar-note,
.scan-panel .form-row span {
  color: #fffaf2;
}

.scan-panel .toolbar-note {
  color: rgba(255, 250, 242, 0.68);
}

.scan-panel .count-pill {
  color: #18191d;
  background: var(--accent);
}

.scan-lookup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.scan-code-input {
  min-height: 54px;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  color: #fffaf2;
  font-size: 20px;
}

.scan-code-input::placeholder {
  color: rgba(255, 250, 242, 0.48);
}

.scan-empty,
.scan-member-card {
  border-color: rgba(255, 189, 115, 0.52);
  background: #fff8ee;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.16);
}

.scan-member-card .strong,
.card-open-member .strong,
.coupon-member-card .strong {
  color: #18191d;
}

.scan-empty {
  color: #4b5563;
}

.scan-member-card .cell-sub {
  color: #5f6874;
}

.member-scan-result {
  color: #1f2937;
  background: #fff8ee;
  border: 1px solid rgba(255, 189, 115, 0.52);
  border-radius: 12px;
  padding: 8px 10px;
}

.scan-points-member-card {
  min-height: 76px;
  border: 1px solid #ffbd73 !important;
  background: #fffaf2 !important;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.2) !important;
}

.scan-points-member-card .member-avatar {
  color: #fffaf2;
  background: #5d4025;
}

.scan-points-member-main {
  display: grid;
  gap: 5px;
}

.scan-points-member-name {
  color: #0f172a !important;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 950;
}

.scan-points-member-card .cell-sub {
  color: #3f4854 !important;
  font-size: 13px;
  font-weight: 850;
}

.scan-points-member-card .open-tata-button {
  white-space: nowrap;
}

.scan-points-grid {
  grid-template-columns: 220px 180px minmax(0, 1fr);
}

.scan-panel .field {
  border-color: rgba(255, 255, 255, 0.18);
}

.scan-preview {
  background: rgba(0, 0, 0, 0.24);
}

.scan-preview strong {
  color: #ffbd73;
}

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

.legendary-actions .primary-button,
.legendary-actions .ghost-button {
  width: 100%;
  min-height: 52px;
}

.card-open-panel .scan-head {
  align-items: flex-start;
}

.card-scan-lookup {
  margin-bottom: 14px;
}

.card-open-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.card-open-grid .form-row {
  display: grid;
  gap: 8px;
}

.card-open-grid .wide {
  grid-column: span 5;
}

.card-open-member {
  justify-content: flex-start;
}

.card-open-member .icon-button {
  margin-left: auto;
}

.quick-chip.active {
  color: #18191d;
  background: #ffbd73;
  border-color: #ffbd73;
}

.card-open-preview {
  display: grid;
  grid-column: span 4;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-height: 78px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.24);
}

.card-open-preview div {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
}

.card-open-preview span {
  display: block;
  color: rgba(255, 250, 242, 0.68);
  font-size: 12px;
  font-weight: 900;
}

.card-open-preview strong {
  display: block;
  margin-top: 4px;
  color: #ffbd73;
  font-size: 18px;
  line-height: 1.18;
}

.card-open-submit {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
}

.card-open-submit .primary-button {
  width: 100%;
  min-height: 78px;
  color: #18191d;
  background: var(--accent);
  box-shadow: none;
}

.quick-chip {
  border-color: rgba(255, 158, 51, 0.3);
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

table {
  min-width: 900px;
}

th {
  padding: 12px 14px;
  color: #7b8491;
  background: #f7f9fb;
}

td {
  padding: 16px 14px;
}

tbody tr:hover td {
  background: #fbfcfd;
}

.row-actions {
  justify-content: flex-end;
}

.icon-button {
  min-height: 34px;
  border-color: #dce4eb;
  border-radius: 999px;
  background: #fff;
}

.drawer-panel {
  background: #f7f9fb;
}

@media (max-width: 1180px) {
  .stats-grid,
  .dashboard-grid,
  .module-grid,
  .original-entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .studio-layout {
    grid-template-columns: 1fr;
  }

  .studio-preview {
    position: static;
  }

  .dashboard-focus {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .topbar,
  .module-toolbar,
  .original-hub-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .card-open-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .card-open-grid .wide {
    grid-column: span 3;
  }

  .card-open-preview {
    grid-column: span 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  body {
    background: #f6f7f8;
  }

  .login-view {
    min-height: 100svh;
    padding: 16px;
  }

  .login-panel {
    padding: 22px;
    border-radius: 22px;
  }

  .login-panel h1 {
    font-size: 26px;
  }

  .shell {
    display: block;
    grid-template-columns: 1fr;
    min-height: 100svh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    padding: 9px 10px 8px;
    overflow: hidden;
    border-radius: 0 0 18px 18px;
    box-shadow: 0 10px 24px rgba(24, 25, 29, 0.13);
  }

  .sidebar-brand {
    margin-bottom: 7px;
    gap: 9px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 13px;
  }

  .brand-mark-image {
    width: 22px;
    height: 22px;
  }

  .sidebar .brand-name {
    font-size: 15px;
  }

  .sidebar .brand-sub {
    display: none;
  }

  .nav {
    display: flex;
    gap: 7px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 0 4px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .nav-section {
    display: contents;
  }

  .nav-section-title {
    display: none;
  }

  .nav-button {
    flex: 0 0 auto;
    width: auto;
    min-height: 34px;
    gap: 7px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
  }

  .nav-icon {
    width: 24px;
    height: 24px;
  }

  .nav-icon-svg {
    width: 15px;
    height: 15px;
  }

  .sidebar-note {
    display: none;
  }

  .main {
    justify-self: stretch;
    width: 100%;
    padding: 10px 12px calc(28px + env(safe-area-inset-bottom));
  }

  .main > *,
  .content > *,
  .dashboard-focus,
  .focus-strip,
  .stats-grid,
  .dashboard-grid,
  .module-grid,
  .hero-panel,
  .card,
  .panel,
  .module-toolbar,
  .stat-card,
  .module-card {
    min-width: 0;
    max-width: 100%;
  }

  .content > *,
  .hero-panel,
  .card,
  .panel,
  .module-toolbar {
    width: auto;
  }

  .topbar {
    position: static;
    display: grid;
    gap: 8px;
    min-height: 0;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .topbar h1 {
    margin-top: 0;
    font-size: 22px;
    line-height: 1.16;
  }

  .eyebrow {
    display: none;
  }

  .connection-status {
    min-height: 23px;
    max-width: 100%;
    margin-top: 6px;
    padding: 0 9px;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
    gap: 7px;
    width: 100%;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  .admin-user {
    display: none;
    min-width: 0;
    justify-content: flex-start;
    min-height: 34px;
    padding: 0 10px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
  }

  #primaryAction {
    grid-column: auto;
    order: -1;
  }

  .top-actions .control {
    min-width: 0;
  }

  .control,
  .field,
  .search-input,
  .primary-button,
  .ghost-button,
  .danger-button {
    min-height: 38px;
    border-radius: 12px;
    font-size: 14px;
  }

  .content {
    gap: 14px;
  }

  .card,
  .module-toolbar,
  .panel {
    border-radius: 16px;
  }

  .hero-panel,
  .command-hero {
    min-height: 0;
    padding: 16px;
    border-radius: 18px;
  }

  .command-hero::after {
    display: none;
  }

  .hero-title {
    margin-top: 9px;
    font-size: 23px;
    line-height: 1.16;
  }

  .hero-copy {
    display: -webkit-box;
    margin-top: 10px;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.65;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .hero-actions {
    display: flex;
    flex-wrap: nowrap;
    width: calc(100% + 4px);
    margin-top: 14px;
    padding: 0 4px 3px 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .hero-actions::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .hero-action {
    flex: 0 0 auto;
    min-width: 112px;
    min-height: 38px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .command-hero .hero-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .hero-metrics div {
    min-height: 64px;
    padding: 10px;
    border-radius: 14px;
  }

  .hero-metrics strong {
    font-size: 23px;
  }

  .hero-metrics span {
    font-size: 11px;
  }

  .module-toolbar {
    display: grid;
    gap: 12px;
    padding: 15px;
  }

  .toolbar-title {
    font-size: 18px;
  }

  .toolbar-note {
    font-size: 12px;
    line-height: 1.6;
  }

  .scan-lookup,
  .scan-points-grid,
  .coupon-issue-controls,
  .coupon-redeem-controls,
  .coupon-type-grid,
  .coupon-issue-preview,
  .redemption-grid,
  .redemption-preview,
  .card-open-grid,
  .card-open-preview {
    grid-template-columns: 1fr;
  }

  .scan-panel {
    padding: 16px;
    border-radius: 18px;
  }

  .scan-head,
  .scan-lookup,
  .scan-member-card,
  .scan-submit {
    display: grid;
    align-items: stretch;
    gap: 10px;
  }

  .scan-code-input {
    min-width: 0;
    font-size: 16px;
  }

  .scan-empty,
  .scan-member-card {
    padding: 12px;
    border-radius: 14px;
  }

  .quick-options {
    flex-wrap: nowrap;
    margin: 0 -2px;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .quick-options::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .quick-chip {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 11px;
    font-size: 12px;
  }

  .scan-points-grid .wide,
  .scan-preview,
  .coupon-issue-controls,
  .coupon-issue-preview,
  .redemption-grid .wide,
  .redemption-preview,
  .card-open-grid .wide,
  .card-open-preview {
    grid-column: auto;
  }

  .control,
  .search-input {
    width: 100%;
  }

  .stats-grid,
  .dashboard-grid,
  .module-grid,
  .form-grid,
  .original-entry-grid,
  .original-controls,
  .studio-head {
    grid-template-columns: 1fr;
  }

  .studio-head {
    justify-items: start;
  }

  .studio-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .original-image-result {
    min-height: 360px;
  }

  .hero-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats-grid,
  .dashboard-grid,
  .module-grid,
  .form-grid,
  .coupon-redeem-list,
  .coupon-type-grid {
    gap: 12px;
  }

  .stat-card,
  .module-card,
  .panel {
    padding: 16px;
  }

  .stat-value {
    font-size: 28px;
  }

  .panel-head {
    display: grid;
    align-items: stretch;
  }

  .table-wrap {
    margin: 0 -2px;
    border-radius: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap::before {
    display: block;
    padding: 10px 12px 0;
    color: #87909d;
    font-size: 12px;
    font-weight: 900;
    content: "表格可左右滑动";
  }

  table {
    min-width: 720px;
  }

  th,
  td {
    padding: 12px 10px;
    font-size: 13px;
  }

  .row-actions {
    gap: 6px;
  }

  .icon-button {
    min-height: 31px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
  }

  .table-pager {
    justify-content: center;
    flex-wrap: wrap;
    padding: 12px 0 0;
  }

  .drawer-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: min(92svh, 760px);
    padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
  }

  .drawer-head {
    gap: 12px;
    margin-bottom: 16px;
  }

  .drawer-head h2 {
    font-size: 22px;
  }

  .drawer-actions {
    position: sticky;
    bottom: calc(-18px - env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 18px -14px calc(-18px - env(safe-area-inset-bottom));
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    background: rgba(246, 247, 248, 0.94);
    backdrop-filter: blur(14px);
  }

  .image-upload-box,
  .article-import-box,
  .member-scan-control {
    grid-template-columns: 1fr;
  }

  .image-upload-preview {
    max-width: 180px;
  }

  .scan-panel {
    margin-bottom: 12px;
    padding: 14px;
  }

  .scan-head {
    margin-bottom: 12px;
    gap: 8px;
  }

  .scan-kicker {
    font-size: 10px;
  }

  .scan-panel .toolbar-title {
    font-size: 20px;
    line-height: 1.15;
  }

  .scan-panel .toolbar-note {
    display: -webkit-box;
    max-width: 100%;
    margin-top: 6px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .scan-panel .count-pill {
    justify-self: start;
    min-height: 28px;
  }

  .scan-lookup {
    gap: 8px;
    margin-bottom: 10px;
  }

  .scan-code-input {
    min-height: 48px;
    font-size: 17px;
  }

  .scan-empty,
  .scan-member-card {
    min-height: 54px;
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.55;
  }

  .scan-points-member-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }

  .scan-points-member-card .icon-button,
  .redemption-member-card .icon-button,
  .card-open-member .icon-button,
  .coupon-member-card .icon-button {
    justify-self: end;
  }

  .scan-points-member-name {
    font-size: 17px;
  }

  .member-avatar {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .scan-points-grid,
  .redemption-grid,
  .card-open-grid {
    gap: 10px;
  }

  .scan-points-grid .form-row:nth-child(1),
  .scan-points-grid .form-row:nth-child(2),
  .redemption-grid .form-row:nth-child(1),
  .redemption-grid .form-row:nth-child(3),
  .card-open-grid .form-row:nth-child(2),
  .card-open-grid .form-row:nth-child(3) {
    min-width: 0;
  }

  .scan-points-grid,
  .redemption-grid,
  .card-open-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .legendary-actions {
    grid-template-columns: 1fr;
  }

  .coupon-issue-controls,
  .coupon-issue-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scan-points-grid .wide,
  .redemption-grid .wide,
  .card-open-grid .wide,
  .scan-preview,
  .coupon-issue-controls,
  .coupon-issue-preview,
  .redemption-preview,
  .card-open-preview,
  .scan-submit,
  .redemption-submit,
  .card-open-submit {
    grid-column: 1 / -1;
  }

  .scan-preview,
  .redemption-preview,
  .card-open-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 0;
    padding: 9px;
    gap: 8px;
    border-radius: 14px;
  }

  .coupon-status-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
  }

  .coupon-issue-submit {
    width: 100%;
    min-height: 44px;
  }

  .coupon-status-preview .coupon-status-item {
    padding: 11px 12px;
  }

  .coupon-status-preview .coupon-status-item strong {
    font-size: 16px;
  }

  .coupon-success-banner {
    align-items: flex-start;
    padding: 12px;
    border-radius: 16px;
  }

  .scan-preview div,
  .redemption-preview div,
  .card-open-preview div {
    padding: 8px 9px;
    border-radius: 12px;
  }

  .scan-preview strong,
  .redemption-preview strong {
    font-size: 19px;
  }

  .coupon-issue-preview strong {
    font-size: 19px;
    line-height: 1.2;
    white-space: normal;
  }

  .card-open-preview strong {
    font-size: 16px;
  }

  .scan-preview span,
  .redemption-preview span,
  .card-open-preview span {
    font-size: 11px;
  }

  .coupon-status-preview .coupon-status-item {
    padding: 11px 12px;
  }

  .coupon-status-preview .coupon-status-item strong {
    font-size: 16px;
    line-height: 1.3;
  }

  .coupon-status-preview .coupon-status-item span {
    font-size: 11px;
  }

  .coupon-redeem-controls {
    grid-template-columns: 1fr;
  }

  .coupon-redeem-submit,
  .scan-submit .primary-button,
  .redemption-submit .primary-button,
  .card-open-submit .primary-button {
    width: 100%;
    min-height: 44px;
  }

  .redemption-submit .primary-button,
  .card-open-submit .primary-button {
    min-height: 48px;
  }

  .coupon-type-grid,
  .coupon-redeem-list {
    grid-template-columns: 1fr;
  }

  .coupon-type-chip {
    min-height: 72px;
    padding: 11px 12px;
  }

  .toast {
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: 12px;
    text-align: center;
  }
}
