/* ==========================================================================
   RentLedger design system v2 — premium SaaS look
   Tokens -> base -> components -> layout -> pages -> responsive -> print
   Every class the app's JS emits is styled here; no JS class was renamed.
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
  /* brand */
  --navy-950: #0A1D45;
  --navy-900: #102B59;
  --navy-800: #17408A;
  --royal-700: #1747c9;
  --royal-600: #0646C8;
  --royal-500: #3b6ff0;
  --royal-100: #dbe7ff;
  --royal-50: #eef3ff;
  --gold: #f5b301;
  --gold-deep: #d99a00;

  /* legacy names the old JS inline-styles may still reference */
  --teal: var(--royal-600);
  --teal-dark: var(--navy-900);
  --teal-soft: var(--royal-100);
  --gold-bright: var(--gold);

  /* neutrals */
  --ink: #0b1b3b;
  --ink-2: #26365a;
  --muted: #5b6b8c;
  --line: #e3e9f5;
  --line-strong: #cfd9ee;
  --bg: #F5F8FF;
  --bg-2: #eaf0fb;
  --card: #ffffff;

  /* status palettes: solid / soft / border */
  --green: #15803d;
  --green-soft: #e7f8ee;
  --green-line: #c4ecd3;
  --red: #c81e1e;
  --red-soft: #fdeceb;
  --red-line: #f7cbc9;
  --amber: #a15c07;
  --amber-soft: #fff4dc;
  --amber-line: #f6dfa8;
  --blue: #0646C8;
  --blue-soft: #e9f0ff;
  --blue-line: #cddcfb;
  --purple: #6d28d9;
  --purple-soft: #f1eaff;
  --purple-line: #ddd0fa;

  /* typography scale */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: .75rem;
  --fs-sm: .875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.1rem;

  /* spacing scale (4px grid) */
  --sp-1: .25rem;
  --sp-2: .5rem;
  --sp-3: .75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;

  /* shape + depth */
  --radius: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 35, 85, .05), 0 2px 8px rgba(15, 35, 85, .05);
  --shadow-md: 0 4px 12px rgba(15, 35, 85, .07), 0 12px 28px rgba(15, 35, 85, .08);
  --shadow-lg: 0 10px 30px rgba(11, 37, 89, .22);
  --ring: 0 0 0 3px rgba(59, 111, 240, .28);

  /* motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t-fast: .15s;
  --t-med: .25s;

  /* layout */
  --sidebar-w: 264px;
  --nav-h: 4.4rem;
}

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--fs-md);
  line-height: 1.5;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--royal-600); text-underline-offset: 3px; }
a:hover { color: var(--navy-800); }
h1 { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin: 0 0 .35rem; color: var(--navy-900); }
h2 { font-size: var(--fs-lg); font-weight: 750; letter-spacing: -.01em; margin: 1.25rem 0 .55rem; color: var(--navy-900); }
h3 { font-size: 1.02rem; font-weight: 700; margin: 1rem 0 .4rem; }
p { margin: .4rem 0; }
ul { padding-left: 1.2rem; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.error { color: var(--red); font-weight: 600; }
.success { color: var(--green); font-weight: 600; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
::selection { background: var(--royal-100); }

/* ---------- 3. Icons (Lucide-style stroke icons, inline SVG) ---------- */
.nav-icon, .stat-icon, .qa-icon, .alert-bell, .insight-icon, .prop-icon, .icon-btn-svg { display: inline-flex; align-items: center; justify-content: center; flex: none; }
svg.i, .nav-icon svg, .stat-icon svg, .qa-icon svg, .alert-bell svg, .insight-icon svg, .prop-icon svg, .icon-btn svg, .chev svg {
  width: 100%; height: 100%;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.nav-icon { width: 1.25rem; height: 1.25rem; }

/* ---------- 4. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1.5px solid var(--line-strong); background: #fff; color: var(--royal-700);
  border-radius: 12px; padding: .7rem 1.15rem; font: inherit; font-size: .97rem; font-weight: 650;
  cursor: pointer; text-decoration: none; line-height: 1.2; min-height: 44px;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  box-shadow: 0 1px 2px rgba(15, 35, 85, .05);
}
.btn:hover { background: var(--royal-50); border-color: var(--royal-500); color: var(--royal-700); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--royal-700), var(--royal-500)); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(29, 78, 216, .32); }
.btn-primary:hover { background: linear-gradient(135deg, var(--navy-800), var(--royal-600)); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(29, 78, 216, .4); }
.btn-green { background: linear-gradient(135deg, #15803d, #22a455); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(21, 128, 61, .3); }
.btn-green:hover { background: linear-gradient(135deg, #116d33, #178f46); color: #fff; border-color: transparent; }
.btn-indigo { background: linear-gradient(135deg, #4338ca, #6366f1); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .3); }
.btn-indigo:hover { background: linear-gradient(135deg, #3730a3, #4f46e5); color: #fff; border-color: transparent; }
.btn-amber { background: linear-gradient(135deg, #c27803, #f0a30a); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(217, 154, 0, .3); }
.btn-amber:hover { background: linear-gradient(135deg, #a96403, #d98f06); color: #fff; border-color: transparent; }
.btn-danger { border-color: var(--red-line); color: var(--red); background: #fff; }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { padding: .4rem .8rem; font-size: var(--fs-sm); min-height: 36px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- 5. Forms ---------- */
label { display: block; font-weight: 650; font-size: var(--fs-sm); margin: .85rem 0 .3rem; color: var(--ink-2); }
input, select, textarea {
  width: 100%; padding: .75rem .9rem; font: inherit; font-size: 1rem; color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: 12px; background: #fff; min-height: 46px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
input::placeholder, textarea::placeholder { color: #94a3c0; }
input:hover, select:hover, textarea:hover { border-color: #b4c4e6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--royal-500); box-shadow: var(--ring); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 2.4rem; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6b8c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .8rem center / 1.15rem;
}
input[type="file"] { padding: .55rem; background: var(--royal-50); border-style: dashed; }
input[type="date"] { min-height: 46px; }
input[type="checkbox"] { width: 1.25rem; height: 1.25rem; min-height: 0; accent-color: var(--royal-600); padding: 0; }
.form-grid { display: grid; gap: 0 1rem; }
.checkbox-row { display: flex; gap: .65rem; align-items: flex-start; margin: .85rem 0; }
.checkbox-row input { width: 1.25rem; flex: none; margin-top: .15rem; }
.checkbox-row label { margin: 0; font-weight: 500; color: var(--ink); font-size: .95rem; }
select.range-pill, .range-pill {
  display: inline-block; background-color: var(--royal-50); color: var(--royal-700); font-weight: 700; font-size: var(--fs-sm);
  padding: .35rem .85rem; border-radius: 999px; border: 1.5px solid var(--royal-100);
}
select.range-pill { width: auto; min-height: 0; padding: .45rem 2.2rem .45rem .9rem; }

/* ---------- 6. Cards, grids, layout primitives ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--sp-5); margin-bottom: var(--sp-4); box-shadow: var(--shadow-sm);
  animation: rise var(--t-med) var(--ease) both;
}
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 7. Stat tiles ---------- */
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4) var(--sp-4) var(--sp-4);
  position: relative; box-shadow: var(--shadow-sm); transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
  animation: rise var(--t-med) var(--ease) both; min-width: 0;
}
.stat .label { color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; line-height: 1.25; }
.stat .value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.025em; margin: .3rem 0 .15rem; line-height: 1.15; overflow-wrap: anywhere; }
.stat .sub { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; line-height: 1.35; }
.stat.alert .value { color: var(--red); }
.stat.ok .value { color: var(--green); }
.stat-top { display: flex; align-items: center; gap: .6rem; padding-right: 1.4rem; }
.stat-icon { width: 2.3rem; height: 2.3rem; border-radius: 50%; font-weight: 800; font-size: 1.05rem; padding: .5rem; }
.progress { height: 8px; background: rgba(15, 35, 85, .09); border-radius: 999px; margin: .55rem 0 .45rem; overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 999px; transition: width .8s var(--ease); min-width: 0; }
.stat-green { background: linear-gradient(160deg, #f2fcf6, var(--green-soft)); border-color: var(--green-line); }
.stat-green .value { color: var(--green); }
.stat-green .stat-icon { background: #1f9d55; color: #fff; box-shadow: 0 4px 10px rgba(31, 157, 85, .35); }
.stat-green .progress span { background: linear-gradient(90deg, #178a46, #34c06f); }
.stat-red { background: linear-gradient(160deg, #fff5f4, var(--red-soft)); border-color: var(--red-line); }
.stat-red .value { color: var(--red); }
.stat-red .stat-icon { background: #e03131; color: #fff; box-shadow: 0 4px 10px rgba(224, 49, 49, .35); }
.stat-red .progress span { background: linear-gradient(90deg, #c81e1e, #f06060); }
.stat-blue { background: linear-gradient(160deg, #f4f8ff, var(--blue-soft)); border-color: var(--blue-line); }
.stat-blue .value { color: var(--royal-700); }
.stat-blue .stat-icon { background: var(--royal-600); color: #fff; box-shadow: 0 4px 10px rgba(29, 78, 216, .35); }
.stat-blue .progress span { background: linear-gradient(90deg, var(--royal-700), #5b8cff); }
.stat-teal { background: linear-gradient(160deg, #f8f5ff, var(--purple-soft)); border-color: var(--purple-line); }
.stat-teal .value { color: var(--purple); }
.stat-teal .stat-icon { background: #7c3aed; color: #fff; box-shadow: 0 4px 10px rgba(124, 58, 237, .35); }
.stat-teal .progress span { background: linear-gradient(90deg, #6d28d9, #a78bfa); }
.stat-amber { background: linear-gradient(160deg, #fffaf0, var(--amber-soft)); border-color: var(--amber-line); }
.stat-amber .value { color: var(--amber); }
.stat-amber .stat-icon { background: #e29a05; color: #fff; box-shadow: 0 4px 10px rgba(226, 154, 5, .35); }
.stat-amber .progress span { background: linear-gradient(90deg, #c27803, #f5b301); }
a.stat { display: block; text-decoration: none; color: inherit; cursor: pointer; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
a.stat:active { transform: scale(.985); }
.stat-chev { position: absolute; top: 1rem; right: .9rem; width: 1.55rem; height: 1.55rem; border-radius: 50%; background: rgba(255, 255, 255, .85); color: var(--royal-700); display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; line-height: 1; box-shadow: var(--shadow-sm); }
.stat-red .stat-chev { color: var(--red); }
.stat-green .stat-chev { color: var(--green); }
.stat-teal .stat-chev { color: var(--purple); }

/* ---------- 8. Badges, tags ---------- */
.badge { display: inline-block; padding: .18rem .65rem; border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; line-height: 1.4; white-space: nowrap; }
.badge-red { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-line); }
.badge-amber { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-line); }
.badge-green { background: var(--green-soft); color: var(--green); border: 1px solid var(--green-line); }
.badge-grey { background: #eef1f8; color: var(--muted); border: 1px solid var(--line); }
.badge-teal { background: var(--royal-50); color: var(--royal-700); border: 1px solid var(--blue-line); }
.badge-type { background: rgba(255, 255, 255, .22); color: #fff; border: 1px solid rgba(255, 255, 255, .35); backdrop-filter: blur(4px); text-transform: capitalize; }
.demo-tag { background: var(--amber-soft); color: var(--amber); font-size: .68rem; font-weight: 800; letter-spacing: .04em; border-radius: 6px; padding: .12rem .45rem; border: 1px solid var(--amber-line); vertical-align: middle; }
.legend-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 4px; vertical-align: middle; margin-right: .4rem; }
.legend-income { background: var(--royal-600); }
.legend-expense { background: #f08a4b; }

/* ---------- 9. Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 calc(var(--sp-2) * -1); padding: 0 var(--sp-2); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .93rem; }
th, td { text-align: left; padding: .75rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: #f7f9fe; white-space: nowrap; }
th:first-child { border-top-left-radius: 10px; }
th:last-child { border-top-right-radius: 10px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td, tr:hover td { background-color: #f8faff; }
tr.overdue td { background: var(--red-soft); }
tr.partial td { background: var(--amber-soft); }
tr.paid td { background: var(--green-soft); }
tr.overdue:hover td, tr.partial:hover td, tr.paid:hover td { filter: brightness(.985); }
table a { font-weight: 650; text-decoration: none; }
table a:hover { text-decoration: underline; }

/* ---------- 10. Lists + property cards ---------- */
.list-item { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-3); background: var(--card); box-shadow: var(--shadow-sm); animation: rise var(--t-med) var(--ease) both; transition: box-shadow var(--t-med), transform var(--t-med) var(--ease); }
.card .list-item { box-shadow: none; background: #fafcff; }
.list-item h3 { margin: 0 0 .2rem; font-size: 1.1rem; }
.list-item h3 a { color: var(--navy-900); text-decoration: none; }
.list-item h3 a:hover { color: var(--royal-600); }
.list-item a:not(.btn) { font-weight: 650; }
.prop-card { padding: 0; overflow: hidden; }
.prop-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.prop-head { height: 96px; display: flex; align-items: flex-end; justify-content: space-between; padding: .85rem 1.1rem; position: relative; overflow: hidden; }
.prop-head::after { content: ""; position: absolute; right: -30px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .13); }
.prop-icon { width: 2.8rem; height: 2.8rem; border-radius: 14px; background: rgba(255, 255, 255, .22); color: #fff; padding: .6rem; border: 1px solid rgba(255, 255, 255, .35); position: relative; z-index: 1; }
.prop-head .badge { position: relative; z-index: 1; }
.prop-body { padding: var(--sp-4) var(--sp-5) var(--sp-5); }
.grad-house { background: linear-gradient(135deg, #0f7a3d, #34c06f); }
.grad-flat { background: linear-gradient(135deg, var(--navy-800), #4f86f7); }
.grad-hmo { background: linear-gradient(135deg, #5b21b6, #a78bfa); }

/* ---------- 11. Brand: logo + header + sidebar ---------- */
.brand { color: #fff; font-weight: 800; font-size: 1.45rem; letter-spacing: -.025em; text-decoration: none; display: inline-flex; align-items: center; gap: .65rem; line-height: 1; }
.brand:hover { color: #fff; }
.brand-name { display: inline-flex; flex-direction: column; gap: .2rem; }
.brand-name b { font-weight: 800; }
.brand-name b em { font-style: normal; color: var(--gold); }
.brand-name small { font-size: .72rem; font-weight: 500; letter-spacing: 0; opacity: .85; }
.brand-logo { width: 2.7rem; height: 2.7rem; border-radius: 14px; background: #fff; padding: 3px; flex: none; box-shadow: 0 6px 14px rgba(0, 0, 0, .22); }
.brand-tag { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 20; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgba(80, 130, 255, .55), transparent 55%), linear-gradient(135deg, var(--navy-950), var(--navy-800) 55%, var(--royal-700));
  padding-top: env(safe-area-inset-top);
  border-radius: 0 0 28px 28px / 0 0 22px 22px;
  box-shadow: 0 8px 24px rgba(11, 37, 89, .28);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: .85rem 1rem 1.15rem; display: flex; align-items: center; gap: .6rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .7rem; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.9rem; height: 2.9rem; padding: 0.7rem;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; text-decoration: none; font: inherit;
  transition: background var(--t-fast), transform var(--t-fast) var(--ease); backdrop-filter: blur(6px);
}
.icon-btn:hover { background: rgba(255, 255, 255, .22); color: #fff; transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.menu { background: rgba(7, 26, 69, .55); }
.bell-count { position: absolute; top: -.2rem; right: -.2rem; min-width: 1.3rem; height: 1.3rem; padding: 0 .3rem; border-radius: 999px; background: #ef4444; color: #fff; font-size: .72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid var(--navy-900); line-height: 1; }
.nav-toggle { margin-left: 0; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(86vw, var(--sidebar-w)); z-index: 40; color: #fff;
  background: radial-gradient(140% 60% at 100% 0%, rgba(80, 130, 255, .35), transparent 60%), linear-gradient(180deg, var(--navy-950), var(--navy-900) 60%, #0d2a68);
  transform: translateX(-105%); transition: transform var(--t-med) var(--ease);
  display: flex; flex-direction: column; padding: 1.25rem 1rem; gap: 1.1rem; overflow-y: auto;
  padding-top: calc(1.25rem + env(safe-area-inset-top));
}
.sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, .5); }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(7, 26, 69, .5); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity var(--t-med); }
.sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
.sidebar-brand { display: flex; flex-direction: column; padding: .2rem .4rem .4rem; }
.sidebar-cta { text-align: center; box-shadow: 0 8px 20px rgba(0, 0, 0, .3); }
.main-nav { display: flex; flex-direction: column; gap: .2rem; }
.main-nav a { color: #c9d8ff; text-decoration: none; padding: .7rem .85rem; border-radius: 12px; font-size: .96rem; font-weight: 600; display: flex; align-items: center; gap: .75rem; transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease); }
.main-nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; transform: translateX(2px); }
.main-nav a.active { background: linear-gradient(135deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .1)); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: .6rem; align-items: stretch; padding: .85rem; border-radius: 14px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); }
.sidebar-user { font-size: var(--fs-sm); opacity: .9; word-break: break-all; }
.sidebar-foot .btn { border-color: rgba(255, 255, 255, .4); color: #fff; background: transparent; box-shadow: none; }
.sidebar-foot .btn:hover { background: rgba(255, 255, 255, .15); border-color: #fff; }

/* ---------- 12. Page shell ---------- */
.app-main { min-height: 100vh; display: flex; flex-direction: column; }
.view { width: 100%; max-width: 1180px; margin: 0 auto; padding: var(--sp-5) var(--sp-4) calc(var(--nav-h) + 3.5rem); flex: 1; min-width: 0; }
.view > h1:first-child, .view > .row-between:first-child { margin-top: .25rem; }
.view > p.muted { font-size: .95rem; max-width: 70ch; }

/* ---------- 13. Dashboard ---------- */
.hero { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: .4rem 0 1rem; }
.hero-art { width: clamp(120px, 34vw, 190px); flex: none; margin-right: -.4rem; filter: drop-shadow(0 12px 18px rgba(15, 35, 85, .18)); animation: float 6s ease-in-out infinite; }
.hero-art svg { width: 100%; height: auto; display: block; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.greeting h1 { font-size: clamp(1.7rem, 6.2vw, 2.2rem); margin-bottom: .2rem; }
.greeting p { font-size: 1.02rem; margin: 0; }
.alert-card {
  background: linear-gradient(135deg, #fff6f5, var(--red-soft)); border: 1px solid var(--red-line); border-left: 5px solid #d92d2d;
  border-radius: var(--radius); padding: var(--sp-4); margin-bottom: var(--sp-4); box-shadow: var(--shadow-sm); animation: rise var(--t-med) var(--ease) both;
}
.alert-card h2 { margin: 0; font-size: 1.25rem; color: #a31616; }
.alert-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .4rem; }
.alert-bell { width: 3rem; height: 3rem; border-radius: 50%; background: linear-gradient(135deg, #d92d2d, #f05252); color: #fff; padding: .75rem; box-shadow: 0 6px 14px rgba(217, 45, 45, .4); }
.alert-card p { margin: .35rem 0; }
.alert-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; text-decoration: none; color: var(--ink); margin: .2rem 0 0; padding: .45rem .1rem .45rem 0; border-radius: 12px; font-weight: 500; line-height: 1.4; transition: background var(--t-fast); }
.alert-row:hover { background: rgba(217, 45, 45, .06); color: var(--ink); }
.alert-row strong { color: var(--ink); }
.alert-row .alert-text { flex: 1; min-width: 0; }
.alert-row .alert-link { flex: none; color: #b42318; font-weight: 750; font-size: var(--fs-sm); text-decoration: none; background: #fff; border: 1.5px solid var(--red-line); padding: .5rem .9rem; border-radius: 999px; white-space: nowrap; box-shadow: var(--shadow-sm); }
.alert-row:hover .alert-link { background: #fff0ef; border-color: #e88; }

.dash-meta { color: var(--muted); font-size: .92rem; margin: .2rem 0 .85rem; font-weight: 500; }
.stat-wide { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem; overflow: hidden; }
.stat-wide .value { font-size: 2.3rem; }
.stat-art { width: 6.5rem; opacity: .95; margin: -.6rem -.2rem -.6rem 0; }
.stat-art svg { width: 100%; height: auto; display: block; }
.stat-wide .stat-chev { top: .9rem; right: .9rem; }

.qa-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin: 0 0 var(--sp-4); }
.qa-tile {
  display: flex; align-items: center; gap: .7rem; padding: .95rem .9rem; border-radius: 18px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: .98rem;
  border: 1px solid transparent; box-shadow: var(--shadow-sm); position: relative; min-height: 64px; line-height: 1.2;
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}
.qa-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--ink); }
.qa-tile:active { transform: scale(.97); }
.qa-tile > span:nth-child(2) { flex: 1; min-width: 0; }
.qa-tile::after { content: ""; flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: rgba(255, 255, 255, .85) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231747c9' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / 62% no-repeat; box-shadow: var(--shadow-sm); }
.qa-icon { width: 2.6rem; height: 2.6rem; border-radius: 13px; padding: .6rem; font-size: 1.3rem; font-weight: 800; background: rgba(0, 0, 0, .08); }
.qa-green { background: linear-gradient(160deg, #f2fcf6, #dcf7e6); border-color: var(--green-line); }
.qa-blue { background: linear-gradient(160deg, #f4f8ff, #dde8ff); border-color: var(--blue-line); }
.qa-indigo { background: linear-gradient(160deg, #f8f5ff, #e8defd); border-color: var(--purple-line); }
.qa-amber { background: linear-gradient(160deg, #fffaf0, #fdecc2); border-color: var(--amber-line); }
.qa-green .qa-icon { background: #1f9d55; color: #fff; box-shadow: 0 4px 10px rgba(31, 157, 85, .3); }
.qa-blue .qa-icon { background: var(--royal-600); color: #fff; box-shadow: 0 4px 10px rgba(29, 78, 216, .3); }
.qa-indigo .qa-icon { background: #7c3aed; color: #fff; box-shadow: 0 4px 10px rgba(124, 58, 237, .3); }
.qa-amber .qa-icon { background: #e29a05; color: #fff; box-shadow: 0 4px 10px rgba(226, 154, 5, .3); }

.steps-card .step { display: flex; align-items: center; gap: .8rem; padding: .75rem 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: transform var(--t-fast) var(--ease); }
.steps-card .step:hover { transform: translateX(3px); }
.steps-card .step:first-of-type { border-top: 0; }
.step-dot { display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 2px solid var(--line-strong); color: #fff; font-weight: 800; font-size: .9rem; flex: none; }
.step.done .step-dot { background: linear-gradient(135deg, #15803d, #34c06f); border-color: transparent; }
.step.done .step-label { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(91, 107, 140, .5); }
.step-label { flex: 1; font-weight: 650; }
.step-chevron { color: var(--royal-600); font-size: 1.4rem; }

.bars { display: flex; gap: .35rem; align-items: stretch; height: 140px; margin-top: .75rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .3rem; min-width: 0; }
.bar-pair { flex: 1; display: flex; gap: 3px; align-items: flex-end; width: 100%; justify-content: center; }
.bar { width: 9px; max-width: 45%; border-radius: 5px 5px 2px 2px; display: block; transition: height .8s var(--ease); }
.bar-income { background: linear-gradient(180deg, var(--royal-500), var(--royal-700)); }
.bar-expense { background: linear-gradient(180deg, #f6a46c, #ec7a3b); }
.bar-label { font-size: .68rem; color: var(--muted); font-weight: 600; }
.cat-row { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.cat-row:first-of-type { border-top: 0; }
.cat-label { flex: 0 0 42%; font-size: .92rem; font-weight: 550; min-width: 0; overflow-wrap: anywhere; }
.cat-bar { flex: 1; height: 9px; background: #e8eefb; border-radius: 999px; overflow: hidden; }
.cat-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--royal-700), #5b8cff); border-radius: 999px; }
.insight-row { display: flex; align-items: center; gap: .8rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.insight-row:first-of-type { border-top: 0; }
.insight-icon { width: 2.3rem; height: 2.3rem; border-radius: 12px; background: var(--royal-50); color: var(--royal-600); padding: .55rem; }
.insight-label { flex: 1; font-weight: 550; }

.month-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.month-nav .btn-sm { min-width: 2.6rem; font-size: 1.2rem; line-height: 1; }
.month-nav strong { font-size: 1.1rem; }
.month-summary { display: flex; gap: 1.4rem; align-items: flex-end; flex-wrap: wrap; margin: .9rem 0 .55rem; }
.month-summary .label { color: var(--muted); font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.month-summary .value { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.change-badge { background: var(--purple-soft); color: var(--purple); font-weight: 700; font-size: var(--fs-xs); padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--purple-line); }
.mini-bars { display: flex; flex-direction: column; gap: 5px; margin: .6rem 0 1rem; }
.mini-bar { display: block; height: 9px; border-radius: 999px; transition: width .8s var(--ease); }
.mini-income { background: linear-gradient(90deg, var(--royal-700), #5b8cff); }
.mini-expense { background: linear-gradient(90deg, #ec7a3b, #f6a46c); }
.txn-list { border-top: 1px solid var(--line); }
.txn-row { display: flex; align-items: center; gap: .8rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.txn-row:last-child { border-bottom: 0; }
.txn-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border-radius: 12px; font-weight: 800; flex: none; }
.txn-in { background: var(--green-soft); color: var(--green); }
.txn-out { background: var(--red-soft); color: var(--red); }
.txn-label { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.txn-date { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.txn-amount-in { color: var(--green); white-space: nowrap; }
.txn-amount-out { color: var(--red); white-space: nowrap; }

.pro-card { background: linear-gradient(135deg, #fffbea, #fff1c2); border: 1px solid #f1d56a; position: relative; overflow: hidden; }
.pro-card::after { content: ""; position: absolute; right: -40px; bottom: -50px; width: 170px; height: 170px; border-radius: 50%; background: radial-gradient(circle, rgba(245, 179, 1, .35), transparent 70%); pointer-events: none; }
.pro-card h2 { color: #7a5800; }
.pro-card > * { position: relative; z-index: 1; }

/* ---------- 14. Bottom nav + FAB (mobile) ---------- */
.bottom-nav {
  position: fixed; left: .6rem; right: .6rem; bottom: calc(.55rem + env(safe-area-inset-bottom)); z-index: 25; display: flex; gap: .15rem;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 24px;
  padding: .4rem; box-shadow: 0 12px 34px rgba(11, 37, 89, .2);
}
.bottom-nav a {
  flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 700; padding: .55rem .1rem .5rem; border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .22rem; min-width: 0; min-height: 52px;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease);
}
.bottom-nav a .nav-icon { width: 1.4rem; height: 1.4rem; }
.bottom-nav a:active { transform: scale(.94); }
.bottom-nav a.active { background: linear-gradient(135deg, var(--royal-50), var(--royal-100)); color: var(--royal-700); box-shadow: inset 0 0 0 1px var(--blue-line); }
.bottom-nav a.active .nav-icon { transform: translateY(-1px) scale(1.06); }
.fab {
  position: fixed; right: 1rem; bottom: calc(var(--nav-h) + 1.1rem + env(safe-area-inset-bottom)); z-index: 26; display: inline-flex; align-items: center; gap: .6rem;
  background: linear-gradient(135deg, var(--navy-900), var(--royal-700)); color: #fff; font-weight: 750; text-decoration: none; padding: .9rem 1.35rem .9rem 1.1rem;
  border-radius: 999px; box-shadow: 0 12px 28px rgba(11, 37, 89, .45), 0 0 0 4px rgba(255, 255, 255, .85);
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med);
}
.fab:hover { color: #fff; transform: translateY(-2px); }
.fab:active { transform: scale(.96); }
.fab .fab-ic { width: 1.4rem; height: 1.4rem; display: inline-flex; }
.fab .fab-ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 15. Toast + footer ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--navy-900); color: #fff;
  padding: .85rem 1.25rem; border-radius: 14px; z-index: 60; max-width: min(92vw, 460px); box-shadow: var(--shadow-lg); font-weight: 600; animation: pop var(--t-med) var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 12px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.toast.error { background: linear-gradient(135deg, #a31616, #d92d2d); }
.toast.success { background: linear-gradient(135deg, #116d33, #1f9d55); }
.footer { max-width: 1180px; width: 100%; margin: 0 auto; padding: 1.25rem 1rem 1.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-xs); display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.footer-note { width: 100%; }
.footer a { color: var(--royal-600); font-weight: 600; }

details { margin: .5rem 0; }
details summary { cursor: pointer; font-weight: 650; color: var(--royal-700); }
pre.code { background: #f0f4fc; padding: .85rem; border-radius: 12px; overflow-x: auto; font-size: var(--fs-sm); }

/* ---------- 16. Login ---------- */
.login-wrap {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1.25rem; position: relative; overflow: hidden;
  background: radial-gradient(90% 60% at 100% 0%, rgba(80, 130, 255, .55), transparent 60%), radial-gradient(70% 50% at 0% 100%, rgba(245, 179, 1, .18), transparent 60%), linear-gradient(160deg, var(--navy-950), var(--navy-800) 60%, var(--royal-700));
}
.login-card { background: #fff; border-radius: 28px; padding: 2rem 1.5rem 1.6rem; max-width: 410px; width: 100%; box-shadow: 0 30px 70px rgba(0, 0, 0, .38); position: relative; animation: rise .5s var(--ease) both; }
.login-card::before { content: ""; position: absolute; left: 1.5rem; right: 1.5rem; top: 0; height: 4px; border-radius: 0 0 6px 6px; background: linear-gradient(90deg, var(--gold), #ffd666); }
.logo { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; color: var(--navy-900); display: flex; align-items: center; gap: .7rem; }
.logo .brand-logo { width: 3rem; height: 3rem; background: var(--navy-900); box-shadow: 0 8px 18px rgba(11, 37, 89, .3); }
.logo em { font-style: normal; color: var(--gold-deep); }
.login-sub { color: var(--muted); margin: .7rem 0 .4rem; }
.login-note { font-size: var(--fs-sm); color: var(--muted); margin-top: 1rem; text-align: center; }
.login-card form .btn { margin-top: 1rem; }

/* ---------- 17. Misc ---------- */
[hidden] { display: none !important; }
.view h1 + .muted { margin-bottom: 1rem; }
#np-room-list .row input { min-width: 0; }
.stat .value.small { font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- 18. Tablet >= 720px ---------- */
@media (min-width: 720px) {
  .view { padding: var(--sp-6) var(--sp-6) calc(var(--nav-h) + 3rem); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .qa-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .qa-tile { flex-direction: column; text-align: center; padding: 1.2rem .8rem; }
  .qa-tile::after { display: none; }
  .qa-tile > span:nth-child(2) { flex: none; }
  .card { padding: var(--sp-6); }
  h1 { font-size: var(--fs-3xl); }
}

/* ---------- 19. Desktop >= 900px: sidebar layout ---------- */
@media (min-width: 900px) {
  .topbar { display: none; }
  .sidebar { transform: none; width: var(--sidebar-w); box-shadow: 6px 0 30px rgba(11, 37, 89, .18); padding-top: 1.5rem; }
  .sidebar-backdrop { display: none; }
  .app-main { margin-left: var(--sidebar-w); }
  .view { padding: 2rem 2.25rem 3rem; }
  .bottom-nav, .fab { display: none; }
  .toast { bottom: 1.5rem; left: calc(50% + var(--sidebar-w) / 2); }
  .hero { margin-top: .2rem; }
  .hero-art { width: 210px; margin-right: 0; }
  .footer { padding-left: 2.25rem; padding-right: 2.25rem; }
}
@media (min-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .dash-split { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--sp-4); align-items: start; }
  .dash-split > .card { margin-bottom: var(--sp-4); }
}
@media (min-width: 900px) and (max-width: 1079px) {
  .stat .value { font-size: 1.45rem; }
}

/* ---------- 20. Mobile tables become stacked cards (<= 640px) ---------- */
@media (max-width: 640px) {
  .table-wrap { overflow: visible; margin: 0; padding: 0; }
  table.stack, table.stack tbody { display: block; width: 100%; }
  table.stack tr:first-child:has(th), table.stack tr:has(th) { display: none; }
  table.stack tr { display: block; margin: 0 0 .75rem; padding: .35rem .85rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm); }
  table.stack tr.overdue { background: var(--red-soft); border-color: var(--red-line); }
  table.stack tr.partial { background: var(--amber-soft); border-color: var(--amber-line); }
  table.stack tr.paid { background: var(--green-soft); border-color: var(--green-line); }
  table.stack td, table.stack tr:hover td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; text-align: right; padding: .55rem 0; border-bottom: 1px dashed rgba(15, 35, 85, .12); background: transparent !important; filter: none; }
  table.stack td:last-child { border-bottom: 0; }
  table.stack td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-align: left; }
  table.stack td[data-label=""]::before { display: none; }
  table.stack td[data-label=""] { justify-content: flex-end; }
  table.stack td.num { text-align: right; }
  .row > .btn { flex: 1 1 100%; }
  .alert-row { font-size: .95rem; }
  .alert-row .alert-link { padding: .42rem .75rem; font-size: .8rem; }
}

/* very small phones */
@media (max-width: 380px) {
  .stat .value { font-size: 1.45rem; }
  .qa-tile { font-size: .9rem; padding: .8rem .65rem; gap: .5rem; }
  .qa-icon { width: 2.2rem; height: 2.2rem; }
  .brand { font-size: 1.3rem; }
}

/* ---------- 21. Print ---------- */
@media print {
  .topbar, .footer, .btn, .nav-toggle, #toast, .sidebar, .sidebar-backdrop, .bottom-nav, .fab, .hero-art, .icon-btn { display: none !important; }
  body { background: #fff; }
  .card, .stat, .list-item { border: 1px solid #999; break-inside: avoid; box-shadow: none; animation: none; }
  .app-main { margin-left: 0; }
  table.stack tr { display: table-row; }
}

/* ---------- 22. Dashboard stat grid (mobile 2-up, wide arrears card) ---------- */
.dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.dash-stats .stat-wide { grid-column: 1 / -1; }
.dash-stats .stat .value { font-size: 1.55rem; }
.dash-stats .stat-wide .value { font-size: 2.2rem; }
.dash-stats .stat-top { align-items: flex-start; }
.dash-stats .stat-top .label { padding-top: .1rem; }
@media (min-width: 1080px) {
  .dash-stats { grid-template-columns: repeat(6, 1fr); gap: var(--sp-4); }
  .dash-stats .stat-blue, .dash-stats .stat-green, .dash-stats .stat-wide { grid-column: span 2; }
  .dash-stats .stat-teal, .dash-stats .stat-amber { grid-column: span 3; }
}

.qa-tile { min-width: 0; overflow-wrap: anywhere; }
.qa-tile > span:nth-child(2) { hyphens: auto; }
@media (max-width: 420px) {
  .qa-tile { padding: .85rem .7rem; gap: .5rem; font-size: .93rem; }
  .qa-tile::after { width: 1.45rem; height: 1.45rem; }
  .qa-icon { width: 2.3rem; height: 2.3rem; padding: .5rem; }
}

/* ---------- 23. Fixes from visual QA ---------- */
a.stat.stat-wide { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .75rem; overflow: hidden; }
a.stat.stat-wide .stat-art { align-self: end; width: 6.2rem; margin: 0 -.3rem -.9rem 0; }
.dash-stats .stat-top { gap: .55rem; padding-right: 1.2rem; }
.dash-stats .stat-icon { width: 2.15rem; height: 2.15rem; padding: .48rem; }
.dash-stats .stat-chev { width: 1.45rem; height: 1.45rem; top: .85rem; right: .75rem; }
@media (max-width: 420px) {
  .qa-tile { font-size: .9rem; gap: .45rem; padding: .8rem .6rem; }
  .qa-icon { width: 2.15rem; height: 2.15rem; padding: .48rem; border-radius: 11px; }
  .qa-tile::after { width: 1.3rem; height: 1.3rem; }
}

/* ---------- 24. Compact stacked cards on mobile: label above value, two columns ---------- */
@media (max-width: 640px) {
  table.stack tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 1rem; padding: .55rem .9rem; }
  table.stack td, table.stack tr:hover td { display: block; text-align: left; padding: .4rem 0; border-bottom: 0; }
  table.stack td::before { display: block; margin-bottom: .1rem; font-size: .68rem; }
  table.stack td.num { text-align: left; }
  table.stack td[data-label=""] { grid-column: 1 / -1; justify-content: flex-start; padding-top: .2rem; }
  table.stack td:first-child { grid-column: 1 / -1; font-weight: 700; padding-bottom: .15rem; border-bottom: 1px dashed rgba(15, 35, 85, .12); margin-bottom: .2rem; }
  table.stack td:first-child::before { display: none; }
  table.stack td .btn { width: 100%; }
}

/* sidebar bell (desktop has no top bar) */
.sidebar-brand { flex-direction: row; align-items: center; justify-content: space-between; gap: .5rem; }
.side-bell { width: 2.6rem; height: 2.6rem; padding: .62rem; flex: none; }
.side-bell .bell-count { border-color: var(--navy-900); }


/* ---------- 25. Property illustrations ---------- */
.prop-head { height: 124px; align-items: flex-end; }
.prop-art { position: absolute; right: .9rem; bottom: 0; height: 112px; width: 186px; z-index: 1; pointer-events: none; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .18)); }
.prop-art svg { width: 100%; height: 100%; display: block; }
.prop-head .prop-icon { align-self: flex-start; }
.prop-head .badge { z-index: 2; }
.prop-hero { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.prop-hero > div:first-child { min-width: 0; }
.prop-hero-art { flex: none; width: clamp(120px, 34vw, 190px); height: clamp(78px, 22vw, 118px); border-radius: 20px; padding: .3rem .4rem 0; position: relative; overflow: hidden; box-shadow: var(--shadow-md); }
.prop-hero-art::after { content: ""; position: absolute; right: -24px; top: -34px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.prop-hero-art svg { width: 100%; height: 100%; display: block; position: relative; z-index: 1; }
@media (max-width: 420px) { .prop-art { width: 150px; height: 92px; right: .5rem; } .prop-head { height: 112px; } .prop-head .badge { margin-bottom: .1rem; } }

/* type badge moves next to the icon (top-left) so it never sits on the illustration */
.prop-head { justify-content: flex-start; align-items: flex-start; gap: .6rem; }
.prop-head .badge-type { align-self: flex-start; margin-top: .62rem; background: rgba(7, 26, 69, .42); color: #fff; border-color: rgba(255, 255, 255, .3); }

/* ---------- 26. Maintenance, reports, tenant/lease, account extras ---------- */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: .4rem 0 1rem; }
.tab { padding: .5rem 1rem; border-radius: 999px; background: #fff; border: 1.5px solid var(--line-strong); color: var(--ink-2); text-decoration: none; font-weight: 650; font-size: .9rem; transition: background var(--t-fast), color var(--t-fast); }
.tab:hover { background: var(--royal-50); color: var(--royal-700); }
.tab.active { background: linear-gradient(135deg, var(--royal-700), var(--royal-500)); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(29, 78, 216, .3); }
.maint-item { border-left: 5px solid var(--amber-line); }
.maint-item.maint-done { opacity: .78; border-left-color: var(--green-line); }
.maint-actions { margin-top: .5rem; }
.danger-card { border-color: var(--red-line); background: linear-gradient(160deg, #fff, #fff6f5); }
details form { margin-top: .6rem; }
details > summary { padding: .35rem 0; }
.rep-cards .value { font-size: 1.5rem; }
textarea { resize: vertical; min-height: 84px; }
@media print { .no-print { display: none !important; } .card, .stat { break-inside: avoid; } h1 { color: #000; } }

/* stat grids are two-up on phones (maintenance, reports, expenses) */
.grid-4:not(.dash-stats) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
@media (max-width: 719px) { .grid-4:not(.dash-stats) .stat .value { font-size: 1.35rem; } .grid-4:not(.dash-stats) .stat .label { font-size: .8rem; } }
@media (min-width: 1080px) { .grid-4:not(.dash-stats) { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); } }

/* ==========================================================================
   Design v3 — reference refresh. Palette: primary #0646C8, navy #102B59,
   success #119B58, warning #F59E0B, critical #DC3038, background #F5F8FF.
   Later rules deliberately override earlier ones (same selectors).
   ========================================================================== */
:root {
  --royal-700: #0646C8; --royal-600: #1559E6; --royal-500: #3D7BFF; --royal-100: #DCE7FF; --royal-50: #EEF3FF;
  --navy-950: #0A1D45; --navy-900: #102B59; --navy-800: #17408A;
  --green: #119B58; --green-soft: #E6F8EE; --green-line: #BDEBD2;
  --red: #DC3038; --red-soft: #FDECEC; --red-line: #F7C9CB;
  --orange: #F59E0B; --amber: #A85F00; --amber-soft: #FFF4DC; --amber-line: #F6DDA3;
  --blue: #0646C8; --blue-soft: #E9F0FF; --blue-line: #CBDAFB;
  --bg: #F5F8FF; --bg-2: #EAF0FB;
  --nav-h: 4.7rem;
}
html { scroll-padding-bottom: calc(var(--nav-h) + 1.75rem); scroll-padding-top: 5rem; }
body { background: var(--bg); }

/* ----- header: gradient with a wave edge ----- */
.topbar {
  border-radius: 0; box-shadow: none; overflow: visible;
  background:
    radial-gradient(80% 130% at 92% 0%, rgba(61, 123, 255, .6), transparent 58%),
    radial-gradient(70% 90% at 0% 100%, rgba(6, 70, 200, .5), transparent 62%),
    linear-gradient(165deg, var(--navy-950), var(--navy-900) 52%, #0b3a9a);
}
.topbar::before, .topbar::after { content: ""; position: absolute; left: 0; right: 0; pointer-events: none; background-repeat: no-repeat; background-size: 100% 100%; }
.topbar::before { bottom: 8px; height: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 34' preserveAspectRatio='none'%3E%3Cpath d='M0 20C70 4 120 4 190 18s130 14 210-6v22H0z' fill='%23ffffff' fill-opacity='.10'/%3E%3C/svg%3E"); }
.topbar::after { bottom: -1px; height: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 30' preserveAspectRatio='none'%3E%3Cpath d='M0 30V16C60 3 112 4 172 15s122 13 228-5v20z' fill='%23F5F8FF'/%3E%3C/svg%3E"); }
.topbar-inner { padding: .85rem 1rem 2.4rem; position: relative; z-index: 1; }
.brand-mark { display: inline-flex; width: 3.2rem; height: 3.2rem; flex: none; }
.brand-mark .logo-mark { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .28)); }
.sidebar .brand-mark { width: 2.9rem; height: 2.9rem; }
.brand { font-size: 1.5rem; }
.icon-btn { width: 3rem; height: 3rem; }
.bell-count { border-color: var(--navy-900); background: var(--red); }

/* ----- critical updates ----- */
.alert-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .9rem; align-items: center; position: relative; overflow: hidden;
  background: linear-gradient(125deg, #FFF4F4, #FFE0E1 62%, #FFEAEA); border: 1.5px solid #F6B8BB; border-left: 5px solid #E5323B;
  padding: 1rem 1rem 1rem .9rem; border-radius: var(--radius); box-shadow: 0 6px 18px rgba(220, 48, 56, .12);
}
.alert-bell { width: 3.7rem; height: 3.7rem; padding: .95rem; border-radius: 50%; color: #fff; background: radial-gradient(circle at 30% 25%, #FF6068, #DC3038 58%, #B31F28); box-shadow: 0 0 0 7px rgba(220, 48, 56, .12), 0 8px 18px rgba(220, 48, 56, .35); }
.alert-main { min-width: 0; }
.alert-main h2 { margin: 0 0 .2rem; font-size: 1.2rem; color: #C0141D; }
.alert-row { margin: 0; padding: .3rem 0; gap: .7rem; }
.alert-row .alert-text { font-size: .98rem; line-height: 1.35; }
.alert-row .alert-link { padding: .5rem .85rem; font-size: .85rem; color: #C0141D; border-color: #F3B2B6; }

/* ----- overview strip ----- */
.dash-meta-row { display: flex; align-items: center; gap: .75rem; margin: .1rem 0 1rem; color: var(--navy-900); font-weight: 650; font-size: .96rem; }
.dm-item { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; white-space: nowrap; }
.dm-item svg { width: 1.45rem; height: 1.45rem; flex: none; color: var(--royal-700); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dm-sep { width: 1px; height: 1.5rem; background: var(--line-strong); flex: none; }
.dm-dot { width: .72rem; height: .72rem; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(17, 155, 88, .16); flex: none; }
.dm-link { margin-left: auto; display: inline-flex; width: 2.5rem; height: 2.5rem; padding: .52rem; flex: none; border-radius: 12px; background: var(--royal-50); color: var(--royal-700); border: 1px solid var(--blue-line); transition: transform var(--t-fast) var(--ease), background var(--t-fast); }
.dm-link:hover { background: var(--royal-100); transform: translateY(-1px); }
.dm-link svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 370px) { .dash-meta-row { font-size: .84rem; gap: .45rem; } .dm-item svg { width: 1.2rem; height: 1.2rem; } }

/* ----- stat cards ----- */
.dash-stats { margin-bottom: var(--sp-3); }
.stat .value { letter-spacing: -.03em; }
.stat-blue { background: linear-gradient(150deg, #F6F9FF, #E4EDFF 70%, #D9E6FF); border-color: #C8D9FB; }
.stat-blue .value { color: var(--navy-900); }
.stat-blue .stat-icon { background: linear-gradient(145deg, #1559E6, #0646C8); }
.stat-blue .progress span { background: linear-gradient(90deg, #0646C8, #3D7BFF); }
.stat-green { background: linear-gradient(150deg, #F5FDF8, #DFF6E8 70%, #CFF0DC); border-color: #BDE9CF; }
.stat-green .value { color: #0E7F47; }
.stat-green .stat-icon { background: linear-gradient(145deg, #17B26A, #119B58); }
.stat-green .progress span { background: linear-gradient(90deg, #0E8A4D, #34C27A); }
.deco { position: absolute; pointer-events: none; }
.deco svg { width: 100%; height: 100%; display: block; }
.deco-rent { right: .55rem; bottom: .45rem; width: 4.4rem; height: 3.5rem; opacity: .95; }
.deco-collect { right: .85rem; top: 3.7rem; width: 3.2rem; height: 2.8rem; }
.stat-blue .sub { max-width: 72%; }
a.stat.stat-wide.stat-red { background: linear-gradient(120deg, #FFF7EE, #FFE5CF 55%, #FFD3AF); border-color: #F6CFAE; }
.stat-wide.stat-red .value { color: #C8161F; }
.stat-wide .stat-art { width: 6.8rem; margin: -.4rem -.2rem -.5rem 0; filter: drop-shadow(0 8px 10px rgba(180, 90, 30, .22)); }
.stat-wide.stat-red .progress span { background: linear-gradient(90deg, #DC3038, #F2665D); }

/* ----- floating action button + docked navigation ----- */
.fab {
  width: 3.7rem; height: 3.7rem; padding: 0; justify-content: center; border-radius: 50%; gap: 0;
  right: 1rem; bottom: calc(var(--nav-h) + 1.1rem + env(safe-area-inset-bottom));
  background: linear-gradient(145deg, #0A47C9, #102B59); box-shadow: 0 12px 26px rgba(16, 43, 89, .42), 0 0 0 7px rgba(6, 70, 200, .13);
}
.fab .fab-ic { width: 1.8rem; height: 1.8rem; }
.bottom-nav {
  left: 0; right: 0; bottom: 0; gap: 0; border: 0; border-top: 1px solid var(--line); border-radius: 26px 26px 0 0; background: #fff; backdrop-filter: none;
  padding: .55rem .35rem calc(.45rem + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgba(16, 43, 89, .12);
}
.bottom-nav::before { content: ""; position: absolute; left: 0; right: 0; top: -20px; height: 20px; pointer-events: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 20' preserveAspectRatio='none'%3E%3Cpath d='M0 20V12C70 0 130 2 200 10s130 6 200-6v16z' fill='%23DCE7FF' fill-opacity='.75'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat; }
.bottom-nav a { position: relative; border-radius: 14px; min-height: 54px; }
.bottom-nav a.active { background: none; box-shadow: none; color: var(--royal-700); }
.bottom-nav a.active::after { content: ""; position: absolute; bottom: 1px; width: 1.7rem; height: 3px; border-radius: 3px; background: var(--royal-700); }
.bottom-nav a.active .nav-icon { transform: translateY(-1px) scale(1.08); }

/* ----- quick actions: one line labels ----- */
.qa-tile { font-size: clamp(.82rem, 3.7vw, .98rem); }
.qa-tile > span:nth-child(2) { white-space: nowrap; }
@media (max-width: 340px) { .qa-tile > span:nth-child(2) { white-space: normal; } }
.qa-green .qa-icon { background: linear-gradient(145deg, #17B26A, #119B58); }
.qa-blue .qa-icon { background: linear-gradient(145deg, #1559E6, #0646C8); }
.qa-amber .qa-icon { background: linear-gradient(145deg, #FFB62E, #F59E0B); }

/* ----- login + misc picks up the new palette ----- */
.login-wrap { background: radial-gradient(90% 60% at 100% 0%, rgba(61, 123, 255, .55), transparent 60%), radial-gradient(70% 50% at 0% 100%, rgba(245, 158, 11, .16), transparent 60%), linear-gradient(160deg, var(--navy-950), var(--navy-900) 60%, #0b3a9a); }
.btn-primary { background: linear-gradient(135deg, #0646C8, #2F6FF2); box-shadow: 0 6px 16px rgba(6, 70, 200, .32); }
.btn-primary:hover { background: linear-gradient(135deg, #102B59, #0646C8); }
.btn-green { background: linear-gradient(135deg, #0E8A4D, #17B26A); box-shadow: 0 6px 16px rgba(17, 155, 88, .3); }
.btn-amber { background: linear-gradient(135deg, #D98200, #F59E0B); box-shadow: 0 6px 16px rgba(245, 158, 11, .32); }

@media (min-width: 900px) {
  .fab, .bottom-nav { display: none; }
  .sidebar .brand-mark { width: 3rem; height: 3rem; }
}

/* ---------- 27. Design v3 polish (after first visual QA) ---------- */
.alert-card.alert-multi { grid-template-columns: minmax(0, 1fr); }
.alert-multi .alert-bell { position: absolute; top: .85rem; left: .9rem; width: 2.8rem; height: 2.8rem; padding: .7rem; box-shadow: 0 0 0 5px rgba(220, 48, 56, .12), 0 6px 14px rgba(220, 48, 56, .3); }
.alert-multi .alert-main h2 { min-height: 2.8rem; display: flex; align-items: center; padding-left: 3.6rem; margin-bottom: .35rem; }
.alert-multi { padding-left: .9rem; }
.alert-multi .alert-row + .alert-row { border-top: 1px dashed rgba(220, 48, 56, .25); }
.dash-meta-row { font-size: .88rem; gap: .5rem; }
.dm-item { gap: .4rem; }
.dm-item svg { width: 1.2rem; height: 1.2rem; }
.dm-sep { height: 1.3rem; }
.dm-link { width: 2.3rem; height: 2.3rem; padding: .48rem; }
.view { padding-top: .4rem; }
.hero { margin-top: 0; }
.dash-stats .stat-top { padding-right: .9rem; gap: .5rem; }
.dash-stats .stat .label { font-size: .82rem; }
.dash-stats .stat-chev { width: 1.4rem; height: 1.4rem; }
.fab { transition: transform var(--t-med) var(--ease), opacity var(--t-med), box-shadow var(--t-med); }
.fab.fab-hide { transform: translateY(90px) scale(.8); opacity: 0; pointer-events: none; }
@media (min-width: 720px) { .view { padding-top: var(--sp-6); } }
@media (min-width: 900px) { .view { padding-top: 2rem; } }

.stat-blue .sub { max-width: 84%; font-size: .78rem; }
.deco-rent { width: 3.9rem; height: 3.1rem; }

/* quick-action labels never touch the chevron */
.qa-tile { padding: .8rem .6rem; gap: .45rem; font-size: clamp(.76rem, 3.25vw, .92rem); }
.qa-icon { width: 2.1rem; height: 2.1rem; padding: .48rem; }
.qa-tile::after { width: 1.3rem; height: 1.3rem; }
@media (min-width: 720px) { .qa-tile { font-size: .95rem; } }


/* ---------- 28. Sky header (status bar blends into the header; clouds behind the hero) ---------- */
body { background: #F5F8FF; }
.topbar { padding-top: env(safe-area-inset-top); background:
    radial-gradient(70% 120% at 88% 0%, rgba(80, 140, 255, .55), transparent 60%),
    radial-gradient(60% 90% at 0% 100%, rgba(6, 70, 200, .45), transparent 62%),
    linear-gradient(180deg, #0A1D45 0, #0d2658 38%, #0f3a8f 100%); }
.topbar::before { bottom: 14px; height: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 40' preserveAspectRatio='none'%3E%3Cpath d='M0 40V24c14 0 18-10 34-10 8-9 26-9 34 0 16-1 20 10 36 10 14-12 36-12 50 0 16-2 22 8 40 8 12-10 30-10 42 0 18-2 22 8 40 8 14-9 30-9 44 0 14-3 22 8 40 8V40z' fill='%23ffffff' fill-opacity='.14'/%3E%3C/svg%3E"); }
.topbar::after { bottom: -1px; height: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 34' preserveAspectRatio='none'%3E%3Cpath d='M0 34V22c12 0 16-9 30-9 8-8 24-8 32 0 14-1 18 9 32 9 12-11 32-11 44 0 14-2 20 7 36 7 10-9 28-9 38 0 16-2 20 7 36 7 12-8 28-8 40 0 14-2 22 8 38 8 14-6 28-6 44 0V34z' fill='%23E6EFFF'/%3E%3C/svg%3E"); }
.app-main { position: relative; background: linear-gradient(180deg, #E6EFFF 0, #EEF4FF 160px, #F5F8FF 380px); }
.app-main::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 340px; pointer-events: none; z-index: 0;
  background:
    radial-gradient(70px 26px at 78% 22%, rgba(255, 255, 255, .95), transparent 72%),
    radial-gradient(54px 20px at 90% 30%, rgba(255, 255, 255, .85), transparent 72%),
    radial-gradient(90px 30px at 14% 40%, rgba(255, 255, 255, .8), transparent 72%),
    radial-gradient(60px 22px at 52% 14%, rgba(255, 255, 255, .7), transparent 72%); }
.view, .footer { position: relative; z-index: 1; }
.hero { align-items: flex-end; margin-bottom: .6rem; }
.hero-art { width: clamp(150px, 46vw, 230px); margin: -.2rem -.9rem -.5rem 0; filter: drop-shadow(0 14px 16px rgba(16, 43, 89, .22)); }
@media (min-width: 900px) { .app-main { background: linear-gradient(180deg, #EAF1FF 0, #F5F8FF 300px); } .hero-art { width: 250px; margin-right: 0; } }

/* ---------- 29. Greeting never wraps or hides under the header ---------- */
.hero { align-items: center; margin-top: .3rem; }
.hero .greeting { flex: 1 1 auto; min-width: 0; }
.hero .greeting h1 { font-size: clamp(1.4rem, 5.5vw, 2.1rem); white-space: nowrap; }
.hero .greeting p { font-size: .96rem; line-height: 1.35; }
.hero-art { width: clamp(124px, 38vw, 230px); margin: -.3rem -.8rem -.6rem 0; }
.view { padding-top: .8rem; }
@media (min-width: 720px) { .view { padding-top: var(--sp-6); } .hero .greeting h1 { font-size: 2.1rem; } }
@media (min-width: 900px) { .view { padding-top: 2rem; } }

.deco-rent { width: 3.2rem; height: 2.6rem; opacity: .55; right: .5rem; bottom: .4rem; }
.stat-blue .sub { max-width: 100%; padding-right: 2.6rem; }


/* ---------- 30. Classic header restored + compact one-line dashboard cards ---------- */
.topbar { background: radial-gradient(120% 140% at 100% 0%, rgba(80, 130, 255, .55), transparent 55%), linear-gradient(135deg, var(--navy-950), var(--navy-800) 55%, var(--royal-700));
  border-radius: 0 0 28px 28px / 0 0 22px 22px; box-shadow: 0 8px 24px rgba(11, 37, 89, .28); overflow: hidden; }
.topbar::before, .topbar::after { content: none; display: none; }
.topbar-inner { padding: .85rem 1rem 1.15rem; }
.app-main, .app-main::before { background: none; }
.app-main { background: var(--bg); }
.app-main::before { content: none; }
@media (min-width: 900px) { .app-main { background: var(--bg); } }
.hero { margin-bottom: .4rem; }
.hero-art { width: clamp(110px, 32vw, 170px); margin: 0 0 -.3rem 0; }

/* compact stat cards: label, value and sub each on one line */
.dash-stats .stat { padding: .75rem .8rem; }
.dash-stats .stat-top { gap: .45rem; padding-right: 1rem; align-items: center; }
.dash-stats .stat-icon { width: 1.8rem; height: 1.8rem; padding: .4rem; }
.dash-stats .stat .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.dash-stats .stat .value { font-size: 1.4rem; margin: .2rem 0 .1rem; white-space: nowrap; }
.dash-stats .stat-wide .value { font-size: 1.7rem; }
.dash-stats .stat .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .74rem; }
.dash-stats .stat .progress { margin: .3rem 0; }
.dash-stats .stat-chev { top: .65rem; right: .55rem; width: 1.25rem; height: 1.25rem; }
.deco-rent { width: 3rem; height: 2.4rem; opacity: .6; bottom: .3rem; }
.deco-collect { display: none; }
.dash-stats .stat-blue .sub { max-width: 100%; }
.stat-wide .stat-art { width: 4.6rem; }

/* compact critical-updates card */
.alert-card { padding: .7rem .8rem .7rem .7rem; gap: .65rem; }
.alert-bell { width: 2.7rem; height: 2.7rem; padding: .7rem; box-shadow: 0 0 0 4px rgba(220, 48, 56, .12); }
.alert-main h2 { font-size: 1rem; margin: 0; }
.alert-row { padding: .2rem 0; gap: .5rem; flex-wrap: nowrap; }
.alert-row .alert-text { font-size: .8rem; line-height: 1.3; }
.alert-row .alert-link { padding: .35rem .6rem; font-size: .75rem; white-space: nowrap; }
@media (max-width: 700px) { .alert-row .alert-text strong { display: none; } }
.dash-meta-row { margin-bottom: .6rem; }
.alert-row .alert-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.alert-row .alert-text strong { display: none; }
.alert-card { align-items: start; }
.alert-bell { margin-top: .1rem; }


/* ---------- 31. Phase 2: modal, notification rows, chips, bars ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(10, 29, 69, .55); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 1.2rem; box-shadow: 0 -10px 40px rgba(10, 29, 69, .3); }
@media (min-width: 700px) { .modal-wrap { align-items: center; padding: 1rem; } .modal { border-radius: 22px; } }
.notif-row { display: flex; justify-content: space-between; gap: .8rem; align-items: center; padding: .7rem .8rem; border-radius: 14px; border: 1px solid var(--line); margin: .5rem 0; background: #fff; }
.notif-row.unread { background: var(--royal-50); border-color: var(--blue-line); border-left: 4px solid var(--royal-700); }
.notif-row > span { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .75rem; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; font-size: .88rem; font-weight: 600; cursor: pointer; margin: 0; }
.chip input { width: auto; margin: 0; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .3rem 0; font-size: .9rem; }
.bar-track { height: .55rem; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; }
.arrears-item .owed { color: var(--red); }


/* ---------- 32. Phase 3: attachments + tenant portal ---------- */
.attach { margin: .5rem 0; }
.attach-row { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.attach-ic { width: 1.5rem; height: 1.5rem; flex: none; color: var(--royal-700); display: inline-flex; }
.attach-ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.attach-thumb { width: 3.2rem; height: 3.2rem; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); flex: none; }
.attach-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .92rem; }
.attach-actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.attach-btn { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; margin-top: .4rem; }
.attach-btn svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2.4; }
@media (max-width: 560px) { .attach-row { flex-wrap: wrap; } .attach-actions { width: 100%; justify-content: flex-start; } }
.code-box { background: var(--royal-50); border: 1px solid var(--blue-line); border-radius: 14px; padding: .8rem 1rem; margin-top: .6rem; }
.code-big { font: 800 1.5rem/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; color: var(--navy-900); }
#portal-screen { min-height: 100vh; background: var(--bg); }
.portal-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1rem; color: #fff; background: linear-gradient(135deg, var(--navy-950), var(--navy-800) 55%, var(--royal-700)); border-radius: 0 0 22px 22px; }
.portal-brand { display: flex; align-items: center; gap: .6rem; }
.portal-brand svg { width: 2.4rem; height: 2.4rem; }
.portal-brand strong { font-size: 1.2rem; display: block; line-height: 1.1; } .portal-brand em { font-style: normal; color: #F5B301; } .portal-brand span { font-size: .8rem; opacity: .8; }
.portal-main { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.portal-login { max-width: 420px; margin: 1.5rem auto; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; }
.kv span { color: var(--muted); }


/* ---------- 33. Phase 5: plans, billing, locks ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3); margin: var(--sp-3) 0; }
.plan-card { position: relative; display: flex; flex-direction: column; }
.plan-card.current { border: 2px solid var(--green); }
.plan-card.popular { border: 2px solid var(--royal-700); box-shadow: 0 10px 28px rgba(6, 70, 200, .18); }
.plan-card .pop { position: absolute; top: -.7rem; right: 1rem; }
.plan-price { font-size: 1.5rem; font-weight: 800; color: var(--navy-900); margin: .2rem 0 .6rem; }
.plan-list { list-style: none; padding: 0; margin: 0 0 1rem; flex: 1; font-size: .9rem; }
.plan-list li { padding: .25rem 0 .25rem 1.4rem; position: relative; }
.plan-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 800; }
.seg { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: .2rem; gap: .2rem; }
.seg-btn { border: 0; background: transparent; padding: .45rem .9rem; border-radius: 999px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.seg-btn.on { background: #fff; color: var(--royal-700); box-shadow: 0 2px 8px rgba(16, 43, 89, .15); }
.trial-card { background: var(--green-soft); border-color: var(--green-line); }
.lock-card { display: flex; gap: .9rem; align-items: center; background: var(--amber-soft); border-color: var(--amber-line); }
.lock-ic { width: 2.4rem; height: 2.4rem; flex: none; color: var(--amber); display: inline-flex; }
.lock-ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; }
.usage { margin: .5rem 0; }


/* ---------- 34. Phase 6: calendar, search, tenants, admin ---------- */
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head span { text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); padding: .3rem 0; }
.cal-cell { min-height: 3.6rem; border: 1px solid var(--line); border-radius: 10px; padding: .25rem .3rem; background: #fff; display: flex; flex-direction: column; gap: .2rem; }
.cal-cell.empty { border: 0; background: transparent; }
.cal-cell.today { border: 2px solid var(--royal-700); }
.cal-cell.has { background: var(--royal-50); }
.cal-day { font-size: .78rem; font-weight: 700; color: var(--ink-2); }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.cal-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--royal-500); }
.cal-paid { background: var(--green); } .cal-soon { background: var(--royal-500); } .cal-part { background: var(--orange); } .cal-late { background: var(--red); }
.cal-day-block { padding: .5rem 0; border-bottom: 1px dashed var(--line); }
.cal-item { padding: .25rem 0; }
@media (max-width: 480px) { .cal-cell { min-height: 3rem; padding: .2rem; } }
.sr-row { display: flex; flex-direction: column; gap: .1rem; padding: .55rem .2rem; border-bottom: 1px dashed var(--line); text-decoration: none; color: inherit; }
.sr-row:hover { background: var(--royal-50); }
#search-btn { margin-right: .1rem; }

/* ---------- 35. Header fits phone widths with equal side margins ---------- */
.topbar-inner { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); box-sizing: border-box; }
.brand { min-width: 0; flex: 0 1 auto; }
.brand-name { min-width: 0; }
.brand-name b, .brand-name small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { flex: none; }
@media (max-width: 520px) {
  .topbar-inner { padding-left: max(1.1rem, env(safe-area-inset-left)); padding-right: max(1.1rem, env(safe-area-inset-right)); gap: .5rem; }
  .topbar-actions { gap: .4rem; }
  .topbar .icon-btn { width: 2.6rem; height: 2.6rem; }
  .brand { font-size: 1.3rem; gap: .5rem; }
  .brand-mark { width: 2.7rem; height: 2.7rem; }
  .brand-name small { font-size: .66rem; }
}
@media (max-width: 360px) {
  .brand-name small { display: none; }
}

/* ---------- 36. Report chart scales to the screen instead of widening the page ---------- */
.chart-scroll { max-width: 100%; overflow-x: auto; }
.chart-scroll svg { display: block; width: 100%; max-width: 100%; height: auto; }

/* ---------- 37. Longer brand name (LandlordSphere) fits every phone width ---------- */
.logo { font-size: clamp(1.2rem, 6.4vw, 1.9rem); gap: .5rem; }
.logo .brand-logo { width: clamp(2.3rem, 10vw, 3rem); height: clamp(2.3rem, 10vw, 3rem); }
.brand-name b { letter-spacing: -.03em; }
@media (max-width: 520px) {
  .brand { font-size: 1.18rem; }
  .brand-mark { width: 2.5rem; height: 2.5rem; }
  .brand-name small { font-size: .62rem; }
}
@media (max-width: 420px) {
  .brand { font-size: 1.04rem; gap: .4rem; }
  .brand-mark { width: 2.25rem; height: 2.25rem; }
  .topbar-inner { gap: .4rem; }
  .topbar .icon-btn { width: 2.45rem; height: 2.45rem; }
  .topbar-actions { gap: .35rem; }
}
@media (max-width: 370px) {
  #search-btn { display: none; }   /* Search stays one tap away in the menu */
  .brand-name small { display: none; }
}
