/* cedarline tenant portal, shared stylesheet */
/* Light + dark via prefers-color-scheme. Responsive to ~380px. */

:root {
  --primary: #B4552E;
  --primary-hover: #9C4728;
  --ink: #1B1D22;
  --muted: #5E626B;
  --hairline: rgba(27, 29, 34, .10);
  --hairline-strong: rgba(27, 29, 34, .18);
  --ground: #F4F4F6;
  --surface: #FFFFFF;
  --surface-2: #FBFBFC;
  --sage: #6E8B4E;
  --sage-soft: rgba(110, 139, 78, .12);
  --amber: #E0952A;
  --amber-soft: rgba(224, 149, 42, .14);
  --red: #D8452E;
  --red-soft: rgba(216, 69, 46, .12);
  --primary-soft: rgba(180, 85, 46, .10);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(27,29,34,.04), 0 8px 24px rgba(27,29,34,.05);
  --shadow-lift: 0 2px 6px rgba(27,29,34,.06), 0 18px 44px rgba(27,29,34,.10);

  --font-display: "Familjen Grotesk", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, sans-serif;
  --font-mono: "Fragment Mono", ui-monospace, monospace;

  --sidebar-w: 244px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #D97A50;
    --primary-hover: #E08B63;
    --ink: #ECEDF0;
    --muted: #9A9EA8;
    --hairline: rgba(236, 237, 240, .12);
    --hairline-strong: rgba(236, 237, 240, .20);
    --ground: #16171B;
    --surface: #1E2025;
    --surface-2: #23262C;
    --sage: #9DBA76;
    --sage-soft: rgba(157, 186, 118, .16);
    --amber: #EDB55D;
    --amber-soft: rgba(237, 181, 93, .16);
    --red: #EE7259;
    --red-soft: rgba(238, 114, 89, .16);
    --primary-soft: rgba(217, 122, 80, .14);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --shadow-lift: 0 2px 6px rgba(0,0,0,.4), 0 18px 44px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }

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

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}

.num { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

/* ---------- wordmark ---------- */
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}
.wordmark .dot { color: var(--primary); }

/* ---------- layout shell ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand { padding: 2px 8px 20px; }
.sidebar__brand .tagline {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 10px 6px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 500;
  font-size: 14.5px;
  transition: background .16s ease, color .16s ease;
}
.nav a svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--muted); transition: color .16s ease; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a[aria-current="page"] svg { color: var(--primary); }

.sidebar__foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--hairline); }
.tenant-card { display: flex; align-items: center; gap: 11px; padding: 8px 6px; }
.avatar {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}
.tenant-card .who { min-width: 0; }
.tenant-card .who strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tenant-card .who span { display: block; font-size: 12px; color: var(--muted); }
.signout {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease;
}
.signout:hover { color: var(--ink); border-color: var(--hairline-strong); }
.signout svg { width: 16px; height: 16px; }

/* ---------- main + topbar ---------- */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar .wordmark { font-size: 18px; }
.hamburger {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.hamburger svg { width: 20px; height: 20px; }

.content { padding: 34px 40px 64px; max-width: 1080px; width: 100%; }

.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 27px; }
.page-head p { color: var(--muted); margin: 6px 0 0; max-width: 60ch; }

/* ---------- cards + surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card__body { padding: 20px 22px; }
.card__head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card__head h2 { font-size: 16px; }

.section-title {
  font-size: 13px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--aside { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
.stack { display: flex; flex-direction: column; }
.mt-32 { margin-top: 32px; }
.mt-24 { margin-top: 24px; }

/* ---------- rent hero (home) ---------- */
.rent-hero {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 28px 30px;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.rent-hero::before {
  content: "";
  position: absolute; inset: 0 0 auto auto;
  width: 220px; height: 220px;
  background: radial-gradient(circle at top right, var(--primary-soft), transparent 70%);
  pointer-events: none;
}
.rent-hero .amount {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 44px;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 8px 0 4px;
}
.rent-hero .amount .cur { font-size: 24px; color: var(--muted); margin-right: 2px; vertical-align: super; }
.rent-hero .due { color: var(--muted); font-size: 14px; }
.rent-hero .due strong { color: var(--ink); font-weight: 600; }
.rent-hero__aside { position: relative; z-index: 1; }
.autopay-line {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  margin-top: 14px;
}
.autopay-line svg { width: 15px; height: 15px; color: var(--sage); }

/* ---------- pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--paid, .pill--resolved, .pill--current { color: var(--sage); background: var(--sage-soft); }
.pill--waiting, .pill--scheduled, .pill--submitted, .pill--due { color: var(--amber); background: var(--amber-soft); }
.pill--progress { color: var(--primary); background: var(--primary-soft); }
.pill--overdue, .pill--urgent { color: var(--red); background: var(--red-soft); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .12s ease;
}
.btn svg { width: 17px; height: 17px; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); color: #fff; }
.btn--primary:active { transform: translateY(1px); }
.btn--ghost { background: transparent; border-color: var(--hairline-strong); color: var(--ink); }
.btn--ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn--block { width: 100%; }
@media (prefers-color-scheme: dark) {
  .btn--primary { color: #1B1D22; }
  .btn--primary:hover { color: #1B1D22; }
}

.confirm {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--sage-soft);
  color: var(--ink);
  font-size: 13.5px;
  border: 1px solid transparent;
}
.confirm svg { width: 18px; height: 18px; color: var(--sage); flex: 0 0 18px; margin-top: 1px; }
.confirm.is-hidden { display: none; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 520px; }
.tbl th, .tbl td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--hairline); }
.tbl th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
}
.tbl td { font-size: 14px; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .amount, .tbl .date { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .amount { text-align: right; }
.tbl .align-r { text-align: right; }

/* ---------- announcements ---------- */
.announce { display: flex; flex-direction: column; }
.announce__item { padding: 18px 0; border-bottom: 1px solid var(--hairline); }
.announce__item:first-child { padding-top: 0; }
.announce__item:last-child { border-bottom: none; padding-bottom: 0; }
.announce__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.announce__from { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.announce__date { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.announce__item h3 { font-size: 16px; margin-bottom: 5px; }
.announce__item p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- quick links ---------- */
.qlinks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.qlink {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 14.5px;
  transition: border-color .16s ease, transform .12s ease, box-shadow .16s ease;
}
.qlink:hover { border-color: var(--primary); color: var(--ink); box-shadow: var(--shadow); }
.qlink__icon { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.qlink__icon svg { width: 18px; height: 18px; }

/* ---------- summary tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.tile .k { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.tile .v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 28px; margin-top: 6px; letter-spacing: -0.01em; }
.tile .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- maintenance list ---------- */
.wo { display: flex; flex-direction: column; }
.wo__item {
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 16px;
}
.wo__item:last-child { border-bottom: none; }
.wo__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wo__id { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.wo__item h3 { font-size: 15.5px; }
.wo__cat { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.wo__detail { grid-column: 1 / -1; color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.wo__note { grid-column: 1 / -1; font-size: 13px; color: var(--ink); margin: 8px 0 0; padding: 9px 12px; background: var(--surface-2); border-left: 2px solid var(--primary); border-radius: 0 8px 8px 0; }
.wo__dates { grid-column: 1 / -1; display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.field input, .field select, .field textarea {
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus, .field select:focus, .field textarea:focus,
.file-drop:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}
.file-drop {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  background: var(--surface-2);
}
.file-drop svg { width: 20px; height: 20px; color: var(--muted); }

/* ---------- messages thread ---------- */
.thread { display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 76%; }
.msg__meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.msg__author { font-size: 12.5px; font-weight: 600; }
.msg__date { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.msg__bubble { padding: 12px 15px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; }
.msg--manager { align-self: flex-start; }
.msg--manager .msg__bubble { background: var(--surface-2); border: 1px solid var(--hairline); border-top-left-radius: 4px; }
.msg--tenant { align-self: flex-end; }
.msg--tenant .msg__meta { justify-content: flex-end; }
.msg--tenant .msg__bubble { background: var(--primary-soft); border: 1px solid transparent; border-top-right-radius: 4px; }

.composer { display: flex; gap: 10px; align-items: flex-end; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--hairline); }
.composer textarea { min-height: 46px; }

/* ---------- callouts ---------- */
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--amber-soft);
  border: 1px solid transparent;
  font-size: 13.5px;
}
.callout svg { width: 18px; height: 18px; color: var(--amber); flex: 0 0 18px; margin-top: 1px; }

/* ---------- meta list ---------- */
.meta-list { list-style: none; margin: 0; padding: 0; }
.meta-list li { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.meta-list li:last-child { border-bottom: none; }
.meta-list .k { color: var(--muted); }
.meta-list .v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- footer ---------- */
.demo-note {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.demo-note svg { width: 14px; height: 14px; flex: 0 0 14px; }

/* ---------- login ---------- */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.login-aside {
  background: var(--primary);
  color: #fff;
  padding: 52px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-aside::after {
  content: "";
  position: absolute; inset: auto -60px -80px auto;
  width: 340px; height: 340px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.login-aside .wordmark { color: #fff; font-size: 24px; }
.login-aside .wordmark .dot { color: #fff; opacity: .7; }
.login-aside__lead h2 { font-size: 30px; color: #fff; max-width: 15ch; margin-bottom: 12px; }
.login-aside__lead p { color: rgba(255,255,255,.82); font-size: 15px; max-width: 34ch; }
.login-aside ul { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-direction: column; gap: 10px; }
.login-aside li { display: flex; gap: 10px; align-items: center; font-size: 14px; color: rgba(255,255,255,.9); }
.login-aside li svg { width: 17px; height: 17px; opacity: .85; }
.login-aside__foot { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: rgba(255,255,255,.7); }

.login-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--ground); }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 25px; margin-bottom: 6px; }
.login-card > p.sub { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
.login-card .demo-tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--primary); background: var(--primary-soft);
  padding: 5px 11px; border-radius: 999px; margin-bottom: 20px;
}
.login-card .demo-tag svg { width: 13px; height: 13px; }
.login-card .row-between { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 20px; font-size: 13px; }
.login-card .row-between label { display: flex; align-items: center; gap: 7px; color: var(--muted); cursor: pointer; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .content > *, .rent-hero, .card, .tile { animation: rise .5s cubic-bezier(.22,.61,.36,1) both; }
  .content > *:nth-child(2) { animation-delay: .04s; }
  .content > *:nth-child(3) { animation-delay: .08s; }
  .content > *:nth-child(4) { animation-delay: .12s; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  .btn--primary:hover { transform: translateY(-1px); }
}

*:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ---------- scrim for mobile nav ---------- */
.scrim {
  display: none;
  position: fixed; inset: 0;
  background: rgba(27,29,34,.42);
  z-index: 40;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .content { padding: 26px 24px 56px; }
  .rent-hero { grid-template-columns: 1fr; gap: 22px; }
  .grid-2, .grid-3, .grid--aside { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-aside { display: none; }
}

@media (max-width: 780px) {
  .topbar { display: flex; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lift);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim { display: block; }
  .qlinks { grid-template-columns: 1fr; }
  .msg { max-width: 88%; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

@media (max-width: 420px) {
  .content { padding: 20px 16px 48px; }
  .page-head h1 { font-size: 23px; }
  .rent-hero { padding: 22px 20px; }
  .rent-hero .amount { font-size: 36px; }
  .card__body { padding: 16px 16px; }
  .card__head { padding: 14px 16px; }
  .tbl th, .tbl td { padding: 11px 12px; }
  .composer { flex-direction: column; align-items: stretch; }
}
