/* Anso Holdings — Rental Portal. Minimal, mobile-first, no framework.
   Clean SaaS dashboard style: white cards, soft shadows, navy + orange. */
:root {
  --navy: #001c34;
  --navy-2: #0a2c4d;
  --orange: #f86820;
  --orange-dark: #d9550f;
  --orange-soft: #fff2ea;
  --ink: #1a2433;
  --muted: #6b7686;
  --line: #e6e9ee;
  --bg: #f4f6f9;
  --card: #ffffff;
  --green: #1d7a4d;
  --green-soft: #e3f3e9;
  --red: #b3261e;
  --red-soft: #fdecea;
  --amber: #8a6100;
  --amber-soft: #fff4d6;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0, 28, 52, .05), 0 1px 3px rgba(0, 28, 52, .06);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: Montserrat, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--navy); }
img { max-width: 100%; }

/* ---------- Brand mark ---------- */
.mark {
  display: inline-block; background: var(--navy); color: #fff; font-weight: 800;
  font-size: 20px; padding: 6px 12px; border-radius: 10px; letter-spacing: .2px;
}
.mark em { font-style: normal; color: var(--orange); }

/* ---------- Top bar ---------- */
.topbar {
  background: #fff;
  color: var(--ink);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 800; font-size: 17px; letter-spacing: .2px; white-space: nowrap; color: var(--navy); display: flex; align-items: center; gap: 10px; }
.topbar .brand small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.lang-switch { display: flex; gap: 4px; }
.lang-switch a {
  color: var(--navy); text-decoration: none; font-size: 13px; font-weight: 700;
  padding: 6px 10px; border-radius: 999px; border: 1px solid #cdd3dc; background: #fff;
}
.lang-switch a.active { background: var(--orange); border-color: var(--orange); color: #fff; }
.topbar .user-chip { display: none; font-size: 13px; font-weight: 700; color: var(--navy); }

/* Top search (real global search, desktop + mobile) */
.top-search { position: relative; flex: 1; max-width: 460px; min-width: 140px; }
.top-search .ic {
  position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 16px; pointer-events: none;
}
.top-search input {
  width: 100%; min-height: 42px; padding: 9px 12px; padding-inline-start: 36px;
  font-size: 14.5px; font-family: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
}
.top-search input:focus { outline: 2px solid var(--orange); outline-offset: 1px; border-color: var(--orange); background: #fff; }

/* ---------- Layout ---------- */
.shell { min-height: calc(100vh - 62px); }
.sidebar { display: none; }
.main { padding: 16px 16px 96px; max-width: 1240px; margin: 0 auto; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.page-head h1 { font-size: 22px; margin: 0; color: var(--navy); }
.page-sub { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

/* ---------- Sidebar (desktop) ---------- */
@media (min-width: 900px) {
  .shell.has-sidebar { display: grid; grid-template-columns: 248px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; background: #fff; border-inline-end: 1px solid var(--line);
    padding: 18px 12px 12px; position: sticky; top: 62px; height: calc(100vh - 62px);
  }
  /* Guest pages (e.g. login) have no sidebar: centre the content instead
     of squeezing it into the empty sidebar column. */
  .shell:not(.has-sidebar) .main { display: flex; flex-direction: column; justify-content: center; }
  .shell:not(.has-sidebar) .login-wrap { margin-top: 0; }
  .side-brand { padding: 2px 10px 16px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
  .side-brand small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
  .side-nav { flex: 1; }
  .side-nav a {
    display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 10px;
    text-decoration: none; color: #33415c; font-weight: 600; font-size: 15px; margin-bottom: 2px;
  }
  .side-nav a .nav-ic { width: 20px; text-align: center; font-size: 16px; color: var(--muted); flex: none; }
  .side-nav a.active, .side-nav a:hover { background: var(--orange-soft); color: var(--orange-dark); }
  .side-nav a.active .nav-ic, .side-nav a:hover .nav-ic { color: var(--orange-dark); }
  .side-user {
    display: flex; align-items: center; gap: 10px; padding: 12px 10px 4px;
    border-top: 1px solid var(--line); margin-top: 16px;
  }
  .side-user .avatar {
    width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--navy);
    color: #fff; font-weight: 800; font-size: 16px; display: grid; place-items: center;
  }
  .side-user .who { min-width: 0; }
  .side-user .who b { display: block; font-size: 14px; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-user .who small { display: block; font-size: 12px; color: var(--muted); }
  .main { padding: 24px 28px 48px; }
  .topbar .user-chip { display: inline; }
  .brand-mobile { display: none; }
}

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottomnav a {
  flex: 1 1 0; min-width: 0; text-align: center; text-decoration: none; color: var(--muted);
  font-size: 11px; font-weight: 700; padding: 6px 2px; border-radius: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25;
}
.bottomnav a.active { color: var(--orange-dark); }
.bottomnav a span { display: block; font-size: 18px; line-height: 1.1; }
@media (min-width: 900px) { .bottomnav { display: none; } }

/* ---------- Cards / KPI ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h2 { font-size: 17px; margin: 0 0 12px; color: var(--navy); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head .card-sub { margin-top: 2px; }
.card-sub { color: var(--muted); font-size: 13.5px; }
.card-link { font-size: 13.5px; font-weight: 700; white-space: nowrap; text-decoration: none; }
.card-link:hover { text-decoration: underline; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(5, 1fr); } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; box-shadow: var(--shadow); }
.kpi-top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; min-width: 0; }
.kpi-icon {
  width: 32px; height: 32px; flex: none; border-radius: 9px; background: var(--orange-soft);
  color: var(--orange-dark); display: grid; place-items: center; font-size: 16px; font-weight: 800;
}
.kpi .label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; overflow-wrap: break-word; }
.kpi .value { font-size: clamp(20px, 2.4vw, 26px); font-weight: 800; color: var(--navy); margin-top: 2px; overflow-wrap: anywhere; }
.kpi .value.orange { color: var(--orange-dark); }
.kpi .value.green { color: var(--green); }
.kpi-delta { margin-top: 8px; font-size: 13px; font-weight: 700; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kpi-delta .pill { padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.kpi-delta.up .pill { background: var(--green-soft); color: var(--green); }
.kpi-delta.down .pill { background: var(--red-soft); color: var(--red); }
.kpi-delta.flat .pill { background: #eef1f5; color: var(--muted); }
.kpi-delta > span:last-child { color: var(--muted); font-weight: 600; font-size: 12.5px; }

/* ---------- Dashboard grids ---------- */
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; }
.dash-head h1 { font-size: 24px; margin: 0; color: var(--navy); }
.dash-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.dash-grid .card { margin-bottom: 0; }
.dash-grid.cols-2-1, .dash-grid.cols-2, .dash-grid.cols-3 { grid-template-columns: 1fr; }
@media (min-width: 700px) {
  .dash-grid.cols-2 { grid-template-columns: 1fr 1fr; }
  .dash-grid.cols-3 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) { .dash-grid.cols-2-1 { grid-template-columns: 2fr 1fr; } }
@media (min-width: 1100px) { .dash-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Charts (server-rendered SVG / CSS, no JS) ---------- */
.legend { display: flex; gap: 16px; font-size: 13px; font-weight: 600; color: var(--muted); flex-wrap: wrap; }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-inline-end: 6px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: inherit; }
.chart-grid-label { font-size: 11px; fill: var(--muted); }
.chart-month-label { font-size: 11.5px; fill: var(--muted); font-weight: 700; }

.donut-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.donut-total { font-size: 15px; font-weight: 800; fill: var(--navy); }
.donut-sub { font-size: 11px; fill: var(--muted); }
.donut-legend { flex: 1; min-width: 160px; list-style: none; margin: 0; padding: 0; }
.donut-legend li { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.donut-legend li:last-child { border-bottom: 0; }
.donut-legend .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.donut-legend .pct { margin-inline-start: auto; font-weight: 800; color: var(--navy); }

.bars { display: flex; gap: 10px; align-items: stretch; height: 208px; padding-top: 6px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.bar .val { font-size: 12px; font-weight: 800; color: var(--navy); white-space: nowrap; }
.bar .fill { height: 148px; width: 100%; max-width: 46px; display: flex; align-items: flex-end; margin: 6px 0; }
.bar i { display: block; width: 100%; height: var(--h, 0%); border-radius: 8px 8px 3px 3px; background: #d7e0ea; min-height: 4px; }
.bar.cur i { background: var(--orange); }
.bar .mon { font-size: 12px; color: var(--muted); font-weight: 700; }

/* ---------- Top list / insights ---------- */
.top-list { list-style: none; margin: 0; padding: 0; }
.top-list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.top-list li:last-child { border-bottom: 0; padding-bottom: 2px; }
.top-list .row { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; }
.top-list .row .pct { color: var(--navy); }
.top-list .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.meter { height: 8px; border-radius: 999px; background: #eef1f5; margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--orange); border-radius: 999px; }

.insight { display: flex; gap: 12px; padding: 12px; background: var(--bg); border-radius: 12px; margin-bottom: 10px; }
.insight .ic {
  width: 34px; height: 34px; flex: none; border-radius: 9px; background: #fff;
  border: 1px solid var(--line); display: grid; place-items: center; font-size: 16px; color: var(--navy);
}
.insight b { display: block; font-size: 14px; color: var(--navy); }
.insight p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.insight p a { font-weight: 700; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 560px; }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfc; }
.num { text-align: end; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 800; background: #fafbfc; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px;
  border-radius: 999px; background: #eef1f5; color: var(--navy); white-space: nowrap;
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.orange { background: var(--orange-soft); color: var(--orange-dark); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 11px 12px; font-size: 16px; font-family: inherit;
  border: 1px solid #cdd3dc; border-radius: 10px; background: #fff; color: var(--ink);
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; border-color: var(--orange); }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.form-grid { display: grid; gap: 0 16px; }
@media (min-width: 700px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
.error { color: var(--red); font-size: 13.5px; margin-top: 4px; }
.errors { background: var(--red-soft); border: 1px solid #f5c6c2; color: var(--red); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; min-height: 48px; padding: 12px 20px; border: 0; border-radius: 10px;
  background: var(--orange); color: #fff; font-weight: 800; font-size: 15px; font-family: inherit;
  text-decoration: none; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--orange-dark); }
.btn-block { display: block; width: 100%; }
.btn-ghost { background: #fff; color: var(--navy); border: 1px solid #cdd3dc; }
.btn-ghost:hover { background: #f1f3f6; }
.btn-navy { background: var(--navy); }
.btn-navy:hover { background: var(--navy-2); }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #f0b8b4; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: 13.5px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.link-danger { color: var(--red); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }

/* ---------- Flash / misc ---------- */
.flash { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; }
.flash.success { background: var(--green-soft); color: var(--green); }
.flash.error { background: var(--red-soft); color: var(--red); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.mt { margin-top: 16px; }
.login-wrap { max-width: 420px; margin: 48px auto 0; }
.login-wrap .logo { text-align: center; margin-bottom: 20px; }
.login-wrap .logo .mark { font-size: 26px; padding: 10px 18px; border-radius: 12px; }
.inline-form { display: inline; }
.alert-strip { background: var(--amber-soft); border: 1px solid #f0dfae; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 14.5px; }
.alert-strip b { color: #6b4d00; }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.alert-list li:last-child { border-bottom: 0; }
.alert-strip .alert-list li { border-bottom-color: #ecd9a0; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 15px; }
.kv dt { color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; }
.result-list { list-style: none; margin: 0; padding: 0; }
.result-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.result-list li:last-child { border-bottom: 0; }
.result-list a { font-weight: 700; text-decoration: none; }
.result-list a:hover { text-decoration: underline; }

/* ---------- Responsive fixes ---------- */
.page-head h1, .card h2 { overflow-wrap: break-word; }
.login-wrap { width: 100%; }

/* Small phones: search drops to its own row; top bar wraps instead of overflowing. */
@media (max-width: 560px) {
  .top-search { order: 5; flex-basis: 100%; max-width: none; }
}
@media (max-width: 400px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; padding: 10px 12px; }
  .topbar .brand { font-size: 15px; }
  .topbar .brand small { font-size: 10px; }
  .lang-switch a { padding: 6px 8px; font-size: 12px; }
}

/* Phones: stack action rows and filter forms full-width; let tables
   scroll edge-to-edge inside their cards. */
@media (max-width: 699px) {
  .btn-row { flex-direction: column; align-items: stretch; }
  .btn-row .btn { width: 100%; }
  .card > .table-wrap { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }
}

/* Narrow screens: stack definition lists instead of squeezing them. */
@media (max-width: 560px) {
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
}

@media print {
  .topbar, .sidebar, .bottomnav, .no-print { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; max-width: none; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}
