:root {
  --bg: #f2f4f7;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #64748b;
  --accent: #0ea5a4;
  --accent-dark: #0b7f7e;
  --line: #e5e7eb;
  --shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  color: var(--ink);
  background: linear-gradient(135deg, #eef2f7 0%, #f8fafc 100%);
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: 120px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #111827;
  color: #e2e8f0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logo {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0ea5a4, #22c55e);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}

.brand-text .name {
  font-size: 13px;
  font-weight: 700;
}

.brand-text .sub {
  font-size: 10px;
  color: #94a3b8;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  background: transparent;
  border: 1px solid transparent;
  color: #cbd5f5;
  padding: 6px 8px;
  font-size: 12px;
  text-align: left;
  border-radius: 10px;
  cursor: pointer;
}

.nav-item.active {
  background: rgba(14, 165, 164, 0.2);
  border-color: rgba(14, 165, 164, 0.5);
  color: #e2e8f0;
}

.nav-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sidebar-footer {
  margin-top: auto;
  font-size: 10px;
  color: #94a3b8;
  display: grid;
  gap: 8px;
}

.logout-btn {
  width: 100%;
  color: #fecaca;
}

.content {
  padding: 14px 16px;
  height: 100vh;
  overflow: auto;
}

.content.runtime-log-mode {
  overflow: hidden;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.rules-table {
  table-layout: fixed;
}

.rules-table th,
.rules-table td {
  white-space: nowrap;
  padding-left: 8px;
  padding-right: 8px;
}

.rules-table .cell-ellipsis {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rules-table th:nth-child(1),
.rules-table td:nth-child(1) {
  width: 60px;
}

.rules-table th:nth-child(2),
.rules-table td:nth-child(2) {
  width: 156px;
}

.rules-table th:nth-child(3),
.rules-table td:nth-child(3) {
  width: 90px;
}

.rules-table th:nth-child(4),
.rules-table td:nth-child(4) {
  width: 220px;
}

.rules-table th:nth-child(5),
.rules-table td:nth-child(5) {
  width: 132px;
}

.rules-table th:nth-child(6),
.rules-table td:nth-child(6) {
  width: 70px;
  text-align: center;
}

.rules-table th:nth-child(7),
.rules-table td:nth-child(7) {
  width: 260px;
}

.rules-table th:nth-child(8),
.rules-table td:nth-child(8) {
  width: 140px;
}

.hero {
  background: var(--panel);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.hero h1 {
  margin: 0 0 6px 0;
  font-size: 18px;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.status-pill {
  padding: 3px 8px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0c4a6e;
  font-size: 10px;
  white-space: nowrap;
}

.status-pill.success {
  background: #dcfce7;
  color: #166534;
}

.status-pill.failed {
  background: #fee2e2;
  color: #991b1b;
}

.status-pill.unmatched {
  background: #f1f5f9;
  color: #475569;
}

.customer-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.72);
}

.customer-login-card {
  width: min(360px, calc(100vw - 32px));
  background: var(--panel);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

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

.customer-login-card p {
  margin: 0;
  color: var(--muted);
}

.customer-login-card label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.customer-login-card input {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 14px;
}

.login-error {
  min-height: 18px;
  color: #dc2626;
  font-size: 12px;
}

.customer-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card {
  background: var(--panel);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  gap: 8px;
}

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

.metric-card strong {
  font-size: 28px;
  line-height: 1;
}

.filters.customer-credit-recharge {
  grid-template-columns: 180px minmax(240px, 1fr) 160px;
  align-items: end;
}

.hero-actions {
  display: flex;
  gap: 8px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 180px;
  gap: 12px;
  background: var(--panel);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.filters.cinema {
  grid-template-columns: repeat(5, minmax(0, 1fr)) 180px;
}

.filters.rules {
  grid-template-columns: repeat(5, minmax(0, 1fr)) 180px;
  align-items: end;
}

.filters.order-grab {
  grid-template-columns: repeat(3, minmax(0, 1fr)) 180px;
  align-items: end;
}

.filters.order-grab-rank {
  grid-template-columns: repeat(5, minmax(0, 1fr)) 180px;
  align-items: end;
}

.filters.quote-records {
  grid-template-columns: 180px 110px 220px 132px 150px 150px;
  align-items: end;
}

.filters.quote-records .actions {
  grid-column: 1 / span 2;
}

.filters.quote-fails {
  grid-template-columns: 220px 220px 220px 220px 180px;
  align-items: end;
}

.filters.quote-fails.quote-fails-details,
.filters.quote-fails.quote-fails-rank {
  grid-template-columns: repeat(3, minmax(0, 1fr)) 180px;
  align-items: end;
}

.filters.ticket-records {
  grid-template-columns: repeat(4, minmax(180px, 1fr)) minmax(280px, 1.2fr) 180px;
  align-items: end;
}

.filters.ticket-records .platform-field,
.filters.ticket-records .cinema-field,
.filters.ticket-records .system-field {
  max-width: 260px;
}

.filters.ticket-records .actions {
  grid-column: auto;
  justify-content: flex-start;
}

.filters.ticket-records .date-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.filters.ticket-records .date-range input {
  min-width: 0;
}

.field label {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 3px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
}

.field input.input-error,
.field select.input-error,
.field textarea.input-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.12);
}

.field .field-error {
  display: none;
  margin-top: 6px;
  font-size: 12px;
  color: #ef4444;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

select:focus {
  outline: none;
  border-color: rgba(14, 165, 164, 0.6);
  box-shadow: 0 0 0 2px rgba(14, 165, 164, 0.15);
}

.select-display.readonly-select {
  opacity: 0.72;
  cursor: not-allowed;
}

.select-shell {
  position: relative;
}

.select-shell select {
  display: none;
}

.select-display {
  width: 100%;
  padding: 6px 28px 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  position: relative;
}

.select-display::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 8px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
}

.select-shell.open .select-display {
  border-color: rgba(14, 165, 164, 0.6);
  box-shadow: 0 0 0 2px rgba(14, 165, 164, 0.15);
}

.select-options {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 200px;
  overflow: auto;
  padding: 4px;
  display: none;
  z-index: 30;
}

.select-shell.open .select-options {
  display: block;
}

.select-option {
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.select-option:hover {
  background: #f1f5f9;
}

.select-option.selected {
  background: rgba(14, 165, 164, 0.15);
  color: var(--accent-dark);
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.global-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 0 10px;
  position: static;
  background: transparent;
}

.switch-btn {
  min-width: 104px;
  font-weight: 600;
}

.switch-enable {
  background: #22c55e;
  color: #ffffff;
}

.switch-enable:hover {
  background: #16a34a;
}

.switch-disable {
  background: #ef4444;
  color: #ffffff;
}

.switch-disable:hover {
  background: #dc2626;
}

.btn {
  border-radius: 8px;
  padding: 8px 12px;
  border: none;
  cursor: pointer;
  font-size: 13px;
}

.btn.small {
  padding: 6px 10px;
  font-size: 11px;
}

.btn.primary {
  background: var(--accent);
  color: #ffffff;
}

.btn.primary:hover {
  background: var(--accent-dark);
}

.btn.ghost {
  background: #f1f5f9;
  color: #0f172a;
}

.btn.link {
  background: transparent;
  color: var(--accent-dark);
  padding: 4px 8px;
}

.btn.link.danger {
  color: #ef4444;
}

.btn.ghost.danger {
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.inline-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-field input {
  flex: 1;
}

.inline-field select {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 13px;
  background: #ffffff;
}

.inline-field .select-shell {
  flex: 1;
  min-width: 0;
}

.icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: none;
  background: #2f88ff;
  color: #ffffff;
  font-size: 16px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-circle.ghost {
  background: #e6f0ff;
  color: #2f88ff;
}

.icon-circle:hover {
  filter: brightness(0.95);
}

.table-wrap {
  background: var(--panel);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.manual-ticket-hero {
  align-items: stretch;
}

.manual-ticket-rule {
  min-width: 180px;
  display: grid;
  gap: 6px;
}

.manual-ticket-rule label {
  font-size: 12px;
  color: var(--muted);
}

.manual-ticket-rule input {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
}

.manual-ticket-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(460px, 1.05fr);
  gap: 16px;
  align-items: start;
}

.manual-ticket-panel {
  background: var(--panel);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.panel-title-row h2 {
  margin: 0 0 4px 0;
  font-size: 16px;
}

.panel-title-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

#manual-ticket-order-text {
  width: 100%;
  min-height: 430px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  line-height: 1.65;
  font-size: 14px;
  font-family: Consolas, "Microsoft YaHei", sans-serif;
}

.manual-ticket-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.manual-ticket-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 430px;
}

.manual-ticket-result.empty {
  display: grid;
  place-items: center;
}

.result-state {
  font-weight: 700;
  margin-bottom: 12px;
}

.result-state.success,
.manual-ticket-status.success {
  color: #166534;
}

.result-state.failed,
.manual-ticket-status.failed {
  color: #991b1b;
}

.manual-ticket-status.pending {
  color: #0c4a6e;
}

.result-message {
  color: #991b1b;
  line-height: 1.6;
}

.manual-ticket-kv {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.manual-ticket-kv span {
  color: var(--muted);
  font-size: 12px;
}

.manual-ticket-kv code,
.manual-ticket-kv strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.manual-ticket-meta span {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 5px 8px;
  color: #334155;
  font-size: 12px;
}

.manual-ticket-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.manual-ticket-preview img {
  width: 100%;
  display: block;
  max-height: 520px;
  object-fit: contain;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.table-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.table-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-top: 8px;
}

.coupon-warehouse-hero {
  align-items: flex-start;
  gap: 20px;
}

.coupon-warehouse-hero .hero-copy {
  min-width: 220px;
  line-height: 1.5;
}

.coupon-warehouse-hero .hero-copy p {
  margin-top: 6px;
}

.coupon-warehouse-actions {
  flex: 1;
}

.cw-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.cw-tab-btn {
  border: 1px solid #e2e8f0;
  background: #eef2f7;
  color: #1f2937;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
}

.cw-tab-btn.active {
  background: #ffffff;
  border-color: #cbd5f5;
  color: #1f3b8e;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.cw-tab-panel {
  display: none;
}

.cw-tab-panel.active {
  display: block;
}

.quote-fail-tabs {
  margin-bottom: 16px;
}

.quote-fail-rank-row {
  cursor: pointer;
}

.quote-fail-rank-row:hover td {
  background: rgba(26, 188, 156, 0.08);
}

.filters.coupon-warehouse.compact {
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr)) minmax(120px, 140px) max-content;
  gap: 12px;
  align-items: end;
}

.filters.coupon-warehouse.compact .field.cinema {
  grid-column: span 2;
}

.filters.coupon-warehouse.compact .field.status {
  grid-column: 5 / 6;
  grid-row: 1 / 2;
  align-self: end;
}

.filters.coupon-warehouse.compact .actions {
  grid-column: 6 / 7;
  grid-row: 1 / 2;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 10px;
}

.filters.coupon-warehouse.compact .actions .btn {
  white-space: nowrap;
  min-width: 0;
  padding: 8px 12px;
}

.filters.coupon-warehouse.compact .btn.ghost {
  background: #eef2f7;
  border-color: #e2e8f0;
  color: #1f2937;
}

.filters.coupon-warehouse.compact .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
}

.filters.coupon-warehouse.compact input,
.filters.coupon-warehouse.compact select {
  background: #fff;
}

.cw-dropdown {
  position: relative;
}

.cw-dropdown-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
  max-height: 180px;
  overflow-y: auto;
  padding: 6px 0;
}

.cw-dropdown-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.cw-dropdown-item:hover,
.cw-dropdown-item.active {
  background: #eef4ff;
  color: #1f6feb;
}

.modal-card .field input,
.modal-card .field select,
.modal-card textarea {
  background: #fff;
  color: #1f2937;
}

.modal-card .field input,
.modal-card .field select {
  height: 44px;
  font-size: 14px;
}

.modal-card textarea {
  font-size: 14px;
}

#coupon-warehouse-modal .modal-card,
#coupon-warehouse-export-modal .modal-card {
  min-height: 520px;
}

#coupon-warehouse-modal .modal-body,
#coupon-warehouse-export-modal .modal-body {
  padding-bottom: 8px;
}

#coupon-warehouse-modal .form-grid,
#coupon-warehouse-export-modal .form-grid {
  row-gap: 24px;
}

#coupon-warehouse-modal textarea,
#coupon-warehouse-export-modal textarea {
  min-height: 220px;
}

#coupon-warehouse-modal .field label,
#coupon-warehouse-export-modal .field label {
  font-size: 15px;
}

#coupon-warehouse-modal .field input,
#coupon-warehouse-modal .field select,
#coupon-warehouse-export-modal .field input,
#coupon-warehouse-export-modal .field select {
  font-size: 15px;
}

.coupon-warehouse-scroll {
  max-height: 420px;
  overflow: auto;
}

.coupon-warehouse-inventory {
  max-height: none;
  overflow: visible;
}

.cw-inventory-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.cw-inventory-filter {
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 8px;
}

.cw-inventory-filter .field {
  margin: 0;
}

.cw-inventory-filter .actions {
  display: flex;
  gap: 8px;
}

.cw-inventory-filter .actions .btn {
  flex: 1;
}

.coupon-warehouse-inventory .data-table th,
.coupon-warehouse-inventory .data-table td {
  white-space: nowrap;
  font-size: 13px;
  padding: 10px 10px;
}

.coupon-warehouse-inventory .data-table th {
  font-size: 15px;
  font-weight: 700;
  color: #12263a;
}

.coupon-warehouse-inventory .data-table td:nth-child(1) {
  font-size: 15px;
  font-weight: 600;
}

.coupon-warehouse-inventory .data-table td:nth-child(4),
.coupon-warehouse-inventory .data-table td:nth-child(7) {
  font-size: 16px;
  font-weight: 700;
  color: #102a43;
}

.inv-status-chip {
  /* 复用报价记录“中标”状态样式，仅保留名称用于定位 */
}

#view-coupon-warehouse .coupon-warehouse-table th:nth-child(1),
#view-coupon-warehouse .coupon-warehouse-table td:nth-child(1) {
  width: 50px;
  min-width: 50px;
}

#view-coupon-warehouse .coupon-warehouse-table th:nth-child(2),
#view-coupon-warehouse .coupon-warehouse-table td:nth-child(2) {
  min-width: 360px;
}

#view-coupon-warehouse .coupon-warehouse-table th:nth-child(4),
#view-coupon-warehouse .coupon-warehouse-table td:nth-child(4) {
  width: 60px;
  min-width: 60px;
}

#view-coupon-warehouse .coupon-warehouse-table th:nth-child(9),
#view-coupon-warehouse .coupon-warehouse-table td:nth-child(9) {
  width: 60px;
  min-width: 60px;
}

#view-coupon-warehouse .coupon-warehouse-table {
  table-layout: fixed;
}

#view-coupon-warehouse .coupon-warehouse-table th,
#view-coupon-warehouse .coupon-warehouse-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#view-coupon-warehouse .coupon-warehouse-table th:nth-child(7),
#view-coupon-warehouse .coupon-warehouse-table td:nth-child(7) {
  width: 120px;
  min-width: 120px;
}

.coupon-warehouse-hero + .table-wrap {
  margin-top: 18px;
}

@media (max-width: 1100px) {
  .filters.coupon-warehouse.compact {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .cw-inventory-layout {
    grid-template-columns: 1fr;
  }

  .cw-inventory-filter {
    position: static;
  }
}

@media (max-width: 760px) {
  .filters.coupon-warehouse.compact {
    grid-template-columns: 1fr;
  }
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.pager {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}

.pager select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
}


.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.25;
}

.data-table th {
  color: #475569;
  font-weight: 600;
}

.cinema-table th,
.cinema-table td {
  white-space: nowrap;
}

.table-scroll {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  overflow: auto;
  max-height: 65vh;
}

.rule-cinema-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.rule-cinema-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.rule-cinema-pager {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
}

.rule-cinema-pager select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.page-list {
  display: flex;
  gap: 4px;
  align-items: center;
}

.page-btn {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  cursor: pointer;
  font-size: 11px;
  color: #475569;
}

.page-btn.active {
  background: rgba(14, 165, 164, 0.12);
  border-color: rgba(14, 165, 164, 0.5);
  color: #0f766e;
}

.page-btn[disabled] {
  cursor: default;
  opacity: 0.5;
}

.table-actions {
  display: flex;
  gap: 8px;
}

.rules-table th,
.rules-table td {
  vertical-align: top;
}

.rules-table .cell-ellipsis {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.data-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  background: #e0f2fe;
  color: #0369a1;
}

.rule-stats-compact {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.rule-stats-main {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rule-stat-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

.rule-stat-chip.gain {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.rule-stat-chip.loss {
  background: #fef2f2;
  border-color: #fecaca;
}

.rule-stat-chip-text {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  color: #0f172a;
}

.rule-stat-chip.gain .rule-stat-chip-text {
  color: #15803d;
}

.rule-stat-chip.loss .rule-stat-chip-text {
  color: #dc2626;
}

.rule-stats-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 12px;
  color: #64748b;
}

.cell-ellipsis {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.cell-ellipsis.hall {
  max-width: 90px;
}

.ticket-job-table {
  table-layout: fixed;
}

.ticket-job-table .cell-ellipsis {
  max-width: 100%;
}

.ticket-job-table th,
.ticket-job-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-job-table th:nth-child(1),
.ticket-job-table td:nth-child(1) {
  width: 60px;
}

.ticket-job-table th:nth-child(2),
.ticket-job-table td:nth-child(2) {
  width: 160px;
}

.ticket-job-table th:nth-child(3),
.ticket-job-table td:nth-child(3) {
  width: 60px;
}

.ticket-job-table th:nth-child(4),
.ticket-job-table td:nth-child(4) {
  width: 84px;
}

.ticket-job-table th:nth-child(8),
.ticket-job-table td:nth-child(8) {
  width: 110px;
}

.ticket-job-table th:nth-child(11),
.ticket-job-table td:nth-child(11) {
  width: 44px;
}

.ticket-job-table th:nth-child(12),
.ticket-job-table td:nth-child(12) {
  width: 52px;
}

.ticket-job-table th:nth-child(13),
.ticket-job-table td:nth-child(13) {
  width: 44px;
}

.ticket-job-table th:nth-child(15),
.ticket-job-table td:nth-child(15) {
  width: 190px;
}

.ticket-job-table td:nth-child(15) {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  overflow: visible;
}

.ticket-job-table td:nth-child(15) .btn {
  flex: 0 0 auto;
}

.ticket-job-table td:nth-child(15) .btn.small {
  padding: 4px 8px;
}

.quote-fail-table th:nth-child(1),
.quote-fail-table td:nth-child(1) {
  width: 60px;
}

.quote-fail-table th:nth-child(2),
.quote-fail-table td:nth-child(2) {
  width: 130px;
}

.quote-fail-table {
  table-layout: fixed;
}

.quote-fail-table th,
.quote-fail-table td {
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.quote-fail-table th:nth-child(3),
.quote-fail-table td:nth-child(3) {
  width: 52px;
}

.quote-fail-table th:nth-child(4),
.quote-fail-table td:nth-child(4) {
  width: 150px;
}

.quote-fail-table th:nth-child(5),
.quote-fail-table td:nth-child(5) {
  width: 100px;
}

.quote-fail-table th:nth-child(6),
.quote-fail-table td:nth-child(6) {
  width: 90px;
}

.quote-fail-table th:nth-child(7),
.quote-fail-table td:nth-child(7) {
  width: 140px;
}

.quote-fail-table th:nth-child(8),
.quote-fail-table td:nth-child(8) {
  width: 44px;
}

.quote-fail-table th:nth-child(9),
.quote-fail-table td:nth-child(9) {
  width: 54px;
}

.quote-fail-table th:nth-child(10),
.quote-fail-table td:nth-child(10) {
  width: 54px;
}

.quote-fail-table th:nth-child(11),
.quote-fail-table td:nth-child(11) {
  width: 54px;
}

.quote-fail-table th:nth-child(12),
.quote-fail-table td:nth-child(12) {
  width: 52px;
}

.quote-fail-table th:nth-child(13),
.quote-fail-table td:nth-child(13) {
  width: 520px;
}

.quote-fail-table th:nth-child(14),
.quote-fail-table td:nth-child(14) {
  width: 140px;
}

.quote-fail-table .cell-ellipsis {
  max-width: 100%;
  text-overflow: clip;
}

.quote-fail-rank-table {
  table-layout: fixed;
}

.quote-fail-rank-table th,
.quote-fail-rank-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-fail-rank-table th:nth-child(1),
.quote-fail-rank-table td:nth-child(1) {
  width: 48px;
}

.quote-fail-rank-table th:nth-child(2),
.quote-fail-rank-table td:nth-child(2) {
  width: 80px;
}

.quote-fail-rank-table th:nth-child(3),
.quote-fail-rank-table td:nth-child(3) {
  width: 300px;
}

.quote-fail-rank-table th:nth-child(4),
.quote-fail-rank-table td:nth-child(4) {
  width: 72px;
  text-align: center;
}

.quote-fail-rank-table th:nth-child(5),
.quote-fail-rank-table td:nth-child(5) {
  width: auto;
}

.quote-fail-rank-table th:nth-child(6),
.quote-fail-rank-table td:nth-child(6) {
  width: 170px;
}

.quote-fail-rank-table .cell-ellipsis {
  display: block;
  max-width: 100%;
}

.quote-record-table {
  table-layout: fixed;
}

.quote-record-table th,
.quote-record-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-record-table th:nth-child(1),
.quote-record-table td:nth-child(1) {
  width: 36px;
}

.quote-record-table th:nth-child(2),
.quote-record-table td:nth-child(2) {
  width: 130px;
}

.quote-record-table th:nth-child(3),
.quote-record-table td:nth-child(3) {
  width: 44px;
}

.quote-record-table th:nth-child(4),
.quote-record-table td:nth-child(4) {
  width: 150px;
}

.quote-record-table th:nth-child(5),
.quote-record-table td:nth-child(5) {
  width: 110px;
}

.quote-record-table th:nth-child(6),
.quote-record-table td:nth-child(6) {
  width: 96px;
}

.quote-record-table th:nth-child(7),
.quote-record-table td:nth-child(7) {
  width: 136px;
}

.quote-record-table th:nth-child(8),
.quote-record-table td:nth-child(8) {
  width: 44px;
}

.quote-record-table th:nth-child(9),
.quote-record-table td:nth-child(9),
.quote-record-table th:nth-child(10),
.quote-record-table td:nth-child(10),
.quote-record-table th:nth-child(11),
.quote-record-table td:nth-child(11),
.quote-record-table th:nth-child(12),
.quote-record-table td:nth-child(12) {
  width: 52px;
}

.quote-record-table th:nth-child(13),
.quote-record-table td:nth-child(13) {
  width: 70px;
}

.quote-record-table th:nth-child(14),
.quote-record-table td:nth-child(14) {
  width: 36px;
}

.quote-record-table th:nth-child(15),
.quote-record-table td:nth-child(15) {
  width: 56px;
}

.quote-record-table .cell-ellipsis {
  max-width: 100%;
}

.yx-order-table {
  table-layout: fixed;
  width: 100%;
}

.yx-order-table th,
.yx-order-table td {
  white-space: nowrap;
}

.yx-order-table th:nth-child(1),
.yx-order-table td:nth-child(1) {
  width: 6%;
}

.yx-order-table th:nth-child(2),
.yx-order-table td:nth-child(2) {
  width: 22%;
}

.yx-order-table th:nth-child(3),
.yx-order-table td:nth-child(3) {
  width: 10%;
}

.yx-order-table th:nth-child(4),
.yx-order-table td:nth-child(4) {
  width: 12%;
}

.yx-order-table th:nth-child(5),
.yx-order-table td:nth-child(5) {
  width: 11%;
}

.yx-order-table th:nth-child(6),
.yx-order-table td:nth-child(6) {
  width: 6%;
}

.yx-order-table th:nth-child(7),
.yx-order-table td:nth-child(7),
.yx-order-table th:nth-child(8),
.yx-order-table td:nth-child(8),
.yx-order-table th:nth-child(9),
.yx-order-table td:nth-child(9),
.yx-order-table th:nth-child(10),
.yx-order-table td:nth-child(10) {
  width: 8.25%;
}

.yx-order-table .cell-ellipsis {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yx-hall-ellipsis {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yx-order-table th:nth-child(6),
.yx-order-table td:nth-child(6),
.yx-order-table th:nth-child(7),
.yx-order-table td:nth-child(7),
.yx-order-table th:nth-child(8),
.yx-order-table td:nth-child(8),
.yx-order-table th:nth-child(9),
.yx-order-table td:nth-child(9),
.yx-order-table th:nth-child(10),
.yx-order-table td:nth-child(10) {
  width: auto !important;
}

.data-badge.positive {
  background: #dcfce7;
  color: #15803d;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  background: #e2e8f0;
  border-radius: 999px;
  transition: 0.2s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: #ffffff;
  border-radius: 50%;
  transition: 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(16px);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 20px;
}

.modal.show {
  display: flex;
}

.modal-card {
  background: var(--panel);
  border-radius: 12px;
  width: min(680px, 100%);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.modal-card.wide {
  width: min(900px, 100%);
}

.modal-card.rule-card {
  width: min(1100px, 100%);
}

.base-search-card {
  width: min(900px, 100%);
  max-height: 70vh;
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 10px 12px;
}

.rule-card .modal-body {
  max-height: 78vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-card.rule-card {
  min-height: 78vh;
}

#rule-cinema-modal .modal-card {
  max-height: 70vh;
}

#rule-cinema-modal .modal-body {
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#bind-coupon-modal .modal-card {
  max-height: 90vh;
}

#bind-coupon-modal .modal-body {
  flex: 1;
  overflow-y: auto;
}

.modal-footer .spacer {
  flex: 1;
}

.seat-adjust-card {
  max-height: 88vh;
}

.seat-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 4px 2px 8px;
}

.seat-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.seat-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  display: inline-block;
}

.seat-adjust-hint {
  margin-bottom: 8px;
}

.seat-grid-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
  max-height: 56vh;
  overflow: auto;
}

.seat-grid {
  --seat-cols: 20;
  --seat-rows: 10;
  display: grid;
  grid-template-columns: 44px repeat(var(--seat-cols), 22px);
  grid-auto-rows: 22px;
  gap: 6px;
  align-items: center;
}

.seat-row-label {
  font-size: 12px;
  color: #64748b;
  text-align: right;
  padding-right: 6px;
  user-select: none;
}

.seat-cell {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid #93c5fd;
  background: #eff6ff;
  padding: 0;
  cursor: pointer;
  position: relative; /* for selected checkmark */
}

.seat-cell.seat-gap {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

.seat-cell.seat-sold,
.seat-cell.seat-unavailable {
  cursor: not-allowed;
  border-color: #b91c1c;
  background: #ef4444;
}

.seat-cell.seat-maint {
  cursor: not-allowed;
  border-color: #9ca3af;
  background: #e5e7eb;
}

.seat-cell.seat-available.seat-area-0 {
  border-color: #93c5fd;
  background: #eff6ff;
}

.seat-cell.seat-available.seat-area-1 {
  border-color: #60a5fa;
  background: #dbeafe;
}

.seat-cell.seat-available.seat-area-2 {
  border-color: #4ade80;
  background: #dcfce7;
}

.seat-cell.seat-available.seat-area-3 {
  border-color: #fb7185;
  background: #ffe4e6;
}

.seat-cell.seat-available.seat-area-4 {
  border-color: #c084fc;
  background: #f3e8ff;
}

/* NOTE:
 * .seat-area-* rules are more specific (.seat-cell.seat-available.seat-area-X),
 * so "original/selected" must be at least as specific to visually win. */
.seat-cell.seat-available.seat-original {
  border-color: #b45309;
  background: repeating-linear-gradient(
    45deg,
    #fde68a,
    #fde68a 6px,
    #fbbf24 6px,
    #fbbf24 12px
  );
  box-shadow: 0 0 0 2px rgba(180, 83, 9, 0.25);
}

.seat-cell.seat-available.seat-selected {
  border-color: #15803d;
  border-width: 2px;
  background: #bbf7d0;
  box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.18);
}

.seat-cell.seat-available.seat-selected::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  color: #14532d;
  pointer-events: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

/* When the original seat is currently sold/maintenance, keep its state color,
 * but add a visible border hint so users can still locate it. */
.seat-cell.seat-original:not(.seat-available) {
  box-shadow: inset 0 0 0 3px #f59e0b, 0 0 0 2px rgba(245, 158, 11, 0.35);
}

.seat-legend-dot.seat-available,
.seat-legend-dot.seat-area-0 {
  border-color: #93c5fd;
  background: #eff6ff;
}

.seat-legend-dot.seat-area-1 {
  border-color: #60a5fa;
  background: #dbeafe;
}

.seat-legend-dot.seat-area-2 {
  border-color: #4ade80;
  background: #dcfce7;
}

.seat-legend-dot.seat-area-3 {
  border-color: #fb7185;
  background: #ffe4e6;
}

.seat-legend-dot.seat-area-4 {
  border-color: #c084fc;
  background: #f3e8ff;
}

.seat-legend-dot.seat-sold,
.seat-legend-dot.seat-unavailable {
  border-color: #b91c1c;
  background: #ef4444;
}

.seat-legend-dot.seat-maint {
  border-color: #9ca3af;
  background: #e5e7eb;
}

.seat-legend-dot.seat-original {
  border-color: #b45309;
  background: repeating-linear-gradient(
    45deg,
    #fde68a,
    #fde68a 6px,
    #fbbf24 6px,
    #fbbf24 12px
  );
}

.seat-legend-dot.seat-selected {
  border-color: #16a34a;
  background: #bbf7d0;
}

.seat-selected-wrap {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.seat-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seat-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.form-grid.triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.rule-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .wide {
  grid-column: span 2;
}

.form-grid.triple .wide {
  grid-column: span 3;
}

.form-grid.triple .wide-2 {
  grid-column: span 2;
}

.form-grid.rule-grid .wide {
  grid-column: span 2;
}

.form-grid.rule-grid > .field {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
}

.form-grid.rule-grid > .field.rule-advanced-section {
  display: none;
}

.form-grid.rule-grid > .field.rule-advanced-section.open {
  display: block;
}

.form-grid.rule-grid > .field > label {
  margin-bottom: 0;
  font-size: 12px;
}

.form-grid.rule-grid > .field .field-error {
  grid-column: 2 / -1;
}

.form-grid.rule-grid > .field.no-label {
  grid-template-columns: 1fr;
}

.form-grid.rule-grid > .field.no-label > * {
  grid-column: 1 / -1;
}

.rule-row {
  display: grid;
  gap: 6px;
}

.rule-row.row-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rule-row.row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rule-row.row-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rule-row .field {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  align-items: center;
  column-gap: 6px;
}

.rule-row .field > label {
  margin-bottom: 0;
  font-size: 12px;
}

.rule-row .field .field-error {
  grid-column: 2 / -1;
}

.rule-row .inline-field {
  gap: 8px;
}

.rule-row .inline-field .tag-input {
  flex: 1;
  min-width: 0;
}

.rule-row .field .tag-input {
  width: 100%;
  min-width: 0;
}

.rule-advanced-section {
  display: none;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

.rule-advanced-section.open {
  display: block;
}

.rule-advanced-toggle {
  white-space: nowrap;
  padding: 4px 8px;
  border: none;
  background: transparent;
  color: var(--muted);
}

.rule-status-inline {
  width: 100%;
  justify-content: space-between;
}

.rule-advanced-section .rule-row {
  margin-bottom: 4px;
}

.rule-advanced-section .rule-row:last-child {
  margin-bottom: 0;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
}

#rule-modal .form-grid input:not([type="checkbox"]):not([type="radio"]),
#rule-modal .form-grid select {
  height: 34px;
  padding: 6px 10px;
  box-sizing: border-box;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 400;
}

#rule-modal .form-grid textarea {
  padding: 6px 10px;
}

#rule-modal .select-shell .select-display {
  height: 34px;
  padding: 0 32px 0 10px;
  display: flex;
  align-items: center;
  line-height: 34px;
  font-size: 12px;
  font-weight: 400;
}

#rule-modal .platform-row select,
#rule-modal .platform-row input {
  height: 34px;
  padding: 6px 10px;
  box-sizing: border-box;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 400;
}

#cinema-modal .form-grid input,
#cinema-modal .form-grid select {
  height: 40px;
  padding: 8px 10px;
  font-size: 13px;
}

#cinema-modal #cinema-form-system + .select-display,
#cinema-modal #cinema-form-city + .select-display,
#cinema-modal #cinema-form-name + .select-display {
  height: 40px;
  padding: 0 32px 0 10px;
  display: flex;
  align-items: center;
  font-size: 13px;
}

.radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.dash {
  color: var(--muted);
  font-size: 12px;
  padding: 0 4px;
}

.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.tag-input input {
  border: none;
  outline: none;
  flex: 1;
  min-width: 160px;
  font-size: 11px;
}

.tag-input.slim {
  min-height: 34px;
  padding: 0 10px;
  align-items: center;
  flex-wrap: wrap;
  overflow: hidden;
  background: #ffffff;
}

.tag-input.slim input {
  min-width: 120px;
  flex: 1;
  font-size: 12px;
  padding: 0;
  margin: 0;
  height: 32px;
  line-height: 32px;
  background: transparent;
}

.tag-input.slim .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 12px;
  white-space: nowrap;
}

.tag-input.slim .tag button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  color: #64748b;
}

.filters.film-group input {
  height: 36px;
  line-height: 36px;
}

.filters.film-group .tag-input {
  height: 36px;
  align-items: center;
  padding: 0 10px;
  overflow-x: auto;
}

.filters.film-group .tag-input input {
  height: 100%;
  line-height: 36px;
  min-width: 140px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 11px;
}

.tag button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.chip-select {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.chip-select.large label {
  padding: 4px 8px;
}

.chip-select label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 11px;
  cursor: pointer;
}

.chip-select input {
  accent-color: var(--accent);
}

.multi-select {
  position: relative;
}

.multi-display {
  width: 100%;
  min-height: 34px;
  padding: 6px 30px 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.multi-display::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 8px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
}

.multi-select.open .multi-display {
  border-color: rgba(14, 165, 164, 0.6);
  box-shadow: 0 0 0 2px rgba(14, 165, 164, 0.15);
}

.multi-options {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  display: none;
  z-index: 30;
}

.multi-select.open .multi-options {
  display: block;
}

#rule-platforms .multi-options {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: none;
  overflow: visible;
}

#rule-platforms.open .multi-options {
  display: grid;
}

#rule-platforms .multi-option {
  font-size: 11px;
  padding: 6px 6px;
}

.multi-options label,
.multi-options .multi-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 12px;
  cursor: pointer;
}

.multi-options label.selected,
.multi-options .multi-option.selected {
  background: rgba(14, 165, 164, 0.12);
  border-color: rgba(14, 165, 164, 0.3);
  color: var(--accent-dark);
}

.multi-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 12px;
}

.multi-tag button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  color: #64748b;
}

.inline-label {
  font-size: 12px;
  color: var(--muted);
  margin-right: 8px;
}

.rule-quick-quote {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: center;
}

.rule-quick-quote .field {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
}

.rule-quick-quote .field label {
  margin-bottom: 0;
}

.platform-rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-height: 360px;
  align-content: start;
}

.platform-row {
  display: grid;
  grid-template-columns: 60px 1fr 1fr;
  gap: 8px;
  align-items: center;
  background: #f8fafc;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.platform-row label {
  font-size: 12px;
  color: var(--muted);
}

.rule-cinema-search {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
}

.search-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto;
  gap: 12px;
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  background: var(--panel);
  padding-bottom: 8px;
  z-index: 2;
}

.search-bar.rule-cinema-search {
  grid-template-columns: 1fr 1fr 0.6fr 1.2fr auto;
}

.search-bar input {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
}

#rule-cinema-system {
  width: 100%;
}

.coupon-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.leying-status {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 0 0 2px;
}

.leying-status.error {
  color: #ef4444;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    position: static;
    height: auto;
    overflow: visible;
  }

  body {
    overflow: auto;
  }

  .content {
    height: auto;
    overflow: visible;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .filters.cinema {
    grid-template-columns: 1fr;
  }

  .filters.rules {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid.triple {
    grid-template-columns: 1fr;
  }

  .form-grid.rule-grid {
    grid-template-columns: 1fr;
  }

  .form-grid.rule-grid > .field {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .form-grid.rule-grid > .field > label {
    margin-bottom: 6px;
  }

  .form-grid.rule-grid > .field .field-error {
    grid-column: 1 / -1;
  }

  .search-bar {
    grid-template-columns: 1fr;
  }

  .rule-cinema-search {
    grid-template-columns: 1fr;
  }

  .platform-row {
    grid-template-columns: 1fr;
  }

  .platform-rows {
    grid-template-columns: 1fr;
  }

  .rule-quick-quote {
    grid-template-columns: 1fr;
  }

  .rule-quick-quote .field {
    grid-template-columns: 1fr;
  }

  .rule-quick-quote .field label {
    margin-bottom: 6px;
  }

  .rule-row.row-2,
  .rule-row.row-3,
  .rule-row.row-4 {
    grid-template-columns: 1fr;
  }

  .rule-row .field {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .rule-row .field > label {
    margin-bottom: 6px;
  }

  .rule-row .field .field-error {
    grid-column: 1 / -1;
  }
}
.base-search-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 60vh;
}
.base-search-results {
  max-height: 40vh;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.base-search-results .data-table th,
.base-search-results .data-table td {
  word-break: break-all;
}

.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 16px 0 8px;
}

.summary-card {
  min-width: 160px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.summary-card .label {
  font-size: 12px;
  color: #64748b;
}

.summary-card .value {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 600;
  color: #0f172a;
}

.rank-dist-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 12px;
}

.rank-side-wrap .data-table th,
.rank-side-wrap .data-table td {
  white-space: nowrap;
}

.rank-side-city-title {
  margin-top: 12px;
}

.platform-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.platform-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: #f1f5f9;
  color: #334155;
}

@media (max-width: 1200px) {
  .rank-dist-grid {
    grid-template-columns: 1fr;
  }
}

.date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-range input {
  min-width: 132px;
}

.range-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.range-inline input,
.range-inline select {
  min-width: 90px;
}

.range-sep {
  color: #94a3b8;
}

.ticket-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
}

.ticket-preview img {
  max-width: 100%;
  max-height: 520px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.range-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.range-input input {
  min-width: 120px;
}
#coupon-warehouse-inventory-page-size {
  direction: rtl;
}

#coupon-warehouse-inventory-page-size option {
  direction: ltr;
}

.runtime-log-layout {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
  height: calc(100vh - 86px);
  min-height: 0;
  overflow: hidden;
}

.runtime-log-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #1f2a35;
  background: #0d141b;
  border-radius: 8px;
  padding: 8px 10px;
  position: sticky;
  top: 0;
  z-index: 66;
}

.runtime-log-titlebar h1 {
  margin: 0;
  font-size: 16px;
  color: #f1f6fb;
}

.runtime-log-meta {
  font-size: 12px;
  color: #8ea2b6;
}

.runtime-log-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border: 1px solid #1f2a35;
  background: #0c1116;
  border-radius: 8px;
  padding: 8px;
  position: sticky;
  top: 48px;
  z-index: 65;
}

.runtime-log-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.runtime-console {
  border: 1px solid #1f2a35;
  border-radius: 8px;
  background: #06090c;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.runtime-console-head {
  padding: 6px 10px;
  border-bottom: 1px solid #16202a;
  color: #95a8bb;
  font-size: 12px;
  background: #0a0f14;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
}

.runtime-log-list {
  overflow: auto;
  padding: 8px 10px 14px;
  line-height: 1.3;
  font-size: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  color: #e8edf3;
  scrollbar-width: thin;
  scrollbar-color: #2c3a48 #081018;
}

.runtime-log-list::-webkit-scrollbar {
  width: 10px;
}

.runtime-log-list::-webkit-scrollbar-track {
  background: #081018;
  border-radius: 10px;
}

.runtime-log-list::-webkit-scrollbar-thumb {
  background: #2c3a48;
  border-radius: 10px;
  border: 2px solid #081018;
}

.runtime-log-list::-webkit-scrollbar-thumb:hover {
  background: #3a4d60;
}

.runtime-log-line {
  margin: 0 0 2px 0;
}

.runtime-log-line .ts {
  color: #ffffff;
}

.runtime-log-line .tag {
  color: #ffffff;
  background: transparent;
  border-radius: 0;
  padding: 0;
  display: inline;
  line-height: inherit;
}

.runtime-log-line.info {
  color: #6dff9a;
}

.runtime-log-line.warn {
  color: #ffd166;
}

.runtime-log-line.error {
  color: #ff7b7b;
}

.runtime-log-line.quote-record {
  color: #f2f5f9;
}

.runtime-log-line.wait-ticket {
  color: #43d4ff;
}

.runtime-log-line.ticket-flow {
  color: #ffd166;
}

.runtime-log-line .profit-num {
  color: #ff4d4f;
  font-weight: 600;
}

@media (max-width: 1280px) {
  .runtime-log-toolbar {
    justify-content: flex-start;
  }
}
