/* ── Ironhold Home — earthy sanctuary (NOT Command) ─────────── */
:root {
  --bg: #f3efe6;
  --bg-deep: #e8e2d4;
  --surface: #fffaf3;
  --surface2: #f0e9dc;
  --border: rgba(55, 48, 36, 0.08);
  --border2: rgba(55, 48, 36, 0.14);
  --ink: #1f1a14;
  --text: #2c261e;
  --text-soft: #5c5348;
  --text-dim: #8a8072;
  --sage: #3d6b4f;
  --sage-lt: #4f8a64;
  --sage-soft: rgba(61, 107, 79, 0.12);
  --sage-glow: rgba(61, 107, 79, 0.18);
  --clay: #b87a4a;
  --amber: #c4782a;
  --amber-soft: rgba(196, 120, 42, 0.12);
  --red: #c04545;
  --red-soft: rgba(192, 69, 69, 0.1);
  --teal: #2a8a9a;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 18px 50px rgba(60, 45, 30, 0.08);
  --shadow-lg: 0 28px 70px rgba(60, 45, 30, 0.12);
  --font: 'DM Sans', system-ui, sans-serif;
  --display: 'Fraunces', Georgia, serif;
  --sidebar-w: 240px;
}

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

.home-body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.home-body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 45% at 15% 0%, rgba(90, 140, 100, 0.14), transparent 50%),
    radial-gradient(ellipse 50% 40% at 100% 10%, rgba(184, 122, 74, 0.1), transparent 45%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E"),
    linear-gradient(175deg, #f7f3ea 0%, var(--bg) 45%, #ebe4d6 100%);
  pointer-events: none;
  z-index: 0;
}

/* ── Preview ────────────────────────────────────────────────── */
.preview-banner {
  display: none;
  position: sticky;
  top: 0;
  z-index: 200;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: linear-gradient(90deg, rgba(47,111,94,0.12), rgba(196,120,42,0.1));
  border-bottom: 1px solid var(--border2);
  font-size: 13px;
  color: var(--text-soft);
}
.preview-banner.visible { display: flex; }
.preview-left { display: flex; align-items: center; gap: 10px; }
.preview-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--sage); animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.preview-back {
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--sage);
  border-radius: 999px;
  padding: 6px 14px;
  font: 500 12px var(--font);
  cursor: pointer;
}

/* ── Auth gate ──────────────────────────────────────────────── */
.tenant-auth {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.tenant-auth.visible { display: flex; }

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
}
.auth-orb-1 {
  width: 320px; height: 320px;
  background: rgba(61, 143, 120, 0.25);
  top: 10%; left: 15%;
}
.auth-orb-2 {
  width: 280px; height: 280px;
  background: rgba(196, 120, 42, 0.15);
  bottom: 15%; right: 10%;
}

.home-auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.45s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.home-auth-brand { text-align: center; margin-bottom: 28px; }
.home-mark {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: linear-gradient(145deg, #3d8f78, #2f6f5e);
  color: #f4f1eb;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  box-shadow: 0 12px 28px rgba(47, 111, 94, 0.28);
}
.home-mark.sm {
  width: 40px; height: 40px;
  font-size: 18px;
  border-radius: 12px;
  margin: 0;
}
.home-auth-brand h1 {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.home-auth-brand h1 span { color: var(--sage); font-weight: 500; }
.home-auth-brand p {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-dim);
}

.invite-banner {
  display: flex;
  background: var(--sage-soft);
  border: 1px solid rgba(47, 111, 94, 0.2);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--sage);
  line-height: 1.45;
}
.invite-banner strong { color: var(--ink); }

.auth-error {
  background: var(--red-soft);
  border: 1px solid rgba(192, 69, 69, 0.25);
  color: var(--red);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  margin-bottom: 12px;
}
.auth-hint {
  font-size: 12px;
  color: var(--text-soft);
  background: var(--surface2);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  line-height: 1.45;
}

.home-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--surface2);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
}
.home-auth-tab {
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 10px;
  font: 500 13px var(--font);
  color: var(--text-dim);
  cursor: pointer;
}
.home-auth-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(40, 50, 45, 0.06);
}

.home-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.home-field span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.home-field input,
.home-field select,
.home-field textarea {
  width: 100%;
  border: 1px solid var(--border2);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font: 400 14px var(--font);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.home-field input:focus,
.home-field select:focus,
.home-field textarea:focus {
  border-color: rgba(47, 111, 94, 0.45);
  box-shadow: 0 0 0 3px var(--sage-glow);
}
.home-field textarea { resize: vertical; min-height: 100px; }

.home-btn-primary {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font: 600 14px var(--font);
  color: #f7faf8;
  background: linear-gradient(145deg, #3d8f78, #2a5f50);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(47, 111, 94, 0.28);
  transition: transform 0.15s, box-shadow 0.15s;
}
.home-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(47, 111, 94, 0.32);
}
.home-btn-primary:disabled { opacity: 0.6; cursor: wait; transform: none; }

.home-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-dim);
  font-size: 12px;
}
.home-divider::before,
.home-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border2);
}

.home-btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--border2);
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  font: 500 13px var(--font);
  color: var(--text);
  cursor: pointer;
}
.home-btn-google:hover { background: var(--surface2); }

.home-auth-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}
.home-auth-foot a { color: var(--sage); text-decoration: none; font-weight: 500; }

/* ── App shell + side nav ───────────────────────────────────── */
.tenant-app {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100vh;
}
.tenant-app.visible {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.home-sidebar {
  position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, #f8f4eb 0%, #ebe4d4 100%);
  border-right: 1px solid var(--border);
  padding: 22px 14px;
  display: flex; flex-direction: column;
  z-index: 40;
}
.home-side-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 8px 20px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.home-brand-name {
  font-family: var(--display); font-size: 15px; font-weight: 600; color: var(--ink);
}
.home-brand-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.home-side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.home-side-item {
  display: flex; align-items: center; gap: 12px;
  border: none; background: transparent; text-align: left;
  padding: 12px 14px; border-radius: 14px;
  font: 500 13px var(--font); color: var(--text-soft); cursor: pointer; width: 100%;
  transition: 0.15s;
}
.home-side-item span { width: 20px; opacity: 0.75; }
.home-side-item:hover { background: rgba(255,255,255,0.55); color: var(--ink); }
.home-side-item.active {
  background: var(--surface);
  color: var(--sage);
  box-shadow: 0 4px 16px rgba(60, 45, 30, 0.06);
  font-weight: 600;
  border: 1px solid var(--border);
}
.home-side-foot {
  padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.home-pill {
  background: var(--sage-soft); color: var(--sage);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600;
  text-align: center;
}
.home-icon-btn {
  border: 1px solid var(--border2); background: var(--surface);
  border-radius: 10px; padding: 10px; cursor: pointer;
  color: var(--text-soft); font: 500 12px var(--font);
}
.home-icon-btn:hover { color: var(--ink); }

.home-shell { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.home-top {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 28px;
  position: sticky; top: 0; z-index: 30;
  background: rgba(243, 239, 230, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.preview-banner.visible ~ .tenant-app .home-top { top: 0; }
.home-menu-btn {
  display: none; border: 1px solid var(--border2); background: var(--surface);
  border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: 14px;
}
.home-top-title {
  font-family: var(--display); font-size: 18px; font-weight: 600; color: var(--ink);
}
.home-top-sub { font-size: 12px; color: var(--text-dim); }
.home-avatar {
  margin-left: auto;
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(145deg, #d4e8d8, #b8d4bc);
  color: var(--sage);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  border: 1px solid rgba(61, 107, 79, 0.2);
}

.home-main {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px 56px;
}

.rights-ul {
  margin: 0; padding-left: 18px; color: var(--text-soft);
  font-size: 14px; line-height: 1.75;
}
.rights-note {
  margin: 16px 0 0; font-size: 12px; color: var(--text-dim); line-height: 1.5;
}

@media (max-width: 820px) {
  .tenant-app.visible { grid-template-columns: 1fr; }
  .home-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
    transform: translateX(-105%); transition: transform 0.25s; z-index: 100;
    box-shadow: var(--shadow-lg);
  }
  .home-sidebar.open { transform: translateX(0); }
  .home-menu-btn { display: inline-flex; }
}

.tab-content { display: none; animation: rise 0.3s ease; }
.tab-content.active { display: block; }

.home-section-head { margin-bottom: 18px; }
.home-section-head h2 {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.home-section-head p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-dim);
}

.home-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.home-card-title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 16px;
}

/* ── Rent ───────────────────────────────────────────────────── */
.rent-hero {
  background: linear-gradient(155deg, #1e3d34 0%, #2f6f5e 55%, #3d8f78 100%);
  color: #f4faf7;
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: 0 20px 50px rgba(47, 111, 94, 0.28);
}
.rent-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
}
.rent-amount {
  font-family: var(--display);
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 6px 0 2px;
}
.rent-period { font-size: 14px; opacity: 0.8; }
.rent-due {
  display: inline-flex;
  margin-top: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  font-size: 12px;
  font-weight: 500;
}
.rent-due.overdue { background: rgba(192, 69, 69, 0.35); }
.pay-btn {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 20px auto 0;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font: 600 14px var(--font);
  color: var(--sage);
  background: #f4faf7;
  cursor: pointer;
  transition: transform 0.15s;
}
.pay-btn:hover { transform: translateY(-1px); }
.pay-btn:disabled { opacity: 0.7; cursor: wait; }
.pay-secure {
  margin-top: 10px;
  font-size: 11px;
  opacity: 0.65;
}

.payment-processing-bar {
  display: none;
  margin-top: 20px;
  text-align: left;
}
.payment-processing-bar.active { display: block; }
.ppb-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 8px;
}
.ppb-track {
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
  overflow: hidden;
}
.ppb-fill {
  height: 100%;
  width: 0;
  background: #f4faf7;
  border-radius: 999px;
  transition: width 0.5s ease;
}
.ppb-steps {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 10px;
  opacity: 0.7;
}
.ppb-step { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ppb-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.3);
}
.ppb-step.active .ppb-dot,
.ppb-step.done .ppb-dot { background: #fff; }
.ppb-step.active { opacity: 1; font-weight: 600; }

/* ── Lease ──────────────────────────────────────────────────── */
.lease-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.lease-item span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.lease-item strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.lease-item strong.highlight { color: var(--sage); }
.lease-bar-wrap { margin-top: 22px; }
.lease-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 8px;
}
.lease-bar-track {
  height: 8px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
}
.lease-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sage), var(--sage-lt));
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ── Maintenance ────────────────────────────────────────────── */
.maint-form { display: flex; flex-direction: column; }
.maint-request-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.maint-request-row:last-child { border-bottom: none; }
.maint-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.maint-info { flex: 1; min-width: 0; }
.maint-title { font-weight: 600; font-size: 14px; color: var(--ink); }
.maint-date { font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.4; }
.maint-landlord-reply {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--sage-soft);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}
.maint-landlord-reply span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sage);
  font-weight: 700;
  margin-bottom: 4px;
}
.maint-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.maint-badge.open { background: var(--amber-soft); color: var(--amber); }
.maint-badge.progress { background: rgba(42, 138, 154, 0.12); color: var(--teal); }
.maint-badge.resolved { background: var(--sage-soft); color: var(--sage); }

/* ── Messages ───────────────────────────────────────────────── */
.messages-card { padding-bottom: 14px; }
.messages-wrap {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
  min-height: 180px;
}
.msg-bubble-wrap { display: flex; flex-direction: column; max-width: 85%; }
.msg-bubble-wrap.tenant { align-self: flex-end; align-items: flex-end; }
.msg-bubble-wrap.landlord { align-self: flex-start; align-items: flex-start; }
.msg-sender {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
  font-weight: 500;
}
.msg-bubble {
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
}
.msg-bubble-wrap.landlord .msg-bubble {
  background: var(--surface2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.msg-bubble-wrap.tenant .msg-bubble {
  background: linear-gradient(145deg, #3d8f78, #2f6f5e);
  color: #f4faf7;
  border-bottom-right-radius: 4px;
}
.msg-time { font-size: 10px; color: var(--text-dim); margin-top: 4px; }
.msg-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.msg-input {
  flex: 1;
  border: 1px solid var(--border2);
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  font: 400 14px var(--font);
  color: var(--ink);
  resize: none;
  outline: none;
  min-height: 46px;
}
.msg-input:focus {
  border-color: rgba(47, 111, 94, 0.4);
  box-shadow: 0 0 0 3px var(--sage-glow);
}
.msg-send-btn {
  width: 46px; height: 46px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(145deg, #3d8f78, #2f6f5e);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.empty-soft {
  text-align: center;
  padding: 20px 12px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #f4f1eb;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 999;
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Payment method cards from payment-methods.js may use dark vars — soften */
#tenant-payment-options {
  color: var(--text);
  font-size: 13px;
}

/* Compatibility for split-payments.js (uses .card classes) */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 16px;
}
.btn-submit {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font: 600 13px var(--font);
  color: #f7faf8;
  background: linear-gradient(145deg, #3d8f78, #2a5f50);
  cursor: pointer;
}
.btn-outline-sm {
  border: 1px solid var(--border2);
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  font: 500 13px var(--font);
  color: var(--text-soft);
  cursor: pointer;
}
.split-progress-wrap { margin-bottom: 14px; }
.split-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}
.split-bar-track {
  height: 8px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
}
.split-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sage), var(--sage-lt));
  border-radius: 999px;
}
.split-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.split-item:last-child { border-bottom: none; }
.split-item-amount { font-weight: 600; color: var(--ink); }
.split-item-date { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.split-item-status { font-size: 12px; font-weight: 600; color: var(--amber); }
.split-item.paid .split-item-status { color: var(--sage); }

@media (max-width: 560px) {
  .home-auth-card { padding: 28px 20px; }
  .rent-amount { font-size: 42px; }
  .lease-grid { grid-template-columns: 1fr; }
  .home-pill { display: none; }
  .home-main { padding: 20px 14px 40px; }
}
