/* ==========================================================
   Property Portal: one stylesheet for every page.
   Colours from the approved mockup.
   ========================================================== */

:root {
  --green: #0E3B2E;        /* sidebar, headings, main buttons */
  --green-2: #16503F;      /* hover on green */
  --gold: #C8892B;         /* highlights */
  --cream: #F6F4EE;        /* page background */
  --white: #FFFFFF;
  --ink: #1C2421;          /* main text */
  --muted: #6B7570;        /* secondary text */
  --line: #E4E0D6;         /* borders */
  --red: #B42318;
  --red-bg: #FEF3F2;
  --ok: #157347;
  --ok-bg: #ECF7F0;
  --blue: #1D5FA8;
  --blue-bg: #EEF4FB;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--cream);
}

a { color: var(--green); }

/* ---------- Layout: sidebar on the left, page on the right ---------- */

.layout {
  display: flex;
  min-height: 100vh;
  /* Paint the sidebar colour all the way down, even on long pages. */
  background: linear-gradient(to right, var(--green) 240px, var(--cream) 240px);
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--green);
  color: #DCE6E1;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
  padding: 0 8px 20px;
}
.brand small { display: block; font-weight: 400; font-size: 12px; color: #9DB5AA; }
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--gold);
  color: var(--green);
  display: grid; place-items: center;
  font-weight: 800;
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.sidebar nav a {
  color: #DCE6E1;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: var(--green-2); color: var(--white); }
.sidebar nav a.active {
  background: rgba(200, 137, 43, 0.16);
  border-left-color: var(--gold);
  color: var(--white);
  font-weight: 600;
}

.nav-heading {
  margin: 18px 12px 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8FAA9E;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 16px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--green);
  display: grid; place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user .who { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user button {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #DCE6E1;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}
.sidebar-user button:hover { background: var(--green-2); }

.content {
  flex: 1;
  min-width: 0;
  padding: 28px 36px 48px;
  max-width: 1200px;
}
.content.signed-out { margin: 0 auto; max-width: 460px; padding-top: 60px; }

/* Phones and small tablets: the sidebar becomes a bar on top. */
@media (max-width: 800px) {
  .layout { flex-direction: column; background: var(--cream); }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .nav-heading { width: 100%; margin-top: 10px; }
  .content { padding: 20px 16px 40px; }
  /* Wide tables scroll sideways instead of squashing. */
  table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ---------- Text ---------- */

h1 { margin: 0 0 16px; font-size: 26px; color: var(--green); }
h2 { margin: 28px 0 10px; font-size: 18px; color: var(--green); }
.muted { color: var(--muted); }
.warning { color: var(--red); font-weight: 600; }

.back { display: inline-block; margin-bottom: 8px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--green); }

.message {
  background: var(--ok-bg);
  border: 1px solid #B7E1C6;
  color: var(--ok);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin: 0 0 16px;
}

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
th, td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #FBFAF6;
  font-weight: 600;
}
tbody tr:hover td { background: #FCFBF8; }

/* A two-column "label: value" table, e.g. the lease review and receipts. */
table.summary th { width: 38%; text-transform: none; letter-spacing: 0; font-size: 14px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  background: var(--green);
  color: var(--white);
  border: 1px solid var(--green);
  padding: 9px 16px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--green-2); }
.btn.secondary { background: var(--white); color: var(--green); border-color: var(--line); }
.btn.secondary:hover { background: #F1EFE8; }

/* ---------- Forms ---------- */

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 16px 0;
  max-width: 640px;
}
.card > div { margin-bottom: 14px; }
/* No big gap above the first heading or paragraph in a card. */
.card > :first-child,
.card > input[type=hidden]:first-child + * { margin-top: 0; }

/* Radio-button groups (e.g. Fixed term / Month-to-month). */
fieldset { border: none; padding: 0; margin: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 4px; }

label { display: block; font-weight: 600; margin-bottom: 4px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=month], input[type=tel], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #CFCAC0;
  border-radius: 8px;
  font: inherit;
  background: var(--white);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(200, 137, 43, 0.45);
  border-color: var(--gold);
}

/* Radio buttons and checkbox lists: label next to the box, not above it. */
.card div div label, .card ul label { display: flex; align-items: center; gap: 8px; font-weight: 400; }

.helptext { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }

.errorlist {
  color: var(--red);
  background: var(--red-bg);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 0 8px;
  list-style: none;
}

.actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; }

/* Phone number with the country flag (Add tenant). */
.phone-row { display: flex; gap: 8px; align-items: center; }
.flag { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }

/* ---------- Lease wizard step bar ---------- */

.steps {
  display: flex;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  flex-wrap: wrap;
}
.steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.steps li span {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px;
  background: #ECE8DE;
}
.steps li a { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.steps li.current { background: var(--green); border-color: var(--green); color: var(--white); font-weight: 600; }
.steps li.current span { background: var(--gold); color: var(--green); }
.steps li.done { color: var(--green); }
.steps li.done span { background: var(--ok-bg); color: var(--ok); }

/* ---------- Printing: only the page content ---------- */

@media print {
  .sidebar, .no-print, .message { display: none !important; }
  body, .layout { background: var(--white); }
  .content { padding: 0; }
}

/* ---------- Overview dashboard ---------- */

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.filters { display: flex; gap: 8px; }
.filters select { width: auto; min-width: 180px; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.tile {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
  text-decoration: none; color: var(--ink);
}
a.tile:hover { border-color: var(--gold); }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { font-size: 24px; font-weight: 700; color: var(--green); }
.tile-note { font-size: 13px; color: var(--muted); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.panel h2 { margin: 0 0 12px; font-size: 15px; }
.small { font-size: 13px; }
.good { color: var(--ok); font-weight: 600; white-space: nowrap; }
.bad { color: var(--red); font-weight: 600; white-space: nowrap; }
.tile-value.bad { color: var(--red); }

/* Chart colours (checked for colour-blind readers; values are always labelled too). */
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.swatch.occupied, .swatch.collected { background: #1A7F5A; }
.swatch.vacant { background: #E4E0D6; }
.swatch.charged { background: #C8892B; }

.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.legend.inline { flex-direction: row; gap: 16px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }

.donut-row { display: flex; align-items: center; gap: 28px; }
.donut { width: 150px; height: 150px; transform: rotate(-90deg); }
.donut-track { fill: none; stroke: #E4E0D6; stroke-width: 5; }
.donut-fill { fill: none; stroke: #1A7F5A; stroke-width: 5; }
.donut-text { transform: rotate(90deg); transform-origin: 21px 21px; font-size: 6px; font-weight: 700; fill: var(--green); }

.rows { list-style: none; padding: 0; margin: 0; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: none; }
.rows li > div { display: flex; flex-direction: column; min-width: 0; }

.bars { display: flex; justify-content: space-around; align-items: flex-end; height: 140px; border-bottom: 1px solid var(--line); padding: 0 8px; }
.bar-group { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; position: relative; }
.bar-pair { display: flex; gap: 2px; align-items: flex-end; height: 100%; }
.bar { width: 22px; border-radius: 4px 4px 0 0; min-height: 1px; }
.bar.charged { background: #C8892B; }
.bar.collected { background: #1A7F5A; }
.bar-label { position: absolute; bottom: -22px; font-size: 12px; color: var(--muted); white-space: nowrap; }
table.mini { margin-top: 30px; font-size: 13px; border: none; }
table.mini th, table.mini td { padding: 4px 8px; text-align: right; border-bottom: none; background: none; }
table.mini td:first-child { text-align: left; color: var(--muted); }

.aging { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.aging li { display: grid; grid-template-columns: 100px 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.aging-label { color: var(--muted); font-size: 13px; }
.aging-track { background: #F1EFE8; border-radius: 4px; height: 10px; }
.aging-bar { display: block; height: 10px; border-radius: 4px; background: #1A7F5A; }
.aging-value { font-weight: 600; white-space: nowrap; }

@media (max-width: 1000px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .grid { grid-template-columns: 1fr; }
}

/* ---------- Lists, tabs and status pills (Properties) ---------- */

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=search] {
  width: 300px; padding: 9px 11px; border: 1px solid #CFCAC0; border-radius: 8px; font: inherit; background: var(--white);
}
.toolbar select { width: auto; }

table.list td { vertical-align: middle; }
tr.clickable { cursor: pointer; }

.with-thumb { display: flex; align-items: center; gap: 12px; }
.with-thumb > div { display: flex; flex-direction: column; }
.thumb { width: 52px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.thumb.placeholder { display: grid; place-items: center; background: #E9E5DA; color: var(--green); font-weight: 700; }
.thumb.big { width: 64px; height: 64px; border-radius: 10px; font-size: 24px; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: "●"; margin-right: 5px; font-size: 9px; vertical-align: 1px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--red-bg); color: var(--red); }
.pill.gold { background: #FBF3E6; color: #8A5A12; }
.pill.blue { background: var(--blue-bg); color: var(--blue); }
.pill.grey { background: #EFEDE7; color: var(--muted); }

.crumbs { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--green); }

.prop-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.prop-head h1 { margin: 0; }
.prop-head p { margin: 4px 0 0; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0 18px; overflow-x: auto; }
.tabs a {
  padding: 10px 14px; color: var(--muted); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--green); }
.tabs a.active { color: var(--green); font-weight: 600; border-bottom-color: var(--gold); }

.tab-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.photo { max-width: 100%; border-radius: 8px; display: block; }

/* ---------- Settings: label on the left, box on the right ---------- */

.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px 0 18px; }
.subtabs span { padding: 8px 12px; font-size: 14px; color: var(--muted); }
.subtabs span.active { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--green); margin-bottom: -1px; }

.settings { max-width: 720px; }
.settings h2 { margin: 0 0 10px; font-size: 15px; }
.settings-card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 4px 20px; }
.settings-row {
  display: grid; grid-template-columns: 1fr 1.2fr; gap: 16px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.settings-row:last-child { border-bottom: none; }
.settings-row > label { margin: 0; }
.settings-input .helptext { margin-top: 4px; }
.settings-input .errorlist { margin: 6px 0 0; }
.settings-input input[type=checkbox] { width: 18px; height: 18px; }
.settings-input select:disabled { background: #F4F2EC; color: var(--muted); }

@media (max-width: 600px) {
  .settings-row { grid-template-columns: 1fr; gap: 6px; }
}

/* ---------- Rent collection ---------- */

.panel.wide { grid-column: 1 / -1; }

.status-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; border-radius: 8px; overflow: hidden; }
.status-step { display: flex; flex-direction: column; align-items: center; padding: 14px 6px; text-align: center; font-size: 13px; }
.status-step strong { font-size: 20px; }
.status-step small { font-size: 12px; }
.status-step.ok { background: var(--ok-bg); color: var(--ok); }
.status-step.bad { background: var(--red-bg); color: var(--red); }
.status-step.gold { background: #FBF3E6; color: #8A5A12; }
.status-step.grey { background: #EFEDE7; color: var(--muted); }

/* Debt aging: one bar split by age. Light = recent, dark = old. */
.stack { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; margin-bottom: 14px; }
.stack-seg { display: block; height: 100%; }
.age1 { background: #F1D9B0; }
.age2 { background: #E3B571; }
.age3 { background: #C8892B; }
.age4 { background: #8A5A12; }
.legend-row { display: flex; justify-content: space-between; gap: 10px; }

@media (max-width: 800px) {
  .status-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Tenants tab ---------- */

.initials {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  background: #E9E5DA; color: var(--green); font-size: 12px; font-weight: 700;
}
th.num, td.num { text-align: right; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 6px; }

/* ---------- Leases tab ---------- */

.block { display: block; }
.pill.dark { background: #E3E0D8; color: #3D4440; }
/* Wide tables: keep each value on one line and scroll sideways if needed. */
.table-scroll { overflow-x: auto; border-radius: var(--radius); }
table.nowrap td, table.nowrap th { white-space: nowrap; padding-left: 10px; padding-right: 10px; }

/* ---------- End lease ---------- */

.btn.danger { background: var(--red); border-color: var(--red); }
.btn.danger:hover { background: #8F1C13; }
.row-actions { display: flex; gap: 14px; align-items: center; }
.end-link { color: var(--red); }

/* ---------- Tenant page ---------- */

.initials.big { width: 56px; height: 56px; font-size: 18px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--white); color: var(--ink); text-decoration: none; font-size: 14px;
}
a.chip:hover { border-color: var(--gold); }
.chip.bad { color: var(--red); border-color: #F3C9C4; background: var(--red-bg); }
.chip.good { color: var(--ok); border-color: #B7E1C6; background: var(--ok-bg); }

/* ---------- Transactions tab buttons ---------- */

.tab-head.between { justify-content: space-between; flex-wrap: wrap; }
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Pop-up windows (Post charge, Receive payment) ---------- */

dialog.modal {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: none;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  background: var(--white);
  color: var(--ink);
}
dialog.modal::backdrop { background: rgba(14, 59, 46, 0.55); }
dialog.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }

.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 18px 24px 12px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 16px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--green); }
.modal-head p { margin: 4px 0 0; }
.modal-x {
  border: none; background: none; font-size: 26px; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 0 4px;
}
.modal-x:hover { color: var(--ink); }

.modal-body { padding: 18px 24px; overflow-y: auto; }
.modal-body input, .modal-body select { height: 42px; }
.modal-row { display: grid; gap: 14px; margin-bottom: 14px; align-items: end; }
.modal-row.cols-2 { grid-template-columns: 1fr 1fr; }
.modal-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* The charge line: Category | Description | Amount, in a light box like DoorLoop. */
.line-item {
  display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 14px;
  border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #FBFAF7;
  align-items: end;
}

.modal-total { text-align: right; margin-top: 18px; }
.modal-total span { display: block; font-size: 14px; font-weight: 600; }
.modal-total strong {
  display: inline-block; font-size: 30px; font-weight: 500; color: var(--ink);
  border-bottom: 2px solid var(--ink); padding-bottom: 2px; min-width: 180px;
}

.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 24px; border-top: 1px solid var(--line); background: #FBFAF7;
}

.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--white); }
.btn.gold:hover { background: #A9711F; }

@media (max-width: 640px) {
  .modal-row.cols-2, .modal-row.cols-3, .line-item { grid-template-columns: 1fr; }
}

/* ---------- "Create new" button and window ---------- */

.create-new-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; margin: 0 0 18px; padding: 10px 12px;
  background: var(--gold); color: var(--white); border: none; border-radius: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
}
.create-new-btn:hover { background: #A9711F; }
.create-new-btn kbd {
  font: 11px system-ui, sans-serif; background: rgba(255, 255, 255, 0.2);
  border-radius: 4px; padding: 2px 6px;
}

dialog.cn { width: min(620px, calc(100vw - 32px)); margin-top: 10vh; }
.cn-head {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.cn-title { font-size: 17px; color: var(--green); white-space: nowrap; }
.cn-head .cn-search {
  flex: 1; border: none; outline: none; font-size: 15px; padding: 6px 4px; background: none;
}
.cn-head .cn-search:focus { outline: none; }
.cn-step { padding: 10px 12px 14px; max-height: 60vh; overflow-y: auto; }
.cn-group + .cn-group { margin-top: 8px; }
.cn-group-title {
  margin: 8px 8px 4px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
}
.cn-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: none; border-radius: 8px; background: none;
  font: inherit; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer;
}
.cn-item:hover, .cn-item.on { background: #F1EFE8; color: var(--ink); }
.cn-item.on { outline: 2px solid rgba(200, 137, 43, 0.45); }
.cn-item[hidden], .cn-group[hidden] { display: none; }
.cn-back {
  border: none; background: none; color: var(--green); font: inherit;
  font-size: 14px; cursor: pointer; padding: 4px 8px;
}
.cn-tenant .initials { flex: none; }
.cn-who { flex: 1; min-width: 0; }
.cn-who strong { display: block; }
.cn-who small { display: block; color: var(--muted); font-size: 13px; }
.cn-money { font-size: 13px; font-weight: 600; white-space: nowrap; }
.cn-empty { padding: 8px 12px; margin: 0; }

/* ---------- Countdowns: late (red), due soon (amber), paid ahead (green) ---------- */

:root { --amber: #B45309; --amber-bg: #FEF6E7; }
.countdown { font-weight: 600; font-size: 14px; white-space: nowrap; }
.countdown.bad { color: var(--red); }
.countdown.warn { color: var(--amber); }
.countdown.good { color: var(--ok); }
.warn { color: var(--amber); }
.chip.warn { color: var(--amber); background: var(--amber-bg); border-color: #F5D9A8; }
.due-right { text-align: right; }
.due-right .muted { display: block; }

/* ---------- Reports ---------- */

.report-group {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 18px; overflow: hidden;
}
.report-group h2 {
  margin: 0; padding: 14px 18px; font-size: 17px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.report-group .count {
  font-size: 12px; font-weight: 600; color: var(--muted); background: #F1EFE8;
  border-radius: 10px; padding: 1px 8px;
}
.report-link {
  display: flex; gap: 14px; align-items: center; padding: 12px 18px;
  color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line);
}
.report-link:last-child { border-bottom: none; }
.report-link:hover { background: #FBFAF7; }
.report-link strong { color: var(--green); }
.report-icon {
  width: 34px; height: 34px; border-radius: 8px; background: #EEF4FB; color: var(--blue);
  display: grid; place-items: center; flex: none;
}

.report-filters { flex-wrap: wrap; align-items: flex-end; }
.report-filters label { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0; }
.report-filters label select, .report-filters label input { display: block; margin-top: 4px; min-width: 160px; }
.presets { display: flex; gap: 14px; margin: -6px 0 16px; font-size: 14px; }

.report-table td { white-space: nowrap; }
.report-table td.muted { color: var(--muted); }
.report-table .section-row td {
  background: #F6F4EE; font-weight: 700; color: var(--green);
  text-transform: uppercase; font-size: 12px; letter-spacing: 0.05em;
}
.report-table .total-row td { font-weight: 700; border-top: 2px solid var(--ink); }
.report-table td.bad { color: var(--red); }
.report-table td.good { color: var(--ok); }
.report-table td.warn { color: var(--amber); }
.report-note { margin: 12px 0 0; font-size: 14px; }
.report-note.good { color: var(--ok); font-weight: 600; }
.report-note.bad { color: var(--red); font-weight: 600; }
.print-only { display: none; }
@media print {
  .print-only { display: block; }
  .table-scroll { overflow: visible; }
  .report-table { font-size: 12px; }
}

/* ---------- Vendors and expenses ---------- */

/* Pop-up with a side menu (New vendor) */
dialog.side-modal { width: min(940px, calc(100vw - 32px)); }
.side-modal-body { display: grid; grid-template-columns: 220px 1fr; min-height: 440px; max-height: calc(100vh - 130px); }
.side-nav { background: #FBFAF7; border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.side-nav h2 { font-size: 18px; margin: 0 8px 12px; color: var(--green); }
.side-nav button {
  text-align: left; border: none; background: none; font: inherit; font-size: 14px;
  padding: 9px 10px; border-radius: 8px; color: var(--ink); cursor: pointer;
}
.side-nav button:hover { background: #F1EFE8; }
.side-nav button.on { background: var(--white); box-shadow: 0 0 0 1px var(--line); font-weight: 600; color: var(--green); }
.side-main { position: relative; padding: 18px 24px; overflow-y: auto; }
.side-main .modal-x { position: absolute; top: 12px; right: 14px; }
.side-main h3 { margin: 0 0 14px; text-transform: uppercase; letter-spacing: 0.04em; font-size: 15px; color: var(--green); }
.modal-row.check { display: flex; align-items: center; gap: 8px; }
.modal-row.check label { margin: 0; }
.kind-cards ul, .kind-cards div > div { display: flex; gap: 12px; list-style: none; padding: 0; margin: 0; }
.kind-cards label { font-weight: 400; display: flex; gap: 8px; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.kind-cards label:has(input:checked) { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }

/* New expense pop-up */
dialog.modal.wide { width: min(1080px, calc(100vw - 32px)); }
.modal-row.cols-payee { grid-template-columns: 2fr 1fr; }
.balance-box { background: #EEF1EC; border-radius: 8px; padding: 8px 12px; align-self: end; height: 42px;
  display: flex; flex-direction: column; justify-content: center; }
.balance-box span { font-size: 12px; line-height: 1; }
.balance-box strong { font-size: 14px; }
.balance-box strong.bad { color: var(--red); }
.expense-lines { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #FBFAF7; margin: 6px 0 12px; }
.expense-line { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr 1.5fr 1fr 36px; gap: 10px; align-items: start; padding: 6px 0; }
.expense-line.head { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding-bottom: 0; }
.expense-line .errorlist { margin: 4px 0 0; padding: 4px 8px; font-size: 13px; }
.expense-line .num { text-align: right; }
.icon-btn { border: none; background: none; cursor: pointer; font-size: 17px; padding: 8px 6px; opacity: 0.6; }
.icon-btn:hover { opacity: 1; }

/* Lists and pages */
tr.voided td { color: var(--muted); text-decoration: line-through; }
tr.voided td .pill { text-decoration: none; }
.prop-head.between { justify-content: space-between; align-items: flex-start; }
dl.pairs { display: grid; grid-template-columns: 140px 1fr; gap: 6px 16px; margin: 0; }
dl.pairs dt { color: var(--muted); }
dl.pairs dd { margin: 0; }

@media (max-width: 760px) {
  .side-modal-body { grid-template-columns: 1fr; }
  .side-nav { flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--line); }
  .expense-line { grid-template-columns: 1fr 1fr; }
  .expense-line.head { display: none; }
}
.toolbar input[type=month] { width: auto; }
.expense-table td:nth-child(1), .expense-table td:nth-child(2), .expense-table td.num { white-space: nowrap; }

/* ---------- Automatic rent note on the Overview ---------- */
.auto-note { margin: -8px 0 16px; }

/* ---------- Opening balances ---------- */
.opening-money .modal-row { margin-top: 12px; }
table.list td input[type=number] { width: 140px; text-align: right; }

/* ---------- English / Français switch ---------- */
.lang-switch { margin: 8px 0 10px; }
.lang-switch label { display: flex; align-items: center; gap: 10px; cursor: pointer; color: #CFE0D8; font-weight: 500; font-size: 14px; margin: 0; }
.lang-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lang-switch .switch { width: 36px; height: 20px; border-radius: 10px; background: #2B5A4B; position: relative; transition: background .15s; flex: none; }
.lang-switch .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.lang-switch input:checked + .switch { background: var(--gold); }
.lang-switch input:checked + .switch::after { left: 18px; }
.lang-switch input:focus-visible + .switch { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Files ---------- */
.file-title { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.file-title:hover strong { text-decoration: underline; }
.file-icon { flex: none; width: 40px; height: 44px; border-radius: 6px; background: #EEF1EC; color: var(--muted);
  font-size: 10px; font-weight: 700; display: grid; place-items: center; letter-spacing: .03em; }
.file-icon.pdf { background: #FDECEA; color: #B42318; }
.file-icon.img { background: #EAF2FB; color: var(--blue); }
.file-icon.doc { background: #EAF0FB; color: #2B4C9B; }
.file-icon.xls { background: #E9F6EE; color: var(--ok); }
.file-desc { max-width: 320px; }
.file-table td.nowrap { white-space: nowrap; }
.small-initials { width: 26px; height: 26px; font-size: 11px; display: inline-grid; vertical-align: middle; margin-right: 4px; }
.pill.cat-land, .pill.cat-deed { background: #FEF6E7; color: #8A4B08; }
.pill.cat-contract, .pill.cat-lease { background: var(--blue-bg); color: var(--blue); }
.check-field { display: flex; gap: 10px; align-items: flex-start; padding-top: 22px; }
.check-field input { margin-top: 4px; }
.check-field label { margin: 0; }
.file-search { min-width: 280px; }
.date-range { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.date-range input { width: auto; }
.toolbar { flex-wrap: wrap; }
