/* ════ DESKTOP LAYOUT ════ */
.app {
  display: flex;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
  background: #EEF1F5;
  background-attachment: fixed;
}

/* ── SIDEBAR — rich navy + subtle light play ── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: linear-gradient(180deg, #182A49 0%, #14233D 100%);
  border-right: none;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  overflow-y: auto;
  box-shadow: none;
}
.sidebar::before {
  content:'';
  position:absolute; top:0; left:0; right:0; height:160px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
  pointer-events:none;
}
.sidebar::after {
  display: none;
}
.sidebar-logo {
  padding: 3px 14px 3px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: transparent;
}
.sidebar-logo .brand { display:flex; align-items:center; gap:10px; }
.sidebar-logo .brand-logo-badge,
.sidebar-logo .brand-icon {
  width:36px; height:36px;
  background: linear-gradient(180deg, #182A49 0%, #14233D 100%);
  border: 1.5px solid #D4AF37;
  border-radius:10px; display:flex; align-items:center; justify-content:center;
  font-size:18px; color:#D4AF37;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  flex-shrink:0;
}
.sidebar-logo .brand-logo-letter {
  display:block; font-size:18px; line-height:1; font-weight:800; letter-spacing:0;
  color:#D4AF37;
  background: linear-gradient(180deg, #E5C76B 0%, #D4AF37 50%, #A87920 100%);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
  text-shadow: none;
}
.sidebar-logo .brand-title,
.sidebar-logo .title {
  font-family: 'Playfair Display', serif;
  font-size: 17px; font-weight: 700;
  color: #D4AF37;
  background: none;
  -webkit-text-fill-color: #D4AF37;
  letter-spacing: 0;
  text-shadow: none;
}
.sidebar-logo .brand-subtitle,
.sidebar-logo .subtitle {
  font-size:9px; color:#F8FAFC; opacity:1; margin-top:1px;
  font-weight:500; letter-spacing:0; text-transform:uppercase;
  text-shadow: none;
}
/* sidebar nav */
.sidebar-nav { flex:1; padding: 8px 10px; }
.sidebar-section-label {
  font-size:9px; font-weight:800; color:rgba(255,255,255,0.45);
  text-transform:uppercase; letter-spacing:1px;
  padding: 10px 10px 5px;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 2px;
  display: none !important;
}
.sidebar .tab-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  background: linear-gradient(180deg, #182A49 0%, #14233D 100%);
  border: none;
  border-left: 3px solid transparent;
  font-size: 13px; font-weight: 600; color: #FFFFFF;
  cursor: pointer; border-radius: 10px; transition: background .18s;
  font-family: 'DM Sans', sans-serif;
  text-align: left; white-space: nowrap;
  margin-bottom: 2px;
  box-shadow: none;
}
.sidebar .tab-btn:hover { background: #1A2D4D; color: #FFFFFF; box-shadow: none; }
.sidebar .tab-btn.active {
  background: linear-gradient(180deg, #3D4D63 0%, #334155 100%);
  color: #FFFFFF;
  border: none;
  border-left: 3px solid rgba(255,255,255,0.55);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14);
}
.sidebar .tab-btn .tab-icon,
.sidebar .tab-btn .tab-icon svg { color: #F8FAFC; stroke: #F8FAFC; }
.sidebar .tab-btn.sme-gold-tab { border-left: 3px solid #D4AF37; color: #D4AF37; }
.sidebar .tab-btn.sme-gold-tab .tab-icon,
.sidebar .tab-btn.sme-gold-tab .tab-icon svg { color: #D4AF37; stroke: #D4AF37; }
.sidebar .tab-btn.gold-tab {
  background: linear-gradient(160deg, #F2DF9C 0%, #E3C25C 45%, #D4AF37 75%, #B8942E 100%);
  color: #14233D; font-weight: 700;
  border-left: 3px solid #A87920;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 2px 6px rgba(0,0,0,0.25);
}
.sidebar .tab-btn.gold-tab .tab-icon,
.sidebar .tab-btn.gold-tab .tab-icon svg { color: #14233D; stroke: #14233D; }
.tab-btn .tab-icon { font-size:16px; width:20px; text-align:center; flex-shrink:0; }

/* sidebar footer */
.sidebar-footer {
  padding: 9px 16px 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.user-bar {
  display: flex; flex-direction: column; gap: 6px;
}
.user-bar-email { font-size: 11.5px; color: rgba(255,255,255,0.5); font-weight: 600; word-break:break-all; }
.user-bar-logout {
  font-size: 11.5px; font-weight: 700; color: #FFFFFF;
  background: linear-gradient(180deg, #182A49 0%, #14233D 100%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; cursor: pointer; padding: 6px 10px; text-align:left;
  width:100%;
  box-shadow: none;
}


/* ── MAIN AREA ── */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  min-width: 0;
}

/* top bar — navy frame band (continues the sidebar; solid = seamless joint) */
.topbar {
  background: #182A49;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0 16px;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 30;
  box-shadow: none;
  min-height: 76px;
  /* no overflow:hidden — the search dropdown must hang below the bar */
  gap: 8px;
}
.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px; font-weight: 800; color: #F8FAFC;
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 1; min-width: 0; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis;
}
.topbar-sub { display: none; }

/* content */
.content {
  flex: 1;
  padding: var(--page-padding) var(--page-padding) 40px;
  background: #EEF1F5;
  position: relative;
  max-width: 100%;
  overflow-x: hidden;
}
.tab-pane { display:none; animation: fadeUp .2s ease; }
.tab-pane.active { display:block; }
@keyframes fadeUp { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:translateY(0)} }

/* desktop grid for forms + results side by side */
.desktop-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  align-items: start;
}
.desktop-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}
.desktop-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* page header */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 22px;
}
.page-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 24px; font-weight: 800; color: var(--navy-2);
}
.page-header p { font-size:13px; color:var(--t-dark-3); margin-top:3px; }

/* stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: 14px; padding: 18px 20px;
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content:''; position:absolute; top:0; left:0; right:0; height:2px;
  background: linear-gradient(90deg, transparent, rgba(30,42,58,0.45), transparent);
}
.stat-label { font-size:11px; font-weight:700; color:var(--t-dark-3); text-transform:uppercase; letter-spacing:.4px; margin-bottom:8px; }
.stat-value { font-family:'Playfair Display',serif; font-size:28px; font-weight:800; color:var(--navy-2); }
.stat-change { font-size:11.5px; font-weight:600; margin-top:4px; }
.stat-change.up { color:var(--green); }
.stat-change.down { color:var(--red); }

/* tabs wrapper hidden on desktop (using sidebar) */
.tabs-wrapper { display: none; }

/* ── AI FLOATING PANEL (top-right) ── */
/* ai-float-toggle styles defined below in premium CSS block */
.ai-float-toggle:hover {
  background: linear-gradient(180deg, #DADADA 0%, #C0C0C0 55%, #ABABAB 100%);
  border-color: #92969B;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 5px 12px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}
.ai-float-toggle .ai-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%,100% { opacity:1; transform:scale(1); }
  50% { opacity:.6; transform:scale(1.3); }
}

.ai-float-panel {
  position: fixed;
  top: 54px;
  right: 16px;
  z-index: 199;
  width: 360px;
  background: linear-gradient(180deg, var(--prm-surface) 0%, var(--prm-surface-deep) 100%);
  border: 1px solid var(--prm-border);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(20, 35, 61, 0.12);
  display: none;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - 80px);
  /* Chat body: initial height, then one more growth step (2×), then scroll inside. */
  --ai-chat-body-min: 180px;
  --ai-chat-body-max: 360px;
}
.ai-float-panel.open { display: flex; animation: slideDown .2s ease; }
@keyframes slideDown {
  from { opacity:0; transform:translateY(-8px); }
  to   { opacity:1; transform:translateY(0); }
}
/* ── No-AI Voice Assistant (skeleton) ── */
.va-fab{position:fixed;right:20px;bottom:20px;z-index:180;width:52px;height:52px;border-radius:50%;border:none;cursor:pointer;background:linear-gradient(180deg,#182A49 0%,#14233D 100%);color:#fff;font-size:22px;box-shadow:0 8px 24px rgba(20,35,61,0.28);display:none;align-items:center;justify-content:center}
.va-fab:hover{filter:brightness(1.06)}
/* Desktop uses the top-header Voice Navigator launcher; show floating mic only on mobile/small screens to avoid duplicate launchers */
@media(max-width:900px){.va-fab{display:flex}}
/* Mobile-only quick-action FABs (bottom-left, mirroring the voice FAB) so the topbar's
   key buttons — voice expense, AI check, notepad — stay reachable on phones. */
.bpro-mobile-fabs{display:none}
@media(max-width:900px){
  .bpro-mobile-fabs{display:flex;flex-direction:column;gap:10px;position:fixed;left:16px;bottom:20px;z-index:180}
  .bpro-mfab{width:46px;height:46px;border-radius:50%;border:none;cursor:pointer;background:linear-gradient(180deg,#182A49 0%,#14233D 100%);color:#fff;font-size:20px;box-shadow:0 8px 24px rgba(20,35,61,0.28);display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:transparent}
  .bpro-mfab:active{filter:brightness(1.1)}
}
.va-panel{position:fixed;right:20px;bottom:84px;z-index:181;width:320px;max-width:calc(100vw - 32px);max-height:calc(100vh - 120px);background:#fff;border:1px solid #E7ECE9;border-radius:14px;box-shadow:0 18px 50px rgba(15,23,42,0.22);display:none;flex-direction:column;overflow:hidden}
.va-panel.open{display:flex}
.va-head{background:linear-gradient(180deg,#182A49 0%,#14233D 100%);padding:11px 14px;display:flex;justify-content:space-between;align-items:center}
.va-head-title{font-size:13px;font-weight:800;color:#fff}
.va-close{background:rgba(255,255,255,0.15);border:none;color:#fff;border-radius:7px;padding:3px 9px;cursor:pointer;font-size:13px;font-weight:700}
.va-body{padding:12px 14px;overflow-y:auto;flex:1}
.va-mic-row{display:flex;gap:8px;align-items:center;margin-bottom:8px}
.va-mic{flex:none;width:42px;height:42px;border-radius:50%;border:1px solid #E7ECE9;background:#F8FAFB;cursor:pointer;font-size:18px;display:flex;align-items:center;justify-content:center}
.va-mic.listening{background:#FEE2E2;border-color:#FCA5A5;animation:vaPulse 1s infinite}
.va-mic:disabled{opacity:0.5;cursor:not-allowed}
@keyframes vaPulse{0%,100%{box-shadow:0 0 0 0 rgba(220,38,38,0.4)}50%{box-shadow:0 0 0 6px rgba(220,38,38,0)}}
.va-input{flex:1;min-width:0;padding:8px 10px;border:1px solid #E7ECE9;border-radius:9px;font-size:12.5px;font-family:'DM Sans',sans-serif}
.va-field-label{font-size:10px;font-weight:700;color:var(--t-dark-4);text-transform:uppercase;letter-spacing:.4px;margin:8px 0 3px}
.va-recognized,.va-response{font-size:12px;border-radius:9px;padding:8px 10px;line-height:1.5}
.va-recognized{background:#F1F5F9;color:var(--t-dark-2);border:1px solid #E7ECE9}
.va-response{background:#ECFDF5;color:#065F46;border:1px solid #A7F3D0;white-space:pre-line}
.va-hint{font-size:10px;color:var(--t-dark-4);margin-top:8px;line-height:1.45}
.va-chip{display:inline-block;font-size:10.5px;padding:3px 8px;margin:2px 3px 2px 0;border-radius:20px;border:1px solid #E7ECE9;background:#F8FAFB;color:var(--t-dark-3);cursor:pointer}
.va-chip:hover{background:#E0F2F1;border-color:#99E5DD}
.ai-panel-header {
  background: linear-gradient(180deg, #182A49 0%, #14233D 100%);
  border-bottom: 1px solid var(--blue-frame);
  padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
  flex: 0 0 auto;
}
.ai-panel-title {
  font-size: 14px; font-weight: 700; color: #FFFFFF;
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
.ai-panel-journal-btn {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 8px;
  border: 2px solid #A87920;
  background: linear-gradient(160deg, #F2DF9C 0%, #E3C25C 45%, #D4AF37 75%, #B8942E 100%);
  color: #14233D;
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 2px 6px rgba(0, 0, 0, 0.25);
}
.ai-panel-journal-btn:hover {
  background: linear-gradient(160deg, #F7E7AC 0%, #EACB6C 45%, #DDB840 75%, #C29C32 100%);
}
.ai-panel-close {
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 18px; cursor: pointer; line-height: 1;
  transition: color .2s;
}
.ai-panel-close:hover { color: white; }
.ai-panel-body {
  flex: 0 1 auto;
  min-height: var(--ai-chat-body-min, 180px);
  max-height: var(--ai-chat-body-max, 360px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}
.ai-panel-input-row {
  display: flex; gap: 8px;
  flex: 0 0 auto;
  padding: 12px;
  border-top: 1px solid rgba(21,101,192,0.15);
  background: rgba(255,255,255,0.6);
}
.ai-panel-input {
  flex: 1; padding: 9px 12px;
  border: 1.5px solid rgba(21,101,192,0.3);
  border-radius: 10px; font-size: 13px;
  background: rgba(255,255,255,0.9);
  font-family: 'DM Sans', sans-serif;
  color: var(--t-dark-1);
  outline: none;
}
.ai-panel-input:focus { border-color: var(--blue-frame); box-shadow: 0 0 0 3px rgba(21,101,192,0.12); }
.ai-panel-send {
  background: linear-gradient(135deg, #182A49, #14233D);
  border: 1px solid var(--blue-border);
  border-radius: 10px;
  color: #FFFFFF;
  font-size: 18px; cursor: pointer; padding: 9px 12px;
  transition: all .2s;
}
.ai-panel-send:hover { transform:scale(1.08); }
.msg.bot {
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(21,101,192,0.2);
  border-bottom-left-radius: 4px;
  color: var(--t-dark-2);
  box-shadow: 0 2px 8px rgba(20,60,120,0.07);
}
.msg.user {
  background: linear-gradient(135deg, #182A49, #14233D);
  border: 1px solid var(--blue-border);
  color: #FFFFFF;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

/* MOBILE RESPONSIVE */
@media(max-width: 900px) {
  .sidebar { display: none; }
  .main-area { margin-left: 0; }
  /* .ai-float-toggle mobile: see premium CSS block below */
  .ai-float-panel { width: calc(100vw - 20px); right: 10px; }
  .tabs-wrapper { display: block !important; }
  .topbar { display: none; }
  .content { padding: 13px 13px 40px; }
  .desktop-grid, .desktop-grid-2, .desktop-grid-3, .stats-row { grid-template-columns: 1fr; }
  .app { display: block; }
}

/* ── 3-ROW TABS ── */
.tabs-wrapper {
  background: linear-gradient(180deg, #182A49 0%, #14233D 100%);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky; top: 0; z-index: 30;
  box-shadow: 0 3px 12px rgba(15,26,43,0.22), inset 0 1px 0 rgba(255,255,255,0.05);
}
.tabs-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.tabs-row:last-child { border-bottom: none; }
.tab-btn {
  padding: 9px 4px; background: none; border: none;
  font-size: 10.5px; font-weight: 600; color: var(--t-light-4);
  cursor: pointer; position: relative; white-space: nowrap; transition: all .2s;
  font-family: 'DM Sans', sans-serif;
  border-right: 1px solid rgba(180,210,240,0.3); letter-spacing: 0.1px;
}
.tab-btn:last-child { border-right: none; }
.tab-btn:hover { color: var(--t-light-2); background: rgba(180,210,240,0.3); }
.tab-btn.active { color: #FFFFFF; background: linear-gradient(180deg, #3D4D63 0%, #334155 100%); }
.tab-btn.active::after {
  content:''; position:absolute; bottom:0; left:15%; right:15%; height:2px;
  background: linear-gradient(90deg, rgba(255,255,255,0.15), rgba(255,255,255,0.65), rgba(255,255,255,0.15));
  border-radius: 2px 2px 0 0;
}

/* ── MOBILE COMFORT: the 4-row sticky tab GRID ate ~260px of every phone screen.
   One low, horizontally-scrollable strip instead (native mobile-app pattern):
   ~44px tall, sticky stays, every tab still one tap away. Pure CSS. ── */
@media(max-width: 900px) {
  .tabs-wrapper {
    display: flex !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs-wrapper::-webkit-scrollbar { display: none; }
  .tabs-row {
    display: flex;
    flex: 0 0 auto;
    border-bottom: none;
  }
  .tabs-row .tab-btn {
    flex: 0 0 auto;
    padding: 12px 13px;
    font-size: 11px;
  }
}

