/* ═══════════════════════════════════════════
   NestOS – Premium Dark Property Manager
   ═══════════════════════════════════════════ */

:root {
  --bg: #0E0F11;
  --bg2: #16181C;
  --bg3: #1E2027;
  --bg4: #252830;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text1: #F0F0F0;
  --text2: #9EA3AE;
  --text3: #5C6170;
  --accent: #E8FF6B;
  --accent-dim: rgba(232,255,107,0.12);
  --blue: #4D9CF8;
  --blue-bg: rgba(77,156,248,0.1);
  --green: #4FC88A;
  --green-bg: rgba(79,200,138,0.1);
  --amber: #F5A623;
  --amber-bg: rgba(245,166,35,0.1);
  --red: #F56565;
  --red-bg: rgba(245,101,101,0.1);
  --purple: #A78BFA;
  --purple-bg: rgba(167,139,250,0.1);
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --sidebar-w: 220px;
  --topbar-h: 56px;
  --font: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Syne', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text1); line-height: 1.5; min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; font-size: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── APP SHELL ─────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ─────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .25s ease, width .25s ease;
  z-index: 100;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar.collapsed { transform: translateX(-100%); position: fixed; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.brand-name { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text1); letter-spacing: -0.3px; }
.brand-sub { font-size: 11px; color: var(--text3); margin-top: 1px; }

.nav-group { padding: 12px 10px 4px; }
.nav-group.nav-bottom { margin-top: auto; padding-top: 6px; }
.nav-label { font-size: 10px; font-weight: 600; color: var(--text3); letter-spacing: .8px; text-transform: uppercase; padding: 0 8px 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text2);
  font-size: 13px;
  font-weight: 400;
  transition: all .15s ease;
  margin-bottom: 1px;
}
.nav-item:hover { color: var(--text1); background: var(--bg3); }
.nav-item.active { color: var(--accent); background: var(--accent-dim); font-weight: 500; }
.nav-icon { flex-shrink: 0; opacity: 0.7; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-item:hover .nav-icon { opacity: 0.9; }

.sidebar-sync {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
  font-size: 11px;
  color: var(--text3);
  border-top: 1px solid var(--border);
  margin-top: 10px;
}
.sync-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  flex-shrink: 0;
}
.sync-dot.saving { background: var(--amber); box-shadow: 0 0 6px var(--amber); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .4 } }

/* ── MAIN WRAP ─────────────────────── */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── TOPBAR ─────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 50;
}
.topbar-l { display: flex; align-items: center; gap: 12px; }
.topbar-r { display: flex; align-items: center; gap: 10px; }

.menu-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: var(--text2);
  transition: all .15s;
}
.menu-btn:hover { background: var(--bg3); color: var(--text1); }

.page-ttl { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--text1); letter-spacing: -0.4px; }

.srch-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  height: 34px;
  color: var(--text3);
  transition: border-color .15s;
  width: 220px;
}
.srch-wrap:focus-within { border-color: var(--border2); color: var(--text2); }
.srch-input { background: none; border: none; outline: none; color: var(--text1); font-size: 13px; width: 100%; }
.srch-input::placeholder { color: var(--text3); }

.cta-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #0D0D0D;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 0 14px;
  height: 34px;
  transition: all .15s;
  white-space: nowrap;
}
.cta-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.cta-btn.btn-sm { height: 30px; font-size: 12px; padding: 0 12px; }
.cta-btn.ml-a { margin-left: auto; }
.cta-btn.full-w { width: 100%; justify-content: center; }

.btn-ol {
  display: flex; align-items: center; gap: 6px;
  background: transparent;
  color: var(--text1);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 0 14px; height: 34px;
  font-size: 13px; font-weight: 500;
  transition: all .15s; white-space: nowrap;
}
.btn-ol:hover { background: var(--bg3); border-color: var(--text3); }
.btn-ol.full-w { width: 100%; justify-content: center; }
.btn-ol.ml-a { margin-left: auto; }

.btn-gh {
  display: flex; align-items: center; gap: 6px;
  background: transparent; color: var(--text2);
  border-radius: 8px;
  padding: 0 14px; height: 34px;
  font-size: 13px; font-weight: 400;
  transition: all .15s; white-space: nowrap;
}
.btn-gh:hover { background: var(--bg3); color: var(--text1); }
.btn-gh.full-w { width: 100%; justify-content: center; }

.btn-danger {
  display: flex; align-items: center; gap: 6px;
  background: var(--red-bg); color: var(--red);
  border: 1px solid rgba(245,101,101,0.2);
  border-radius: 8px;
  padding: 0 14px; height: 34px;
  font-size: 13px; font-weight: 500;
  transition: all .15s; white-space: nowrap;
}
.btn-danger:hover { background: rgba(245,101,101,0.2); }
.btn-danger.full-w { width: 100%; justify-content: center; }

.btn-success {
  display: flex; align-items: center; gap: 6px;
  background: var(--green-bg); color: var(--green);
  border: 1px solid rgba(79,200,138,0.2);
  border-radius: 8px;
  padding: 0 14px; height: 34px;
  font-size: 13px; font-weight: 500;
  transition: all .15s; white-space: nowrap;
}
.btn-success:hover { background: rgba(79,200,138,0.2); }

/* ── CONTENT ─────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg4) transparent;
}
.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }

.page { display: none; }
.page.active { display: block; }

/* ── KPI CARDS ─────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.kpi-row--3 { grid-template-columns: repeat(3, 1fr); }

.kpi {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s;
}
.kpi:hover { border-color: var(--border2); }
.kpi.hero-kpi {
  background: linear-gradient(135deg, #1C1F2A 0%, #141618 100%);
  border-color: rgba(232,255,107,0.18);
}
.hero-bg-shape {
  position: absolute;
  right: -16px; top: -16px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--accent-dim);
}

.kpi-lbl { font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px; }
.kpi-num { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--text1); letter-spacing: -1px; margin-bottom: 4px; }
.kpi-num.blue { color: var(--blue); }
.kpi-num.green { color: var(--green); }
.kpi-num.amber { color: var(--amber); }
.kpi-meta { font-size: 11px; color: var(--text3); }

/* ── PANELS ─────────────────────── */
.dash-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 13px;
}
.see-all { font-size: 12px; color: var(--text3); font-weight: 400; font-family: var(--font); transition: color .15s; }
.see-all:hover { color: var(--text1); }

/* ── TABLES ─────────────────────── */
.tbl-wrap { overflow-x: auto; }
.dtbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.dtbl th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); background: var(--bg2); white-space: nowrap; }
.dtbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text2); vertical-align: middle; }
.dtbl tr:last-child td { border-bottom: none; }
.dtbl tbody tr:hover td { background: var(--bg3); color: var(--text1); }
.dtbl .empty { text-align: center; color: var(--text3); padding: 28px; font-style: italic; }

/* ── FILTER BAR ─────────────────────── */
.fbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.fpill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 12px;
  color: var(--text2);
  transition: all .15s;
}
.fpill em { font-style: normal; font-size: 10px; background: var(--bg4); border-radius: 10px; padding: 1px 5px; color: var(--text3); }
.fpill:hover { border-color: var(--border2); color: var(--text1); }
.fpill.active { background: var(--accent-dim); border-color: rgba(232,255,107,0.25); color: var(--accent); }

.fbar-srch {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  color: var(--text3);
}
.fbar-srch input { background: none; border: none; outline: none; color: var(--text1); font-size: 12px; width: 170px; }
.fbar-srch input::placeholder { color: var(--text3); }

/* ── ACTION BAR ─────────────────────── */
.act-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.act-bar-r { margin-left: auto; display: flex; gap: 6px; }

/* ── BADGES ─────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge-occupied, .badge-paid { background: var(--green-bg); color: var(--green); border: 1px solid rgba(79,200,138,0.2); }
.badge-vacant { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.badge-pending { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(245,166,35,0.2); }
.badge-maintenance { background: var(--purple-bg); color: var(--purple); border: 1px solid rgba(167,139,250,0.2); }
.badge-overdue { background: var(--red-bg); color: var(--red); border: 1px solid rgba(245,101,101,0.2); }

/* ── ROOM MAP ─────────────────────── */
.wing-block { margin-bottom: 24px; }
.wing-hdr { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-family: var(--font-display); font-size: 13px; font-weight: 600; }
.wing-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #0D0D0D;
}
.wing-cnt { color: var(--text3); font-size: 12px; font-weight: 400; }
.room-row { display: flex; flex-wrap: wrap; gap: 5px; }
.room-cell {
  width: 48px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  border: 1px solid transparent;
  position: relative;
}
.room-cell:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.15); z-index: 1; }
.room-cell.r-occupied { background: rgba(77,156,248,0.15); color: var(--blue); }
.room-cell.r-vacant { background: rgba(79,200,138,0.1); color: var(--green); }
.room-cell.r-pending { background: rgba(245,166,35,0.12); color: var(--amber); }
.room-cell.r-maintenance { background: rgba(167,139,250,0.12); color: var(--purple); }
.room-cell.r-overdue { background: var(--red-bg); color: var(--red); }

.room-lgd { display: flex; gap: 18px; margin-top: 20px; }
.lgd-i { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); }
.lgd-dot { width: 10px; height: 10px; border-radius: 3px; }
.lgd-dot.occ { background: var(--blue); }
.lgd-dot.vac { background: var(--green); }
.lgd-dot.pend { background: var(--amber); }
.lgd-dot.maint { background: var(--purple); }

/* ── TENANT CARDS ─────────────────────── */
.tenant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tc {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.tc::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 70%, rgba(255,255,255,.02));
  pointer-events: none;
}
.tc:hover { border-color: var(--border2); transform: translateY(-2px); }
.tc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.av-lg {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 15px; font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.av-lg img { width: 100%; height: 100%; object-fit: cover; }
.tc-name { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--text1); margin-bottom: 2px; }
.tc-room { font-size: 11px; color: var(--text3); }
.tc-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; padding: 5px 0; border-top: 1px solid var(--border); }
.tc-row:first-of-type { border-top-color: transparent; }
.tc-row span:first-child { color: var(--text3); }
.tc-row span:last-child { color: var(--text2); }

/* ── AVATAR ─────────────────────── */
.avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  font-family: var(--font-display);
}

/* ── SECTION TITLE ─────────────────────── */
.section-ttl { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--text1); }

/* ── REPORT TOTALS ─────────────────────── */
.rpt-totals {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin-top: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}
.rt-l { color: var(--text3); }
.rt-sep { color: var(--border2); }
.green { color: var(--green); }
.amber { color: var(--amber); }
.blue { color: var(--blue); }
.red { color: var(--red); }

/* ── SETTINGS ─────────────────────── */
.set-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.set-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.set-card-ttl { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--text1); margin-bottom: 18px; }
.fld-row { margin-bottom: 12px; }
.fld-lbl { display: block; font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; }
.fld-inp {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text1);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.fld-inp:focus { border-color: var(--border2); }
.fld-inp::placeholder { color: var(--text3); }
.fld-sel {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text1);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%235C6170' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}
.fld-sel:focus { border-color: var(--border2); }
.fld-sel option { background: var(--bg2); }
.set-note { font-size: 11px; color: var(--text3); line-height: 1.5; }
.set-acts { display: flex; flex-direction: column; gap: 8px; }
.full-w { width: 100%; justify-content: center; }

/* ── MODAL ─────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slide-up .2s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--bg4) transparent;
}
.modal--wide { max-width: 760px; }
@keyframes slide-up { from { transform: translateY(16px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

.modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg2);
  z-index: 1;
}
.modal-hdr h3 { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--text1); }
.modal-hdr-btns { display: flex; gap: 8px; align-items: center; }
.modal-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; color: var(--text2); font-size: 16px;
  transition: all .15s;
}
.modal-close:hover { background: var(--bg3); color: var(--text1); }

.modal-body { padding: 20px 22px; }

/* ── PROFILE ─────────────────────── */
.prof-hdr {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.prof-av {
  width: 66px; height: 66px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  border: 1.5px solid var(--border2);
  transition: opacity .15s;
  position: relative;
}
.prof-av:hover { opacity: 0.85; }
.prof-av img { width: 100%; height: 100%; object-fit: cover; }
.prof-av-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
  font-size: 18px;
}
.prof-av:hover .prof-av-overlay { opacity: 1; }
.prof-name { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--text1); margin-bottom: 3px; }
.prof-room { font-size: 12px; color: var(--text3); margin-bottom: 8px; }
.prof-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.prof-rent { margin-left: auto; text-align: right; }
.prof-rent-val { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--green); }
.prof-rent-lbl { font-size: 10px; color: var(--text3); text-transform: uppercase; }

.prof-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: none;
}
.prof-tabs::-webkit-scrollbar { display: none; }
.prof-tab {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text3);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  margin-bottom: -1px;
}
.prof-tab:hover { color: var(--text1); }
.prof-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.prof-section { display: none; }
.prof-section.active { display: block; }

/* ── INFO GRID ─────────────────────── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; }
.info-item { background: var(--bg3); padding: 11px 14px; }
.info-lbl { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.info-val { font-size: 13px; color: var(--text1); }
.info-full { grid-column: 1 / -1; }

/* ── FORM GRID ─────────────────────── */
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.form-grid2 .full { grid-column: 1 / -1; }

/* ── SUBSECTION ─────────────────────── */
.sub-ttl {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ── DOC UPLOAD ─────────────────────── */
.doc-drop {
  border: 2px dashed var(--border2);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 16px;
}
.doc-drop:hover, .doc-drop.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.doc-drop-icon { font-size: 28px; margin-bottom: 8px; }
.doc-drop-text { font-size: 13px; color: var(--text2); margin-bottom: 4px; }
.doc-drop-hint { font-size: 11px; color: var(--text3); }

.doc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 8px;
  transition: border-color .15s;
}
.doc-item:hover { border-color: var(--border2); }
.doc-thumb {
  width: 40px; height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg4);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 13px; color: var(--text1); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 11px; color: var(--text3); }
.doc-actions { display: flex; gap: 6px; flex-shrink: 0; }
.doc-view-btn {
  background: var(--blue-bg);
  color: var(--blue);
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.doc-view-btn:hover { background: rgba(77,156,248,0.2); }
.doc-del-btn {
  background: var(--red-bg);
  color: var(--red);
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.doc-del-btn:hover { background: rgba(245,101,101,0.2); }

/* ── PAYMENT SECTION ─────────────────────── */
.pay-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.pay-info-cell { background: var(--bg3); padding: 10px 14px; }
.pay-info-lbl { font-size: 10px; color: var(--text3); text-transform: uppercase; font-weight: 600; letter-spacing: .4px; }
.pay-info-val { font-size: 14px; color: var(--text1); font-weight: 600; margin-top: 3px; }
.pay-history { }
.pay-hist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.pay-hist-item:last-child { border-bottom: none; }

/* ── WATER / NOTES ─────────────────────── */
.water-form { background: var(--bg3); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.water-row { display: flex; gap: 10px; margin-bottom: 10px; }
.water-row .fld-row { flex: 1; margin-bottom: 0; }

/* ── TOAST ─────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text1);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  animation: toast-in .2s ease, toast-out .3s ease 2.5s forwards;
  pointer-events: none;
  white-space: nowrap;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(10px) } to { opacity: 1; transform: translateX(-50%) translateY(0) } }
@keyframes toast-out { to { opacity: 0; transform: translateX(-50%) translateY(10px) } }

/* ── EMPTY STATE ─────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
  font-size: 13px;
}
.empty-state-ico { font-size: 32px; margin-bottom: 10px; }

/* ── RESPONSIVE ─────────────────────── */
@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-row { grid-template-columns: 1fr; }
  .set-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .kpi-row { grid-template-columns: 1fr; }
  .srch-wrap { display: none; }
  .info-grid { grid-template-columns: 1fr; }
  .form-grid2 { grid-template-columns: 1fr; }
  .form-grid2 .full { grid-column: 1; }
}

/* ── LANGUAGE SWITCHER ───────────────────── */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 6px;
  height: 34px;
}
.lang-btn {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 12px;
  font-weight: 500;
  padding: 3px 7px;
  border-radius: 5px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-family: var(--font);
}
.lang-btn.active {
  background: var(--accent);
  color: #0D0D0D;
  font-weight: 700;
}
.lang-btn:not(.active):hover { color: var(--text1); background: var(--bg4); }
.lang-sep { color: var(--border2); font-size: 12px; }

/* Khmer font override when KH active */
body.lang-kh {
  font-family: 'Hanuman', 'DM Sans', system-ui, sans-serif;
}
body.lang-kh .brand-name,
body.lang-kh .page-ttl,
body.lang-kh .set-card-ttl,
body.lang-kh .panel-hdr span,
body.lang-kh .kpi-lbl,
body.lang-kh .modal-hdr h3,
body.lang-kh .prof-name,
body.lang-kh .cta-btn,
body.lang-kh .section-ttl {
  font-family: 'Hanuman', 'Syne', system-ui, sans-serif;
}

/* ═══════════════════════════════════════════
   MOBILE / PHONE RESPONSIVE — Full Support
   ═══════════════════════════════════════════ */

/* ── MOBILE OVERLAY (sidebar backdrop) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 90;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

@media (max-width: 768px) {

  /* Sidebar: hidden off-screen by default on mobile */
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Main wrap takes full width */
  .main-wrap {
    width: 100%;
  }

  /* Topbar: tighter on mobile */
  .topbar {
    padding: 0 12px;
    gap: 8px;
    height: 52px;
  }
  .page-ttl { font-size: 16px; }

  /* Search: hidden on very small screens, shown as icon */
  .srch-wrap {
    width: 160px;
  }

  /* Language switcher: compact */
  .lang-switcher {
    padding: 2px 4px;
    height: 30px;
  }
  .lang-btn { font-size: 11px; padding: 2px 5px; }

  /* CTA button: icon only on tiny screens */
  .cta-btn span { display: none; }
  .cta-btn { padding: 0 10px; min-width: 34px; justify-content: center; }

  /* Content padding */
  .content { padding: 12px; }

  /* KPI cards: 2 columns then 1 */
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-num { font-size: 22px; }

  /* Tables: horizontal scroll with sticky first col */
  .tbl-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
  }
  .dtbl { min-width: 540px; }
  .dtbl th, .dtbl td { padding: 10px 12px; font-size: 12px; }

  /* Dashboard panels: single column */
  .dash-row { grid-template-columns: 1fr; gap: 12px; }
  .panel { padding: 14px; }

  /* Room map: smaller cells */
  .room-cell { width: 36px; height: 36px; font-size: 10px; }
  .wing-block { margin-bottom: 16px; }
  .wing-label { font-size: 12px; margin-bottom: 8px; }

  /* Filter bar: wrap on mobile */
  .fbar {
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 4px;
  }
  .fpill { font-size: 12px; padding: 5px 10px; height: 30px; }

  /* Tenant cards: 1 column */
  #tenant-card-view { grid-template-columns: 1fr !important; gap: 10px; }

  /* Settings grid: single column */
  .set-grid { grid-template-columns: 1fr; }
  .set-card { padding: 16px; }

  /* Modal: full-width on mobile */
  .modal-box {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 88vh;
    overflow-y: auto;
    margin: auto;
    border-radius: var(--radius-lg);
  }
  .modal-backdrop {
    align-items: flex-end;
    padding-bottom: 0;
  }
  .modal-box {
    border-radius: 16px 16px 0 0 !important;
    max-height: 90vh;
  }

  /* Monthly report action bar */
  .act-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .act-bar .fld-sel { width: 100% !important; }

  /* Room detail modal info grid */
  .info-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid2 { grid-template-columns: 1fr; }

  /* KPI row for payments: 3-col → 2-col */
  .kpi-row--3 { grid-template-columns: repeat(2, 1fr); }
  .kpi-row--3 .kpi:last-child { grid-column: 1 / -1; }

  /* Report totals: stacked */
  .rpt-totals { flex-direction: column; gap: 6px; align-items: flex-start; }
  .rt-sep { display: none; }

  /* Tenant profile header */
  .prof-hdr { flex-direction: column; align-items: flex-start; gap: 10px; }

  /* Payment form */
  .modal-body .fld-row { flex-direction: column; }

  /* Bottom safe area for iOS */
  .content { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
  .topbar { padding: 0 10px; gap: 6px; }
  .srch-wrap { display: none; }
  .page-ttl { font-size: 15px; }
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 12px; }
  .kpi-num { font-size: 20px; }
  .kpi-lbl { font-size: 11px; }
  .content { padding: 10px; }
  .fbar { gap: 5px; }
  .fpill { font-size: 11px; padding: 4px 8px; height: 28px; }

  /* Room grid tighter */
  .room-cell { width: 32px; height: 32px; font-size: 9px; }
  #room-map { gap: 14px; }

  /* Section title */
  .section-ttl { font-size: 14px; }

  /* Panel header */
  .panel-hdr { font-size: 13px; }
}

/* ── MOBILE TOUCH IMPROVEMENTS ── */
@media (hover: none) and (pointer: coarse) {
  /* Bigger tap targets */
  .nav-item { padding: 10px 10px; min-height: 40px; }
  .fpill { min-height: 32px; }
  .room-cell { cursor: pointer; }

  /* Remove hover transforms (jarring on touch) */
  .cta-btn:hover { transform: none; }
  .tenant-card:hover { transform: none; }
  .kpi:hover { transform: none; }

  /* Smooth scrolling */
  .tbl-wrap { scroll-snap-type: x proximity; }

  /* Better modal scroll */
  .modal-box { -webkit-overflow-scrolling: touch; }
}

/* ── SWIPE / SLIDE-UP MODAL ANIMATION on mobile ── */
@media (max-width: 768px) {
  @keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  .modal-box { animation: slideUp .22s ease; }

  /* Sidebar slide-in animation */
  .sidebar.mobile-open {
    animation: sideIn .22s ease;
  }
  @keyframes sideIn {
    from { transform: translateX(-100%); }
    to   { transform: translateX(0); }
  }
}

/* ── SIDEBAR USER / LOGOUT ── */
.sidebar-user {
  padding: 10px 12px 4px;
  border-top: 1px solid var(--border);
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 9px;
}
.su-avatar {
  width: 30px; height: 30px;
  background: var(--accent-dim);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.su-info { flex: 1; min-width: 0; }
.su-name { font-size: 12px; font-weight: 500; color: var(--text1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-role { font-size: 10px; color: var(--text3); }
.su-logout {
  color: var(--text3);
  padding: 4px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.su-logout:hover { color: var(--red); background: var(--red-bg); }
