:root {
  --bg: #0b1220;
  --panel: #121b2e;
  --text: #e8eefc;
  --muted: #a9b6d8;
  --accent: #7aa2ff;
  --vacant: #9aa6c7;
  --vacantBg: rgba(154, 166, 199, 0.12);
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 15% 10%, #172449 0%, var(--bg) 55%);
  color: var(--text);
}

.shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 20px;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.title {
  font-size: clamp(20px, 2.4vw, 36px);
  letter-spacing: 0.3px;
  margin: 0;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: clamp(12px, 1.2vw, 16px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-content: start;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 16px 14px;
  min-height: 88px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.unit {
  font-size: clamp(18px, 2.4vw, 42px);
  font-weight: 750;
  color: var(--accent);
  letter-spacing: 0.6px;
  min-width: 84px;
}

.tenant {
  font-size: clamp(16px, 1.8vw, 28px);
  font-weight: 650;
  line-height: 1.15;
}

.meta {
  margin-top: 4px;
  font-size: clamp(11px, 1.1vw, 14px);
  color: var(--muted);
}

.card.vacant {
  background: var(--vacantBg);
}
.card.vacant .unit {
  color: var(--vacant);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(122, 162, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, 0.15);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

/* Admin */
.panel {
  background: rgba(18, 27, 46, 0.72);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

input[type="text"] {
  width: 100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
}
input[type="text"]:focus {
  border-color: rgba(122, 162, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, 0.12);
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

button {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
}
button.primary {
  background: rgba(122, 162, 255, 0.18);
  border-color: rgba(122, 162, 255, 0.35);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

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

/* Admin tabs */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.admin-tab {
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.admin-tab:hover {
  background: rgba(255, 255, 255, 0.08);
}

.admin-tab.active {
  background: rgba(122, 162, 255, 0.2);
  border-color: rgba(122, 162, 255, 0.4);
}

.admin-panel.hidden {
  display: none !important;
}

/* Settings: background image drop zone */
.bg-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 24px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.15s, background 0.15s;
}

.bg-drop-zone .bg-drop-zone-text {
  font-weight: 600;
  color: var(--text);
}

.bg-drop-zone.dragover {
  border-color: rgba(122, 162, 255, 0.6);
  background: rgba(122, 162, 255, 0.08);
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

/* ----- Display (TV) page ----- */
.display-page {
  min-height: 100vh;
  overflow: auto;
}

.display-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: #0e4a6e;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.display-slide {
  position: absolute;
  inset: -4%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(1);
  transition: opacity 1.2s ease-in-out;
  pointer-events: none;
}

.display-slide.active {
  opacity: 1;
  z-index: 1;
  animation: display-zoom 20s ease-in-out forwards;
}

@keyframes display-zoom {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

.display-overlay {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 3vw, 32px);
  padding-bottom: 64px;
}

.display-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  height: 40%;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
  pointer-events: none;
  z-index: -1;
}

.display-header {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(12px, 2vw, 24px) 0;
}

.display-building-name {
  margin: 0;
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.display-title-divider {
  width: 40px;
  height: 2px;
  margin-top: 5px;
  background: #ffcc00; /* same as vacant color */
}

.display-address {
  margin: 5px 0 5px;
  font-size: clamp(14px, 2vw, 22px);
  color: #fff;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.display-main {
  flex: 1;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
  padding: 0 clamp(20px, 4vw, 40px);
}

.display-units {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 auto;
}

.unit-bar {
  display: grid;
  grid-template-columns: 100px 1fr;
  min-height: 52px;
  align-items: center;
  background: #fff;
  padding: 0;
  gap: 0;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 5px 5px 0 0 rgba(0, 0, 0, 0.6);
}



.unit-bar-num {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
  background: #fff;
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 700;
  color: #000;
  letter-spacing: 0.02em;
  min-width: 0;
  box-sizing: border-box;
}

.unit-bar-tenant {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: #fff;
  border-left: 3px solid #c8ccd0;
  font-size: clamp(14px, 1.65vw, 18px);
  font-weight: 700;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.25;
  box-sizing: border-box;
}

.unit-bar.vacant {
  background: #ffcc00;
}

.unit-bar.vacant .unit-bar-num,
.unit-bar.vacant .unit-bar-tenant {
  background: #ffcc00;
  color: #000;
}

.unit-bar.vacant .unit-bar-tenant {
  border-left: 3px solid #e6b800;
}

.display-footer {
  margin-top: 10px;
  padding-top: 16px;
}

.display-footer-inner {
  /* full-width white bar edge to edge */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: #fff;
  color: #000;
  padding: 0 clamp(20px, 4vw, 40px);
  font-size: clamp(12px, 1.4vw, 15px);
  overflow: hidden;
  min-height: 52px;
  display: flex;
  align-items: center;
  font-weight: 700;
}

.display-footer-track {
  display: inline-block;
  white-space: pre;
  padding-left: 100%;
  animation: footer-marquee 50s linear infinite;
}

@keyframes footer-marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

