: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.company-name-link {
  display: inline;
  padding: 0;
  min-height: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  text-align: left;
  text-decoration: none;
}

button.company-name-link:hover {
  background: transparent;
  color: var(--primary-dark);
  text-decoration: underline;
}

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;
}

.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;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  z-index: 8;
}

.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;
}

.nav-group {
  display: grid;
  gap: 5px;
}

.nav-group.active > .nav-parent {
  background: #1d2f49;
  color: #fff;
}

.nav-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
}

.nav-arrow {
  color: #9eb0c6;
  font-size: 12px;
}

.nav-children {
  display: grid;
  gap: 4px;
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-children button {
  padding: 9px 10px;
  font-size: 13px;
}

.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;
  gap: 18px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(10px);
}

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

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

.global-search {
  position: relative;
  flex: 1 1 440px;
  max-width: 560px;
  min-width: 240px;
}

.global-search input {
  width: 100%;
  height: 38px;
  padding: 0 42px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--text);
  outline: none;
}

.global-search input:focus {
  border-color: #8fb4df;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(35, 100, 170, 0.12);
}

.global-search-clear {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  background: #e8eef7;
  color: var(--muted);
}

.global-search-clear:hover {
  background: #d8e3f2;
  color: var(--text);
}

.global-search-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(23, 32, 51, 0.16);
}

.global-search-result {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 3px 10px;
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.global-search-result:hover {
  background: #f2f6fb;
}

.global-search-type {
  grid-row: span 2;
  align-self: center;
  justify-self: start;
  min-width: 42px;
  padding: 3px 8px;
  border-radius: 99px;
  background: #e8f0fa;
  color: var(--primary);
  font-size: 12px;
  text-align: center;
}

.global-search-main {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-search-sub {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.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));
}

.grid .span-2,
.detail-grid .span-2 {
  grid-column: 1 / -1;
}

.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;
}

.metric.clickable {
  cursor: pointer;
}

.metric.clickable:hover {
  border-color: #b8d5f4;
  box-shadow: 0 14px 30px rgba(35, 100, 170, 0.12);
}

.todo-workbench {
  padding-bottom: 18px;
}

.todo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.todo-card {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--text);
  text-align: left;
}

.todo-card:hover {
  background: #eef6ff;
}

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

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

.todo-card.warning {
  border-color: #f2d7a6;
}

.todo-card.danger {
  border-color: #f0b4b4;
}

.dashboard-event-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 22px 24px;
  border: 1px solid #dce8f6;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #eef6ff 100%);
  box-shadow: 0 12px 30px rgba(23, 32, 51, 0.06);
}

.dashboard-event-summary span,
.event-countdown span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dashboard-event-summary h2 {
  margin: 8px 0 6px;
  font-size: 24px;
}

.dashboard-event-summary p {
  margin: 0;
  color: var(--muted);
}

.event-countdown {
  min-width: 170px;
  padding: 16px 18px;
  border: 1px solid #dce8f6;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.event-countdown strong {
  display: block;
  margin-top: 8px;
  color: var(--primary);
  font-size: 30px;
  line-height: 1;
}

.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;
}

.mini-progress.fluid {
  width: 100%;
  max-width: 128px;
}

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

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

.completion-cell {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.completion-cell strong {
  font-size: 13px;
}

.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;
}

.compact-grid {
  max-width: 520px;
}

.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;
  height: calc(100vh - 190px);
  min-height: 440px;
  position: relative;
}

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

.draw-preset-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  width: 260px;
  display: grid;
  gap: 8px;
  padding: 12px;
  margin: 0;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(23, 32, 51, 0.14);
  backdrop-filter: blur(8px);
}

.draw-preset-panel strong {
  font-size: 13px;
}

.draw-preset-panel.collapsed {
  width: 168px;
  gap: 4px;
  padding: 8px;
}

.draw-preset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.draw-preset-toggle {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.draw-preset-panel label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.draw-preset-panel input,
.draw-preset-panel select {
  height: 34px;
}

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

.draw-preset-actions {
  display: flex;
  justify-content: flex-end;
}

.draw-preset-panel small {
  color: var(--muted);
  font-size: 11px;
}

.draw-reset-hint {
  padding: 6px 8px;
  border-radius: 6px;
  background: #eef7f1;
  color: #1f6f43 !important;
}

.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.base {
  stroke: #ffcf33;
  stroke-width: 5;
  filter: drop-shadow(0 0 5px rgba(255, 207, 51, 0.85));
}

.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-rect.locked {
  stroke: #111827;
  stroke-dasharray: 5 3;
  cursor: not-allowed;
}

.booth-lock-text {
  pointer-events: none;
  fill: #111827;
  font-size: 11px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
}

.obstacle-rect {
  stroke-width: 1.6;
  cursor: grab;
}

.obstacle-group:active .obstacle-rect {
  cursor: grabbing;
}

.obstacle-rect.internal {
  fill: rgba(194, 65, 65, 0.74);
  stroke: #7f1d1d;
}

.obstacle-rect.external {
  fill: rgba(71, 85, 105, 0.66);
  stroke: #1f2937;
}

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

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

.sales-map-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 14px;
}

.sales-map-summary div {
  display: grid;
  gap: 2px;
  min-width: 126px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fbff;
}

.sales-map-summary strong {
  font-size: 24px;
  color: var(--text);
}

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

.sales-map-toolbar {
  align-items: end;
}

.sales-map-frame {
  height: calc(100vh - 300px);
  min-height: 440px;
  margin-bottom: 16px;
}

.sales-booth-rect {
  stroke: #fff;
  stroke-width: 1.4;
  cursor: help;
  transition: opacity 0.16s ease, stroke-width 0.16s ease, filter 0.16s ease;
}

.sales-booth-rect.unavailable {
  opacity: 0.76;
}

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

.sales-booth-group:hover .sales-booth-rect {
  stroke: #111827;
  stroke-width: 3;
}

.zone-table table {
  min-width: 640px;
}

.color-input {
  min-width: 92px;
  height: 38px;
  padding: 3px;
}

.zone-swatch {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid rgba(15, 23, 42, 0.15);
}

.zone-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.zone-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.zone-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.furniture-table table {
  min-width: 880px;
}

.furniture-table .price-col {
  width: 112px;
  max-width: 112px;
}

.price-input {
  width: 96px;
  min-width: 0;
}

.furniture-thumb-wrap {
  display: grid;
  grid-template-columns: 56px auto;
  gap: 8px;
  align-items: center;
  min-width: 150px;
}

.furniture-thumb {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f3f6fa;
}

.furniture-thumb.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

.file-upload-button {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 6px;
  background: #eef3f9;
  color: var(--text);
  font-size: 12px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  width: fit-content;
}

.file-upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.furniture-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.furniture-choice-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 4px 10px;
  text-align: left;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 8px;
}

.furniture-choice-card:hover {
  background: #f8fbff;
}

.furniture-choice-card .furniture-thumb {
  grid-row: span 2;
}

.furniture-choice-card strong {
  font-size: 13px;
}

.furniture-choice-card span:not(.furniture-thumb) {
  color: var(--muted);
  font-size: 12px;
}

.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;
}

.required-label::after {
  content: " *";
  color: var(--danger);
  font-weight: 800;
}

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

.dashboard-stat-table,
.dashboard-compact-table {
  min-width: 0;
  table-layout: fixed;
  font-size: 13px;
}

.dashboard-stat-table th,
.dashboard-stat-table td,
.dashboard-compact-table th,
.dashboard-compact-table td {
  padding: 10px 8px;
  white-space: normal;
  vertical-align: middle;
}

.dashboard-stat-table th:first-child,
.dashboard-stat-table td:first-child {
  width: 22%;
}

.dashboard-stat-table th:last-child,
.dashboard-stat-table td:last-child {
  width: 120px;
}

.dashboard-compact-table {
  min-width: 860px;
}

.dashboard-sales-table {
  min-width: 0;
}

.event-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  min-width: 320px;
  margin-bottom: 8px;
}

.event-role-grid label {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.event-role-grid span {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.event-role-boxes {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 10px;
  min-width: 360px;
  margin-bottom: 8px;
}

.event-role-boxes label {
  display: grid;
  gap: 6px;
}

.event-role-boxes span {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.event-role-boxes select {
  min-height: 118px;
}

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

.inline-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inline-label select {
  min-width: 130px;
}

.field-actions {
  display: flex;
  align-items: flex-end;
}

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

.quota-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.quota-card {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

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

.event-role-picker-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.event-role-check {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.event-role-check input {
  width: 16px;
  height: 16px;
}

.event-role-check span {
  display: grid;
  gap: 2px;
}

.event-role-check small {
  color: var(--muted);
}

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,
.status.special-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;
}

.inline-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.customer-table {
  min-width: 720px;
}

.customer-table th {
  background: #f4f7fb;
}

.customer-table td {
  padding: 13px 12px;
  vertical-align: middle;
}

.customer-table tbody tr:hover td {
  background: #f7fbff;
}

.customer-info-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border: 1px solid #dbe7f4;
  border-radius: 999px;
  background: #f6faff;
  color: #38506b;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.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;
}

.hidden {
  display: none !important;
}

.compact-section {
  padding-top: 12px;
  padding-bottom: 12px;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin: 12px 0 14px;
}

.filter-bar label {
  display: grid;
  gap: 6px;
}

.advanced-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.advanced-filter-bar label {
  display: grid;
  min-width: 220px;
  gap: 6px;
}

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

.similar-company-alert {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #f2d7a6;
  border-radius: 8px;
  background: #fffaf0;
  color: #7a4b00;
}

.similar-company-alert strong {
  color: #5f3b00;
}

.similar-company-alert p {
  margin: 0;
  color: #856219;
  font-size: 12px;
}

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

.similar-company-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(160px, 1.2fr) minmax(180px, 1.2fr);
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(183, 110, 0, 0.2);
  border-radius: 6px;
  background: #fff;
}

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

.similar-company-row div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.similar-company-row em {
  padding: 3px 7px;
  border-radius: 99px;
  background: #fff0cf;
  color: #7a4b00;
  font-style: normal;
  font-size: 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);
}

.compact-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.attachment-preview-list {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.attachment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
}

.attachment-meta strong {
  color: var(--text);
}

.attachment-preview-media {
  display: block;
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
}

.attachment-preview-frame {
  width: 100%;
  height: 68vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}

.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;
}

.customer-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.customer-summary-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.customer-summary-card span,
.customer-summary-card small {
  color: var(--muted);
  font-size: 12px;
}

.customer-summary-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.detail-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.detail-grid strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  word-break: break-word;
}

.detail-actions {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.company-edit-form {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.company-edit-form input[readonly] {
  color: var(--muted);
  background: #f1f5f9;
  cursor: not-allowed;
}

.detail-section {
  margin-top: 16px;
}

.detail-list {
  display: grid;
  gap: 10px;
}

.detail-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-list-row strong,
.detail-list-row span {
  display: block;
}

.detail-list-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.profile-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-mini-card {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.audit-mini-list {
  display: grid;
  gap: 10px;
}

.audit-mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.audit-mini-row strong,
.audit-mini-row span {
  display: block;
}

.audit-mini-row div span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.audit-mini-row p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.detail-order-card {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-order-head,
.detail-order-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detail-order-meta {
  justify-content: flex-start;
  color: var(--muted);
  font-size: 12px;
}

.detail-order-meta span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5fa;
}

.order-timeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
}

.timeline-step {
  position: relative;
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.timeline-step i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #b8c2d1;
}

.timeline-step.done i {
  background: var(--success);
}

.timeline-step.active {
  border-color: #f2d7a6;
  background: #fffaf0;
}

.timeline-step strong {
  font-size: 13px;
}

.timeline-step span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.detail-action-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.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,
  .customer-summary-grid {
    grid-template-columns: 1fr;
  }

  .order-timeline {
    grid-template-columns: repeat(3, minmax(0, 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;
  }

  .topbar {
    height: auto;
    align-items: stretch;
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .global-search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  .sidebar {
    min-height: auto;
    height: auto;
    position: static;
    overflow-y: visible;
  }

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

  .map-frame,
  .sales-map-frame {
    height: 62vh;
    min-height: 360px;
  }

  .cards,
  .dashboard-event-summary,
  .order-timeline,
  .profile-mini-grid,
  .detail-grid,
  .sales-kpis,
  .chart-panel,
  .filter-bar,
  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }

  .dashboard-event-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .event-countdown {
    width: 100%;
  }

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

  .detail-list-row,
  .audit-mini-row,
  .similar-company-row {
    grid-template-columns: 1fr;
  }
}
