@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;700&family=IBM+Plex+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #050A0F;
  --surface: #0C1520;
  --surface2: #111D2C;
  --border: #1E3048;
  --accent: #00C2FF;
  --accent2: #00FF9D;
  --warn: #FF6B35;
  --danger: #FF2D55;
  --text: #E8F4FF;
  --muted: #5A7A95;
  --card-glow: 0 0 30px rgba(0,194,255,0.07);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── TOP BAR ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--accent);
  text-transform: uppercase;
}

.divider-v {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.page-title {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--accent2);
  letter-spacing: 1px;
}

.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent2);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0,255,157,0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 5px rgba(0,255,157,0); }
}

/* ─── MAIN LAYOUT ─── */
.main {
  display: grid;
  grid-template-columns: 1fr 340px;
  grid-template-rows: auto 1fr;
  gap: 0;
  min-height: calc(100vh - 53px);
}

/* ─── KPI ROW ─── */
.kpi-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
}

.kpi-card {
  padding: 22px 28px;
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: background 0.2s;
}
.kpi-card:last-child { border-right: none; }

.kpi-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  font-family: 'IBM Plex Mono', monospace;
}

.kpi-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-value.green { color: var(--accent2); }
.kpi-value.blue { color: var(--accent); }
.kpi-value.orange { color: var(--warn); }
.kpi-value.red { color: var(--danger); }

.kpi-sub {
  font-size: 11px;
  color: var(--muted);
}

.kpi-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--border);
}

.kpi-bar-fill {
  height: 100%;
  transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── FLOOR MAP ─── */
.floor-area {
  padding: 28px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

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

.floor-tab {
  padding: 5px 12px;
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 3px;
}

.floor-tab.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 700;
}

/* ─── SVG FLOOR PLAN ─── */
.floor-plan-wrap {
  width: 100%;
  position: relative;
}

.floor-plan-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Room areas inside SVG — hover & status */
.room-area {
  cursor: pointer;
  transition: opacity 0.2s;
}
.room-area:hover { opacity: 0.85; }

.room-area.status-urgent rect   { fill: rgba(255,45,85,0.18);  stroke: var(--danger); }
.room-area.status-needed rect   { fill: rgba(255,107,53,0.18); stroke: var(--warn); }
.room-area.status-clean rect    { fill: rgba(0,255,157,0.10);  stroke: var(--accent2); }
.room-area.status-in-progress rect { fill: rgba(0,194,255,0.12); stroke: var(--accent); }

/* Status dot badge inside SVG */
.svg-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  pointer-events: none;
}

/* ─── LEGEND ─── */
.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
}

.legend-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}

/* ─── RIGHT PANEL ─── */
.right-panel {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

.panel-section {
  border-bottom: 1px solid var(--border);
  padding: 20px;
}

.panel-section-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.worker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.worker-item:last-child { border-bottom: none; }
.worker-item:hover { padding-left: 4px; }

.worker-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.worker-info { flex: 1; min-width: 0; }

.worker-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.worker-task {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.worker-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.worker-eta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

/* ALERT FEED */
.alert-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--surface2);
  border-radius: 5px;
  border-left: 3px solid;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.alert-item.danger { border-left-color: var(--danger); }
.alert-item.warn { border-left-color: var(--warn); }
.alert-item.info { border-left-color: var(--accent); }
.alert-item.success { border-left-color: var(--accent2); }

.alert-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }

.alert-body { flex: 1; }
.alert-msg {
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 3px;
}

.alert-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--muted);
}

/* ROUTING EFFICIENCY GRAPH */
.efficiency-chart {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 60px;
  margin-top: 12px;
}

.eff-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  transition: height 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

.eff-bar::after {
  content: attr(data-val) '%';
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}

.chart-labels {
  display: flex;
  justify-content: space-around;
  margin-top: 20px;
  padding: 0 2px;
}

.chart-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  text-align: center;
}

/* ─── BOTTOM: ROI STRIP ─── */
.roi-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.roi-item {
  padding: 16px 28px;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.roi-item:last-child { border-right: none; }

.roi-icon {
  font-size: 20px;
  width: 40px; height: 40px;
  background: var(--surface2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.roi-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.roi-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.3;
}

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,10,15,0.85);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 480px;
  max-width: 95vw;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-stat {
  background: var(--surface2);
  border-radius: 6px;
  padding: 14px;
}

.modal-stat-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.modal-stat-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 20px;
  font-weight: 700;
}

.modal-history {
  background: var(--surface2);
  border-radius: 6px;
  padding: 14px;
}

.history-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.history-item:last-child { border-bottom: none; }

.history-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  width: 50px;
  flex-shrink: 0;
}

.assign-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 12px 20px;
  border-radius: 5px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}
.assign-btn:hover { background: #33CEFF; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* TIMER */
.sync-timer {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--muted);
}

.highlight-new {
  animation: newGlow 2s ease forwards;
}

@keyframes newGlow {
  0% { background: rgba(0,194,255,0.15); }
  100% { background: var(--surface2); }
}

/* ─── SIDE MENU ─── */
.menu-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 9px;
}

.menu-btn span {
  height: 2px;
  width: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.side-menu {
  position: fixed;
  top: 0;
  left: -280px;
  width: 260px;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 500;
  padding: 20px;
  transition: left 0.25s ease;
}

.side-menu.open { left: 0; }

.side-menu-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 20px;
  text-transform: uppercase;
}

.side-menu a {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  text-transform: uppercase;
}

.side-menu a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 400;
  display: none;
}

.menu-overlay.open { display: block; }

/* ─── DESKTOP FIT: TODO EN UNA SOLA PANTALLA ─── */
@media (min-width: 901px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .topbar {
    height: 46px;
    min-height: 46px;
    padding: 6px 18px;
    position: static;
  }

  .topbar-left {
    gap: 12px;
  }

  .page-title {
    font-size: 12px;
  }

  .menu-btn {
    width: 34px;
    height: 34px;
    padding: 7px;
  }

  .main {
    height: calc(100vh - 46px);
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
    grid-template-rows: 78px minmax(0, 1fr) 62px;
    overflow: hidden;
  }

  .kpi-row {
    grid-column: 1 / -1;
    min-height: 0;
    overflow: hidden;
  }

  .kpi-card {
    padding: 8px 16px;
  }

  .kpi-label {
    font-size: 9px;
    margin-bottom: 4px;
  }

  .kpi-value {
    font-size: clamp(22px, 3.2vh, 30px);
    margin-bottom: 3px;
  }

  .kpi-sub {
    font-size: 10px;
    line-height: 1.15;
  }

  .floor-area {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
    padding: 10px 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .section-header {
    flex-shrink: 0;
    margin-bottom: 6px;
  }

  .section-title {
    font-size: 10px;
  }

  .legend {
    gap: 8px;
  }

  .legend-item {
    font-size: 9px;
  }

  .floor-plan-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .floor-plan-svg {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  .right-panel {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .panel-section {
    padding: 8px 12px;
    flex-shrink: 0;
  }

  .panel-section-title {
    font-size: 9px;
    margin-bottom: 6px;
  }

  .worker-item {
    gap: 8px;
    padding: 5px 0;
  }

  .worker-avatar {
    width: 26px;
    height: 26px;
    font-size: 10px;
  }

  .worker-name {
    font-size: 11px;
    margin-bottom: 1px;
  }

  .worker-task {
    font-size: 9px;
  }

  .worker-eta {
    font-size: 9px;
  }

  .efficiency-chart {
    height: 38px;
    margin-top: 6px;
  }

  .chart-labels {
    margin-top: 14px;
  }

  .chart-label {
    font-size: 8px;
  }

  .eff-bar::after {
    font-size: 8px;
    bottom: -14px;
  }

  .right-panel .panel-section:last-child {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .alert-feed {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    gap: 5px;
  }

  .alert-item {
    padding: 6px 8px;
  }

  .alert-msg {
    font-size: 10px;
    line-height: 1.2;
  }

  .alert-time {
    font-size: 9px;
  }

  .roi-strip {
    grid-column: 1 / -1;
    grid-row: 3;
    min-height: 0;
    overflow: hidden;
  }

  .roi-item {
    padding: 7px 16px;
    gap: 8px;
  }

  .roi-icon {
    width: 30px;
    height: 30px;
  }

  .roi-num {
    font-size: clamp(16px, 2.3vh, 20px);
  }

  .roi-desc {
    font-size: 10px;
    line-height: 1.15;
  }
}

@media (min-width: 901px) and (max-height: 760px) {
  .topbar {
    height: 40px;
    min-height: 40px;
    padding: 4px 16px;
  }

  .main {
    height: calc(100vh - 40px);
    grid-template-rows: 64px minmax(0, 1fr) 50px;
  }

  .kpi-card {
    padding: 6px 14px;
  }

  .kpi-label,
  .kpi-sub,
  .legend-item,
  .roi-desc {
    font-size: 8px;
  }

  .kpi-value {
    font-size: 22px;
  }

  .floor-area {
    padding: 6px 12px;
  }

  .section-header {
    margin-bottom: 4px;
  }

  .right-panel {
    font-size: 10px;
  }

  .panel-section {
    padding: 6px 10px;
  }

  .worker-item {
    padding: 4px 0;
  }

  .worker-avatar {
    width: 24px;
    height: 24px;
  }

  .efficiency-chart {
    height: 30px;
  }

  .alert-item:nth-child(n+4) {
    display: none;
  }

  .roi-item {
    padding: 5px 12px;
  }

  .roi-icon {
    width: 26px;
    height: 26px;
  }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  body { min-width: 0; }

  .topbar {
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    flex-direction: column;
  }

  .topbar-left { width: 100%; gap: 10px; flex-wrap: wrap; }

  .topbar > div:last-child { width: 100%; justify-content: space-between; gap: 12px; }

  .logo { font-size: 12px; letter-spacing: 2px; }
  .divider-v { display: none; }
  .page-title { font-size: 12px; line-height: 1.35; }
  .main { display: block; min-height: auto; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .kpi-card {
    padding: 16px;
    min-width: 0;
    border-bottom: 1px solid var(--border);
  }

  .kpi-card:nth-child(2n) { border-right: none; }
  .kpi-value { font-size: 28px; }

  .floor-area {
    padding: 18px 14px 22px;
    border-right: none;
    overflow: visible;
  }

  .section-header { align-items: flex-start; gap: 14px; flex-direction: column; }
  .floor-tabs { width: 100%; }
  .floor-tab { flex: 1; min-height: 36px; }
  .legend { gap: 10px 14px; }

  .right-panel {
    border-left: none;
    border-top: 1px solid var(--border);
    overflow: visible;
  }

  .panel-section { padding: 18px 14px; }

  .roi-strip { grid-template-columns: 1fr; }

  .roi-item {
    padding: 16px 14px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .roi-item:last-child { border-bottom: none; }

  .modal-overlay { align-items: flex-end; padding: 10px; }

  .modal {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 20px);
    overflow: hidden;
    border-radius: 10px;
  }

  .modal-header { padding: 16px; }
  .modal-title { font-size: 13px; line-height: 1.3; padding-right: 12px; }
  .modal-close { min-width: 40px; min-height: 40px; }

  .modal-body {
    padding: 16px;
    max-height: calc(100vh - 92px);
    overflow-y: auto;
  }

  .modal-stat-row { grid-template-columns: 1fr; }

  .assign-btn {
    width: 100%;
    min-height: 44px;
    white-space: normal;
    line-height: 1.25;
  }
}

@media (max-width: 480px) {
  .topbar { position: static; }
  .kpi-row { grid-template-columns: 1fr; }
  .kpi-card { border-right: none; }

  .kpi-label,
  .section-title,
  .panel-section-title {
    letter-spacing: 1.3px;
    line-height: 1.35;
  }

  .worker-item { gap: 10px; }
  .worker-eta { font-size: 9px; }
  .roi-num { font-size: 20px; }
}

/* Manager light theme override */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface2: #f5f5f5;
  --border: #e0e0e0;
  --accent: #2563eb;
  --accent2: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --text: #1a1a1a;
  --muted: #777777;
  --card-glow: none;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  background: #ffffff;
  color: var(--text);
  font-family: Arial, sans-serif;
}

.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

.logo {
  background: var(--accent);
  color: #ffffff;
  font-family: Arial, sans-serif;
  letter-spacing: .5px;
  padding: 4px 9px;
  border-radius: 6px;
}

.page-title,
.sync-timer,
.section-title,
.panel-section-title,
.kpi-label,
.kpi-sub,
.legend-item,
.alert-time,
.worker-task,
.worker-eta,
.roi-desc {
  color: var(--muted);
  font-family: Arial, sans-serif;
  letter-spacing: 0;
}

.divider-v,
.kpi-row,
.right-panel,
.floor-area,
.panel-section,
.roi-item,
.worker-item,
.alert-item,
.modal-header {
  border-color: var(--border);
}

.main {
  background: #ffffff;
}

.kpi-row {
  gap: 12px;
  padding: 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.kpi-card {
  background: #f5f5f5;
  border: 0;
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: none;
}

.kpi-value {
  font-family: Arial, sans-serif;
  color: var(--text);
}

.kpi-value.green { color: var(--accent2); }
.kpi-value.blue { color: var(--accent); }
.kpi-value.orange { color: var(--warn); }
.kpi-value.red { color: var(--danger); }

.kpi-bar {
  left: 18px;
  right: 18px;
  bottom: 12px;
  height: 4px;
  background: #e9edf3;
  border-radius: 999px;
  overflow: hidden;
}

.floor-area,
.right-panel {
  background: #ffffff;
}

.floor-plan-wrap {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  overflow: hidden;
}

.floor-plan-svg {
  background: #ffffff;
  border-radius: var(--radius-sm);
}

.floor-plan-svg rect[fill="#0C1520"] { fill: #f5f5f5; }
.floor-plan-svg rect[fill="#1A3550"] { fill: #d7dde5; }
.floor-plan-svg rect[fill="#1E3048"] { fill: #d7dde5; }
.floor-plan-svg rect[fill="#111D2C"] { fill: #ffffff; }
.floor-plan-svg line { stroke: #d8dee8; }
.floor-plan-svg text[fill="#5A7A95"] { fill: #777777; }
.floor-plan-svg text[fill="#1A3550"] { fill: #555555; }
.floor-plan-svg text[fill="#E8F4FF"] { fill: #1a1a1a; }

.floor-tab,
.menu-btn,
.assign-btn,
.modal-close {
  border-radius: var(--radius-sm);
}

.floor-tab {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: Arial, sans-serif;
}

.floor-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.panel-section {
  margin: 12px;
  background: #f5f5f5;
  border: 0;
  border-radius: var(--radius);
  padding: 16px;
}

.worker-avatar,
.roi-icon {
  border-radius: 10px;
}

.worker-name,
.alert-msg,
.roi-num,
.modal-title {
  color: var(--text);
}

.alert-item {
  background: #ffffff;
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.alert-item.danger { border-left-color: var(--danger); }
.alert-item.warn { border-left-color: var(--warn); }
.alert-item.success { border-left-color: var(--accent2); }
.alert-item.info { border-left-color: var(--accent); }

.side-menu {
  background: #ffffff;
  border-right: 1px solid var(--border);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .16);
}

.side-menu-title,
.side-menu a {
  color: var(--text);
}

.side-menu a:hover {
  background: #eff6ff;
  color: var(--accent);
}

.modal {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(15, 23, 42, .22);
}

.modal-body {
  background: #ffffff;
}

.assign-btn {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #ffffff;
  font-family: Arial, sans-serif;
}

.assign-btn:hover {
  background: #1d4ed8;
}

.roi-strip {
  background: #ffffff;
  border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
  .kpi-row { padding: 14px; }
  .panel-section { margin: 10px 14px; }
}

/* Final visual fixes for office sensor map */
.main {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.kpi-row {
  align-items: stretch;
  min-height: 118px;
}

.kpi-card {
  min-height: 92px;
  overflow: visible;
  padding: 16px 18px 24px;
}

.kpi-label {
  display: block;
  margin-bottom: 6px;
  line-height: 1.2;
}

.kpi-value {
  display: block;
  font-size: 34px;
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-sub {
  display: block;
  line-height: 1.25;
}

.kpi-card .kpi-bar {
  left: 18px;
  right: 18px;
  bottom: 12px;
  top: auto;
  height: 4px;
}

.floor-plan-wrap {
  background: #dfe3e8;
  border-color: #d5dbe3;
  padding: 18px;
}

.floor-plan-svg {
  background: #dfe3e8;
}

.floor-plan-svg rect[fill="#0C1520"] {
  fill: #f4f5f7;
}

.floor-plan-svg rect[fill="#1A3550"],
.floor-plan-svg rect[fill="#1E3048"] {
  fill: #d5dbe3;
}

.floor-plan-svg text[font-size="8"] {
  font-weight: 600;
}

@media (min-width: 901px) and (max-height: 760px) {
  .main {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .kpi-row {
    min-height: 112px;
  }

  .kpi-card {
    min-height: 88px;
    padding: 14px 18px 24px;
  }

  .kpi-label,
  .kpi-sub {
    font-size: 11px;
  }

  .kpi-value {
    font-size: 32px;
  }
}


/* Full-screen responsive fit */
html, body { width:100%; min-height:100dvh; overflow-x:hidden; }
body { min-height:100dvh; }
.main { min-height:calc(100dvh - 53px); }
.floor-area, .right-panel { min-width:0; }
.floor-plan-svg { max-width:100%; height:auto; }
@media (min-width: 1101px) {
  body { height:100dvh; overflow:hidden; }
  .main { height:calc(100dvh - 53px); }
  .floor-area, .right-panel { min-height:0; overflow:auto; }
}
@media (max-width: 1100px) {
  body { height:auto; overflow-y:auto; }
  .main { display:flex; flex-direction:column; min-height:0; }
  .kpi-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .floor-area { border-right:0; border-bottom:1px solid var(--border); padding:18px; }
  .right-panel { border-left:0; }
  .roi-strip { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .topbar { flex-wrap:wrap; gap:10px; padding:12px 14px; }
  .topbar-left { width:100%; min-width:0; }
  .page-title { white-space:normal; }
  .kpi-row { grid-template-columns:1fr; }
  .kpi-card { padding:16px; border-right:0; border-bottom:1px solid var(--border); }
  .section-header { flex-direction:column; align-items:flex-start; gap:12px; }
  .legend { gap:8px; }
  .floor-tabs { width:100%; }
  .floor-tab { flex:1; }
  .floor-area { padding:14px; }
  .roi-strip { grid-template-columns:1fr; }
  .roi-item { padding:14px; border-right:0; border-bottom:1px solid var(--border); }
  .modal { width:min(480px, calc(100vw - 24px)); max-height:90dvh; overflow:auto; }
}


.brand-logo {
  display:block;
  width:92px;
  max-height:34px;
  height:auto;
  object-fit:contain;
  flex-shrink:0;
}
@media (max-width:640px) {
  .brand-logo { width:82px; max-height:32px; }
}
