@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #eef3f9;
  --surface: #ffffff;
  --surface-alt: #f7fafc;
  --sidebar: #142136;
  --sidebar-accent: #1d2e4b;
  --text: #182230;
  --muted: #6b7788;
  --line: #d8e1ec;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success-bg: #e8f8ef;
  --success-text: #18724d;
  --warning-bg: #fff3da;
  --warning-text: #9a6110;
  --danger-bg: #fdeceb;
  --danger-text: #b42318;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
          radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 26%),
          linear-gradient(180deg, #f6f9fd 0%, var(--bg) 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

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

button,
.inline-expander summary {
  border: none;
  border-radius: 12px;
  padding: 0.82rem 1rem;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, background 0.15s ease;
}

button:hover,
.inline-expander summary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

button.secondary {
  width: 100%;
  background: #24344f;
}

button[disabled] {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.86rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #7aa7ff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

label {
  display: block;
  margin-bottom: 0.42rem;
  font-weight: 700;
}

code {
  background: #eef2ff;
  border-radius: 5px;
  padding: 0.1rem 0.35rem;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 22px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.login-card form {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.25rem;
}

.narrow-card {
  max-width: 560px;
}

.shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background:
          linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 24%),
          linear-gradient(180deg, var(--sidebar) 0%, #0f1a2b 100%);
  color: #f8fbff;
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
}

.brand-block {
  display: grid;
  gap: 0.2rem;
}

.brand-kicker,
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: #8da4c7;
}

.brand {
  font-size: 1.28rem;
  font-weight: 800;
}

.sidebar nav {
  display: grid;
  gap: 0.4rem;
}

.sidebar nav a {
  padding: 0.9rem 0.95rem;
  border-radius: 14px;
  color: #c9d4e4;
  font-weight: 600;
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.sidebar-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1rem;
  display: grid;
  gap: 0.35rem;
}

.sidebar-card-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #8da4c7;
}

.content {
  padding: 2rem;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1,
.login-card h1,
.card h2,
.card h3 {
  margin: 0;
}

.page-header h1 {
  font-size: clamp(2rem, 3vw, 2.6rem);
  margin-top: 0.25rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card,
.card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(216, 225, 236, 0.9);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: var(--shadow);
}

.metric-card strong {
  display: block;
  margin-top: 0.45rem;
  font-size: 1.9rem;
}

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

.small {
  font-size: 0.9rem;
}

.helper-text {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.45rem 0 0;
}

.checkbox-row {
  display: grid;
  gap: 0.45rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0;
  font-weight: 700;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  border-radius: 6px;
  flex: 0 0 auto;
}

.alert {
  border-radius: 14px;
  padding: 0.95rem 1rem;
  margin: 0 0 1rem;
  background: var(--surface-alt);
  color: #334155;
  border: 1px solid var(--line);
}

.alert.error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: rgba(180, 35, 24, 0.18);
}

.alert.success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: rgba(24, 114, 77, 0.16);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-card {
  max-width: 980px;
}

.form-card-header {
  margin-bottom: 1.25rem;
}

.form-card-header h2 {
  margin-bottom: 0.35rem;
}

.action-link,
.table-link,
.table-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 700;
}

.action-link {
  background: var(--primary);
  color: white;
  padding: 0.82rem 1rem;
}

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

.table-link {
  color: var(--primary-dark);
}

.table-button {
  padding: 0;
  background: transparent;
  color: var(--primary-dark);
}

.table-button:hover {
  background: transparent;
  transform: none;
}

.danger-link {
  color: var(--danger-text);
}

.danger-button {
  background: #b42318;
  color: white;
}

.danger-button:hover {
  background: #971d14;
}

.warning-button {
  background: #c67a12;
  color: white;
}

.warning-button:hover {
  background: #a8640e;
}

.secondary-button {
  background: #334155;
  color: white;
}

.secondary-button:hover {
  background: #1f2937;
}

.section-divider {
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.section-divider h3 {
  margin-bottom: 0.35rem;
}

.section-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.inline-expander {
  position: relative;
}

.inline-expander summary {
  list-style: none;
}

.inline-expander summary::-webkit-details-marker {
  display: none;
}

.inline-expander[open] summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.expander-panel {
  margin-top: 0;
  min-width: min(720px, 90vw);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}

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

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

.full-span {
  grid-column: 1 / -1;
}

.form-submit {
  display: flex;
  align-items: end;
}

.field-error {
  color: var(--danger-text);
  font-size: 0.9rem;
  margin: 0.35rem 0 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.95rem 0.75rem;
  border-bottom: 1px solid #e8edf5;
  vertical-align: top;
}

.data-table th {
  color: #526173;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: rgba(37, 99, 235, 0.04);
}

.inline-form {
  margin: 0;
}

.stacked-meta {
  display: grid;
  gap: 0.7rem;
}

.tenancy-summary + .tenancy-summary {
  padding-top: 0.7rem;
  border-top: 1px solid #e8edf5;
}

.property-cell {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.property-thumb {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  color: #1e3a8a;
  display: grid;
  place-items: center;
  font-weight: 800;
  overflow: hidden;
  flex: 0 0 auto;
}

.property-thumb.has-image {
  background: #dbeafe;
}

.property-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.entity-link,
.back-link {
  font-weight: 800;
  color: var(--primary-dark);
}

.detail-page {
  max-width: 1120px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
  align-items: flex-start;
}

.detail-title {
  display: grid;
  gap: 0.35rem;
}

.detail-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.section-subtitle {
  margin-top: 1.2rem;
}

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

.detail-card {
  padding: 1.2rem;
}

.detail-image-wrap {
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  min-height: 240px;
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
}

.detail-image {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
}

.detail-image-fallback {
  color: #38506f;
  font-weight: 700;
}

.photo-link-row {
  margin-bottom: 1rem;
}

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

.detail-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.2rem;
}

.notes-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e8edf5;
}

.notes-block p {
  margin: 0.25rem 0 0;
  white-space: pre-wrap;
}

.detail-list-link {
  display: block;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  background: var(--surface-alt);
}

.detail-list-link:hover {
  border-color: #b8caf0;
  background: #f2f7ff;
}

.full-width {
  grid-column: 1 / -1;
}

.pill {
  display: inline-block;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.pill.success {
  background: var(--success-bg);
  color: var(--success-text);
}

.pill.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.pill.neutral {
  background: #e6edf6;
  color: #38506f;
}

.file-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  background: #ebf2ff;
  color: #24477a;
  font-size: 0.85rem;
  font-weight: 700;
}

.file-chip:hover {
  background: #dbe8ff;
}

.plain-list {
  margin: 0;
  padding-left: 1.2rem;
}

.plain-list li + li {
  margin-top: 0.55rem;
}

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

  .sidebar {
    gap: 1rem;
  }

  .expander-panel {
    min-width: 100%;
  }
}

@media (max-width: 900px) {
  .content {
    padding: 1.2rem;
  }

  .card-header,
  .section-toolbar,
  .page-header,
  .detail-header,
  .detail-actions {
    flex-direction: column;
    align-items: stretch;
  }

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

  .detail-grid,
  .detail-meta {
    grid-template-columns: 1fr;
  }

  .inline-expander summary,
  button,
  button.secondary {
    width: 100%;
  }
}
