/* ═══════════════════════════════════════════════════════════
   Expat OS Spain — Luxury Mediterranean Design System
═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette */
  --navy:        #0B3954;
  --navy-mid:    #0F4F75;
  --ocean:       #1A7BA4;
  --ocean-light: #E8F4F8;
  --gold:        #C9A84C;
  --gold-light:  #F5E9CC;
  --gold-pale:   #FDF8EE;
  --sand:        #F7F4EF;
  --white:       #FFFFFF;
  --dark:        #1E2329;
  --text:        #2C3E50;
  --muted:       #7B8D9A;
  --border:      #E4E7EC;
  --success:     #22C55E;
  --success-bg:  #F0FDF4;
  --danger:      #EF4444;
  --danger-bg:   #FEF2F2;
  --warning:     #F59E0B;
  --warning-bg:  #FFFBEB;
  --purple:      #7C3AED;
  --purple-bg:   #F5F3FF;

  /* Layout */
  --sidebar-w:   260px;
  --radius:      12px;
  --radius-lg:   16px;
  --radius-xl:   20px;

  /* Shadows */
  --shadow-xs:   0 1px 3px rgba(0,0,0,.06);
  --shadow-sm:   0 2px 8px rgba(0,0,0,.08);
  --shadow:      0 4px 20px rgba(0,0,0,.09);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.12);
  --shadow-gold: 0 4px 20px rgba(201,168,76,.25);
}

html, body { height: 100%; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--sand); color: var(--text); font-size: 14px; line-height: 1.6; }
a { color: var(--ocean); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; background: var(--sand); padding: 2px 6px; border-radius: 4px; }

/* ── Screens ── */
.screen { display: none; }
.screen.active { display: block; height: 100vh; }

/* ════════════════════════════ LOGIN ════════════════════════════════════════ */
.login-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.login-brand {
  background: linear-gradient(150deg, var(--navy) 0%, var(--navy-mid) 55%, var(--ocean) 100%);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  padding: 72px 60px; color: white;
}
.login-brand::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.brand-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; position: relative; }
.logo-icon { font-size: 44px; }
.logo-text { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.logo-sub { font-size: 11px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; opacity: .6; margin-top: -4px; }
.brand-tagline { font-size: 18px; font-weight: 300; opacity: .85; margin-bottom: 36px; line-height: 1.5; position: relative; }
.brand-features { display: flex; flex-direction: column; gap: 14px; margin-bottom: 36px; position: relative; }
.feature-item { display: flex; align-items: center; gap: 12px; font-size: 14px; opacity: .9; }
.feature-item .fi-icon { font-size: 20px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.1); border-radius: 10px; flex-shrink: 0; }
.brand-mock-pill { display: inline-flex; align-items: center; gap: 8px; background: rgba(201,168,76,.2); border: 1px solid rgba(201,168,76,.4); color: var(--gold-light); padding: 8px 16px; border-radius: 20px; font-size: 12px; font-weight: 500; position: relative; }

.login-form-panel { background: var(--white); display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-form-box { width: 100%; max-width: 420px; }
.login-form-box h2 { font-size: 28px; font-weight: 800; color: var(--dark); margin-bottom: 6px; }
.login-sub { color: var(--muted); margin-bottom: 20px; }

.lang-selector-row { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.lang-selector-label { font-size: 18px; }

.form-tabs { display: flex; gap: 4px; background: var(--sand); padding: 4px; border-radius: var(--radius); margin-bottom: 24px; }
.form-tab { flex: 1; padding: 8px 16px; border: none; background: transparent; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--muted); transition: all .2s; }
.form-tab.active { background: var(--white); color: var(--navy); font-weight: 600; box-shadow: var(--shadow-xs); }

.auth-form { display: none; }
.auth-form.active { display: block; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--dark); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.field input, .field select { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; font-family: inherit; outline: none; transition: border-color .2s; background: var(--white); }
.field input:focus, .field select:focus { border-color: var(--ocean); box-shadow: 0 0 0 3px rgba(26,123,164,.1); }

.forgot { text-align: right; margin-bottom: 8px; }
.forgot a { font-size: 12px; color: var(--ocean); font-weight: 500; }

.btn-primary { width: 100%; padding: 13px 24px; background: linear-gradient(135deg, var(--navy) 0%, var(--ocean) 100%); color: white; border: none; border-radius: var(--radius); font-size: 15px; font-weight: 600; cursor: pointer; transition: all .2s; letter-spacing: .2px; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-primary:disabled { opacity: .6; transform: none; cursor: not-allowed; }
.btn-secondary { padding: 9px 18px; background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; transition: all .2s; color: var(--text); }
.btn-secondary:hover { border-color: var(--ocean); color: var(--ocean); }
.btn-ghost { padding: 7px 14px; background: transparent; border: none; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--muted); transition: all .2s; }
.btn-ghost:hover { background: var(--sand); color: var(--dark); }
.btn-gold { padding: 10px 20px; background: linear-gradient(135deg, var(--gold) 0%, #E8C56A 100%); color: var(--navy); border: none; border-radius: var(--radius); font-size: 13px; font-weight: 700; cursor: pointer; transition: all .2s; }
.btn-gold:hover { transform: translateY(-1px); box-shadow: var(--shadow-gold); }

.terms-note { font-size: 11px; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-top-color: white; border-radius: 50%; animation: spin .6s linear infinite; }
.hidden { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════ APP SHELL ════════════════════════════════════ */
#screen-app.active { display: flex; height: 100vh; }
.app-layout { display: flex; width: 100%; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex; flex-direction: column;
  overflow-y: auto; flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo { padding: 20px 20px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.logo-icon-sm { font-size: 26px; }
.sidebar-logo-text { display: flex; flex-direction: column; }
.sidebar-logo-name { color: white; font-weight: 800; font-size: 15px; letter-spacing: -.2px; }
.sidebar-logo-tag  { color: var(--gold); font-size: 9px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }

.sidebar-section-label { padding: 16px 16px 4px; font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: rgba(255,255,255,.3); }

.sidebar-nav { padding: 8px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: rgba(255,255,255,.65); cursor: pointer; text-decoration: none; transition: all .2s; font-size: 13.5px; font-weight: 500; margin-bottom: 2px; }
.nav-item:hover { background: rgba(255,255,255,.08); color: white; text-decoration: none; }
.nav-item.active { background: linear-gradient(135deg, rgba(201,168,76,.25) 0%, rgba(201,168,76,.1) 100%); color: var(--gold-light); border-left: 3px solid var(--gold); }
.nav-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.nav-divider { height: 1px; background: rgba(255,255,255,.08); margin: 8px 12px; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), var(--ocean)); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: white; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name  { color: white; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { color: rgba(255,255,255,.45); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { background: transparent; border: none; color: rgba(255,255,255,.35); cursor: pointer; font-size: 18px; padding: 4px; border-radius: 6px; transition: all .2s; line-height: 1; }
.logout-btn:hover { color: var(--danger); background: rgba(239,68,68,.1); }
.sidebar-lang-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mock-indicator { font-size: 10px; color: rgba(255,255,255,.3); text-align: center; padding: 2px; }

/* ── Language select ── */
.lang-select { background: rgba(255,255,255,.1); color: white; border: 1px solid rgba(255,255,255,.15); border-radius: 8px; padding: 6px 8px; font-size: 12px; font-family: inherit; cursor: pointer; outline: none; }
.lang-select option { background: var(--navy); color: white; }
.lang-select.full-width { background: white; color: var(--text); border: 1.5px solid var(--border); width: 100%; padding: 10px 12px; font-size: 13px; border-radius: var(--radius); }
.lang-select.full-width option { background: white; color: var(--text); }
.sidebar-lang { flex: 1; }

/* ── Main content ── */
.main-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.view { display: none; padding: 28px 32px; min-height: 100%; }
.view.active { display: block; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 24px; font-weight: 800; color: var(--dark); letter-spacing: -.4px; }
.page-sub   { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ── Cards ── */
.card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 15px; font-weight: 700; color: var(--dark); }
.card-body { padding: 20px 24px; }
.card-badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; background: var(--ocean-light); color: var(--ocean); }
.card-badge.gold { background: var(--gold-pale); color: #8B6914; }
.link-btn { background: none; border: none; color: var(--ocean); font-size: 13px; cursor: pointer; font-weight: 500; padding: 0; }
.link-btn:hover { color: var(--navy); }

/* ════════════════════════════ KPI ROW ══════════════════════════════════════ */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--white); border-radius: var(--radius-lg); padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--gold), var(--ocean)); }
.kpi-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); margin-bottom: 4px; }
.kpi-value { font-size: 24px; font-weight: 800; color: var(--dark); line-height: 1.1; }
.kpi-sub   { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ════════════════════════════ PROPERTY INTEL ═══════════════════════════════ */
.property-search-bar { background: var(--white); border-radius: var(--radius-lg); padding: 20px 24px; box-shadow: var(--shadow-sm); margin-bottom: 24px; display: flex; gap: 12px; align-items: center; border: 2px solid transparent; transition: border-color .2s; }
.property-search-bar:focus-within { border-color: var(--ocean); }
.search-icon { font-size: 20px; color: var(--muted); flex-shrink: 0; }
.search-input { flex: 1; border: none; outline: none; font-size: 15px; font-family: inherit; color: var(--dark); background: transparent; }
.search-input::placeholder { color: var(--muted); }
.search-btn { padding: 10px 24px; background: var(--navy); color: white; border: none; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s; white-space: nowrap; }
.search-btn:hover { background: var(--ocean); }

.property-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-bottom: 24px; }
.property-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.property-hero { height: 180px; background: linear-gradient(135deg, var(--navy) 0%, var(--ocean) 100%); display: flex; align-items: center; justify-content: center; font-size: 64px; position: relative; }
.property-hero-badge { position: absolute; top: 12px; left: 12px; background: var(--gold); color: var(--navy); font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.property-details { padding: 20px 24px; }
.property-address { font-size: 15px; font-weight: 700; color: var(--dark); margin-bottom: 4px; }
.property-ref { font-size: 11px; color: var(--muted); margin-bottom: 16px; font-family: monospace; }
.property-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spec-item { display: flex; flex-direction: column; }
.spec-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.spec-value { font-size: 14px; font-weight: 600; color: var(--dark); }

.valuation-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 24px; }
.valuation-price { font-size: 36px; font-weight: 800; color: var(--navy); line-height: 1; margin-bottom: 4px; }
.valuation-range { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.valuation-metrics { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.val-metric { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--sand); border-radius: 10px; }
.val-metric-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.val-metric-value { font-size: 14px; font-weight: 700; color: var(--dark); }
.val-metric-value.yield { color: var(--success); }

.similar-section { margin-top: 24px; }
.similar-title { font-size: 15px; font-weight: 700; color: var(--dark); margin-bottom: 14px; }
.similar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.similar-card { background: var(--white); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-xs); border: 1.5px solid var(--border); transition: border-color .2s; }
.similar-card:hover { border-color: var(--ocean); }
.similar-addr { font-size: 12px; font-weight: 600; color: var(--dark); margin-bottom: 6px; }
.similar-price { font-size: 18px; font-weight: 800; color: var(--navy); }
.similar-meta  { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* Map placeholder */
.map-section { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; margin-top: 24px; }
.map-header { padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.map-placeholder { height: 300px; background: linear-gradient(145deg, #E8F4F8 0%, #D1E9F5 50%, #B8DBF0 100%); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.map-placeholder::before { content: ''; position: absolute; inset: 0; background-image: repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(26,123,164,.08) 40px, rgba(26,123,164,.08) 41px), repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(26,123,164,.08) 40px, rgba(26,123,164,.08) 41px); }
.map-pin { font-size: 48px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); animation: bounce-pin 2s ease-in-out infinite; position: relative; z-index: 1; }
.map-note { font-size: 13px; color: var(--muted); margin-top: 8px; position: relative; z-index: 1; text-align: center; }
@keyframes bounce-pin { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* Tax calendar */
.tax-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 16px; }
.tax-item { background: var(--white); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-xs); border-left: 4px solid var(--border); }
.tax-item.high   { border-left-color: var(--danger); }
.tax-item.medium { border-left-color: var(--warning); }
.tax-item.low    { border-left-color: var(--success); }
.tax-title { font-size: 13px; font-weight: 700; color: var(--dark); margin-bottom: 4px; }
.tax-deadline { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.tax-desc  { font-size: 12px; color: var(--muted); line-height: 1.5; }
.tax-badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.tax-badge.irpf  { background: #FEF3C7; color: #92400E; }
.tax-badge.ibi   { background: #E0E7FF; color: #3730A3; }
.tax-badge.m210  { background: #FCE7F3; color: #9D174D; }
.tax-badge.local { background: #D1FAE5; color: #065F46; }

/* ════════════════════════════ AI CHAT HUB ══════════════════════════════════ */
.ai-layout { display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px; height: calc(100vh - 180px); }
.agents-panel { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.agent-card { background: var(--white); border-radius: var(--radius-lg); padding: 20px; cursor: pointer; border: 2px solid var(--border); transition: all .25s; position: relative; overflow: hidden; }
.agent-card:hover { border-color: var(--ocean); transform: translateY(-2px); box-shadow: var(--shadow); }
.agent-card.active { border-color: var(--gold); box-shadow: var(--shadow-gold); }
.agent-card.active::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--gold), #E8C56A); }
.agent-avatar { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 12px; }
.agent-name { font-size: 15px; font-weight: 800; color: var(--dark); margin-bottom: 3px; }
.agent-role { font-size: 12px; color: var(--ocean); font-weight: 600; margin-bottom: 8px; }
.agent-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.agent-topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.agent-topic { font-size: 11px; background: var(--sand); color: var(--muted); padding: 3px 8px; border-radius: 6px; }
.agent-card.active .agent-topic { background: var(--gold-pale); color: #8B6914; }

.chat-panel { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; overflow: hidden; }
.chat-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; background: var(--sand); }
.chat-agent-avatar { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.chat-agent-name { font-size: 15px; font-weight: 700; color: var(--dark); }
.chat-agent-status { font-size: 11px; color: var(--success); font-weight: 500; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; text-align: center; }
.chat-empty-icon { font-size: 48px; margin-bottom: 12px; }
.chat-empty-text { font-size: 14px; color: var(--muted); line-height: 1.6; }
.chat-empty-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip { background: var(--ocean-light); color: var(--ocean); padding: 7px 14px; border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer; border: none; transition: all .2s; }
.chip:hover { background: var(--ocean); color: white; }

.msg { display: flex; gap: 10px; max-width: 88%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.msg-bubble { padding: 12px 16px; border-radius: 14px; font-size: 13.5px; line-height: 1.6; }
.msg.agent .msg-bubble { background: var(--sand); color: var(--dark); border-top-left-radius: 4px; }
.msg.user  .msg-bubble { background: linear-gradient(135deg, var(--navy), var(--ocean)); color: white; border-top-right-radius: 4px; }
.msg-bubble strong { font-weight: 700; }
.msg-bubble p + p { margin-top: 8px; }
.msg-time { font-size: 10px; color: var(--muted); margin-top: 4px; text-align: right; }
.msg.agent .msg-time { text-align: left; }

/* Typing indicator */
.typing-indicator { display: flex; gap: 4px; align-items: center; padding: 12px 16px; background: var(--sand); border-radius: 14px; border-top-left-radius: 4px; width: fit-content; }
.typing-dot { width: 7px; height: 7px; background: var(--muted); border-radius: 50%; animation: typing .8s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%,80%,100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-6px); opacity: 1; } }

.chat-input-area { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.chat-input { flex: 1; padding: 11px 16px; border: 1.5px solid var(--border); border-radius: 24px; font-size: 14px; font-family: inherit; outline: none; transition: border-color .2s; resize: none; }
.chat-input:focus { border-color: var(--ocean); }
.chat-send-btn { width: 44px; height: 44px; background: var(--navy); color: white; border: none; border-radius: 50%; cursor: pointer; font-size: 18px; transition: all .2s; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.chat-send-btn:hover { background: var(--ocean); transform: scale(1.05); }

/* Markdown-like rendering in chat */
.msg-bubble table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 12px; }
.msg-bubble th, .msg-bubble td { padding: 5px 10px; border: 1px solid rgba(0,0,0,.1); text-align: left; }
.msg-bubble th { background: rgba(0,0,0,.05); font-weight: 700; }

/* ════════════════════════════ LOCAL LIFE ═══════════════════════════════════ */
.emergency-section { margin-bottom: 28px; }
.emergency-title { font-size: 18px; font-weight: 800; color: var(--danger); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.sos-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.sos-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 12px; border-radius: var(--radius-lg); border: none; cursor: pointer; transition: all .2s; text-decoration: none; }
.sos-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }
.sos-btn .sos-emoji { font-size: 28px; margin-bottom: 8px; }
.sos-btn .sos-label { font-size: 11px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.sos-btn .sos-number { font-size: 16px; font-weight: 800; }

.services-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
.community-card { background: var(--white); border-radius: var(--radius-lg); padding: 20px 24px; box-shadow: var(--shadow-sm); }
.community-links { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.community-link { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--sand); border-radius: var(--radius); cursor: pointer; transition: all .2s; }
.community-link:hover { background: var(--ocean-light); }
.community-link-icon { font-size: 20px; width: 36px; text-align: center; }
.community-link-body { flex: 1; }
.community-link-title { font-size: 13px; font-weight: 600; color: var(--dark); }
.community-link-sub { font-size: 11px; color: var(--muted); }

.pharmacy-card { background: linear-gradient(135deg, var(--success-bg) 0%, #DCFCE7 100%); border: 1.5px solid var(--success); border-radius: var(--radius-lg); padding: 20px 24px; box-shadow: var(--shadow-sm); }
.pharmacy-status { font-size: 13px; font-weight: 600; color: var(--success); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.pharmacy-name { font-size: 16px; font-weight: 800; color: var(--dark); margin-bottom: 4px; }
.pharmacy-addr { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.pharmacy-hours { font-size: 13px; font-weight: 600; color: var(--dark); }

/* Directory */
.dir-filters { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.dir-filter { padding: 7px 16px; border-radius: 20px; border: 1.5px solid var(--border); background: var(--white); font-size: 12px; font-weight: 600; cursor: pointer; transition: all .2s; color: var(--muted); }
.dir-filter.active { background: var(--navy); border-color: var(--navy); color: white; }
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.dir-card { background: var(--white); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); border: 1.5px solid var(--border); transition: all .2s; position: relative; }
.dir-card:hover { border-color: var(--ocean); box-shadow: var(--shadow); }
.dir-card-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.dir-card-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--sand); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.dir-card-name { font-size: 15px; font-weight: 700; color: var(--dark); }
.dir-card-cat  { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.verified-badge { position: absolute; top: 14px; right: 14px; background: var(--gold); color: var(--navy); font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 8px; display: flex; align-items: center; gap: 3px; }
.dir-rating { display: flex; align-items: center; gap: 4px; font-size: 12px; margin-bottom: 8px; }
.dir-stars { color: var(--gold); }
.dir-review-count { color: var(--muted); }
.dir-desc { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 12px; }
.dir-price { font-size: 13px; font-weight: 600; color: var(--dark); margin-bottom: 12px; }
.dir-areas { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.dir-area { font-size: 11px; background: var(--ocean-light); color: var(--ocean); padding: 2px 8px; border-radius: 6px; }
.dir-actions { display: flex; gap: 8px; }
.dir-btn { flex: 1; padding: 9px; border-radius: 10px; border: none; cursor: pointer; font-size: 12px; font-weight: 600; transition: all .2s; }
.dir-btn.call { background: var(--navy); color: white; }
.dir-btn.call:hover { background: var(--ocean); }
.dir-btn.whatsapp { background: #25D366; color: white; }
.dir-btn.whatsapp:hover { background: #128C7E; }

/* ════════════════════════════ DOCUMENTS ════════════════════════════════════ */
.bills-layout { display: flex; flex-direction: column; gap: 20px; }
.scan-result-box { background: var(--gold-pale); border: 1.5px solid var(--gold); border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 16px; }
.scan-result-box h4 { font-size: 14px; font-weight: 700; color: var(--dark); margin-bottom: 14px; }
.scan-fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.scan-field label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 4px; }
.scan-field span { font-size: 14px; font-weight: 600; color: var(--dark); }
.scan-loading-box { text-align: center; color: var(--muted); font-size: 14px; padding: 8px; }

.filter-row { display: flex; align-items: center; gap: 12px; }
.filter-select { padding: 7px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; outline: none; background: var(--white); cursor: pointer; }
.tag-select { padding: 5px 10px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 12px; font-family: inherit; background: var(--white); cursor: pointer; }

.bills-table { width: 100%; border-collapse: collapse; }
.bills-table th { text-align: left; padding: 10px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); border-bottom: 2px solid var(--border); }
.bills-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.bills-table tr:hover td { background: var(--sand); }
.loading-cell { text-align: center; color: var(--muted); padding: 32px !important; }

.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge.paid    { background: var(--success-bg); color: var(--success); }
.badge.pending { background: var(--warning-bg); color: var(--warning); }
.badge.overdue { background: var(--danger-bg); color: var(--danger); }

.ocr-bar { display: flex; align-items: center; gap: 8px; }
.ocr-track { flex: 1; height: 5px; background: var(--sand); border-radius: 3px; overflow: hidden; }
.ocr-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--ocean)); border-radius: 3px; }
.ocr-pct { font-size: 11px; color: var(--muted); white-space: nowrap; }

.agent-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 700; background: var(--gold-pale); color: #8B6914; }

/* Vault overview */
.vault-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.vault-row:last-child { border-bottom: none; }
.vault-row-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.vault-row-body { flex: 1; min-width: 0; }
.vault-row-name { font-size: 13px; font-weight: 600; color: var(--dark); }
.vault-row-ref  { font-size: 11px; color: var(--muted); }
.vault-row-right { text-align: right; }
.vault-row-amount { font-size: 14px; font-weight: 700; color: var(--dark); }

/* ════════════════════════════ BANKING ══════════════════════════════════════ */
.banking-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.span-full { grid-column: 1 / -1; }
.account-detail { display: flex; flex-direction: column; gap: 1px; }
.account-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.account-row:last-child { border-bottom: none; }
.account-row span { font-size: 12px; color: var(--muted); }
.account-row strong { font-size: 13px; font-weight: 600; color: var(--dark); }

.predicted-grid, .predicted-grid-banking { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 20px 24px; }
.pred-card { background: var(--white); border-radius: var(--radius); padding: 16px; border: 1.5px solid var(--border); transition: all .2s; }
.pred-card:hover { border-color: var(--gold); box-shadow: var(--shadow-gold); }
.pred-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pred-emoji { font-size: 24px; }
.pred-conf { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pred-supplier { font-size: 13px; font-weight: 700; color: var(--dark); margin-bottom: 4px; }
.pred-amount { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.pred-amount.urgent  { color: var(--danger); }
.pred-amount.warning { color: var(--warning); }
.pred-amount.ok      { color: var(--navy); }
.pred-footer { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.pred-due.urgent  { color: var(--danger); font-weight: 700; }
.pred-due.warning { color: var(--warning); font-weight: 700; }

.tx-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.tx-item:last-child { border-bottom: none; }
.tx-emoji { font-size: 20px; width: 36px; text-align: center; }
.tx-body { flex: 1; }
.tx-name { font-size: 13px; font-weight: 600; color: var(--dark); }
.tx-date { font-size: 11px; color: var(--muted); }
.tx-amount { font-size: 14px; font-weight: 700; color: var(--danger); }

.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.status-pill.connected { background: var(--success-bg); color: var(--success); }

/* ════════════════════════════ SECURITY ═════════════════════════════════════ */
.security-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.alarm-full-card { grid-column: 1; }
.alarm-full-inner { display: flex; align-items: center; justify-content: space-between; padding: 32px; }
.alarm-full-left { display: flex; flex-direction: column; gap: 8px; }
.alarm-provider-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--navy); color: white; padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; width: fit-content; }
.alarm-full-icon  { font-size: 56px; }
.alarm-full-state { font-size: 28px; font-weight: 800; color: var(--dark); }
.alarm-full-state.armed { color: var(--success); }
.alarm-full-alias { font-size: 14px; color: var(--muted); }

.alarm-toggle-large { width: 80px; height: 44px; background: var(--border); border-radius: 22px; cursor: pointer; transition: all .4s; position: relative; }
.alarm-toggle-large.armed { background: linear-gradient(135deg, var(--success), #16A34A); }
.alarm-thumb-large { width: 36px; height: 36px; background: white; border-radius: 50%; position: absolute; top: 4px; left: 4px; transition: all .4s; box-shadow: var(--shadow); }
.alarm-toggle-large.armed .alarm-thumb-large { left: 40px; }
.alarm-toggle-label { font-size: 12px; color: var(--muted); text-align: center; margin-top: 8px; }
.alarm-action-btn { display: block; width: calc(100% - 48px); margin: 0 24px 24px; padding: 14px; border: none; border-radius: var(--radius); background: linear-gradient(135deg, var(--navy), var(--ocean)); color: white; font-size: 14px; font-weight: 700; cursor: pointer; transition: all .2s; }
.alarm-action-btn.armed { background: linear-gradient(135deg, var(--danger), #DC2626); }
.alarm-action-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.alarm-vault-note { padding: 0 24px 20px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }

.alarm-toggle-mini { width: 46px; height: 26px; background: var(--border); border-radius: 13px; cursor: pointer; transition: all .3s; position: relative; flex-shrink: 0; }
.alarm-toggle-mini.armed { background: var(--success); }
.alarm-thumb-mini { width: 20px; height: 20px; background: white; border-radius: 50%; position: absolute; top: 3px; left: 3px; transition: all .3s; box-shadow: var(--shadow-xs); }
.alarm-toggle-mini.armed .alarm-thumb-mini { left: 23px; }

.alarm-kpi { gap: 12px; }
.alarm-big-icon  { font-size: 36px; }
.alarm-big-state { font-size: 16px; font-weight: 700; }
.alarm-big-state.armed { color: var(--success); }
.alarm-big-alias { font-size: 12px; color: var(--muted); }

.security-arch { display: flex; flex-direction: column; gap: 0; }
.arch-step { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.arch-step:last-child { border-bottom: none; }
.arch-num { width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: white; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }

.fn-list { display: flex; flex-direction: column; gap: 0; }
.fn-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.fn-row:last-child { border-bottom: none; }
.fn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.fn-name { font-size: 13px; font-weight: 600; color: var(--dark); flex: 1; }
.fn-status { font-size: 12px; }
.endpoint-url { font-size: 11px; display: block; }

/* ════════════════════════════ SETTINGS ════════════════════════════════════ */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.profile-row { display: flex; align-items: center; gap: 14px; padding: 4px 0; }
.profile-av { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), var(--ocean)); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: white; }
.profile-nm { font-size: 15px; font-weight: 700; color: var(--dark); }
.profile-em { font-size: 12px; color: var(--muted); }

.integration-list { display: flex; flex-direction: column; }
.int-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.int-row:last-child { border-bottom: none; }
.int-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.int-icon.bank     { background: #DBEAFE; }
.int-icon.alarm    { background: #D1FAE5; }
.int-icon.ocr      { background: #FEF3C7; }
.int-icon.firebase { background: #FEE2E2; }
.int-body { flex: 1; }
.int-title { font-size: 13px; font-weight: 600; color: var(--dark); }
.int-sub   { font-size: 11px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.pill.green  { background: var(--success-bg); color: var(--success); }
.pill.orange { background: var(--warning-bg); color: var(--warning); }

.bank-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 16px 20px; }
.bank-option { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; border-radius: 10px; cursor: pointer; border: 1.5px solid var(--border); font-size: 12px; font-weight: 500; transition: all .2s; color: var(--text); }
.bank-option:hover { border-color: var(--ocean); }
.bank-option.selected { border-color: var(--gold); background: var(--gold-pale); }

/* ════════════════════════════ SHARED UTILS ═════════════════════════════════ */
.skeleton { background: linear-gradient(90deg, var(--border) 25%, var(--sand) 50%, var(--border) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); height: 120px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dash-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.dash-card.span-2 { grid-column: 1 / -1; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--dark); color: white; padding: 12px 24px; border-radius: 24px; font-size: 14px; font-weight: 500; z-index: 1000; opacity: 0; transition: all .3s; box-shadow: var(--shadow-lg); border-left: 4px solid var(--gold); max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.fade-up { animation: fadeUp .3s ease forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.header-actions { display: flex; align-items: center; gap: 12px; }
.last-updated { font-size: 12px; color: var(--muted); }
.btn-label { display: inline; }

/* ════════════════════════════ MY PROPERTY ══════════════════════════════════ */

/* Aerial photo grid */
.aerial-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.aerial-slot { position: relative; aspect-ratio: 16/10; border-radius: 10px; overflow: hidden; cursor: pointer; border: 2px dashed var(--border); background: var(--sand); transition: border-color .2s; }
.aerial-slot:hover { border-color: var(--ocean); }
.aerial-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aerial-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 6px; color: var(--muted); }
.aerial-placeholder span:first-child { font-size: 28px; }
.aerial-placeholder .ap-label { font-size: 12px; font-weight: 600; color: var(--text); }
.aerial-placeholder .ap-sub   { font-size: 10px; color: var(--muted); }
.aerial-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0); display: flex; align-items: center; justify-content: center; opacity: 0; transition: all .2s; }
.aerial-slot:hover .aerial-overlay { background: rgba(0,0,0,.4); opacity: 1; }
.aerial-overlay span { color: white; font-size: 22px; }
.aerial-hint { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0 0; }

/* Section blocks */
.section-block { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 20px; }
.section-block-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 14px; border-bottom: 1px solid var(--border); }
.section-block-header h3 { font-size: 15px; font-weight: 700; color: var(--dark); margin: 0; display: flex; align-items: center; gap: 8px; }
.section-block-body { padding: 20px; }

/* Property config form */
.prop-form { display: flex; flex-direction: column; gap: 0; }
.form-section-title { font-size: 10px; font-weight: 700; letter-spacing: 1.1px; color: var(--muted); text-transform: uppercase; padding: 16px 20px 10px; border-top: 1px solid var(--border); }
.form-section-title:first-child { border-top: none; padding-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 0 20px 16px; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 11px; font-weight: 600; color: var(--text); }
.form-input { padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; color: var(--dark); background: var(--white); outline: none; transition: border-color .2s; width: 100%; box-sizing: border-box; }
.form-input:focus { border-color: var(--ocean); }
.form-input.font-mono { font-family: 'Courier New', monospace; letter-spacing: 0.5px; }
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input { cursor: pointer; }

/* Feature checkboxes */
.features-checkboxes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 20px 16px; }
.feat-check { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; color: var(--text); }
.feat-check input[type=checkbox] { accent-color: var(--gold); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }

/* Form save row */
.form-save-row { padding: 12px 20px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* Neighbourhood demo strip */
.demo-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.demo-kpi { background: var(--sand); border-radius: 10px; padding: 12px 8px; text-align: center; }
.demo-kpi-icon { font-size: 20px; }
.demo-kpi-val { font-size: 16px; font-weight: 800; color: var(--dark); margin: 4px 0 2px; }
.demo-kpi-lbl { font-size: 10px; color: var(--muted); font-weight: 500; }

/* Nationality bar chart */
.nbh-nationals { display: flex; flex-direction: column; gap: 8px; }
.nat-row { display: flex; align-items: center; gap: 10px; }
.nat-label { font-size: 12px; color: var(--text); width: 90px; flex-shrink: 0; }
.nat-bar-wrap { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.nat-bar { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--ocean), var(--gold)); }
.nat-pct { font-size: 12px; font-weight: 700; color: var(--dark); width: 32px; text-align: right; }

/* Neighbourhood tabs */
.nbh-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 16px 20px 0; }
.nbh-tab { padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1.5px solid var(--border); color: var(--muted); background: var(--white); transition: all .2s; }
.nbh-tab:hover  { border-color: var(--ocean); color: var(--ocean); }
.nbh-tab.active { border-color: var(--gold); background: var(--gold-pale); color: var(--dark); }

/* Neighbourhood content cards */
.nbh-content { padding: 16px 20px 20px; }
.nbh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nbh-card { background: var(--sand); border-radius: 10px; padding: 14px; }
.nbh-card-name { font-size: 13px; font-weight: 700; color: var(--dark); margin-bottom: 4px; }
.nbh-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.nbh-badge-sm { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; background: var(--white); color: var(--muted); border: 1px solid var(--border); }
.nbh-badge-sm.green  { background: var(--success-bg); color: var(--success); border-color: transparent; }
.nbh-badge-sm.gold   { background: var(--gold-pale);  color: var(--dark);    border-color: transparent; }
.nbh-badge-sm.blue   { background: #EFF6FF;            color: #1D4ED8;        border-color: transparent; }
.nbh-card-detail { font-size: 11px; color: var(--muted); }
.nbh-card-km { font-size: 11px; color: var(--ocean); font-weight: 600; }

/* Similar properties table */
.sim-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sim-table th { text-align: left; padding: 8px 12px; font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); border-bottom: 1.5px solid var(--border); white-space: nowrap; }
.sim-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.sim-table tr:last-child td { border-bottom: none; }
.sim-table tr:hover td { background: var(--sand); }
.sim-price { font-weight: 700; color: var(--dark); }
.sim-est   { font-weight: 600; color: var(--ocean); }

/* Btn variants */
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 7px; cursor: pointer; font-weight: 600; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); transition: all .2s; }
.btn-outline:hover { border-color: var(--ocean); color: var(--ocean); }

/* Service contracts list */
.contract-card { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.contract-card:last-child { border-bottom: none; }
.contract-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; background: var(--sand); }
.contract-body { flex: 1; min-width: 0; }
.contract-name { font-size: 13px; font-weight: 700; color: var(--dark); }
.contract-company { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.contract-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.contract-pill { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.contract-pill.freq  { background: #EFF6FF; color: #1D4ED8; }
.contract-pill.price { background: var(--gold-pale); color: var(--dark); }
.contract-pill.due   { background: var(--success-bg); color: var(--success); }
.contract-pill.warn  { background: var(--warning-bg); color: var(--warning); }
.contract-notes { font-size: 11px; color: var(--muted); margin-top: 4px; }
.contract-ref { font-size: 10px; color: var(--muted); font-family: monospace; }
.contract-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

/* Rental KPI strip */
.rental-kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.rental-kpi { background: var(--sand); border-radius: 10px; padding: 12px; text-align: center; }
.rental-kpi-val { font-size: 18px; font-weight: 800; color: var(--dark); }
.rental-kpi-lbl { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* Booking calendar */
.rental-bookings { display: flex; flex-direction: column; gap: 8px; }
.booking-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; padding: 12px 14px; background: var(--sand); border-radius: 10px; }
.booking-status { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.booking-status.confirmed { background: var(--success); }
.booking-status.pending   { background: var(--warning); }
.booking-status.owner     { background: var(--ocean); }
.booking-guest { font-size: 13px; font-weight: 600; color: var(--dark); }
.booking-dates { font-size: 11px; color: var(--muted); }
.booking-nights { font-size: 12px; color: var(--muted); }
.booking-amount { font-size: 13px; font-weight: 700; color: var(--dark); text-align: right; }
.booking-platform { font-size: 10px; color: var(--muted); text-align: right; }

/* ════════════════════════════ MOBILE (< 768px) ═════════════════════════════ */

/* ── Mobile-only elements (hidden on tablet/desktop) ── */
.mobile-topbar,
.mobile-bottom-nav,
.mobile-drawer,
.mobile-drawer-overlay { display: none; }

/* ════ MOBILE MEDIA QUERY ════ */
@media (max-width: 767px) {

  /* ── App shell: hide sidebar, stack vertically ── */
  .sidebar { display: none !important; }
  #screen-app.active { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
  .app-layout { flex-direction: column; height: 100%; overflow: hidden; }
  .main-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom); }
  .view { padding: 16px 14px 24px; }

  /* ── Mobile top bar ── */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: linear-gradient(135deg, var(--navy), var(--ocean));
    color: white;
    flex-shrink: 0;
    z-index: 100;
  }
  .mobile-topbar-brand { display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 800; letter-spacing: -.2px; flex-shrink: 0; }
  .mobile-topbar-title { flex: 1; font-size: 13px; color: rgba(255,255,255,.65); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobile-topbar-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
  .mobile-icon-btn { background: transparent; border: none; color: rgba(255,255,255,.7); font-size: 18px; padding: 6px; cursor: pointer; line-height: 1; border-radius: 8px; }
  .mobile-icon-btn:hover { background: rgba(255,255,255,.1); }
  .mobile-lang { background: rgba(255,255,255,.12); color: white; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: 4px 6px; font-size: 11px; cursor: pointer; max-width: 80px; }
  .mobile-lang option { background: var(--navy); color: white; }

  /* ── Mobile bottom nav ── */
  .mobile-bottom-nav {
    display: flex;
    background: var(--white);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    flex-shrink: 0;
    box-shadow: 0 -4px 16px rgba(0,0,0,.08);
    z-index: 100;
  }
  .mob-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 8px 4px 6px; background: transparent; border: none; cursor: pointer;
    color: var(--muted); transition: color .2s; min-height: 56px; position: relative;
  }
  .mob-nav-item::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 0; height: 3px; background: var(--gold); border-radius: 0 0 3px 3px; transition: width .2s;
  }
  .mob-nav-item.active { color: var(--navy); }
  .mob-nav-item.active::before { width: 24px; }
  .mob-nav-icon { font-size: 22px; line-height: 1; }
  .mob-nav-label { font-size: 9px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }

  /* ── More drawer overlay ── */
  .mobile-drawer-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4);
    z-index: 200; backdrop-filter: blur(2px);
  }
  .mobile-drawer-overlay.open { display: block; }

  /* ── More drawer (slide up) ── */
  .mobile-drawer {
    display: flex; flex-direction: column;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--white); border-radius: 20px 20px 0 0;
    z-index: 201; transform: translateY(100%); transition: transform .3s cubic-bezier(.32,.72,0,1);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -8px 32px rgba(0,0,0,.15);
  }
  .mobile-drawer.open { transform: translateY(0); }
  .mobile-drawer-handle { width: 40px; height: 4px; background: var(--border); border-radius: 2px; margin: 12px auto 0; }
  .mobile-drawer-header { padding: 12px 20px 14px; border-bottom: 1px solid var(--border); }
  .mobile-drawer-user { display: flex; align-items: center; gap: 12px; }
  .mobile-drawer-nav { padding: 8px 12px; }
  .mob-drawer-item {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 12px;
    background: transparent; border: none; cursor: pointer; border-radius: 10px;
    font-size: 14px; font-weight: 500; color: var(--text); text-align: left; transition: background .15s;
  }
  .mob-drawer-item:hover, .mob-drawer-item.active { background: var(--sand); color: var(--navy); }
  .mob-drawer-item span:first-child { font-size: 20px; width: 28px; text-align: center; }
  .mobile-drawer-footer { padding: 10px 20px 16px; text-align: center; }

  /* ── Login: brand strip at top, form below ── */
  .login-split {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }
  .login-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: max(env(safe-area-inset-top), 28px) 28px 28px;
    min-height: auto;
    flex-shrink: 0;
  }
  /* Hide verbose feature list and pill — keep logo + tagline only */
  .brand-features,
  .brand-mock-pill { display: none; }
  .brand-tagline { font-size: 15px; margin-bottom: 0; }
  .logo-text { font-size: 24px; }
  .logo-icon { font-size: 34px; }

  .login-form-panel {
    flex: 1;
    padding: 28px 24px 32px;
    align-items: flex-start;
    overflow-y: auto;
  }
  .login-form-panel::before { display: none; }
  .login-form-box { max-width: 100%; }

  /* ── Page header ── */
  .page-header { flex-direction: column; gap: 8px; margin-bottom: 16px; }
  .page-title { font-size: 20px; }
  .header-actions .last-updated { display: none; }

  /* ── KPI row: 2×2 grid ── */
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .kpi-card { padding: 14px; gap: 10px; }
  .kpi-icon { width: 38px; height: 38px; font-size: 18px; }
  .kpi-value { font-size: 18px; }

  /* ── Settings grid: single column ── */
  .settings-grid { grid-template-columns: 1fr; }

  /* ── Property search bar ── */
  .property-search-bar { flex-wrap: wrap; padding: 14px; gap: 8px; }
  .search-btn { width: 100%; }

  /* ── Market benchmarks grid: 2 col ── */
  .benchmarks-grid { grid-template-columns: 1fr 1fr !important; }

  /* ── AI chat: full height ── */
  .ai-chat-layout { flex-direction: column; height: calc(100vh - 112px); }
  .agent-sidebar { width: 100%; max-height: 120px; overflow-x: auto; flex-direction: row; border-right: none; border-bottom: 1px solid var(--border); }
  .agent-btn { flex-direction: row; min-width: 120px; padding: 8px 12px; }

  /* ── Local life: emergency grid 2 cols ── */
  .emergency-grid { grid-template-columns: 1fr 1fr !important; }

  /* ── Cards: remove side padding on mobile ── */
  .card-body { padding: 14px 16px; }
  .card-header { padding: 14px 16px; }

  /* ── My Property ── */
  .aerial-grid { grid-template-columns: 1fr 1fr; }
  .demo-strip  { grid-template-columns: repeat(3, 1fr); }
  .features-checkboxes { grid-template-columns: repeat(2, 1fr); }
  .form-grid   { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .nbh-grid    { grid-template-columns: 1fr; }
  .rental-kpi-strip { grid-template-columns: 1fr 1fr; }
  .booking-row { grid-template-columns: auto 1fr auto; }
  .booking-amount { display: none; }
  .section-block-body { padding: 14px 16px; }
  .sim-table { font-size: 11px; }

  /* ── Predicted bills ── */
  .pred-grid { grid-template-columns: 1fr 1fr !important; }

  /* ── Directory cards ── */
  .directory-grid { grid-template-columns: 1fr !important; }
}

/* ── Tablet (768–1023px): keep desktop layout, minor tweaks ── */
@media (min-width: 768px) and (max-width: 1023px) {
  :root { --sidebar-w: 220px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .view { padding: 20px 24px; }
  .settings-grid { grid-template-columns: 1fr; }
  .sim-table { font-size: 11px; }
}
