/* Roomee — mobile-first app styling.
   Brand: #2F6BFF (Livable & Lovable Room Community). */

:root {
  --brand: #2F6BFF;
  --brand-dark: #1E4FD1;
  --brand-soft: #EAF0FF;
  --ink: #101828;
  --muted: #667085;
  --line: #EAECF0;
  --bg: #F5F7FB;
  --card: #FFFFFF;
  --ok: #12B76A;
  --ok-soft: #E7F7EF;
  --warn: #F79009;
  --warn-soft: #FEF3E6;
  --danger: #F04438;
  --danger-soft: #FDECEA;
  --field: #FFFFFF;
  --chip-grey: #F2F4F7;
  /* Aliases used by inline styles across views */
  --success: var(--ok);
  --border: var(--line);
  --radius: 16px;
  --shadow: 0 2px 12px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 8px 28px rgba(16, 24, 40, 0.12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Dark theme ---------- */
:root[data-theme="dark"] {
  --ink: #E6E9EF;
  --muted: #97A2B4;
  --line: #262C38;
  --bg: #0E121B;
  --card: #171D29;
  --field: #1E2634;
  --chip-grey: #262E3C;
  --ok: #34D399; --ok-soft: #0F2A20;
  --warn: #FBBF24; --warn-soft: #2C2510;
  --danger: #F87171; --danger-soft: #2C1719;
  --shadow: 0 2px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.6);
}
:root[data-theme="dark"] .chip.grey { background: var(--chip-grey); color: var(--muted); }
:root[data-theme="dark"] table.data th { background: #1B2230; }
:root[data-theme="dark"] .site-footer { background: #12161F; }
:root[data-theme="dark"] .demo-note code,
:root[data-theme="dark"] code { background: rgba(255,255,255,0.08); }
:root[data-theme="dark"] img.footer-logo,
:root[data-theme="dark"] .landing-nav img { filter: none; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; display: block; }

/* App shell centered as a phone frame on wide screens */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(76px + var(--safe-bottom));
}

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--brand);
  color: #fff;
  padding: 16px 18px 18px;
  border-radius: 0 0 22px 22px;
  box-shadow: var(--shadow);
}
.app-header.plain { background: var(--card); color: var(--ink); border-bottom: 1px solid var(--line); border-radius: 0; }
.app-header .header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-header .greeting { font-size: 13px; opacity: .85; }
.app-header .title { font-size: 20px; font-weight: 700; margin: 2px 0 0; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.18); color: #fff; border: none;
  font-size: 18px; cursor: pointer; position: relative;
}
.app-header.plain .icon-btn { background: var(--brand-soft); color: var(--brand); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700;
  background: #fff; color: var(--brand);
}
.badge-dot { position: absolute; top: 7px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); border: 2px solid var(--brand); }

/* ---------- Content ---------- */
.content { padding: 16px; }
.section-title { font-size: 15px; font-weight: 700; margin: 22px 4px 10px; display: flex; justify-content: space-between; align-items: center; }
.section-title:first-child { margin-top: 6px; }
.section-title a { font-size: 13px; font-weight: 600; }
.muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }

/* ---------- Hero card ---------- */
.hero {
  background: linear-gradient(135deg, var(--brand), #5C86FF);
  color: #fff; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-lg); margin-top: 6px;
}
.hero h2 { margin: 0 0 6px; font-size: 20px; }
.hero p { margin: 0; opacity: .9; font-size: 14px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.card.tight { padding: 14px; }
.card h3 { margin: 0 0 4px; font-size: 15px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.stat-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-card .stat-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; margin-bottom: 10px; background: var(--brand-soft); color: var(--brand); }
.stat-card .stat-label { font-size: 12px; color: var(--muted); }
.stat-card .stat-value { font-size: 20px; font-weight: 700; margin-top: 2px; }
.stat-icon.green { background: var(--ok-soft); color: var(--ok); }
.stat-icon.warn { background: var(--warn-soft); color: var(--warn); }
.stat-icon.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Quick actions ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 4px 0 6px; }
.quick-action { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--ink); text-align: center; }
.quick-action .qa-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 20px; background: #fff; color: var(--brand); box-shadow: var(--shadow); }

/* ---------- List rows ---------- */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: none; }
.list-row .lr-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 16px; flex: none; }
.list-row .lr-body { flex: 1; min-width: 0; }
.list-row .lr-title { font-weight: 600; font-size: 14px; }
.list-row .lr-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--brand-soft); color: var(--brand); }
.chip.green { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.grey { background: var(--chip-grey); color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 16px; border-radius: 12px; border: none;
  background: var(--brand); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: transform .05s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--brand-soft); color: var(--brand); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { background: var(--danger); }
.btn.sm { width: auto; padding: 9px 14px; font-size: 13px; }
.btn.block { width: 100%; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.input, select, textarea {
  width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 15px; background: var(--field); color: var(--ink); font-family: inherit;
}
.input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 96px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ---------- Flash ---------- */
.flash { padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; font-weight: 500; }
.flash.success { background: var(--ok-soft); color: #067647; }
.flash.error { background: var(--danger-soft); color: #B42318; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  max-width: 480px; margin: 0 auto;
  background: var(--card); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 6px calc(8px + var(--safe-bottom));
  box-shadow: 0 -2px 16px rgba(16,24,40,.05);
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--muted); padding: 4px 0; }
.nav-item .nav-icon { font-size: 20px; line-height: 1; }
.nav-item.active { color: var(--brand); font-weight: 600; }
.nav-badge { position: absolute; top: -6px; right: -10px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; line-height: 1; }

/* ---------- Floating action button ---------- */
.fab {
  position: fixed; right: calc(50% - 240px + 18px); bottom: calc(92px + var(--safe-bottom));
  width: 56px; height: 56px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 26px; box-shadow: var(--shadow-lg);
  z-index: 25; border: none; cursor: pointer;
}
@media (max-width: 520px) { .fab { right: 18px; } }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .empty-icon { font-size: 42px; margin-bottom: 10px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 440px; margin: 0 auto; }
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand .logo { width: 72px; height: 72px; border-radius: 20px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 34px; font-weight: 800; margin: 0 auto 14px; box-shadow: var(--shadow-lg); }
.auth-brand h1 { margin: 0; font-size: 26px; }
.auth-brand p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.auth-card { background: var(--card); border-radius: 20px; padding: 24px; box-shadow: var(--shadow-lg); }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.demo-note { margin-top: 16px; font-size: 12px; color: var(--muted); background: var(--brand-soft); padding: 12px 14px; border-radius: 12px; }
.demo-note code { background: rgba(0,0,0,.05); padding: 1px 5px; border-radius: 5px; }

/* ---------- Admin ---------- */
.admin-body { max-width: 1080px; }
.admin-topbar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; }
.admin-topbar .brand { font-weight: 800; font-size: 18px; color: var(--brand); }
.admin-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .admin-metrics { grid-template-columns: repeat(4, 1fr); } .admin-body { padding-bottom: 24px; } }

.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #FAFBFD; }
table.data tr:last-child td { border-bottom: none; }

.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; }
.filter-bar .chip { cursor: pointer; white-space: nowrap; text-decoration: none; }
.filter-bar .chip.active { background: var(--brand); color: #fff; }

.modal-toggle { display: none; }
.hidden { display: none; }

/* ---------- CSS bar chart (dependency-free) ---------- */
.bar-chart { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 34px; align-items: center; gap: 10px; font-size: 13px; }
.bar-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: #F2F4F7; border-radius: 99px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), #5C86FF); border-radius: 99px; }
.bar-value { text-align: right; font-weight: 700; }
@media (max-width: 420px) { .bar-row { grid-template-columns: 84px 1fr 28px; } }

/* ---------- Settings: FAQ editor ---------- */
.faq-edit { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #FAFBFD; }

/* ---------- Public landing page ---------- */
body.landing { background: #fff; }
.landing-nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.landing-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--ink); }
.landing-brand img { height: 32px; width: auto; border-radius: 8px; }
.landing-brand .brand-badge { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.landing-nav-links { display: flex; align-items: center; gap: 8px; }

.landing-main { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.landing-hero { text-align: center; padding: 64px 12px 48px; }
.landing-hero h1 { font-size: 48px; margin: 16px 0 12px; letter-spacing: -.02em; }
.landing-hero .hero-sub { font-size: 18px; color: var(--muted); max-width: 640px; margin: 0 auto 28px; line-height: 1.5; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-cta .btn { width: auto; }
@media (max-width: 560px) { .landing-hero { padding: 40px 8px 32px; } .landing-hero h1 { font-size: 34px; } .landing-hero .hero-sub { font-size: 16px; } }

.landing-section { padding: 40px 0; border-top: 1px solid var(--line); }
.landing-h2 { text-align: center; font-size: 28px; margin: 0 0 28px; }
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 860px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature-card .feature-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 22px; margin-bottom: 12px; }
.feature-card h3 { margin: 0 0 6px; font-size: 17px; }
.feature-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ---------- Promotions ---------- */
.promo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 640px) { .promo-grid { grid-template-columns: 1fr; } }
.promo-card { background: linear-gradient(135deg, #FFF7E6, #FDECEA); border: 1px solid #FCE4C7; border-radius: var(--radius); padding: 22px; }
.promo-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--warn); color: #fff; font-weight: 700; font-size: 13px; }
.promo-card h3 { margin: 12px 0 4px; font-size: 20px; }
.promo-card p { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.promo-code { font-size: 14px; margin-top: 6px; }
.promo-code strong { background: #fff; padding: 2px 8px; border-radius: 6px; border: 1px dashed var(--warn); letter-spacing: 1px; }
.promo-until { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Testimonials ---------- */
.testimonial-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 820px) { .testimonial-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .testimonial-grid { grid-template-columns: 1fr; } }
.testimonial-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0; }
.testimonial-stars { color: #F79009; letter-spacing: 2px; margin-bottom: 8px; }
.testimonial-stars .dim { color: var(--line); }
.testimonial-card blockquote { margin: 0 0 12px; font-size: 15px; line-height: 1.55; }
.testimonial-card figcaption { font-size: 13px; color: var(--muted); }

.faq-section { max-width: 760px; margin: 0 auto; }
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.faq-item summary { cursor: pointer; font-weight: 600; font-size: 16px; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '＋'; float: right; color: var(--brand); font-weight: 700; }
.faq-item[open] summary::after { content: '－'; }
.faq-item p { margin: 12px 0 0; color: var(--muted); line-height: 1.6; }

.landing-cta-band { text-align: center; background: linear-gradient(135deg, var(--brand), #5C86FF); color: #fff; border-radius: 24px; padding: 48px 24px; margin: 40px 0; }
.landing-cta-band h2 { margin: 0 0 8px; font-size: 26px; }
.landing-cta-band p { margin: 0 0 20px; opacity: .92; }
.landing-cta-band .btn { background: #fff; color: var(--brand); }

.landing-nav-link { color: var(--ink); font-weight: 600; font-size: 14px; padding: 6px 4px; }
@media (max-width: 560px) { .landing-nav-link { display: none; } }

/* ---------- Rooms grid ---------- */
.room-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 820px) { .room-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .room-grid { grid-template-columns: 1fr; } }
.room-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.room-media { height: 120px; display: grid; place-items: center; font-size: 46px; background: linear-gradient(135deg, var(--brand-soft), #fff); }
.room-body { padding: 16px; }
.room-body h3 { margin: 8px 0 2px; font-size: 17px; }
.room-price { font-size: 20px; font-weight: 800; color: var(--brand); margin: 10px 0 14px; }
.room-price span { font-size: 13px; font-weight: 500; color: var(--muted); }

/* ---------- Services grid ---------- */
.service-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 820px) { .service-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .service-grid { grid-template-columns: 1fr; } }
.service-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; gap: 14px; }
.service-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--brand-soft); display: grid; place-items: center; font-size: 24px; flex: none; }
.service-body h3 { margin: 2px 0 0; font-size: 16px; }

/* ---------- Assistant chat ---------- */
.assistant-wrap { padding-bottom: 84px; }
.assistant-intro { margin-bottom: 12px; }
.chat-log { display: flex; flex-direction: column; gap: 10px; padding: 6px 0 12px; }
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg .bubble { max-width: 82%; padding: 11px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45; box-shadow: var(--shadow); }
.chat-msg.bot .bubble { background: var(--card); border-bottom-left-radius: 5px; }
.chat-msg.user .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.chat-msg.typing .bubble { color: var(--muted); letter-spacing: 3px; }
.chat-suggestions { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0 10px; }
.chat-suggestions .suggestion { cursor: pointer; border: none; }
.chat-input-bar { position: fixed; left: 0; right: 0; bottom: calc(76px + var(--safe-bottom)); max-width: 480px; margin: 0 auto; display: flex; gap: 8px; padding: 10px 16px; background: var(--bg); border-top: 1px solid var(--line); }
.chat-input-bar .input { flex: 1; }
.chat-input-bar .btn { width: 48px; flex: none; }

/* Room-to-room conversation view */
.chat-room-wrap { padding-bottom: 84px; }
.chat-room .chat-log { height: calc(100vh - 250px); overflow-y: auto; padding-right: 2px; }
.chat-sender { font-size: 11px; font-weight: 700; color: var(--brand); margin-bottom: 3px; }
.chat-msg.user .chat-sender { color: rgba(255,255,255,.9); }
.chat-time { font-size: 10px; opacity: .6; margin-top: 4px; text-align: right; }

/* ---------- Site footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: #FAFBFD; padding: 32px 20px; }
.footer-inner { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-logo { height: 40px; width: auto; border-radius: 8px; }
.footer-logo-badge { width: 40px; height: 40px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.footer-about { max-width: 560px; margin: 0; }
.footer-contact { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.footer-social { display: flex; gap: 8px; flex-wrap: wrap; }
.footer-social .chip { text-decoration: none; }
.footer-copy { margin-top: 6px; }

/* ============================================================
   Desktop / landscape layout (>= 900px)
   Converts the mobile bottom-nav into a left sidebar and lets
   the app shell (tenant + admin) use the full landscape width.
   ============================================================ */
@media (min-width: 900px) {
  .app-shell {
    max-width: 1240px;
    display: grid;
    grid-template-columns: 224px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "nav header"
      "nav main";
    padding-bottom: 0;
    box-shadow: var(--shadow);
    background: var(--card);
  }
  .admin-body { max-width: 1300px; }

  .app-header,
  .admin-topbar {
    grid-area: header;
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .content {
    grid-area: main;
    padding: 24px 28px;
    background: var(--bg);
  }

  /* Bottom nav -> left sidebar */
  .bottom-nav {
    grid-area: nav;
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    overflow-y: auto;
    left: auto; right: auto; bottom: auto;
    width: auto; max-width: none; margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    grid-template-columns: none;
    border-top: none;
    border-right: 1px solid var(--line);
    box-shadow: none;
    padding: 20px 12px;
  }
  .bottom-nav .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    font-size: 14px;
    padding: 11px 14px;
    border-radius: 12px;
    position: relative;
  }
  .bottom-nav .nav-item .nav-icon { font-size: 20px; }
  .bottom-nav .nav-item:hover { background: var(--bg); }
  .bottom-nav .nav-item.active { background: var(--brand-soft); }

  /* Floating action button back to a normal corner */
  .fab { right: 32px; bottom: 32px; }

  /* Chat composer flows within the main column instead of a fixed phone bar */
  .chat-input-bar {
    position: sticky;
    left: auto; right: auto;
    bottom: 0;
    max-width: none;
    width: auto;
    margin: 0;
  }

  /* Give common dashboard/stat grids more columns on wide screens */
  .stat-grid { grid-template-columns: repeat(4, 1fr) !important; }
}

/* Extra breathing room on very wide monitors */
@media (min-width: 1400px) {
  .app-shell { max-width: 1400px; }
  .admin-body { max-width: 1440px; }
}

/* Multi-column card lists on wide screens (dense admin lists) */
@media (min-width: 900px) {
  .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 16px; align-items: start; }
  .card-grid > .card { margin: 0; }
  /* Two side-by-side panels (e.g. ledger add + filter) */
  .desk-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .desk-2col > * { margin: 0 !important; }
}

/* ============================================================
   ERP ADMIN SHELL — grouped sidebar back office
   Mobile-first: sidebar is an off-canvas drawer; at >=900px it
   becomes a persistent left column in a CSS grid.
   ============================================================ */
.erp-shell { min-height: 100vh; background: var(--bg); }

.erp-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 264px; z-index: 60;
  background: var(--card); border-right: 1px solid var(--line);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  transform: translateX(-100%); transition: transform .22s ease;
}
.erp-shell.nav-open .erp-sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }

.erp-backdrop {
  position: fixed; inset: 0; z-index: 55; background: rgba(17,24,39,.45);
  opacity: 0; pointer-events: none; transition: opacity .22s ease;
}
.erp-shell.nav-open .erp-backdrop { opacity: 1; pointer-events: auto; }

.erp-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px; border-bottom: 1px solid var(--line);
}
.erp-brand img { height: 30px; width: auto; border-radius: 7px; }
.erp-brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: var(--brand); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.erp-brand-name { font-weight: 800; color: var(--brand); line-height: 1.1; font-size: 16px; }
.erp-brand-name small { display: block; font-weight: 500; font-size: 10.5px; color: var(--muted); letter-spacing: .04em; }

.erp-nav { padding: 10px 10px 28px; }
.erp-nav-section {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); font-weight: 700; padding: 14px 12px 6px;
}
.erp-nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px; margin-bottom: 1px;
  color: var(--ink); text-decoration: none; font-size: 14px; position: relative;
}
.erp-nav-item:hover { background: var(--bg); }
.erp-nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.erp-nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.erp-nav-icon { width: 22px; text-align: center; font-size: 16px; flex: none; }
.erp-nav-label { flex: 1; min-width: 0; }
.erp-nav-badge {
  background: var(--danger); color: #fff; border-radius: 10px;
  font-size: 11px; font-weight: 700; padding: 1px 7px; min-width: 18px; text-align: center;
}

.erp-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.erp-burger {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  width: 38px; height: 38px; border-radius: 10px; font-size: 18px; cursor: pointer; flex: none;
}
.erp-title { font-size: 18px; font-weight: 700; margin: 0; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erp-actions { display: flex; align-items: center; gap: 10px; }
.erp-user { display: none; line-height: 1.15; text-align: right; }
.erp-user-name { display: block; font-weight: 600; font-size: 13px; }
.erp-user-role { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.erp-main { padding: 16px; }

@media (min-width: 620px) { .erp-user { display: block; } }

@media (min-width: 900px) {
  .erp-shell {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "sidebar topbar" "sidebar main";
  }
  .erp-sidebar {
    position: sticky; grid-area: sidebar; transform: none;
    top: 0; height: 100vh; bottom: auto; box-shadow: none;
  }
  .erp-topbar { grid-area: topbar; }
  .erp-main { grid-area: main; padding: 24px 28px; }
  .erp-burger { display: none; }
  .erp-backdrop { display: none; }
}

/* Dashboard action center (things needing attention) */
.action-center { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 4px 0 8px; }
.action-tile {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  column-gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; text-decoration: none; color: var(--ink);
}
.action-tile:hover { border-color: var(--brand); }
.action-icon { grid-row: 1 / span 2; font-size: 22px; }
.action-count { font-size: 20px; font-weight: 800; line-height: 1; color: var(--brand); }
.action-label { font-size: 12px; color: var(--muted); }
@media (min-width: 620px) { .action-center { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .action-center { grid-template-columns: repeat(4, 1fr); } }

/* Password field with show/hide toggle */
.pw-field { position: relative; }
.pw-field .input { padding-right: 46px; }
.pw-toggle {
  position: absolute; top: 0; right: 0; height: 100%; width: 44px;
  border: none; background: transparent; cursor: pointer; font-size: 17px;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  line-height: 1;
}
.pw-toggle:hover { opacity: .75; }