:root {
  --ink: #18201d;
  --muted: #64716d;
  --line: #dfe6e1;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --green: #2f6f5e;
  --green-dark: #1e4d42;
  --blue: #31708f;
  --amber: #c78328;
  --rose: #b85d50;
  --shadow: 0 18px 50px rgba(24, 32, 29, .12);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

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

img {
  display: block;
  max-width: 100%;
}

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

[hidden] {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef5f2;
}

.auth-box {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  padding: clamp(22px, 5vw, 34px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-box h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 56px);
  border-bottom: 1px solid rgba(24, 32, 29, .08);
  background: rgba(251, 250, 246, .94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(24, 32, 29, .14);
}

.brand span {
  max-width: 220px;
  line-height: 1.1;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: #34413d;
  font-weight: 700;
  font-size: 14px;
}

.site-nav a:hover {
  background: #edf3ee;
}

.language-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.language-switch button {
  min-width: 38px;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.language-switch button.active {
  color: #fff;
  background: var(--green);
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-width: 44px;
  min-height: 44px;
}

.hero {
  position: relative;
  min-height: min(720px, calc(100vh - 72px));
  display: grid;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(16, 27, 24, .72), rgba(16, 27, 24, .42) 45%, rgba(16, 27, 24, .08));
}

.hero img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-content {
  width: min(720px, 100%);
  padding: clamp(36px, 8vw, 96px) clamp(18px, 6vw, 72px);
  color: #fff;
}

.hero h1,
.admin-hero h1 {
  margin: 6px 0 18px;
  font-size: clamp(42px, 7vw, 84px);
  line-height: .95;
  letter-spacing: 0;
}

.hero p:not(.eyebrow) {
  width: min(610px, 100%);
  color: rgba(255, 255, 255, .92);
  font-size: clamp(18px, 2vw, 23px);
}

.hero-actions,
.filter-row,
.calendar-toolbar,
.legend,
.card-meta,
.stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

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

.button.secondary {
  color: #fff;
  border-color: rgba(255, 255, 255, .48);
  background: rgba(255, 255, 255, .14);
}

.button.ghost {
  color: var(--green-dark);
  border-color: var(--line);
  background: #fff;
}

.section {
  padding: clamp(42px, 7vw, 86px) clamp(16px, 4vw, 56px);
}

.section-heading,
.intro,
.split {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.admin-grid {
  width: min(1880px, 100%);
  margin: 0 auto;
}

.intro {
  display: grid;
  grid-template-columns: minmax(240px, 420px) 1fr;
  gap: clamp(24px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
}

.intro p:last-child,
.split > div > p {
  color: var(--muted);
  font-size: 18px;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h2 {
  margin: 6px 0 18px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

.apartment-grid {
  width: min(1180px, 100%);
  margin: 24px auto 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.apartment-card,
.panel,
.calendar-shell,
.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.apartment-card {
  overflow: hidden;
}

.apartment-card .thumb,
.detail-visual {
  min-height: 220px;
  background-image: linear-gradient(135deg, rgba(47, 111, 94, .15), rgba(49, 112, 143, .28)), url("../assets/images/residence-hero.png");
  background-size: cover;
  background-position: center;
}

.apartment-card:nth-child(2) .thumb,
body[data-apartment-id="apt-2"] .detail-visual {
  background-position: 72% center;
}

.apartment-card:nth-child(3) .thumb,
body[data-apartment-id="apt-3"] .detail-visual {
  background-position: 40% center;
}

.apartment-card:nth-child(4) .thumb,
body[data-apartment-id="apt-4"] .detail-visual {
  background-position: 88% center;
}

.apartment-card .content {
  padding: 18px;
}

.apartment-card h3,
.panel h2 {
  margin: 0 0 10px;
}

.apartment-card p,
.panel p,
.form-note {
  color: var(--muted);
}

.form-note.warning {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #7f342c;
  font-weight: 800;
}

.date-note {
  margin: -4px 0 2px;
  min-height: 24px;
}

.date-note:empty {
  display: none;
}

.alert-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--rose);
  animation: blink-alert .9s steps(2, start) infinite;
  flex: 0 0 auto;
}

@keyframes blink-alert {
  50% {
    opacity: .18;
    transform: scale(.92);
  }
}

.card-meta span,
.status,
.calendar-day strong {
  font-size: 12px;
  font-weight: 800;
}

.card-meta span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef5f2;
  color: var(--green-dark);
}

.split {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: clamp(22px, 5vw, 54px);
  align-items: start;
}

.calendar-shell,
.panel {
  padding: clamp(16px, 3vw, 24px);
}

.filter-row {
  align-items: end;
  margin-top: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: #34413d;
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfd9d3;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

.calendar-toolbar {
  justify-content: space-between;
  margin-bottom: 16px;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 24px;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-head,
.calendar-day {
  min-height: 48px;
  border-radius: 8px;
  padding: 8px;
}

.calendar-head {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.calendar-day {
  width: 100%;
  appearance: none;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  border: 1px solid var(--line);
  background: #f8fbf8;
}

.calendar-day:hover,
.calendar-day.selected {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

.calendar-day.muted {
  opacity: .34;
}

.calendar-day.pending {
  border-color: rgba(199, 131, 40, .55);
  background: #fff6e8;
}

.calendar-day.booked {
  border-color: rgba(184, 93, 80, .55);
  background: #fff0ee;
}

.calendar-day small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.2;
}

.admin-calendar-layout {
  width: min(1480px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(620px, 1fr) minmax(260px, 340px);
  gap: 22px;
  align-items: start;
}

.admin-calendar-intro p {
  color: var(--muted);
}

.calendar-shell-large {
  padding: clamp(14px, 2vw, 22px);
}

.calendar-large {
  gap: 8px;
}

.calendar-large .calendar-head {
  min-height: 38px;
}

.calendar-large .calendar-day {
  min-height: 128px;
  display: grid;
  align-content: start;
  gap: 6px;
}

.booking-chip {
  display: grid;
  gap: 1px;
  padding: 6px;
  border-radius: 6px;
  color: #34413d;
  background: #eef5f2;
  font-size: 11px;
  line-height: 1.2;
}

.booking-chip.booked {
  background: #fff0ee;
}

.booking-chip.pending {
  background: #fff6e8;
}

.booking-chip b,
.booking-chip em {
  font-style: normal;
  font-weight: 900;
}

.day-details h2 {
  font-size: 28px;
}

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

.day-detail-list article {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.day-detail-list span {
  color: var(--muted);
  font-size: 13px;
}

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

.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
}

.legend .free { background: #e8f3ec; }
.legend .pending { background: var(--amber); }
.legend .booked { background: var(--rose); }

.forms,
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.forms > .panel:only-child {
  grid-column: 1 / -1;
  width: min(760px, 100%);
  margin: 0 auto;
}

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

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

.movement-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf8;
}

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

.table-count {
  margin-right: auto;
  color: var(--muted);
  font-weight: 800;
}

.panel {
  display: grid;
  gap: 14px;
}

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

.detail-hero {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  min-height: 520px;
}

.detail-copy {
  display: grid;
  align-content: center;
  padding: clamp(34px, 6vw, 72px);
}

.detail-copy h1 {
  margin: 6px 0 18px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: .98;
}

.apartment-gallery {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 14px;
}

.apartment-gallery figure {
  min-height: 260px;
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #eef2ef;
}

.apartment-gallery figure.featured {
  grid-row: span 2;
  min-height: 540px;
}

.apartment-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feature-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  list-style: none;
}

.feature-list li {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
}

.admin-hero {
  padding: clamp(34px, 6vw, 72px) clamp(16px, 4vw, 56px);
  background: #eef5f2;
}

.admin-hero h1,
.admin-hero .stats {
  width: min(1180px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.admin-hero .eyebrow {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.backup-actions {
  width: min(1180px, 100%);
  margin: 18px auto 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.backup-actions .form-note {
  min-height: auto;
  margin: 0;
}

.stat {
  min-width: 180px;
  padding: 16px;
  box-shadow: none;
}

.stat strong {
  display: block;
  font-size: 28px;
}

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

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

.bookings-table {
  min-width: 1120px;
  table-layout: fixed;
}

.movements-table {
  min-width: 1440px;
}

.bookings-panel .table-wrap,
.movements-panel .table-wrap {
  height: clamp(360px, 48vh, 620px);
  overflow-x: auto;
  overflow-y: scroll;
  scrollbar-gutter: stable both-edges;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bookings-table th,
.movements-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

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

.bookings-table th:nth-child(1) { width: 120px; }
.bookings-table th:nth-child(2) { width: 140px; }
.bookings-table th:nth-child(3) { width: 210px; }
.bookings-table th:nth-child(4) { width: 72px; }
.bookings-table th:nth-child(5) { width: 92px; }
.bookings-table th:nth-child(7) { width: 118px; }
.bookings-table th:nth-child(8) { width: 112px; }
.bookings-table th:nth-child(9) { width: 150px; }

.client-cell {
  display: grid;
  gap: 3px;
}

.client-cell span {
  color: var(--muted);
  font-size: 13px;
}

.status {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
}

.payment {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.payment.paid {
  color: #1e4d42;
  background: #e8f3ec;
}

.payment.due {
  color: #7a5117;
  background: #fff6e8;
}

.status.booked {
  color: #7f342c;
  background: #fff0ee;
}

.status.pending {
  color: #7a5117;
  background: #fff6e8;
}

.delete-button {
  border: 0;
  border-radius: 8px;
  color: #7f342c;
  background: #fff0ee;
  cursor: pointer;
  padding: 7px 9px;
  font-weight: 800;
}

.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.action-button {
  border: 0;
  border-radius: 8px;
  color: var(--green-dark);
  background: #e8f3ec;
  cursor: pointer;
  padding: 7px 8px;
  font-weight: 800;
}

.action-button.accept {
  color: #fff;
  background: var(--green);
}

td select {
  min-width: 128px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 28px clamp(16px, 4vw, 56px);
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.footer-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-contact img {
  width: 125px;
  height: 34px;
  object-fit: contain;
}

@media (max-width: 960px) {
  .apartment-grid,
  .forms,
  .admin-grid,
  .admin-calendar-layout,
  .intro,
  .split,
  .detail-hero {
    grid-template-columns: 1fr;
  }

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

  .detail-visual {
    min-height: 360px;
  }

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

  .apartment-gallery figure.featured {
    grid-column: 1 / -1;
    min-height: 420px;
  }

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

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-grid;
    place-items: center;
  }

  .site-nav {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 68px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
  }

  .site-nav.open {
    display: flex;
  }

  .hero {
    min-height: 640px;
  }

  .apartment-grid,
  .form-grid,
  .feature-list,
  .apartment-gallery {
    grid-template-columns: 1fr;
  }

  .apartment-gallery figure,
  .apartment-gallery figure.featured {
    min-height: 320px;
  }

  .calendar {
    gap: 4px;
  }

  .calendar-head,
  .calendar-day {
    min-height: 42px;
    padding: 6px;
    font-size: 12px;
  }

  .calendar-day small {
    display: none;
  }

  .calendar-large .calendar-day {
    min-height: 62px;
  }

  .calendar-large .booking-chip {
    display: none;
  }

  .movement-filters {
    grid-template-columns: 1fr;
  }

  .site-footer {
    flex-direction: column;
  }
}
