﻿:root {
  --ink: #16212b;
  --muted: #66717f;
  --line: #dce4e8;
  --paper: #f6f9fb;
  --panel: #ffffff;
  --nav: #122c39;
  --action: #0f6b5c;
  --action-hover: #0b5147;
  --directory: #315f78;
  --directory-hover: #254b61;
  --directory-soft: #e7f0f4;
  --blue: #275d9f;
  --amber: #b36b18;
  --red: #af3f46;
  --soft-green: #e7f4ef;
  --soft-blue: #eaf1fb;
  --soft-red: #faecee;
  --shadow: 0 18px 48px rgba(18, 44, 57, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.login-view {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 0.72fr);
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 31, 42, 0.98), rgba(17, 77, 72, 0.92)),
    var(--paper);
}

.login-intro,
.login-panel {
  display: grid;
  align-content: center;
  gap: 34px;
  padding: clamp(24px, 6vw, 72px);
  color: #fff;
}

.login-panel {
  justify-items: start;
  background: rgba(255, 255, 255, 0.07);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-block strong,
.brand-block small {
  display: block;
}

.brand-block small {
  color: inherit;
  opacity: 0.72;
  margin-top: 2px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #fff;
  background: var(--action);
  font-weight: 800;
}

.login-card {
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 60px rgba(2, 20, 26, 0.2);
}

.login-intro h1 {
  max-width: 620px;
  margin: 0 0 8px;
  font-size: clamp(2.45rem, 5vw, 4.35rem);
  line-height: 1;
  letter-spacing: 0;
}

.login-card h2 {
  margin: 4px 0 0;
  color: #fff;
  font-size: 1.45rem;
}

.login-card-head {
  display: grid;
  gap: 12px;
}

.login-copy {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
  line-height: 1.55;
}

.login-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.login-card label,
.detail-form label,
.attachment-form label,
.dialog-card label,
.compact-field,
.search-box {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.login-card label {
  color: rgba(255, 255, 255, 0.72);
}

.login-card input {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.96);
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--action);
  box-shadow: 0 0 0 3px rgba(15, 107, 92, 0.13);
}

.primary-action,
.secondary-action,
.danger-action {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-action {
  color: #fff;
  background: var(--action);
}

.primary-action:hover {
  background: var(--action-hover);
}

.secondary-action {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
}

.secondary-action:hover {
  background: #eef5f3;
}

.danger-action {
  color: #fff;
  background: var(--red);
}

.danger-action:hover {
  background: #91333a;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  align-content: stretch;
  gap: 16px;
  padding: 16px;
  color: #fff;
  background: var(--nav);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
  padding: 0 10px;
  text-align: left;
  font-weight: 800;
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: #d9eee8;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: rgba(49, 95, 120, 0.46);
}

.nav-item.is-hidden {
  display: none;
}

.portfolio-card {
  display: grid;
  gap: 7px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.active-portfolio-card {
  align-self: end;
  grid-row: 5;
}

.portfolio-card strong,
.portfolio-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0;
  color: var(--action);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #bce4da;
}

.workspace {
  min-width: 0;
  max-height: 100vh;
  overflow: auto;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.topbar h1 {
  display: none;
}

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

.search-box {
  min-width: min(360px, 42vw);
}

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

.metric-card,
.panel,
.unit-card,
.parking-card,
.attachment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  display: grid;
  gap: 6px;
  min-height: 128px;
  padding: 18px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong {
  font-size: 1.75rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

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

.panel-heading h2 {
  margin: 4px 0 0;
  font-size: 1.2rem;
}

.building-health,
.watch-list,
.attachment-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.building-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.portfolio-analytics {
  display: grid;
  gap: 12px;
}

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

.analytics-stat {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.analytics-stat small {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.analytics-stat strong {
  font-size: 1.55rem;
}

.status-mix {
  display: grid;
  gap: 8px;
}

.status-mix-row {
  display: grid;
  gap: 6px;
}

.status-mix-row .row-line {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.health-row,
.watch-row,
.building-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.row-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress {
  height: 9px;
  border-radius: 999px;
  background: #e8eef1;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--action);
}

.progress .status-available {
  background: var(--blue);
}

.progress .status-expired,
.progress .status-maintenance-hold,
.progress .status-delinquent {
  background: var(--red);
}

.progress .status-in-contract {
  background: var(--amber);
}

.building-layout {
  display: grid;
  grid-template-columns: minmax(210px, 0.45fr) minmax(520px, 1.55fr);
  gap: 18px;
  transition: grid-template-columns 0.32s ease;
}

.building-layout.portfolio-collapsed {
  grid-template-columns: 54px minmax(520px, 1fr);
}

.building-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-action {
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.portfolio-rail-toggle {
  display: none;
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--directory);
  background: #f8fbfc;
  font-weight: 900;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.portfolio-rail-toggle span {
  writing-mode: horizontal-tb;
  font-size: 1.2rem;
}

.building-layout.portfolio-collapsed .building-list-panel {
  padding: 10px;
  overflow: hidden;
  transition: padding 0.32s ease, opacity 0.24s ease;
}

.building-layout.portfolio-collapsed .building-list-panel > .panel-heading,
.building-layout.portfolio-collapsed .building-list {
  display: none;
}

.building-layout.portfolio-collapsed .portfolio-rail-toggle {
  display: flex;
  animation: railFadeIn 0.22s ease both;
}

@keyframes railFadeIn {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.building-row {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.building-row:nth-of-type(even) {
  background: #f7f9fa;
}

.building-row:last-of-type {
  border-bottom: 0;
}

.building-row.fully-rented {
  opacity: 0.72;
  background: #f8fbfc;
}

.building-row.fully-rented:nth-of-type(even) {
  background: #f2f5f6;
}

.building-row.active,
.building-row:hover {
  border-bottom-color: rgba(15, 107, 92, 0.35);
  background: #ecfaf4;
}

.building-row.active {
  background: #ddf5eb;
  box-shadow: inset 4px 0 0 var(--action);
}

.building-row.active .building-group-label {
  background: #fff;
}

.segmented {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.floor-tools {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.unit-filter-field {
  display: grid;
  gap: 6px;
  min-width: 150px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.unit-filter-field select {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-size: 0.86rem;
  font-weight: 800;
}

.building-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(112px, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}

.building-metric-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 94px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff 0%, #f8fbfc 100%);
  box-shadow: 0 10px 26px rgba(16, 38, 48, 0.06);
}

.building-metric-card span,
.building-metric-card small {
  color: var(--muted);
  font-weight: 800;
}

.building-metric-card span {
  font-size: 0.78rem;
}

.building-metric-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 1.3rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.building-metric-card small {
  font-size: 0.72rem;
  line-height: 1.2;
}

.compact-field {
  width: 86px;
}

.compact-field input {
  min-height: 34px;
  padding: 6px 8px;
}

.segmented button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--directory);
  background: var(--directory-soft);
  padding: 0 10px;
  font-weight: 800;
}

.segmented button.active {
  color: #fff;
  border-color: var(--directory);
  background: var(--directory);
}

.segmented button:hover {
  color: #fff;
  border-color: var(--directory-hover);
  background: var(--directory-hover);
}

.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.unit-card {
  display: grid;
  gap: 8px;
  min-height: 138px;
  padding: 13px;
  text-align: left;
  box-shadow: none;
  border-left: 4px solid transparent;
}

.unit-card-main {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  text-align: left;
}

.remove-unit-action {
  align-self: end;
  justify-self: start;
  width: auto;
  height: 28px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 0.72rem;
  line-height: 1;
}

.unit-card.active {
  outline: 3px solid rgba(15, 107, 92, 0.17);
  border-color: var(--action);
}

.unit-card-available {
  border-left-color: var(--blue);
  background: #f7fbff;
}

.unit-card-rented {
  border-left-color: var(--action);
  background: #f4fbf7;
}

.unit-card-in-contract {
  border-left-color: var(--amber);
  background: #fffaf1;
}

.unit-card-expired,
.unit-card-delinquent {
  border-left-color: var(--red);
  background: #fff7f8;
}

.unit-card-maintenance-hold {
  border-left-color: #7b6c5f;
  background: #faf8f5;
}

.unit-card strong,
.parking-card strong {
  font-size: 1.05rem;
}

.unit-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.status-pill {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--action);
  background: var(--soft-green);
  font-size: 0.72rem;
  font-weight: 800;
}

.status-vacant {
  color: var(--blue);
  background: var(--soft-blue);
}

.status-maintenance-hold,
.status-delinquent,
.status-notice-given {
  color: var(--red);
  background: var(--soft-red);
}

.status-reserved {
  color: var(--amber);
  background: #fff3df;
}

.status-available {
  color: var(--blue);
  background: var(--soft-blue);
}

.status-expired {
  color: var(--red);
  background: var(--soft-red);
}

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-bar button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  padding: 0 13px;
  font-weight: 800;
}

.filter-bar button.active {
  color: #fff;
  border-color: var(--action);
  background: var(--action);
}

.building-group-label {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: #eef3f5;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-form,
.attachment-form,
.dialog-card,
.building-edit-form {
  display: grid;
  gap: 13px;
}

.building-edit-form {
  padding: 12px;
  border: 1px solid rgba(15, 107, 92, 0.2);
  border-radius: 8px;
  background: #f8fbfc;
}

.import-help,
.import-summary {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.import-help small,
.import-summary {
  color: var(--muted);
  font-weight: 700;
}

.import-summary:empty {
  display: none;
}

.admin-notice {
  margin: -4px 0 16px;
  border-color: #a9d8cf;
  color: var(--ink);
  background: #eef9f6;
}

.admin-notice strong {
  color: var(--action);
}

.building-edit-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.floor-plan-preview {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.unit-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.unit-tabs button {
  min-height: 34px;
  border: 1px solid var(--directory-soft);
  border-radius: 7px;
  color: var(--directory);
  background: var(--directory-soft);
  min-width: 0;
  padding: 0 6px;
  overflow: hidden;
  font-weight: 800;
  font-size: 0.86rem;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-tabs button.active,
.unit-tabs button:hover {
  color: #fff;
  border-color: var(--directory);
  background: var(--directory);
}

.unit-tab-panel {
  display: grid;
  gap: 13px;
  min-width: 0;
}

.unit-editor-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.unit-editor-dialog::backdrop {
  background: rgba(10, 25, 34, 0.48);
}

.unit-editor-dialog .detail-panel {
  max-height: calc(100vh - 32px);
  overflow: auto;
  box-shadow: 0 28px 80px rgba(3, 18, 28, 0.28);
}

.unit-tab-panel > label:not(.checkbox-line),
.unit-tab-panel .form-row > label:not(.checkbox-line),
.unit-tab-panel .type-builder > label {
  grid-template-columns: 140px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid #edf2f4;
}

.unit-tab-panel .form-row {
  grid-template-columns: 1fr;
  gap: 9px;
}

.unit-tab-panel .checkbox-line {
  min-height: 42px;
  padding-bottom: 9px;
  border-bottom: 1px solid #edf2f4;
}

.unit-tab-panel input[readonly] {
  color: var(--action);
  border-color: #a9d8cf;
  background: #eef9f6;
  font-weight: 900;
}

.unit-form-actions {
  position: sticky;
  top: -1px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 18px rgba(18, 44, 57, 0.08);
}

.unit-form-actions span {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
}

.unit-form-actions .primary-action {
  min-width: 128px;
}

.unit-number-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}

.unit-number-row label {
  min-width: 0;
}

.type-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

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

.economics-panel span {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.economics-panel strong {
  color: var(--ink);
  font-size: 1rem;
}

.unit-attachments {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  min-width: 0;
}

.unit-attachments-head h3 {
  margin: 4px 0 0;
  font-size: 1rem;
}

.unit-attachment-uploader {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.55fr);
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.unit-attachment-uploader label:nth-child(3) {
  grid-column: 1 / -1;
  min-width: 0;
}

.unit-attachment-uploader button {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 38px;
  padding: 0 10px;
  white-space: nowrap;
}

.unit-attachment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.unit-attachment-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  align-content: start;
  min-width: 0;
}

.unit-attachment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  text-align: left;
  overflow: hidden;
}

.unit-attachment-item.active {
  border-color: var(--action);
  box-shadow: 0 0 0 3px rgba(15, 107, 92, 0.12);
}

.unit-attachment-main {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 2px;
  text-align: left;
}

.unit-attachment-main .row-line {
  min-width: 0;
}

.unit-attachment-main strong,
.unit-attachment-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-danger-action {
  min-height: 30px;
  border: 1px solid #f0c8cc;
  border-radius: 6px;
  color: var(--red);
  background: #fff6f7;
  padding: 0 9px;
  font-weight: 800;
}

.text-danger-action:hover {
  color: #fff;
  background: var(--red);
}

.unit-attachment-preview {
  display: grid;
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: auto;
  min-width: 0;
}

.unit-attachment-preview iframe,
.unit-attachment-preview img {
  display: block;
  width: 100%;
  height: 210px;
  border: 0;
  object-fit: contain;
  background: #fff;
}

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

.compact-preview .secondary-action {
  justify-self: start;
}

.preview-empty {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.unit-history-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.unit-history-panel h3 {
  margin: 2px 0 0;
}

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

.unit-history-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #dfe9ec;
  border-radius: 8px;
  background: #fff;
}

.unit-history-item small {
  color: var(--muted);
  font-weight: 700;
}

.attachment-edit-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #f8fbfc;
  min-width: 0;
}

.attachment-edit-form .form-row {
  grid-template-columns: minmax(0, 1fr);
}

.attachment-edit-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

.viewer-dialog {
  width: min(1100px, calc(100vw - 32px));
}

.viewer-shell {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.viewer-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.viewer-header h2 {
  margin: 4px 0 0;
}

.viewer-body {
  min-height: 70vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: #fff;
}

.viewer-body iframe,
.viewer-body img {
  display: block;
  width: 100%;
  height: 72vh;
  border: 0;
  object-fit: contain;
}

.plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plan-map {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr;
  grid-template-rows: 72px 52px 64px;
  gap: 6px;
  min-height: 210px;
}

.plan-zone {
  display: grid;
  place-items: center;
  border: 2px solid #b9cbd2;
  border-radius: 6px;
  color: #48606b;
  background: #fff;
  font-size: 0.76rem;
  font-weight: 800;
}

.plan-zone.primary {
  grid-row: span 2;
  color: var(--action);
  background: var(--soft-green);
}

.plan-zone.wide {
  grid-column: span 2;
  background: var(--soft-blue);
}

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

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

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

th {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.parking-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 107, 92, 0.12), rgba(15, 107, 92, 0) 240px),
    #f8fbfc;
}

.parking-card,
.attachment-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  box-shadow: none;
}

.parking-card {
  border-color: transparent;
}

.parking-card.available {
  background: #edf8f3;
  border-color: #bfdfd4;
}

.parking-card.assigned {
  background: #fff0f1;
  border-color: #efc4c9;
}

.parking-card.available strong {
  color: var(--action);
}

.parking-card.assigned strong {
  color: var(--red);
}

.parking-card > small,
.parking-form > small {
  color: var(--muted);
  font-weight: 800;
}

.attachment-card iframe,
.attachment-card img {
  width: 100%;
  height: 280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
}

.parking-form {
  display: grid;
  gap: 10px;
}

.table-action {
  min-height: 34px;
  padding: 0 10px;
}

#toggleFullyRentedButton {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.parking-form .form-row {
  grid-template-columns: 1fr 1fr;
}

.checkbox-line {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px;
  color: var(--ink) !important;
  text-transform: none !important;
}

.checkbox-line input {
  width: auto;
  min-height: auto;
}

.attachment-form {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
  margin-bottom: 16px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
  gap: 18px;
}

.admin-layout.site-admin-mode {
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  align-items: start;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.55fr) minmax(0, 1fr);
  gap: 18px;
}

.profile-hero {
  align-content: start;
  display: grid;
  gap: 16px;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 8px;
  color: #fff;
  background: var(--action);
  font-size: 1.45rem;
  font-weight: 900;
}

.profile-hero h2 {
  margin: 4px 0;
}

.profile-hero small {
  color: var(--muted);
  font-weight: 800;
}

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

.profile-form label:not(.checkbox-line) {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-form .checkbox-line,
.profile-form .primary-action {
  align-self: end;
}

.admin-form {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.admin-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.admin-dialog::backdrop {
  background: rgba(12, 34, 42, 0.48);
}

.dialog-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(18, 44, 57, 0.28);
}

.admin-dialog .admin-form {
  margin-bottom: 0;
  max-height: calc(100vh - 180px);
  overflow: auto;
}

.app-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid #a9d8cf;
  border-radius: 8px;
  color: #103a35;
  background: #eef9f6;
  box-shadow: 0 16px 42px rgba(18, 44, 57, 0.2);
  font-weight: 900;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.user-admin-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.admin-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

.admin-layout.site-admin-mode .admin-list {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.agency-row,
.user-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.agency-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.agency-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(18, 44, 57, 0.06);
}

.agency-card-main {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.agency-logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #0f7d6d, #173f4b);
  font-weight: 900;
  letter-spacing: 0;
}

.agency-card-main strong,
.agency-card-metrics strong {
  display: block;
  color: var(--ink);
}

.agency-card-main small,
.agency-card-metrics small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

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

.agency-card-metrics span {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: #f3f7f8;
}

.agency-row small,
.user-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 700;
}

.agency-actions,
.user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.temp-password {
  width: fit-content;
  border-radius: 6px;
  padding: 4px 7px;
  color: var(--action);
  background: var(--soft-green);
}

.user-row-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.assignment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.assignment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
  font-weight: 800;
}

.assignment-chip input {
  width: auto;
  min-height: auto;
}

.assignment-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

dialog {
  width: min(520px, calc(100vw - 32px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(3, 18, 28, 0.32);
}

dialog::backdrop {
  background: rgba(10, 25, 34, 0.42);
}

.dialog-card {
  padding: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1180px) {
  .metrics,
  .dashboard-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }

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

  .attachment-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 980px) {
  .building-layout,
  .building-layout.portfolio-collapsed {
    grid-template-columns: 1fr;
  }

  .building-layout.portfolio-collapsed .building-list-panel > .panel-heading,
  .building-layout.portfolio-collapsed .building-list {
    display: grid;
  }

  .building-layout.portfolio-collapsed .portfolio-rail-toggle {
    display: none;
  }
}

@media (max-width: 760px) {
  .login-view,
  .app-shell,
  .metrics,
  .building-metrics,
  .form-row,
  .profile-layout,
  .profile-form,
  .unit-number-row,
  .unit-form-actions,
    .type-builder,
    .economics-panel,
    .unit-attachment-uploader,
    .unit-attachment-layout,
    .user-admin-form,
    .attachment-form {
    grid-template-columns: 1fr;
  }

  .unit-form-actions {
    display: grid;
  }

  .unit-tab-panel > label:not(.checkbox-line),
  .unit-tab-panel .form-row > label:not(.checkbox-line),
  .unit-tab-panel .type-builder > label {
    grid-template-columns: 1fr;
  }

  .unit-attachment-uploader button {
    width: fit-content;
    justify-self: start;
  }

  .floor-tools {
    justify-content: stretch;
  }

  .compact-field,
  .floor-tools .secondary-action,
  .floor-tools .primary-action {
    width: 100%;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    grid-template-rows: auto auto;
  }

  .portfolio-card {
    display: none;
  }

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

  .topbar {
    display: grid;
  }

  .topbar-actions,
  .search-box {
    width: 100%;
  }
}

/* Clean visual source: mode switch, ribbons, floor controls, portfolio arrows */
.unit-card {
  position: relative;
  overflow: hidden;
}

.unit-card-rented,
.unit-card-sold {
  border-left-color: var(--red);
}

.unit-card-sold {
  background: #f7fbff;
}

.sold-ribbon,
.rented-ribbon {
  position: absolute;
  top: 12px;
  right: -30px;
  z-index: 10;
  width: 112px;
  height: 24px;
  display: grid;
  place-items: center;
  transform: rotate(42deg);
  transform-origin: center;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: var(--red);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 4px 10px rgba(175, 63, 70, 0.28);
  pointer-events: none;
}

.rented-ribbon {
  width: 124px;
  right: -38px;
}

.mode-switch-card {
  padding: 12px;
  align-self: start;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: 68px 68px;
  width: auto;
  max-width: none;
  gap: 5px;
  margin-top: 8px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.mode-switch button {
  width: 68px;
  min-width: 68px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
}

.mode-switch button.active[data-workspace-mode="lease"] {
  color: #fff;
  background: var(--action);
  box-shadow: 0 8px 18px rgba(15, 107, 92, 0.25);
}

.mode-switch button.active[data-workspace-mode="sale"] {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(39, 93, 159, 0.28);
}

.app-shell:has(.mode-switch button.active[data-workspace-mode="sale"]) {
  --nav: #123a5d;
  --action: var(--blue);
  --action-hover: #1e4c84;
  --directory: #275d9f;
  --directory-hover: #1e4c84;
  --directory-soft: #eaf1fb;
}

.app-shell:has(.mode-switch button.active[data-workspace-mode="sale"]) .sidebar {
  background: linear-gradient(180deg, #123a5d 0%, #0f2f4f 100%);
}

.app-shell:has(.mode-switch button.active[data-workspace-mode="sale"]) .nav-item.active,
.app-shell:has(.mode-switch button.active[data-workspace-mode="sale"]) .primary-action {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 24px rgba(39, 93, 159, 0.18);
}

.app-shell:has(.mode-switch button.active[data-workspace-mode="sale"]) .primary-action:hover {
  background: #1e4c84;
  border-color: #1e4c84;
}

.unit-panel > .panel-heading > div:last-child {
  align-items: flex-end;
  gap: 6px;
}

.unit-panel .floor-action-divider {
  display: inline-block;
  flex: 0 0 1px;
  width: 1px;
  min-width: 1px;
  height: 34px;
  margin: 0 5px;
  align-self: flex-end;
  background: #ccd8de;
}

.unit-panel #addFloorButton,
.unit-panel #importUnitsButton,
.unit-panel #addUnitButton {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  max-width: max-content;
  height: 34px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 0.8rem;
  line-height: 1;
  white-space: nowrap;
}

.unit-panel #addUnitButton {
  padding-inline: 13px;
}

.icon-action#toggleBuildingRailButton {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
}

.building-layout:not(.portfolio-collapsed) #toggleBuildingRailButton,
.building-layout.portfolio-collapsed #toggleBuildingRailButton,
#openBuildingRailButton span {
  color: transparent;
  font-size: 0;
  text-indent: -999px;
  overflow: hidden;
}

.building-layout:not(.portfolio-collapsed) #toggleBuildingRailButton::before,
.building-layout.portfolio-collapsed #toggleBuildingRailButton::before,
#openBuildingRailButton span::before {
  text-indent: 0;
  display: inline-grid;
  place-items: center;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
}

.building-layout:not(.portfolio-collapsed) #toggleBuildingRailButton::before {
  content: "<";
  color: var(--ink);
}

.building-layout.portfolio-collapsed #toggleBuildingRailButton::before,
#openBuildingRailButton span::before {
  content: ">";
  color: #fff;
}

.portfolio-rail-toggle {
  justify-content: center;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.portfolio-rail-toggle span {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--directory);
  font-size: 1.15rem;
  line-height: 1;
}

@media (max-width: 760px) {
  .unit-panel .floor-action-divider {
    display: none;
  }

  .unit-panel #addFloorButton,
  .unit-panel #importUnitsButton,
  .unit-panel #addUnitButton {
    width: 100%;
    max-width: none;
  }
}

