/* Maine Village Apartments — Tenant Portal stylesheet
   Palette: lobster red, slate blue, white
   Typography: Source Serif body, Inter UI/headings */

:root {
  --lobster: #C8102E;
  --lobster-dark: #9C0A21;
  --lobster-soft: #F8E1E5;
  --slate: #4A6E8A;
  --slate-dark: #2F4A60;
  --slate-soft: #E6EDF3;
  --white: #FFFFFF;
  --bg: #FAF8F5;
  --ink: #1F2933;
  --muted: #6B7280;
  --line: #E5E0D8;
  --green: #1B5E20;
  --green-soft: #E8F5E9;
  --amber: #B45309;
  --amber-soft: #FEF3C7;
  --shadow: 0 1px 2px rgba(31,41,51,.04), 0 8px 24px rgba(31,41,51,.06);
  --radius: 10px;
  --radius-sm: 6px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .ui, button, input, select, textarea, label, .nav, .badge, .btn,
.signin-card, .portal-hero, .action-card, .history-card, .summary {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

h1 { font-size: 2.2rem; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 .4em; font-weight: 600; }
h2 { font-size: 1.4rem; line-height: 1.2;  letter-spacing: -0.01em; margin: 0 0 .5em; font-weight: 600; }
h3 { font-size: 1.1rem; margin: 0 0 .4em; font-weight: 600; }
p  { margin: 0 0 1em; }
a  { color: var(--slate-dark); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.section   { padding: 40px 0; }

/* ---------- Header ---------- */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px; gap: 14px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--lobster) 0%, var(--lobster-dark) 100%);
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px;
}
.brand-name { font-weight: 600; font-size: 1.05rem; }
.brand-sub  { font-size: .78rem; color: var(--muted); display: block; line-height: 1; margin-top: 2px;}

.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  text-decoration: none; color: var(--ink); font-size: .92rem;
  padding: 8px 12px; border-radius: var(--radius-sm);
}
.nav a:hover { background: var(--slate-soft); color: var(--slate-dark); }
.nav a.active { color: var(--lobster); font-weight: 600; }
.nav a.signout {
  color: var(--muted); font-size: .85rem;
  border-left: 1px solid var(--line); margin-left: 8px; padding-left: 16px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-size: .95rem; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: all .15s ease;
}
.btn-primary { background: var(--lobster); color: white; }
.btn-primary:hover { background: var(--lobster-dark); }
.btn-secondary { background: var(--white); color: var(--slate-dark); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--slate); }
.btn-slate { background: var(--slate); color: white; }
.btn-slate:hover { background: var(--slate-dark); }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--slate-dark); padding: 0; cursor: pointer; font-weight: 500; }

/* ============================================
   SIGN-IN SCREEN
   ============================================ */
.signin-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 18px;
  background:
    linear-gradient(180deg, rgba(250,248,245,.8) 0%, var(--bg) 100%),
    linear-gradient(135deg, var(--slate-soft) 0%, var(--lobster-soft) 100%);
}
.signin-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%; max-width: 420px;
  padding: 36px 32px;
}
.signin-card .brand-stack {
  text-align: center; margin-bottom: 26px;
}
.signin-card .brand-stack .brand-mark { width: 44px; height: 44px; font-size: 18px; margin-bottom: 10px; }
.signin-card h1 { font-size: 1.3rem; margin: 4px 0 0; }
.signin-card .subtitle { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.signin-card .helper {
  font-size: .82rem; color: var(--muted); text-align: center;
  margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line);
}
.signin-card .demo-pill {
  display: block; text-align: center; font-size: .75rem;
  color: var(--slate-dark); background: var(--slate-soft);
  padding: 6px 10px; border-radius: 4px; margin-bottom: 18px;
  font-weight: 500;
}

/* ============================================
   PORTAL DASHBOARD
   ============================================ */
.portal-hero {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 28px 0 24px;
}
.portal-hero .greet-row {
  display: flex; gap: 18px; align-items: center;
}
.portal-hero .unit-thumb {
  width: 72px; height: 72px; border-radius: var(--radius-sm);
  overflow: hidden; background: var(--slate-soft); flex-shrink: 0;
  border: 1px solid var(--line);
}
.portal-hero .unit-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.portal-hero h1 { font-size: 1.6rem; margin: 0 0 2px; font-weight: 600; }
.portal-hero .unit-label {
  color: var(--muted); font-size: .92rem; margin: 0;
}

/* Action cards row */
.action-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  margin-top: 28px;
}
@media (max-width: 720px) { .action-grid { grid-template-columns: 1fr; } }

.action-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
}
.action-card .eyebrow {
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.action-card.payment .eyebrow { color: var(--lobster); }
.action-card.maintenance .eyebrow { color: var(--slate); }
.action-card .big-number {
  font-size: 2rem; font-weight: 700; color: var(--slate-dark);
  letter-spacing: -0.02em; margin: 2px 0;
}
.action-card .meta-line {
  color: var(--muted); font-size: .9rem;
}
.action-card .meta-line.due-soon { color: var(--amber); font-weight: 600; }
.action-card .meta-line.ok { color: var(--green); font-weight: 600; }
.action-card .cta-row {
  margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap;
}

/* History strips */
.history-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  margin-top: 24px;
}
@media (max-width: 800px) { .history-grid { grid-template-columns: 1fr; } }

.history-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px;
}
.history-card h2 {
  font-size: 1rem; margin: 0 0 12px; color: var(--slate-dark);
  display: flex; align-items: baseline; justify-content: space-between;
}
.history-card h2 a { font-size: .78rem; font-weight: 500; color: var(--slate); text-decoration: none; }
.history-card h2 a:hover { text-decoration: underline; }
.history-card table {
  width: 100%; border-collapse: collapse; font-size: .88rem;
}
.history-card th, .history-card td {
  text-align: left; padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}
.history-card th { font-weight: 500; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }
.history-card tr:last-child td { border-bottom: none; }
.history-card td.amount, .history-card th.amount { text-align: right; font-variant-numeric: tabular-nums; }
.status-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: .03em;
}
.status-pill.paid     { background: var(--green-soft); color: var(--green); }
.status-pill.scheduled { background: var(--amber-soft); color: var(--amber); }
.status-pill.resolved { background: var(--green-soft); color: var(--green); }
.status-pill.open     { background: var(--slate-soft); color: var(--slate-dark); }

.empty-state {
  color: var(--muted); font-size: .88rem;
  text-align: center; padding: 18px 8px;
}

/* ============================================
   FORMS (Payment + Maintenance)
   ============================================ */
.form-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px;
}
.form-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 640px) { .form-row, .form-row.cols-3 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink); }
.field .hint { font-size: .8rem; color: var(--muted); }
.field input, .field select, .field textarea {
  font-size: 1rem; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--white); color: var(--ink); font-family: "Inter", sans-serif;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--slate);
  box-shadow: 0 0 0 3px rgba(74,110,138,.18);
}
.field textarea { min-height: 110px; resize: vertical; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.checkbox input { margin-top: 4px; }
.checkbox label { font-weight: 400; font-size: .92rem; color: var(--ink); }
fieldset { border: none; padding: 0; margin: 0 0 20px; }
legend {
  font-weight: 600; font-size: 1rem; color: var(--slate-dark);
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); width: 100%;
}

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 20px;
}
.back-link {
  font-size: .85rem; color: var(--slate); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.back-link:hover { color: var(--slate-dark); text-decoration: underline; }

/* Payment summary */
.pay-grid { display: grid; grid-template-columns: 1fr .8fr; gap: 22px; }
@media (max-width: 800px) { .pay-grid { grid-template-columns: 1fr; } }
.summary {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  height: fit-content; font-size: .85rem;
}
.summary h3 { font-size: .98rem; margin-bottom: 10px; }
.summary h4 { font-size: .78rem; margin: 16px 0 4px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.summary .row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 5px 0; font-size: .88rem;
}
.summary .row.total {
  border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px;
  font-weight: 700; font-size: 1rem; color: var(--slate-dark);
}
.summary p { font-size: .78rem; line-height: 1.5; color: var(--muted); margin: 10px 0 0; }
.stripe-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .78rem; color: var(--muted); margin-top: 14px;
}
.stripe-badge .lock { width: 14px; height: 14px; }

.demo-note {
  background: var(--lobster-soft); color: var(--lobster-dark);
  border: 1px dashed var(--lobster); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: .85rem; margin-bottom: 20px;
}
.success-banner {
  background: var(--green-soft); color: var(--green); border: 1px solid #A5D6A7;
  padding: 14px 16px; border-radius: var(--radius-sm);
  font-size: .92rem; margin-bottom: 18px; display: none;
}
.success-banner.show { display: block; }

/* ============================================
   Footer
   ============================================ */
.site-footer {
  margin-top: 56px;
  background: var(--slate-dark); color: rgba(255,255,255,.85);
  padding: 24px 0;
  font-size: .82rem;
}
.site-footer .container {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}
.site-footer a { color: rgba(255,255,255,.85); text-decoration: none; }
.site-footer .legal { opacity: .75; }

/* ============================================
   Mobile
   ============================================ */
@media (max-width: 720px) {
  .site-header .container {
    flex-direction: column; align-items: stretch; gap: 8px;
    padding-top: 10px; padding-bottom: 10px;
  }
  .brand { justify-content: flex-start; }
  .brand-sub { display: none; }
  .nav {
    display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 2px;
    -webkit-overflow-scrolling: touch;
    margin: 0 -18px; padding: 0 18px 2px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: 0 0 auto; font-size: .85rem; padding: 7px 10px; white-space: nowrap; }
  .nav a.signout { border-left: none; margin-left: 0; padding-left: 10px; }

  .container { padding: 0 16px; }
  .section { padding: 28px 0; }
  h1 { font-size: 1.6rem; }
  .portal-hero h1 { font-size: 1.3rem; }
  .portal-hero .unit-thumb { width: 56px; height: 56px; }
  .action-card { padding: 18px; }
  .action-card .big-number { font-size: 1.6rem; }
  .form-card { padding: 20px 16px; }
  .signin-card { padding: 28px 22px; }

  .site-footer .container { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 420px) {
  .container { padding: 0 14px; }
  .field input, .field select, .field textarea { font-size: 16px; } /* prevent iOS auto-zoom */
}
