/* =============================================================
   RentFlow Manager — design system
   Dark charcoal + antique gold, Playfair Display / Inter
   ============================================================= */

:root {
  --bg:            #101219;
  --bg-elevated:   #161923;
  --surface:       #1b1f2b;
  --surface-2:     #212635;
  --line:          #2b3142;
  --line-soft:     #232838;
  --text:          #eceae4;
  --text-muted:    #9aa0b1;
  --gold:          #cfa75f;
  --gold-soft:     #e2c48c;
  --gold-dim:      rgba(207, 167, 95, 0.14);
  --ok:            #4fb583;
  --warn:          #d9a13b;
  --danger:        #d9604f;

  --radius:   14px;
  --radius-sm: 9px;
  --shadow:   0 18px 50px rgba(0, 0, 0, 0.45);
  --serif:    "Playfair Display", Georgia, serif;
  --sans:     "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --maxw:     1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 12% -10%, rgba(207, 167, 95, 0.10), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(79, 181, 131, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; letter-spacing: .2px; }
h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); }
h2 { font-size: clamp(1.35rem, 2.4vw, 1.85rem); }
h3 { font-size: 1.12rem; }
p  { margin: 0 0 1rem; }
a  { color: var(--gold-soft); text-decoration: none; }
a:hover { color: var(--gold); text-decoration: underline; }

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--gold); color: #14161d;
  padding: .6rem 1rem; z-index: 100; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

.muted   { color: var(--text-muted); }
.small   { font-size: .85rem; }
.center  { text-align: center; }
.right   { text-align: right; }
.mono    { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .06em; }
.nowrap  { white-space: nowrap; }
.eyebrow {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .22em;
  color: var(--gold); font-weight: 600; margin-bottom: .6rem;
}

/* ─── Top bar ──────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(16, 18, 25, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto; padding: .85rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 11px; font-family: var(--serif); font-weight: 700; font-size: .95rem;
  color: #14161d; background: linear-gradient(140deg, var(--gold-soft), var(--gold));
  box-shadow: 0 6px 18px rgba(207, 167, 95, .28);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__text strong { font-family: var(--serif); font-size: 1.08rem; letter-spacing: .4px; }
.brand__text em {
  font-style: normal; font-size: .66rem; letter-spacing: .28em;
  text-transform: uppercase; color: var(--text-muted);
}

.nav { display: flex; align-items: center; gap: 1.15rem; }
.nav__link { color: var(--text-muted); font-size: .93rem; font-weight: 500; padding: .3rem 0; position: relative; }
.nav__link:hover { color: var(--text); text-decoration: none; }
.nav__link.is-active { color: var(--gold); }
.nav__link.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 2px;
  background: var(--gold); border-radius: 2px;
}
.nav__who {
  font-size: .78rem; color: var(--text-muted); padding-left: 1rem;
  border-left: 1px solid var(--line); letter-spacing: .04em;
}
.nav-toggle { display: none; background: none; border: 0; padding: .4rem; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 4px 0; border-radius: 2px; }

/* ─── Page shell ───────────────────────────────────────────── */
.page { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 2.2rem 1.25rem 3.5rem; }
.page--narrow { max-width: 520px; }
.page-head { margin-bottom: 1.8rem; }
.page-head p { color: var(--text-muted); max-width: 62ch; margin: 0; }

/* ─── Cards ────────────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-elevated));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.25rem; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.card__head h2, .card__head h3 { margin: 0; }
.card--flat { box-shadow: none; background: var(--surface); }
.card--gold { border-color: rgba(207, 167, 95, .35); background: linear-gradient(170deg, rgba(207,167,95,.10), var(--bg-elevated) 55%); }

.grid { display: grid; gap: 1.25rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 1.25rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* ─── Stats ────────────────────────────────────────────────── */
.stat {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 1.15rem 1.25rem; position: relative; overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(var(--gold), transparent);
}
.stat__label { font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); }
.stat__value { font-family: var(--serif); font-size: 1.85rem; margin-top: .35rem; }
.stat__hint { font-size: .8rem; color: var(--text-muted); }
.stat--ok::before     { background: linear-gradient(var(--ok), transparent); }
.stat--warn::before   { background: linear-gradient(var(--warn), transparent); }
.stat--danger::before { background: linear-gradient(var(--danger), transparent); }

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font-family: var(--sans); font-size: .92rem; font-weight: 500;
  padding: .68rem 1.25rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; transition: .18s ease;
  text-decoration: none; line-height: 1.2;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn--primary { background: linear-gradient(140deg, var(--gold-soft), var(--gold)); color: #14161d; box-shadow: 0 8px 22px rgba(207,167,95,.22); }
.btn--primary:hover { color: #14161d; filter: brightness(1.06); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn--ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn--ok { background: rgba(79,181,131,.14); border-color: rgba(79,181,131,.45); color: #8fe0b6; }
.btn--ok:hover { background: rgba(79,181,131,.24); color: #a8ecc7; }
.btn--danger { background: rgba(217,96,79,.12); border-color: rgba(217,96,79,.45); color: #f0a397; }
.btn--danger:hover { background: rgba(217,96,79,.22); color: #ffb9ad; }
.btn--sm { padding: .45rem .85rem; font-size: .84rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ─── Forms ────────────────────────────────────────────────── */
.field { margin-bottom: 1.05rem; }
.field label { display: block; font-size: .82rem; font-weight: 500; letter-spacing: .04em; margin-bottom: .4rem; color: var(--text-muted); }
.input, select.input, textarea.input {
  width: 100%; padding: .72rem .9rem; font: inherit; font-size: .95rem;
  color: var(--text); background: #12151d; border: 1px solid var(--line);
  border-radius: var(--radius-sm); transition: .16s ease;
}
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.input::placeholder { color: #5f667a; }
textarea.input { min-height: 90px; resize: vertical; }
.field__hint { font-size: .78rem; color: var(--text-muted); margin-top: .35rem; }
.field__error { font-size: .8rem; color: #f0a397; margin-top: .35rem; }
.field--inline { display: flex; gap: .5rem; align-items: flex-end; }
fieldset { border: 0; padding: 0; margin: 0; }

/* ─── Alerts ───────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm); padding: .8rem 1rem; margin-bottom: 1.25rem;
  font-size: .92rem; border: 1px solid var(--line);
}
.alert--success { background: rgba(79,181,131,.10); border-color: rgba(79,181,131,.4); color: #9fe4c1; }
.alert--error   { background: rgba(217,96,79,.10);  border-color: rgba(217,96,79,.4);  color: #f2ab9f; }
.alert--info    { background: rgba(207,167,95,.08); border-color: rgba(207,167,95,.35); color: var(--gold-soft); }

/* ─── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; padding: .28rem .6rem; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge--ok     { background: rgba(79,181,131,.12); border-color: rgba(79,181,131,.4); color: #8fe0b6; }
.badge--warn   { background: rgba(217,161,59,.12); border-color: rgba(217,161,59,.4); color: #edc784; }
.badge--danger { background: rgba(217,96,79,.12);  border-color: rgba(217,96,79,.4);  color: #f0a397; }
.badge--muted  { background: rgba(154,160,177,.10); border-color: var(--line); color: var(--text-muted); }

/* ─── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line-soft); }
table.table { width: 100%; border-collapse: collapse; min-width: 640px; background: var(--surface); }
.table th, .table td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table th {
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; background: var(--surface-2);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255,255,255,.02); }
.table td.right, .table th.right { text-align: right; }

/* ─── Empty state ──────────────────────────────────────────── */
.empty { text-align: center; padding: 2.6rem 1rem; color: var(--text-muted); }
.empty__mark {
  width: 46px; height: 46px; margin: 0 auto .8rem; border-radius: 50%;
  display: grid; place-items: center; border: 1px dashed var(--line);
  color: var(--gold); font-family: var(--serif); font-size: 1.2rem;
}

/* ─── Hero (landing) ───────────────────────────────────────── */
.hero { padding: 3.5rem 0 2.5rem; display: grid; gap: 2.5rem; grid-template-columns: 1.05fr .95fr; align-items: center; }
.hero h1 { margin-bottom: 1rem; }
.hero h1 .accent {
  background: linear-gradient(120deg, var(--gold-soft), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: 1.06rem; color: var(--text-muted); max-width: 52ch; }
.hero__actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.6rem; }
.hero__panel {
  background: linear-gradient(170deg, rgba(207,167,95,.12), var(--bg-elevated) 60%);
  border: 1px solid rgba(207,167,95,.28); border-radius: 20px; padding: 1.6rem;
  box-shadow: var(--shadow);
}
.hero__line { display: flex; justify-content: space-between; padding: .6rem 0; border-bottom: 1px dashed var(--line); font-size: .95rem; }
.hero__line:last-child { border-bottom: 0; font-family: var(--serif); font-size: 1.2rem; padding-top: 1rem; }
.divider { height: 1px; background: var(--line-soft); border: 0; margin: 2.6rem 0; }

.feature { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 1.35rem; }
.feature__mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--gold-dim); color: var(--gold); font-family: var(--serif); font-weight: 700; margin-bottom: .8rem;
}
.feature h3 { margin-bottom: .35rem; }
.feature p { margin: 0; color: var(--text-muted); font-size: .92rem; }

.steps { counter-reset: step; display: grid; gap: 1rem; }
.step { display: flex; gap: 1rem; align-items: flex-start; }
.step__num {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-dim); color: var(--gold); font-size: .85rem; font-weight: 600;
}
.step p { margin: 0; color: var(--text-muted); font-size: .93rem; }
.step strong { color: var(--text); display: block; font-size: .98rem; }

/* ─── Auth cards ───────────────────────────────────────────── */
.auth { max-width: 460px; margin: 3rem auto; }
.auth__head { text-align: center; margin-bottom: 1.6rem; }
.auth__foot { text-align: center; margin-top: 1.4rem; font-size: .9rem; color: var(--text-muted); }
.demo-hint {
  margin-top: 1.2rem; font-size: .82rem; color: var(--text-muted);
  background: rgba(255,255,255,.03); border: 1px dashed var(--line);
  border-radius: var(--radius-sm); padding: .7rem .9rem;
}
.demo-hint code { color: var(--gold-soft); }

/* ─── Bill summary ─────────────────────────────────────────── */
.bill-line { display: flex; justify-content: space-between; align-items: baseline; padding: .7rem 0; border-bottom: 1px dashed var(--line); }
.bill-line:last-of-type { border-bottom: 0; }
.bill-line span { color: var(--text-muted); font-size: .93rem; }
.bill-line b { font-weight: 500; font-size: 1rem; }
.bill-total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: .9rem; padding-top: 1rem; border-top: 1px solid var(--line);
}
.bill-total b { font-family: var(--serif); font-size: 1.8rem; color: var(--gold); }
.detail-list { display: grid; gap: .8rem; }
.detail-list div { display: flex; justify-content: space-between; gap: 1rem; font-size: .94rem; }
.detail-list dt, .detail-list span:first-child { color: var(--text-muted); }

/* ─── Chart (pure CSS bars) ────────────────────────────────── */
.chart { display: flex; align-items: flex-end; gap: .9rem; height: 170px; padding-top: .5rem; }
.chart__col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .5rem; height: 100%; }
.chart__bars { width: 100%; display: flex; gap: 3px; align-items: flex-end; height: 100%; }
.chart__bar { flex: 1; border-radius: 5px 5px 0 0; min-height: 3px; transition: height .5s ease; }
.chart__bar--billed { background: rgba(255,255,255,.10); }
.chart__bar--collected { background: linear-gradient(180deg, var(--gold-soft), rgba(207,167,95,.45)); }
.chart__label { font-size: .74rem; color: var(--text-muted); letter-spacing: .06em; }
.legend { display: flex; gap: 1.1rem; font-size: .8rem; color: var(--text-muted); margin-top: .9rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .4rem; }

/* ─── Tabs ─────────────────────────────────────────────────── */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line-soft); margin-bottom: 1.4rem; flex-wrap: wrap; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  color: var(--text-muted); font: inherit; font-size: .92rem; padding: .65rem .95rem;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--gold); border-bottom-color: var(--gold); }
.tab__count { font-size: .72rem; background: var(--gold-dim); color: var(--gold); border-radius: 999px; padding: .1rem .45rem; margin-left: .4rem; }
[data-panel][hidden] { display: none; }

/* ─── Modal ────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 60; display: none;
  align-items: center; justify-content: center; padding: 1.25rem;
  background: rgba(8, 9, 13, .72); backdrop-filter: blur(4px);
}
.modal.is-open { display: flex; }
.modal__box {
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.6rem; width: 100%; max-width: 440px;
  box-shadow: var(--shadow);
}
.modal__box h3 { margin-bottom: .3rem; }
.modal__actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.3rem; }

/* ─── Footer ───────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--line-soft); background: rgba(0,0,0,.22); margin-top: auto; }
.footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 1.8rem 1.25rem; font-size: .88rem; color: var(--text-muted); }
.footer__inner strong { color: var(--text); font-family: var(--serif); font-weight: 600; }
.footer__meta { margin: 0; font-size: .8rem; }

/* ─── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  padding: .7rem 1.1rem; border-radius: 999px; font-size: .88rem;
  opacity: 0; transition: .25s ease; z-index: 80; pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 2rem; }
}
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; top: 100%; left: 0; right: 0; display: none;
    flex-direction: column; align-items: flex-start; gap: .9rem;
    background: var(--bg-elevated); border-bottom: 1px solid var(--line);
    padding: 1.1rem 1.25rem;
  }
  .nav.is-open { display: flex; }
  .nav__who { border-left: 0; padding-left: 0; }
  .topbar__inner { position: relative; }
  .card { padding: 1.2rem; }
}

@media print {
  .topbar, .footer, .btn, .nav { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}
