/* ============================================================
   DATA ANALYSIS — 大数据可视化主题
   设计参考 iGaoWei/BigDataView 通用大数据可视化模板
   深蓝 + 青色发光风格，面板带边角装饰
   ============================================================ */

:root {
  --bg-0: #03060f;
  --bg-1: #061025;
  --bg-2: #0a1738;
  --panel: rgba(12, 28, 66, 0.55);
  --panel-solid: #0b1c3f;
  --line: rgba(64, 158, 255, 0.22);
  --line-strong: rgba(64, 184, 255, 0.55);
  --muted: #8aa6d4;
  --text: #e8f2ff;
  --cyan: #19e0ff;
  --blue: #3f7dff;
  --sales: #ffc24b;
  --traffic: #19e0ff;
  --vehicle: #7aa2ff;
  --danger: #ff5b6a;
  --growth: #2ee6a6;
  --glow: 0 0 18px rgba(25, 224, 255, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(33, 90, 200, 0.35), transparent 60%),
    radial-gradient(900px 500px at 90% 12%, rgba(25, 224, 255, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  background-attachment: fixed;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* faint grid overlay for the big-data look */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(64, 158, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(64, 158, 255, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  z-index: 0;
}

/* ---------- login ---------- */
.login-body {
  min-height: 100vh;
}

.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
  backdrop-filter: blur(6px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45), inset 0 0 30px rgba(25, 224, 255, 0.06);
  padding: 30px;
}

.login-panel h1 {
  font-size: 30px;
  text-shadow: var(--glow);
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.login-form input,
.login-form button {
  width: 100%;
}

.login-secondary {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
}

.login-secondary a {
  color: var(--cyan);
  text-decoration: none;
}

.login-secondary a:hover {
  text-decoration: underline;
}

button,
input,
select {
  font: inherit;
}

/* ---------- shell ---------- */
.shell {
  position: relative;
  z-index: 1;
  width: min(1680px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

/* ---------- header ---------- */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px 18px;
  margin-bottom: 16px;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.7;
}

.topbar .brand {
  text-align: center;
  flex: 1;
}

.tool-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.tool-links a {
  position: relative;
  overflow: hidden;
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid rgba(64, 184, 255, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(25, 224, 255, 0.18), rgba(31, 78, 168, 0.18)),
    rgba(6, 16, 37, 0.7);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28), inset 0 0 18px rgba(25, 224, 255, 0.08);
  transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.tool-links a::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.75;
}

.tool-links a:hover {
  border-color: rgba(255, 194, 75, 0.88);
  background:
    linear-gradient(180deg, rgba(255, 194, 75, 0.24), rgba(25, 224, 255, 0.13)),
    rgba(6, 16, 37, 0.72);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34), 0 0 18px rgba(255, 194, 75, 0.28);
  transform: translateY(-2px);
}

.tool-links span {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.tool-links small {
  color: #031226;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(25, 224, 255, 0.86);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--cyan);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 800;
  letter-spacing: 4px;
  background: linear-gradient(180deg, #ffffff, #9fd6ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 22px rgba(25, 224, 255, 0.25);
}

h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
}

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

.top-side {
  min-width: 220px;
}

.top-side.left {
  color: var(--muted);
  font-size: 13px;
}

.top-clock {
  font-size: 22px;
  font-weight: 700;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

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

.tenant-search,
.upload-box,
.trend-controls,
.segmented {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

input,
select,
textarea {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(4, 12, 30, 0.7);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(25, 224, 255, 0.15);
}

.icon-button,
button,
.action-link {
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(31, 78, 168, 0.28);
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

button:hover,
.action-link:hover,
.segment.active {
  border-color: var(--cyan);
  background: rgba(25, 224, 255, 0.18);
  box-shadow: var(--glow);
}

.action-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  white-space: nowrap;
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 19px;
}

/* ---------- summary band ---------- */
.summary-band {
  position: relative;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(25, 224, 255, 0.1), rgba(31, 78, 168, 0.12));
  padding: 14px 18px;
  margin-bottom: 14px;
  color: #dcebff;
  line-height: 1.8;
}

/* ---------- KPI ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 128px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: blur(4px);
  box-shadow: inset 0 0 24px rgba(25, 224, 255, 0.05);
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--sales);
  box-shadow: 0 0 14px var(--sales);
}

.metric::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 194, 75, 0.18), transparent 70%);
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric span {
  font-size: 14px;
  letter-spacing: 1px;
}

.metric strong {
  display: block;
  margin: 14px 0 8px;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.15);
}

.accent-sales strong { color: var(--sales); }
.accent-traffic strong { color: var(--traffic); }
.accent-vehicle strong { color: var(--vehicle); }
.accent-tenant strong { color: var(--danger); }

.accent-traffic::before { background: var(--traffic); box-shadow: 0 0 14px var(--traffic); }
.accent-traffic::after { background: radial-gradient(circle, rgba(25, 224, 255, 0.18), transparent 70%); }
.accent-vehicle::before { background: var(--vehicle); box-shadow: 0 0 14px var(--vehicle); }
.accent-vehicle::after { background: radial-gradient(circle, rgba(122, 162, 255, 0.18), transparent 70%); }
.accent-tenant::before { background: var(--danger); box-shadow: 0 0 14px var(--danger); }
.accent-tenant::after { background: radial-gradient(circle, rgba(255, 91, 106, 0.18), transparent 70%); }

/* ---------- panels ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.panel {
  position: relative;
  min-width: 0;
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: blur(4px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3), inset 0 0 30px rgba(25, 224, 255, 0.04);
}

/* glowing corner brackets */
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.panel::before {
  left: -1px;
  top: -1px;
  border-left: 2px solid var(--cyan);
  border-top: 2px solid var(--cyan);
  border-top-left-radius: 6px;
}

.panel::after {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid var(--cyan);
  border-bottom: 2px solid var(--cyan);
  border-bottom-right-radius: 6px;
}

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

.panel-head h2 {
  position: relative;
  padding-left: 14px;
}

.panel-head h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--blue));
  box-shadow: 0 0 10px var(--cyan);
}

.panel-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.ranking-panel,
.period-panel {
  grid-column: span 1;
  display: flex;
  flex-direction: column;
  height: 678px;
  overflow: hidden;
}

.ranking-panel .fill-table,
.period-panel .scroll-table {
  flex: 1;
  min-height: 0;
  height: auto;
  overflow: auto;
}

.period-panel .compact-table {
  max-height: 420px;
}

.period-panel .period-tenant-table {
  flex: 1 1 auto;
  min-height: 472px;
}

/* ---------- charts (ECharts containers) ---------- */
.chart {
  width: 100%;
  height: 380px;
}

.chart.tall {
  height: 460px;
}

.mini-chart {
  width: 100%;
  height: 220px;
}

/* trend metric/compare toggles */
.trend-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 16, 37, 0.5);
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.toggle-label {
  color: var(--cyan);
  font-size: 13px;
  letter-spacing: 1px;
}

.trend-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.trend-toggles input {
  width: auto;
  height: auto;
  accent-color: var(--cyan);
}

.month-range {
  transition: opacity 0.15s;
}

/* full-width panels stack as their own rows */
.chart-panel,
.category-panel,
.commission-panel,
.new-tenant-panel,
.anomaly-panel,
.tenant-panel,
.floor-panel {
  margin-bottom: 14px;
}

.empty-chart {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
}

/* ---------- anomalies ---------- */
.anomaly-list {
  display: grid;
  gap: 8px;
  max-height: 380px;
  overflow: auto;
  padding-right: 4px;
}

.anomaly-list.wide {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  max-height: 320px;
}

.new-tenant-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.anomaly-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 16, 37, 0.6);
  padding: 10px 12px;
  transition: border-color 0.15s, background 0.15s;
}

.new-tenant-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(46, 230, 166, 0.24);
  border-radius: 8px;
  background: rgba(6, 16, 37, 0.62);
  padding: 10px 12px;
}

.new-tenant-metrics {
  display: grid;
  gap: 4px;
  min-width: 92px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.new-tenant-metrics b {
  color: var(--growth);
  font-size: 15px;
}

.anomaly-item:hover {
  border-color: var(--line-strong);
  background: rgba(25, 224, 255, 0.06);
}

.anomaly-title {
  font-weight: 700;
}

.anomaly-meta,
.tag {
  color: var(--muted);
  font-size: 12px;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.tag.drop {
  color: var(--danger);
  border-color: rgba(255, 91, 106, 0.55);
  background: rgba(255, 91, 106, 0.08);
}

.tag.growth {
  color: var(--growth);
  border-color: rgba(46, 230, 166, 0.55);
  background: rgba(46, 230, 166, 0.08);
}

.tag.zero {
  color: var(--sales);
  border-color: rgba(255, 194, 75, 0.55);
  background: rgba(255, 194, 75, 0.08);
}

/* ---------- tables ---------- */
.table-wrap {
  overflow: auto;
}

.scroll-table {
  max-height: 460px;
  overflow: auto;
}

.scroll-table.thin-scroll,
.thin-scroll,
.anomaly-list,
.new-tenant-list,
.alias-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(25, 224, 255, 0.55) rgba(6, 16, 37, 0.18);
}

.scroll-table::-webkit-scrollbar,
.thin-scroll::-webkit-scrollbar,
.anomaly-list::-webkit-scrollbar,
.new-tenant-list::-webkit-scrollbar,
.alias-list::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.scroll-table::-webkit-scrollbar-track,
.thin-scroll::-webkit-scrollbar-track,
.anomaly-list::-webkit-scrollbar-track,
.new-tenant-list::-webkit-scrollbar-track,
.alias-list::-webkit-scrollbar-track {
  background: rgba(6, 16, 37, 0.18);
  border-radius: 999px;
}

.scroll-table::-webkit-scrollbar-thumb,
.thin-scroll::-webkit-scrollbar-thumb,
.anomaly-list::-webkit-scrollbar-thumb,
.new-tenant-list::-webkit-scrollbar-thumb,
.alias-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(25, 224, 255, 0.72), rgba(63, 125, 255, 0.5));
  border-radius: 999px;
}

.scroll-table::-webkit-scrollbar-thumb:hover,
.thin-scroll::-webkit-scrollbar-thumb:hover,
.anomaly-list::-webkit-scrollbar-thumb:hover,
.new-tenant-list::-webkit-scrollbar-thumb:hover,
.alias-list::-webkit-scrollbar-thumb:hover {
  background: rgba(25, 224, 255, 0.9);
}

.ranking-panel .scroll-table,
.period-panel .scroll-table {
  max-height: none;
}

.ranking-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ranking-controls select {
  height: 34px;
}

/* ---------- sales category comparison ---------- */
.category-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(560px, 1.15fr);
  gap: 14px;
  align-items: stretch;
}

.category-controls button {
  align-self: end;
  white-space: nowrap;
}

.category-chart {
  height: 460px;
}

.category-panel #categoryMeta {
  white-space: pre-line;
  line-height: 1.55;
}

.category-table {
  height: auto;
  max-height: none;
  overflow: visible;
  border: 1px solid rgba(64, 158, 255, 0.12);
  border-radius: 8px;
  background: rgba(6, 16, 37, 0.28);
}

.category-table table {
  min-width: 0;
  table-layout: fixed;
  font-size: 12.5px;
}

.category-table th,
.category-table td {
  padding: 7px 5px;
  line-height: 1.35;
}

.category-table th {
  white-space: normal;
}

.category-table .num {
  white-space: nowrap;
}

.category-name-col {
  width: 82px;
}

.category-name-col strong {
  display: block;
  max-width: 82px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-total td {
  background: rgba(8, 20, 46, 0.96);
  color: var(--text);
  font-weight: 700;
  border-top: 1px solid rgba(64, 184, 255, 0.24);
}

.category-rate.up {
  color: var(--growth);
}

.category-rate.down {
  color: var(--danger);
}

.category-rate.neutral {
  color: var(--muted);
}

/* ---------- commission rent analysis ---------- */
.commission-panel {
  padding-bottom: 16px;
}

.commission-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 12px;
}

.commission-summary {
  min-width: 0;
  border: 1px solid rgba(64, 158, 255, 0.12);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(8, 20, 46, 0.72), rgba(6, 16, 37, 0.36));
  padding: 12px;
}

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

.commission-kpi {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 5px;
  min-width: 0;
  border: 1px solid rgba(64, 158, 255, 0.12);
  border-radius: 7px;
  background: rgba(6, 16, 37, 0.42);
  padding: 8px 9px;
}

.commission-kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.commission-kpi strong {
  color: var(--text);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  text-align: left;
  white-space: nowrap;
}

.commission-kpi.up strong {
  color: var(--growth);
}

.commission-kpi.down strong {
  color: var(--danger);
}

.commission-controls button {
  align-self: end;
  white-space: nowrap;
}

.commission-chart {
  height: 390px;
  border: 1px solid rgba(64, 158, 255, 0.12);
  border-radius: 8px;
  background: rgba(6, 16, 37, 0.2);
}

.commission-table {
  height: 300px;
  max-height: none;
  border: 1px solid rgba(64, 158, 255, 0.12);
  border-radius: 8px;
  background: rgba(6, 16, 37, 0.28);
}

.commission-table table {
  min-width: 900px;
  table-layout: fixed;
  font-size: 13px;
}

.commission-table th,
.commission-table td {
  padding: 7px 6px;
  line-height: 1.35;
}

.commission-table th:first-child {
  width: 84px;
}

.commission-table th:nth-child(2) {
  width: 170px;
}

.commission-year-toggles {
  margin-bottom: 12px;
  padding: 8px 10px;
}

.commission-tenant-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(64, 158, 255, 0.16);
}

.compact-head {
  margin-bottom: 10px;
}

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

.commission-tenant-chart {
  height: 330px;
}

.commission-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 118px;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
}

.commission-status.new_commission {
  color: var(--growth);
  border-color: rgba(46, 230, 166, 0.55);
  background: rgba(46, 230, 166, 0.08);
}

.commission-status.lost_commission {
  color: var(--danger);
  border-color: rgba(255, 91, 106, 0.55);
  background: rgba(255, 91, 106, 0.08);
}

.commission-status.continuing {
  color: var(--cyan);
  border-color: rgba(25, 224, 255, 0.5);
  background: rgba(25, 224, 255, 0.07);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  position: sticky;
  top: 0;
  background: rgba(8, 20, 46, 0.95);
  backdrop-filter: blur(2px);
  z-index: 1;
}

th,
td {
  border-bottom: 1px solid rgba(64, 158, 255, 0.12);
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 600;
}

tbody tr {
  transition: background 0.12s;
}

tbody tr:hover {
  background: rgba(25, 224, 255, 0.06);
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.segment {
  width: 42px;
  padding: 0;
}

/* ---------- period ---------- */
.period-controls {
  display: grid;
  grid-template-columns: minmax(116px, 0.8fr) minmax(116px, 0.8fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.period-controls select {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.period-controls button {
  white-space: nowrap;
}

.period-controls label,
.trend-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.trend-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.trend-controls input {
  width: 146px;
}

.trend-controls .tenant-day-range input {
  width: 138px;
}

.period-project {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.period-card {
  position: relative;
  background: rgba(8, 20, 46, 0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 14px;
  overflow: hidden;
}

.period-card::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}

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

.period-card strong {
  display: block;
  font-size: 23px;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.period-card small {
  color: var(--muted);
}

.period-tenant-table table {
  font-size: 13px;
}

.period-tenant-table th,
.period-tenant-table td {
  padding: 6px 7px;
  line-height: 1.3;
}

.period-tenant-table .anomaly-meta {
  font-size: 11px;
}

.compact-table {
  max-height: 320px;
}

/* ---------- tenant ---------- */
.tenant-search {
  margin-bottom: 12px;
}

.tenant-search input {
  flex: 1;
}

.tenant-search select {
  width: 48%;
}

.year-boxes {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
}

.year-boxes label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.year-boxes input {
  width: auto;
  height: auto;
  accent-color: var(--cyan);
}

.tenant-detail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.tenant-visual {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.tenant-visual.with-side {
  grid-template-columns: minmax(0, 1fr) 260px;
}

.tenant-cumulative {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 20, 46, 0.58);
  padding: 12px;
  min-height: 0;
}

.cumulative-block + .cumulative-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(64, 158, 255, 0.14);
}

.cumulative-block h3 {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.cumulative-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 58px;
  gap: 8px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid rgba(64, 158, 255, 0.08);
  font-size: 12px;
}

.cumulative-row:last-child {
  border-bottom: 0;
}

.cumulative-row span {
  color: var(--muted);
}

.cumulative-row strong {
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cumulative-row em {
  font-style: normal;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cumulative-row em.up {
  color: var(--growth);
}

.cumulative-row em.down {
  color: var(--danger);
}

.cumulative-row em.neutral,
.cumulative-empty {
  color: var(--muted);
}

.cumulative-empty {
  padding: 12px 0;
  font-size: 12px;
}

.tenant-stat {
  background: rgba(8, 20, 46, 0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.tenant-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.tenant-stat strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

/* ---------- floor map ---------- */
.floor-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.floor-date-control {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.floor-date-control input,
.floor-date-control select {
  height: 32px;
  min-width: 142px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(6, 16, 37, 0.72);
  color: var(--text);
  padding: 0 8px;
}

.floor-refresh-status {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(122, 162, 255, 0.22);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(82, 105, 143, 0.16);
  font-size: 12px;
  white-space: nowrap;
}

.floor-refresh-status.ok {
  border-color: rgba(46, 230, 166, 0.45);
  color: var(--growth);
}

.floor-tabs {
  display: flex;
  gap: 8px;
}

.floor-tab {
  width: auto;
  min-width: 54px;
  padding: 0 14px;
}

.floor-tab.active {
  color: #031226;
  border-color: rgba(255, 194, 75, 0.86);
  background: linear-gradient(180deg, rgba(255, 214, 98, 0.96), rgba(255, 170, 44, 0.86));
  box-shadow: 0 0 18px rgba(255, 194, 75, 0.45);
  font-weight: 800;
}

.floor-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.floor-legend i {
  display: inline-block;
  width: 22px;
  height: 10px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: middle;
}

.floor-stage {
  position: relative;
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 40%, rgba(31, 78, 168, 0.18), transparent 70%),
    rgba(4, 12, 30, 0.6);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.floor-stage img.floor-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.92;
  user-select: none;
  -webkit-user-drag: none;
}

.floor-badge {
  position: absolute;
  right: 4%;
  bottom: 4%;
  z-index: 1;
  color: rgba(226, 232, 240, 0.42);
  font-size: clamp(48px, 7.5vw, 110px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: 0;
  pointer-events: none;
  text-shadow: 0 2px 12px rgba(3, 10, 24, 0.48), 0 0 10px rgba(255, 255, 255, 0.16);
}

.floor-hotspots {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.floor-hotspots:empty {
  pointer-events: none;
}

.floor-shapes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.floor-shape {
  cursor: pointer;
  fill-opacity: 0.16;
  pointer-events: all;
  transition: fill-opacity 0.12s, filter 0.12s;
}

.floor-shape.bound {
  fill-opacity: 0.56;
}

.floor-shape.floor-vacant {
  fill: #ff1f2d !important;
  fill-opacity: 0.72;
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 2px;
}

.floor-shape:hover,
.floor-shape.active {
  fill-opacity: 0.82;
  filter: drop-shadow(0 0 8px rgba(25, 224, 255, 0.85));
}

.floor-shape.floor-vacant:hover,
.floor-shape.floor-vacant.active {
  fill-opacity: 0.94;
  filter: drop-shadow(0 0 10px rgba(255, 31, 45, 0.88));
}

.floor-shape-label {
  pointer-events: none;
  fill: #031226;
  font-size: 24px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 4px;
}

.floor-shape-label .tenant {
  font-weight: 800;
}

.floor-shape-label .unit {
  font-weight: 900;
}

.floor-shape-label.muted {
  fill: rgba(3, 18, 38, 0.55);
  font-size: 14px;
}

.label-drag-handle {
  cursor: grab;
  fill: rgba(25, 224, 255, 0.18);
  stroke: rgba(3, 18, 38, 0.8);
  stroke-width: 2px;
  pointer-events: all;
}

.label-drag-handle:hover,
.label-drag-handle.active {
  fill: rgba(25, 224, 255, 0.34);
  stroke: rgba(255, 255, 255, 0.92);
}

.floor-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 14px;
  min-height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  background: var(--blue);
  box-shadow: 0 0 8px rgba(25, 224, 255, 0.5);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}

.floor-hotspot:hover,
.floor-hotspot.active {
  transform: translate(-50%, -50%) scale(1.35);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.9);
  z-index: 3;
}

.floor-hotspot.lvl-0 { background: #3a4f7a; }
.floor-hotspot.lvl-1 { background: var(--vehicle); }
.floor-hotspot.lvl-2 { background: var(--traffic); }
.floor-hotspot.lvl-3 { background: var(--growth); }
.floor-hotspot.lvl-4 { background: var(--sales); }
.floor-hotspot.lvl-5 { background: var(--danger); }

/* shop cells (vector redraw from PPT) */
.floor-cell {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(159, 194, 255, 0.45);
  border-radius: 4px;
  background: rgba(64, 158, 255, 0.1);
  color: #dcebff;
  font-size: 11px;
  line-height: 1.1;
  text-align: center;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s, border-color 0.12s;
}

.floor-cell span {
  display: grid;
  gap: 1px;
  padding: 1px 2px;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.floor-cell span b {
  display: block;
  font-size: 10px;
  line-height: 1;
}

.floor-cell:hover,
.floor-cell.active {
  transform: scale(1.04);
  border-color: #fff;
  box-shadow: 0 0 14px rgba(25, 224, 255, 0.7);
  z-index: 4;
}

.floor-cell.lvl-0 { background: rgba(58, 79, 122, 0.45); border-color: rgba(120, 140, 180, 0.5); }
.floor-cell.lvl-1 { background: rgba(122, 162, 255, 0.4); }
.floor-cell.lvl-2 { background: rgba(25, 224, 255, 0.32); }
.floor-cell.lvl-3 { background: rgba(46, 230, 166, 0.34); }
.floor-cell.lvl-4 { background: rgba(255, 194, 75, 0.38); border-color: rgba(255, 194, 75, 0.7); }
.floor-cell.lvl-5 { background: rgba(255, 91, 106, 0.45); border-color: rgba(255, 91, 106, 0.8); }

.floor-tooltip {
  position: absolute;
  z-index: 10;
  min-width: 210px;
  width: max-content;
  max-width: min(420px, calc(100% - 24px));
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(6, 16, 37, 0.96);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  font-size: 13px;
  display: none;
}

.floor-tooltip.show {
  display: block;
}

.floor-tooltip h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--cyan);
}

.floor-tooltip .row {
  display: grid;
  grid-template-columns: max-content max-content;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  white-space: nowrap;
}

.floor-tooltip .row b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.floor-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 20px;
  line-height: 1.8;
}

.floor-hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

/* annotation mode */
.floor-stage.annotating {
  cursor: crosshair;
}

.floor-stage.annotating .floor-hotspot {
  cursor: grab;
}

.floor-annotate-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  align-items: end;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 16, 37, 0.5);
}

.floor-annotate-bar label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
}

.floor-annotate-bar input,
.floor-annotate-bar select {
  width: 100%;
  min-width: 0;
}

.floor-annotate-bar button {
  white-space: nowrap;
}

.vacancy-field[hidden] {
  display: none !important;
}

/* ---------- upload ---------- */
.upload-box {
  align-items: stretch;
}

.upload-box input {
  flex: 1;
  padding-top: 6px;
}

.status-line {
  min-height: 22px;
  margin: 12px 0;
  color: var(--muted);
}

.import-history {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.import-history.large {
  max-height: 520px;
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.75fr) minmax(0, 1.25fr);
  gap: 14px;
}

.alias-panel {
  grid-column: 1 / -1;
}

.floor-binding-panel {
  grid-column: 1 / -1;
}

.floor-binding-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.34fr);
  gap: 14px;
  align-items: start;
}

.binding-stage {
  min-height: 620px;
}

.floor-binding-editor {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 16, 37, 0.42);
}

.floor-binding-editor label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.tenant-result-list {
  display: grid;
  gap: 6px;
  min-height: 420px;
  max-height: 520px;
  overflow: auto;
}

.tenant-result,
.tenant-result-empty {
  width: 100%;
  border: 1px solid rgba(64, 158, 255, 0.16);
  border-radius: 8px;
  padding: 9px 10px;
  text-align: left;
  background: rgba(7, 22, 50, 0.72);
  color: var(--text);
}

.tenant-result {
  cursor: pointer;
}

.tenant-result:hover,
.tenant-result.active {
  border-color: rgba(25, 224, 255, 0.65);
  background: rgba(25, 224, 255, 0.12);
}

.tenant-result strong,
.tenant-result span {
  display: block;
}

.tenant-result span,
.tenant-result-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.floor-binding-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.alias-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(220px, 1.2fr) minmax(220px, 1.1fr) auto;
  gap: 10px;
  align-items: end;
}

.alias-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.alias-form button {
  white-space: nowrap;
}

.alias-form textarea {
  height: auto;
  min-height: 72px;
  padding-top: 9px;
  padding-bottom: 9px;
  resize: vertical;
}

.alias-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.alias-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(120px, 0.8fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid rgba(64, 158, 255, 0.12);
  padding: 9px 0;
}

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

.alias-row strong {
  color: var(--text);
}

.alias-row span,
.alias-note {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.alias-row button {
  height: 30px;
  padding: 0 12px;
}

.import-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  border-bottom: 1px solid rgba(64, 158, 255, 0.12);
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.import-row strong {
  color: var(--text);
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpi-grid,
  .dashboard-grid,
  .tenant-detail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-panel,
  .category-panel,
  .commission-panel,
  .ranking-panel,
  .tenant-panel,
  .period-panel,
  .floor-panel,
  .upload-panel,
  .new-tenant-panel,
  .anomaly-panel {
    grid-column: 1 / -1;
  }

  .ranking-panel,
  .period-panel {
    height: auto;
    overflow: visible;
  }

  .period-controls,
  .period-project,
  .category-layout,
  .commission-main,
  .tenant-visual,
  .floor-binding-layout,
  .floor-annotate-bar,
  .alias-form,
  .alias-row,
  .upload-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .commission-main {
    grid-template-columns: 1fr;
  }

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

  .topbar {
    flex-wrap: wrap;
  }

  .top-side {
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1680px);
    padding-top: 12px;
  }

  .topbar,
  .top-actions,
  .tenant-search,
  .upload-box,
  .trend-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .kpi-grid,
  .dashboard-grid,
  .tenant-detail {
    grid-template-columns: 1fr;
  }

  .tenant-search select {
    width: 100%;
  }

  .period-controls,
  .period-project,
  .category-layout,
  .commission-main,
  .commission-project,
  .tenant-visual,
  .floor-binding-layout,
  .floor-binding-actions,
  .floor-annotate-bar,
  .alias-form,
  .alias-row,
  .upload-layout {
    grid-template-columns: 1fr;
  }

  .trend-controls input {
    width: 100%;
  }

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

  .commission-table table {
    min-width: 860px;
  }

  .chart {
    height: 320px;
  }

  .tenant-result-list {
    min-height: 260px;
    max-height: 360px;
  }

  .floor-legend {
    margin-left: 0;
  }
}
