:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #dde4ef;
  --text: #172033;
  --muted: #65748b;
  --primary: #2364aa;
  --primary-dark: #174f88;
  --success: #168a55;
  --warning: #b76e00;
  --danger: #c24141;
  --reserved: #e6a23c;
  --sold: #5c6ac4;
  --available: #18a058;
  --disabled: #7c8797;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

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

button {
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: var(--primary-dark);
}

button.secondary {
  background: #eef3f9;
  color: var(--text);
}

button.secondary:hover {
  background: #dfe8f3;
}

button.danger {
  background: var(--danger);
}

button.success {
  background: var(--success);
}

button.ghost {
  background: transparent;
  color: var(--primary);
  padding: 4px 8px;
}

button.tiny {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 12px;
}

button:disabled {
  background: #b8c2d1;
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

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

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 560px);
  background: linear-gradient(135deg, #f7f9fc 0%, #eaf1f7 100%);
}

.login-hero {
  padding: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-hero h1 {
  margin: 0 0 16px;
  font-size: 42px;
  letter-spacing: 0;
}

.login-hero p {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.8;
  font-size: 16px;
}

.login-panel {
  display: flex;
  align-items: center;
  padding: 48px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 48px rgba(28, 42, 68, 0.12);
}

.login-card h2 {
  margin: 0 0 20px;
}

.demo-accounts {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px 1fr;
}

.sidebar {
  background: #122033;
  color: #d9e4f2;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.brand {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand strong {
  display: block;
  font-size: 18px;
  color: #fff;
  margin-bottom: 6px;
}

.brand span {
  color: #9eb0c6;
  font-size: 12px;
}

.nav {
  padding: 12px;
  display: grid;
  gap: 6px;
}

.nav button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #c8d6e6;
  border-radius: 6px;
  padding: 11px 12px;
}

.nav button:hover,
.nav button.active {
  background: #223654;
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #9eb0c6;
  font-size: 12px;
  line-height: 1.7;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(10px);
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.content {
  padding: 24px 28px 38px;
  display: grid;
  gap: 20px;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 10px 28px rgba(23, 32, 51, 0.05);
  min-width: 0;
}

.section h2 {
  margin: 0 0 14px;
  font-size: 16px;
}

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

.section-title-row h2 {
  margin: 0;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 99px;
  background: #eef6ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  min-width: 0;
}

.metric {
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 10px 26px rgba(23, 32, 51, 0.06);
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1.1;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
  gap: 18px;
  align-items: stretch;
  min-width: 0;
}

.sales-overview,
.chart-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 12px 30px rgba(23, 32, 51, 0.06);
  min-width: 0;
}

.sales-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  min-width: 0;
}

.sales-kpi {
  min-height: 118px;
  padding: 16px;
  border: 1px solid #dce8f6;
  border-radius: 8px;
  background: #f8fbff;
  min-width: 0;
}

.sales-kpi span,
.donut-card span {
  color: var(--muted);
  font-size: 12px;
}

.sales-kpi strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 30px;
  line-height: 1;
}

.sales-kpi small {
  color: var(--muted);
}

.progress-stack {
  display: grid;
  gap: 14px;
}

.progress-line {
  display: grid;
  gap: 8px;
}

.progress-line > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.progress-line strong {
  font-size: 13px;
}

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

.progress-track,
.mini-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef6;
}

.progress-track i,
.mini-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #18a058);
}

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

.donut-card,
.status-chart-card {
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  min-width: 0;
}

.donut-card {
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}

.donut,
.status-pie {
  width: 118px;
  aspect-ratio: 1;
  border-radius: 50%;
  flex: 0 0 auto;
}

.donut {
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(var(--color) var(--value), #e8eef6 0);
}

.donut::after {
  content: "";
  position: absolute;
  width: 76px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.donut strong {
  position: relative;
  z-index: 1;
  font-size: 22px;
}

.donut-card h3,
.status-chart-card h3 {
  margin: 12px 0 6px;
  font-size: 14px;
}

.status-chart-card {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 18px;
}

.legend.vertical {
  display: grid;
  gap: 8px;
}

.mini-progress {
  width: 110px;
  height: 7px;
  margin-bottom: 5px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.toolbar label {
  min-width: 130px;
}

.search-control {
  display: flex;
  align-items: end;
  gap: 8px;
}

.search-control label {
  min-width: 190px;
}

.map-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
}

.map-frame {
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  min-height: 560px;
}

.booth-svg {
  min-width: 980px;
  display: block;
  background: #f7f9fc;
}

.booth-rect {
  stroke: #fff;
  stroke-width: 1.4;
  cursor: pointer;
}

.booth-rect.available {
  fill: rgba(24, 160, 88, 0.84);
}

.booth-rect.reserved {
  fill: rgba(230, 162, 60, 0.9);
}

.booth-rect.sold {
  fill: rgba(92, 106, 196, 0.9);
}

.booth-rect.disabled {
  fill: rgba(124, 135, 151, 0.75);
}

.booth-rect.selected {
  stroke: #111827;
  stroke-width: 3;
}

.booth-rect.focused {
  stroke: #ffcf33;
  stroke-width: 5;
  filter: drop-shadow(0 0 5px rgba(255, 207, 51, 0.85));
}

.booth-rect.unselectable {
  cursor: not-allowed;
  opacity: 0.72;
}

.booth-text {
  fill: #fff;
  font-size: 10px;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: middle;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 5px;
}

.side-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

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

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

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

th {
  background: #f7f9fc;
  color: #526174;
  font-size: 12px;
  font-weight: 600;
}

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

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

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 99px;
  padding: 3px 8px;
  font-size: 12px;
  background: #eef3f9;
  color: #4b5563;
  white-space: nowrap;
}

.status.available,
.status.approved,
.status.sold {
  background: #e7f7ee;
  color: var(--success);
}

.status.reserved,
.status.pending,
.status.pending_payment_review {
  background: #fff4db;
  color: var(--warning);
}

.status.rejected,
.status.released,
.status.cancelled {
  background: #fdecec;
  color: var(--danger);
}

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

.hint {
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}

.split-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 178px;
}

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

.subnav button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #eef3f9;
  color: var(--text);
}

.subnav button.active {
  background: var(--primary);
  color: #fff;
}

.subnav span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  font-size: 12px;
}

.notice {
  border: 1px solid #cfe2ff;
  background: #f0f6ff;
  color: #244c7c;
  border-radius: 8px;
  padding: 12px;
}

.error {
  border: 1px solid #ffc6c6;
  background: #fff1f1;
  color: #9b1c1c;
  border-radius: 8px;
  padding: 10px 12px;
}

.success-message {
  border: 1px solid #bfe8d2;
  background: #ecfbf2;
  color: #146c43;
  border-radius: 8px;
  padding: 10px 12px;
}

.compact-list {
  display: grid;
  gap: 8px;
}

.compact-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(23, 32, 51, 0.04);
}

.attachment-link {
  color: var(--primary);
  text-decoration: none;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(15, 23, 42, 0.42);
}

.modal {
  width: min(960px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.modal.large {
  width: min(1240px, 98vw);
}

.modal.small {
  width: min(560px, 94vw);
}

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

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-map {
  height: 540px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 14px 0;
  background: #eef2f7;
}

@media (max-width: 1180px) {
  .cards,
  .dashboard-hero,
  .grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-layout,
  .dashboard-hero,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 840px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-hero {
    padding: 38px 28px 8px;
  }

  .login-panel {
    padding: 24px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

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

  .cards,
  .sales-kpis,
  .chart-panel,
  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }

  .status-chart-card {
    align-items: flex-start;
    flex-direction: column;
  }
}
