@import url('../../css/theme.css');

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

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
  color: var(--text-muted);
}

.app-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: app-spin 0.8s linear infinite;
}

@keyframes app-spin {
  to { transform: rotate(360deg); }
}

.app-error-screen {
  max-width: 480px;
  margin: 4rem auto;
  padding: 2rem;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.app-error-screen h2 {
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.app-error-screen p {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.app-banner {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: #fef3c7;
  color: #92400e;
  font-size: 0.9rem;
}

/* ── Admin property approval review ── */
.approval-review-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.approval-review-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.approval-review-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.approval-review-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
}

.approval-review-address {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.approval-review-section {
  margin-bottom: 1.25rem;
}

.approval-review-section h4 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.approval-photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.approval-photo-btn {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--primary-light);
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.approval-photo-btn:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.approval-photo-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.approval-no-photos {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.875rem;
}

.approval-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem 1.25rem;
}

.approval-details-grid dt {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.approval-details-grid dd {
  font-size: 0.9375rem;
  font-weight: 500;
}

.approval-description {
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.approval-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.modal-photo {
  max-width: min(92vw, 720px);
}

.approval-photo-lightbox {
  padding: 0 !important;
}

.approval-photo-lightbox img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #111;
}

body.nav-menu-open { overflow: hidden; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

button, input, select, textarea {
  font-family: inherit;
  font-size: 0.9375rem;
}

/* ── Auth ── */
/* Auth shell — header + centered card */
.auth-shell-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

#app:has(.auth-shell-header) {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem var(--container-pad);
  background: var(--auth-gradient);
  width: 100%;
}

.auth-header { text-align: center; margin-bottom: 1.5rem; width: 100%; max-width: 440px; }
.auth-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.auth-header-top .brand-link {
  text-align: left;
  flex: 1 1 auto;
  min-width: 0;
}
.auth-header-top .header-controls {
  flex-shrink: 0;
  margin-left: auto;
}
.auth-header h1 {
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 800;
  margin-bottom: 0;
  color: var(--dark);
}
.auth-header h1 span { color: var(--primary); }
.auth-header p { color: var(--text-muted); font-size: 0.9375rem; }
.brand-link { text-decoration: none; color: inherit; display: inline-block; }
.brand-link:hover { opacity: 0.85; }
.brand-link h1 span { color: var(--primary); }

.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}

.auth-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.auth-card-header .icon-box {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.auth-card-header h2 { font-size: 1rem; font-weight: 600; }
.auth-card-body { padding: 1.25rem; }

@media (min-width: 640px) {
  .auth-card-body { padding: 1.5rem; }
  .auth-page { padding: 2rem 1rem; }
  .auth-header { margin-bottom: 2rem; }
}

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--text);
}

.form-group label svg { color: var(--text-muted); flex-shrink: 0; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: var(--input-focus-bg);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  width: 2.25rem;
  height: 2.25rem;
  min-width: 2.25rem;
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  padding: 0;
}

.password-toggle:hover { color: var(--text); }
.password-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.35rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s ease, box-shadow 0.15s ease;
  min-height: var(--tap-min);
}

.btn-block { width: 100%; }

.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--btn-shadow);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-blue { background: var(--blue); color: #fff; box-shadow: 0 6px 18px rgba(37, 99, 235, 0.28); }
.btn-blue:hover:not(:disabled) { background: #1d4ed8; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover { background: var(--bg-alt); }

.btn-sm { padding: 0.4375rem 0.95rem; font-size: 0.8125rem; min-height: 36px; border-radius: 999px; }
.btn-lg { padding: 0.9rem 1.6rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: transparent; border: 1px solid rgba(220, 38, 38, 0.35); color: var(--danger); }
.btn-danger:hover { background: rgba(220, 38, 38, 0.08); }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-alt); border-color: var(--text-muted); }

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-footer a { font-weight: 600; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-transform: lowercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background: #fff;
  color: var(--text);
  border: 1.5px solid var(--border);
  font-weight: 600;
}

.btn-google:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-google:disabled {
  opacity: 0.7;
  cursor: wait;
}

.google-icon { flex-shrink: 0; }

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.google-btn .g-icon {
  width: 20px;
  height: 20px;
  background: conic-gradient(from -45deg, #ea4335 110deg, #4285f4 90deg 180deg, #34a853 180deg 270deg, #fbbc05 270deg) 73% 55%/150% 150% no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
  font-size: 1.125rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── App Shell ── */
.app-shell { min-height: 100vh; background: var(--bg); }

.role-bar {
  display: none;
}

.role-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.role-option {
  padding: 0.625rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.2s;
}

.role-option:hover { border-color: var(--primary-light); }
.role-option.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.user-role-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
  flex-shrink: 0;
  white-space: nowrap;
}

.logout-link {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.375rem 0;
}

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

.sub-page-header {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  min-height: auto;
  background: transparent;
  border-bottom: none;
}

.sub-page-header .header-bar {
  border-bottom: 1px solid var(--border);
}

.sub-header-meta {
  margin: 0;
  padding: 0.35rem var(--container-pad) 0.45rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge--sub {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  font-size: 0.8125rem;
}

.logout-link--compact {
  flex-shrink: 0;
  min-height: var(--tap-min);
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  white-space: nowrap;
}

@media (min-width: 600px) {
  .header-bar {
    height: var(--header-height);
    padding: 0 var(--container-pad);
  }

  .sub-header-meta {
    font-size: 0.875rem;
  }
}

.top-header {
  background: transparent;
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-header .header-bar {
  border-bottom: 1px solid var(--border);
}

.top-header .top-nav {
  border-bottom: none;
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: var(--header-height);
  height: auto;
  padding: 0.35rem var(--container-pad);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-bar--centered {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 0.35rem;
}

.header-bar-slot--center {
  justify-self: center;
  min-width: 0;
}

.header-bar-slot--right {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-wrap: nowrap;
  min-width: 0;
}

.header-bar-slot--left {
  min-width: 0;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: var(--dark);
  font-weight: 800;
  font-size: 1rem;
  min-width: 0;
  flex: 0 1 auto;
  justify-content: center;
}

.app-brand-text span { color: var(--primary); }

.app-brand-mark {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.28);
}

.user-role-badge--bar {
  flex-shrink: 0;
  font-size: 0.6875rem;
}

.top-header h1 { font-size: inherit; font-weight: inherit; }

.top-nav {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.3rem;
  overflow-x: auto;
  padding: 0.4rem var(--container-pad) 0.55rem;
  background: transparent;
  border: none;
  box-shadow: none;
  position: static;
  width: 100%;
  max-height: none;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.top-nav::-webkit-scrollbar { display: none; }

.top-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  flex: 0 0 auto;
  position: relative;
  min-width: 3.1rem;
  max-width: 4.25rem;
  padding: 0.35rem 0.35rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  line-height: 1.15;
  transition: background 0.15s, color 0.15s;
}

.top-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
}

.top-nav-icon svg {
  width: 1.2rem;
  height: 1.2rem;
}

.top-nav-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-nav-item:hover,
.top-nav-item.active,
.top-nav .logout-link:hover {
  color: var(--primary-dark);
  background: var(--primary-light);
}

.top-nav .logout-link {
  color: var(--text-muted);
}

.top-nav .nav-badge {
  position: absolute;
  top: 0.15rem;
  right: 0.2rem;
  margin: 0;
}

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: var(--tap-min);
  height: var(--tap-min);
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle-bar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
}

.nav-toggle-bar:nth-child(1) { top: 14px; }
.nav-toggle-bar:nth-child(2) { top: 21px; }
.nav-toggle-bar:nth-child(3) { top: 28px; }

.nav-toggle.is-open .nav-toggle-bar:nth-child(1) {
  top: 21px;
  transform: translateX(-50%) rotate(45deg);
}

.nav-toggle.is-open .nav-toggle-bar:nth-child(2) { opacity: 0; }

.nav-toggle.is-open .nav-toggle-bar:nth-child(3) {
  top: 21px;
  transform: translateX(-50%) rotate(-45deg);
}

.page-content {
  padding: 1.25rem var(--container-pad);
  max-width: min(1100px, 100%);
  margin: 0 auto;
  width: 100%;
}

.page-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  margin-bottom: 1.5rem;
  padding: 0;
}

.page-back:hover { color: var(--text); }

.welcome-section { margin-bottom: 1.25rem; text-align: center; }
.welcome-section h2 { font-size: clamp(1.35rem, 4.5vw, 1.75rem); font-weight: 700; margin-bottom: 0.25rem; }
.welcome-section p { color: var(--text-muted); font-size: 0.9375rem; }

@media (min-width: 900px) {
  .welcome-section { text-align: left; }
}

/* ── Stat Cards ── */
.stats-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card-colored {
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  min-height: 110px;
}

.stat-card-colored.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-card-colored.green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.stat-card-colored.orange { background: linear-gradient(135deg, #7dd3fc, #38bdf8); }

.stat-card-colored .label { font-size: 0.8125rem; opacity: 0.9; margin-bottom: 0.25rem; }
.stat-card-colored .value { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat-card-colored .sub { font-size: 0.75rem; opacity: 0.85; margin-top: 0.25rem; }
.stat-card-colored .stat-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.3;
  font-size: 2.5rem;
}

.stat-card-white {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.stat-card-white .label { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.stat-card-white .value { font-size: 1.75rem; font-weight: 700; }

/* ── Property List Cards (horizontal) ── */
.property-list { display: flex; flex-direction: column; gap: 1rem; }

.property-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.property-row-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

.property-thumb {
  width: 80px;
  height: 80px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
}

.property-info { flex: 1; min-width: 0; }
.property-info h3 { font-size: 1.0625rem; font-weight: 700; margin-bottom: 0.375rem; }
.property-info .address {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
.property-info .specs {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.property-info .price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.property-status {
  text-align: right;
  flex-shrink: 0;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.occupied { background: var(--blue-light); color: var(--blue); }
.status-badge.available { background: var(--green-light); color: var(--green); }
.status-badge.pending { background: #fef3c7; color: #92400e; }

.property-status .sub-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.property-actions-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.request-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
}

.request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}

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

.request-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── Tenant Dashboard ── */
.tenant-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tenant-apartment-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.tenant-apartment-card .card-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1rem;
}

.tenant-side-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rent-card {
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
  border-radius: var(--radius);
  padding: 1.25rem;
  color: #fff;
  position: relative;
}

.rent-card .label { font-size: 0.8125rem; opacity: 0.9; }
.rent-card .value { font-size: 2rem; font-weight: 700; margin-top: 0.25rem; }
.rent-card .icon { position: absolute; right: 1rem; top: 1rem; opacity: 0.4; font-size: 1.5rem; }

.contract-expiry-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.contract-expiry-card .label { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.contract-expiry-card .value { font-size: 1.75rem; font-weight: 700; }
.contract-expiry-card .date { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.25rem; }

.tenant-contact {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.action-cards-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
}

.action-card .icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-card .icon-box.orange { background: var(--primary-light); color: var(--primary); }
.action-card .icon-box.blue { background: var(--blue-light); color: var(--blue); }

.action-card .content { flex: 1; }
.action-card .content h3 { font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.125rem; }
.action-card .content p { font-size: 0.8125rem; color: var(--text-muted); }

.search-bar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow);
}

.search-bar-card .left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  font-weight: 500;
}

.search-bar-card .left svg { color: var(--primary); }

/* ── Admin ── */
.admin-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.admin-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.admin-stat .label { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.admin-stat .value { font-size: 2rem; font-weight: 700; }

.table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

.quick-actions { margin-bottom: 1.5rem; }
.quick-actions h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }

.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.quick-action-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: box-shadow 0.2s;
  box-shadow: var(--shadow);
}

.quick-action-card:hover { box-shadow: var(--shadow-lg); }
.quick-action-card h3 { font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.25rem; }
.quick-action-card p { font-size: 0.8125rem; color: var(--text-muted); }

.activity-feed {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.activity-feed h4 {
  padding: 1rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.activity-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.activity-item-body {
  flex: 1;
  min-width: 0;
}

.activity-item:last-child { border-bottom: none; }
.activity-item .title { font-size: 0.875rem; font-weight: 500; }
.activity-item .meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: left;
  margin-top: 0.2rem;
}

.admin-delete-audit-btn {
  flex-shrink: 0;
}

/* ── Profile ── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
}

.profile-header h2 { font-size: 1.5rem; font-weight: 700; }

.profile-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.profile-section h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

/* ── Forms (Add Property) ── */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.form-section h3,
.form-section h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  min-width: 0;
}

.form-group {
  min-width: 0;
}

.form-group--checkbox {
  display: flex;
  align-items: center;
}

.form-group--checkbox .checkbox-label {
  margin-bottom: 0;
  color: var(--text);
  font-weight: 500;
}

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

.amenities-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.amenity-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

/* ── Search Advanced ── */
.search-filters {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  max-width: 100%;
  overflow: hidden;
}

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

.search-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.search-filter-actions .btn {
  flex: 1 1 auto;
  min-width: min(100%, 9rem);
}

.search-filters-advanced {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
}

.search-filter-toolbar {
  margin-top: 0.75rem;
}

.btn-text {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary-dark);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-text:hover {
  color: var(--blue);
}

.search-results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.search-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.search-result-card .property-thumb-lg {
  height: 160px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 3rem;
}

.search-result-card .body { padding: 1rem; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  padding: 0;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 { font-size: 1.0625rem; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.modal-proof-viewer { max-width: min(920px, 96vw); }

.proof-viewer-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 75vh;
  overflow: auto;
}

.proof-viewer-img {
  display: block;
  max-width: 100%;
  max-height: 65vh;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
}

.proof-viewer-frame {
  width: 100%;
  min-height: 60vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

.contract-preview {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.7;
}

.signatures-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.signature-preview {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  min-height: 72px;
}

.signature-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.signature-img {
  display: block;
  max-width: 100%;
  max-height: 64px;
  object-fit: contain;
}

.signature-typed-name {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--primary);
}

.section-subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.25rem 0 0.75rem;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td {
  padding: 0.75rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
}
th { font-weight: 600; color: var(--text-muted); background: #f9fafb; }

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

/* ── Responsive (progressive enhancement) ── */
@media (min-width: 480px) {
  .action-cards-row { grid-template-columns: 1fr 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .admin-stats { grid-template-columns: repeat(3, 1fr); }
  .search-results-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .search-filters { padding: 1.25rem; }
  .signatures-row { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 640px) {
  :root {
    --header-height: 72px;
    --container-pad: 1.25rem;
  }

  .quick-actions-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .page-title { font-size: 1.125rem; max-width: 20rem; }
  .user-role-badge { font-size: 0.75rem; padding: 0.25rem 0.625rem; }
  .page-content { padding: 1.5rem var(--container-pad); }
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
  .profile-stats-grid { grid-template-columns: repeat(4, 1fr); gap: 1rem; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .search-filters .form-grid { grid-template-columns: 1fr; }
  .amenities-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-overlay { align-items: center; padding: 1rem; }
  .modal { border-radius: var(--radius); max-width: min(520px, 100%); }
  th, td { padding: 0.75rem 1rem; font-size: 0.875rem; }
  .property-list { gap: 1rem; }
}

@media (min-width: 768px) {
  .page-title { max-width: 28rem; }
  .tenant-grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .action-cards-row { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 900px) {
  :root { --container-pad: 2rem; }

  .top-header {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
  }

  .header-bar {
    padding: 0 var(--container-pad);
    min-height: var(--header-height);
  }

  .top-nav {
    padding: 0.35rem var(--container-pad) 0.6rem;
    gap: 0.4rem;
    flex-wrap: wrap;
    overflow: visible;
  }

  .top-nav-item {
    flex-direction: row;
    min-width: auto;
    max-width: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    gap: 0.4rem;
  }

  .page-content {
    padding: 2rem var(--container-pad);
    max-width: min(1200px, 100%);
  }

  .tenant-grid { grid-template-columns: 1fr 300px; }

  .amenities-grid { grid-template-columns: repeat(3, 1fr); }

  .quick-actions-grid { grid-template-columns: repeat(3, 1fr); }

  .property-row-main { flex-direction: row; }

  .property-status { text-align: right; }

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

@media (min-width: 1200px) {
  .page-content { max-width: min(1280px, 100%); }
  .search-results-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

@media (min-width: 1600px) {
  .page-content { max-width: min(1400px, 100%); padding: 2.5rem var(--container-pad); }
  .stats-row { gap: 1.25rem; grid-template-columns: repeat(3, 1fr); }
  .property-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
  .app-shell { max-width: 1800px; margin: 0 auto; }
  .action-cards-row { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1920px) {
  .page-content { max-width: min(1600px, 100%); }
  .app-shell { max-width: 1920px; font-size: 1.02rem; }
  .top-nav-item { font-size: 0.9375rem; padding: 0.5rem 0.9rem; }
}

@media (max-width: 599px) {
  .header-bar {
    gap: 0.35rem;
    min-height: var(--header-height);
  }

  .user-role-badge--bar {
    display: none;
  }

  .app-brand-text {
    font-size: 0.9375rem;
  }

  .btn { padding: 0.65rem 1rem; font-size: 0.875rem; }
  .btn-sm { padding: 0.45rem 0.75rem; font-size: 0.8125rem; }

  .card-actions { flex-direction: column; }
  .card-actions .btn { width: 100%; }

  .modal { width: 100%; max-height: 92vh; border-radius: var(--radius) var(--radius) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }

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

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

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

  .action-cards-row { grid-template-columns: 1fr; }

  .property-list .property-row-main { flex-direction: column; align-items: flex-start; }

  table { font-size: 0.8125rem; }
}

@media (min-width: 600px) and (max-width: 899px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .action-cards-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .amenities-grid { grid-template-columns: repeat(2, 1fr); }
  .tenant-grid { grid-template-columns: 1fr; }
  .search-results-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 379px) {
  .logout-link--compact {
    padding: 0.45rem 0.55rem;
    font-size: 0.75rem;
  }

  .sub-page-header {
    gap: 0.4rem 0.5rem;
  }
}

.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; padding: 0.75rem 1rem; border-radius: var(--radius-sm); }
.alert-success { background: var(--green-light); color: #166534; padding: 0.75rem 1rem; border-radius: var(--radius-sm); }
.nav-badge { background: var(--danger); color: #fff; font-size: 0.6875rem; padding: 0.125rem 0.375rem; border-radius: 999px; margin-left: 0.25rem; }
.pagination { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; justify-content: center; }
.property-thumb-img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.required-mark { color: var(--danger); }
.existing-photos-preview { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.5rem 0; }
.photo-preview-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.full-width { grid-column: 1 / -1; }
.activity-item.unread { border-left: 3px solid var(--primary); background: var(--primary-light); }
.card-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; flex-wrap: wrap; }
.auth-back { display: inline-block; margin-top: 1rem; font-size: 0.875rem; }
.status-badge.danger { background: #fee2e2; color: var(--danger); }
.contract-preview { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; line-height: 1.7; box-shadow: var(--shadow); }

/* ── Dark mode & landing-aligned polish ── */
[data-theme="dark"] .alert-error { background: rgba(248, 113, 113, 0.12); color: #fecaca; border-color: rgba(248, 113, 113, 0.35); }
[data-theme="dark"] .alert-info { background: rgba(96, 165, 250, 0.12); color: #bfdbfe; border-color: rgba(96, 165, 250, 0.35); }
[data-theme="dark"] .alert-warning,
[data-theme="dark"] .app-banner { background: rgba(251, 191, 36, 0.12); color: #fde68a; border-color: rgba(251, 191, 36, 0.35); }
[data-theme="dark"] .alert-success { background: var(--green-light); color: #bbf7d0; }
[data-theme="dark"] .btn-google { background: var(--bg-card); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .btn-google:hover { background: var(--bg-alt); }
[data-theme="dark"] .status-badge.danger { background: rgba(248, 113, 113, 0.15); color: #fecaca; }
[data-theme="dark"] .data-table th { background: var(--bg-alt); }
[data-theme="dark"] .data-table tr:nth-child(even) { background: rgba(15, 23, 42, 0.35); }
[data-theme="dark"] #signature-canvas { background: #f8fafc !important; }

.search-result-card,
.tenant-apartment-card,
.action-card,
.approval-review-card {
  box-shadow: var(--shadow);
}

.page-content h2 {
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.02em;
}
