/* ═══════════════════════════════════════════════════════════════════════════
   pqb-layout.css — v4.4.0
   Compact icon sidebar · centered topbar command bar · bottom status bar
   Layers on top of styles.css; uses tokens from pqb-pro.css.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── App shell layout ──────────────────────────────────────────── */
#app {
  display: grid !important;
  grid-template-columns: var(--pqb-sidebar-w, 240px) 1fr;
  grid-template-rows: 1fr auto;
  height: 100vh !important;
  overflow: hidden !important;
  transition: grid-template-columns 0.28s var(--pqb-easing-snap, cubic-bezier(0.16, 1, 0.3, 1));
}

#app.hidden {
  display: none !important;
}

#app.pqb-sidebar-collapsed { --pqb-sidebar-w: 64px; }

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  background: linear-gradient(180deg, rgba(15, 23, 41, 0.97), rgba(20, 30, 55, 0.97)) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  height: 100vh !important;
  padding: 0 !important;
}

/* Brand area */
.sidebar .brand {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 16px 18px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  flex-shrink: 0;
  min-height: 64px;
  box-sizing: border-box;
}
.sidebar .brand-logo-img {
  width: 32px; height: 32px; border-radius: 8px;
  flex-shrink: 0; object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px;
}
.sidebar .brand-text {
  overflow: hidden; white-space: nowrap;
  transition: opacity 0.18s, transform 0.22s;
  opacity: 1;
}
#app.pqb-sidebar-collapsed .sidebar .brand-text { opacity: 0; transform: translateX(-8px); pointer-events: none; }
.sidebar .brand-title {
  font-weight: 700; font-size: 0.92rem; color: white;
  letter-spacing: -0.01em; line-height: 1.2;
}
.sidebar .brand-sub {
  font-size: 0.72rem; color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
}

/* Sidebar toggle button — overlays at the top right of the sidebar */
.pqb-sidebar-toggle {
  position: absolute;
  top: 18px; right: -14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(15, 23, 41, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 100;
  font-size: 0.9rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: all 0.18s;
}
.pqb-sidebar-toggle:hover {
  background: var(--pqb-green-600, #2563eb);
  color: white;
  transform: scale(1.08);
}

/* Nav scroll area */
.sidebar .nav {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 12px 0 !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.sidebar .nav::-webkit-scrollbar { width: 6px; }
.sidebar .nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }

.sidebar .nav-group {
  font-size: 0.66rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.14em !important;
  text-transform: uppercase !important;
  color: rgba(255, 255, 255, 0.4) !important;
  padding: 16px 22px 6px !important;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.18s, height 0.18s;
}
#app.pqb-sidebar-collapsed .sidebar .nav-group { opacity: 0; height: 14px; padding: 8px 0 0; }

/* Nav items — icons primary, label trails */
.sidebar .nav-item {
  display: flex !important;
  align-items: center !important;
  gap: 13px !important;
  padding: 9px 18px !important;
  margin: 1px 8px !important;
  border-radius: 8px !important;
  color: rgba(255, 255, 255, 0.72) !important;
  font-size: 0.88rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.sidebar .nav-item:first-letter {
  /* Make the icon (single char/emoji at start of label) a fixed-width column */
  font-size: 1.05rem;
}
.sidebar .nav-item:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: white !important;
}
.sidebar .nav-item.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(96, 165, 250, 0.12)) !important;
  color: white !important;
  box-shadow: inset 3px 0 0 var(--pqb-green-500, #3b82f6);
}

/* Collapsed-state — icon-only with hover-tooltip from label */
#app.pqb-sidebar-collapsed .sidebar .nav-item {
  padding: 11px 0 !important;
  justify-content: center !important;
  margin: 1px 8px !important;
  font-size: 0; /* hide label */
}
#app.pqb-sidebar-collapsed .sidebar .nav-item::first-letter,
#app.pqb-sidebar-collapsed .sidebar .nav-item::before { font-size: 1.18rem; }

/* Tooltip on hover in collapsed mode */
#app.pqb-sidebar-collapsed .sidebar .nav-item[data-route]:hover::after {
  content: attr(data-route);
  position: absolute;
  left: 56px; top: 50%; transform: translateY(-50%);
  background: rgba(15, 23, 41, 0.95); color: white;
  padding: 6px 12px; border-radius: 6px;
  font-size: 0.78rem; font-weight: 500;
  text-transform: capitalize; white-space: nowrap;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Sidebar footer (user chip) */
.sidebar .sidebar-footer {
  padding: 12px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
  flex-shrink: 0;
}
.sidebar .user-chip {
  display: flex !important; align-items: center !important; gap: 10px !important;
  padding: 8px !important; border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap; overflow: hidden;
}
.sidebar .user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pqb-green-500, #3b82f6), var(--pqb-green-700, #1d4ed8));
  color: white; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; flex-shrink: 0;
}
.sidebar .user-meta { flex: 1; overflow: hidden; min-width: 0; transition: opacity 0.18s; }
#app.pqb-sidebar-collapsed .sidebar .user-meta { opacity: 0; }
.sidebar .user-name { color: white; font-size: 0.82rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.sidebar .user-role { color: rgba(255, 255, 255, 0.45); font-size: 0.7rem; }

/* ── Main column ────────────────────────────────────────────────── */
.main {
  display: flex !important;
  flex-direction: column !important;
  height: 100vh !important;
  overflow: hidden !important;
  background: transparent !important;
}

/* ── Topbar — centered command bar ──────────────────────────────── */
.topbar {
  display: grid !important;
  grid-template-columns: 1fr auto 1fr !important;
  gap: 20px !important;
  align-items: center !important;
  padding: 12px 24px !important;
  height: 64px !important;
  box-sizing: border-box;
  flex-shrink: 0 !important;
  background: rgba(255, 255, 255, 0.65) !important;
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(15, 23, 41, 0.06) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 1px 3px rgba(15, 23, 41, 0.03);
}

.topbar-left {
  display: flex; align-items: center; gap: 14px;
  min-width: 0;
}
.topbar-left h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem; font-weight: 500;
  margin: 0; color: var(--pqb-ink-900, #0f172a);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-left .page-sub {
  font-size: 0.78rem; color: var(--pqb-muted, #64748b);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Center: command pills */
.pqb-cmd {
  display: flex; align-items: center; gap: 10px;
  justify-content: center;
}
.pqb-cmd-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px;
  font-family: inherit; font-size: 0.88rem; font-weight: 500;
  border: 1px solid rgba(15, 23, 41, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 250, 253, 0.85));
  color: var(--pqb-ink-800, #1e293b);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 3px rgba(15, 23, 41, 0.04);
  transition: all 0.16s;
  white-space: nowrap;
}
.pqb-cmd-btn:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(247, 250, 253, 0.95));
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 4px 12px rgba(15, 23, 41, 0.08);
}
.pqb-cmd-btn.pqb-cmd-new {
  background: linear-gradient(135deg, var(--pqb-green-500, #3b82f6), var(--pqb-green-600, #2563eb));
  color: white; border: none; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 14px rgba(37, 99, 235, 0.32);
}
.pqb-cmd-btn.pqb-cmd-new:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 22px rgba(37, 99, 235, 0.44);
}
.pqb-cmd-btn .pqb-kbd {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 5px;
  font-size: 0.7rem; font-weight: 600;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: inherit;
  margin-left: 4px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}
.pqb-cmd-btn:not(.pqb-cmd-new) .pqb-kbd {
  background: rgba(15, 23, 41, 0.06);
  border-color: rgba(15, 23, 41, 0.08);
  color: var(--pqb-muted, #64748b);
}
.pqb-cmd-search-input {
  min-width: 280px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid rgba(15, 23, 41, 0.1);
  background: rgba(255, 255, 255, 0.85);
  font-family: inherit; font-size: 0.88rem;
  color: var(--pqb-ink-900, #0f172a);
  outline: none;
  transition: all 0.16s;
}
.pqb-cmd-search-input:focus {
  background: white;
  border-color: var(--pqb-green-500, #3b82f6);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
  min-width: 360px;
}

/* Topbar right: icons + workspace context */
.topbar-right {
  display: flex; align-items: center; gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}
.pqb-icon-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  border: none; background: transparent;
  color: var(--pqb-muted, #64748b);
  font-size: 1.1rem; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pqb-icon-btn:hover {
  background: rgba(15, 23, 41, 0.06);
  color: var(--pqb-ink-900, #0f172a);
}
.topbar-right .company {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 0 12px;
  border-right: 1px solid rgba(15, 23, 41, 0.08);
  margin-right: 6px;
}
.topbar-right .company-name {
  font-size: 0.78rem; font-weight: 600;
  color: var(--pqb-ink-800, #1e293b);
  white-space: nowrap;
}
.topbar-right .company-period {
  font-size: 0.7rem; color: var(--pqb-muted, #64748b);
}

/* ── View area ─────────────────────────────────────────────────── */
.view {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 24px 28px !important;
  background: transparent !important;
}

/* ── Bottom status bar ─────────────────────────────────────────── */
.pqb-statusbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between;
  height: 28px; padding: 0 16px;
  background: rgba(15, 23, 41, 0.94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.74rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.pqb-statusbar .pqb-status-left {
  display: flex; align-items: center; gap: 10px;
}
.pqb-statusbar .pqb-status-left .pqb-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--pqb-green-500, #3b82f6);
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.45);
}
.pqb-statusbar .pqb-status-right {
  display: flex; align-items: center; gap: 14px;
}
.pqb-statusbar a, .pqb-statusbar button {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none; background: transparent; border: none;
  cursor: pointer; padding: 0;
  font-size: inherit;
}
.pqb-statusbar a:hover, .pqb-statusbar button:hover { color: white; }
.pqb-statusbar .pqb-timer { display: flex; align-items: center; gap: 6px; }

/* ── Hide page-title from topbar-left when dashboard route ─────── */
.topbar-left.pqb-hide-on-dashboard { visibility: hidden; }

/* ════════════════════════════════════════════════════════════════
   COMMAND PALETTE (Ctrl+K)
   ════════════════════════════════════════════════════════════════ */
.pqb-palette-bg {
  position: fixed; inset: 0; z-index: 10500;
  background: rgba(15, 23, 41, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: none;
  align-items: flex-start; justify-content: center;
  padding-top: 12vh;
  animation: pqb-fade-in 0.18s ease-out;
}
.pqb-palette-bg.open { display: flex; }
.pqb-palette {
  width: 100%; max-width: 620px;
  background: rgba(255, 255, 255, 0.98);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 16px;
  box-shadow: 0 30px 80px -16px rgba(15, 23, 41, 0.4),
              inset 0 1px 0 rgba(255, 255, 255, 0.9);
  overflow: hidden;
  animation: pqb-pop-in 0.22s var(--pqb-easing-snap, cubic-bezier(0.16, 1, 0.3, 1));
}
.pqb-palette input {
  width: 100%; padding: 18px 22px;
  font-size: 1.05rem; font-family: inherit;
  border: none; outline: none; background: transparent;
  border-bottom: 1px solid rgba(15, 23, 41, 0.08);
  box-sizing: border-box;
  color: var(--pqb-ink-900, #0f172a);
}
.pqb-palette-hint {
  padding: 12px 22px; font-size: 0.78rem;
  color: var(--pqb-muted, #64748b);
  border-bottom: 1px solid rgba(15, 23, 41, 0.05);
  background: rgba(248, 250, 252, 0.6);
}
.pqb-palette-results {
  max-height: 460px; overflow-y: auto;
  padding: 8px;
}
.pqb-palette-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
}
.pqb-palette-item:hover, .pqb-palette-item.selected {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(96, 165, 250, 0.08));
}
.pqb-palette-item .pqb-pi-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 41, 0.05);
  font-size: 1.1rem;
}
.pqb-palette-item .pqb-pi-text { flex: 1; min-width: 0; }
.pqb-palette-item .pqb-pi-title { font-weight: 500; color: var(--pqb-ink-900, #0f172a); }
.pqb-palette-item .pqb-pi-sub { font-size: 0.78rem; color: var(--pqb-muted, #64748b); }
.pqb-palette-item .pqb-pi-kbd {
  padding: 2px 7px; border-radius: 5px;
  font-size: 0.7rem; font-weight: 600;
  background: rgba(15, 23, 41, 0.06);
  color: var(--pqb-muted, #64748b);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}

/* ════════════════════════════════════════════════════════════════
   DASHBOARD — Zoho-Books-style
   ════════════════════════════════════════════════════════════════ */
.pqb-dash-greet {
  display: flex; align-items: center; gap: 18px;
  padding: 22px 26px; margin-bottom: 22px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 8px 24px rgba(15, 23, 41, 0.05);
  position: relative;
}
.pqb-dash-greet .pqb-greet-avatar {
  width: 72px; height: 72px; border-radius: 14px;
  background: linear-gradient(135deg, var(--pqb-green-500, #3b82f6), var(--pqb-green-700, #1d4ed8));
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.6rem; font-weight: 700;
  font-family: 'Playfair Display', Georgia, serif;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}
.pqb-dash-greet .pqb-greet-avatar img { width: 100%; height: 100%; object-fit: contain; padding: 6px; box-sizing: border-box; }
.pqb-dash-greet h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem; font-weight: 500;
  margin: 0; color: var(--pqb-ink-900, #0f172a);
  letter-spacing: -0.01em;
}
.pqb-dash-greet .pqb-greet-sub {
  margin-top: 4px;
  font-size: 0.92rem; color: var(--pqb-muted, #64748b);
}
.pqb-dash-greet .pqb-greet-cta {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  color: var(--pqb-green-600, #2563eb);
  font-size: 0.88rem; font-weight: 500;
  text-decoration: none;
  padding: 9px 14px; border-radius: 8px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.16);
}
.pqb-dash-greet .pqb-greet-cta:hover { background: rgba(37, 99, 235, 0.14); }

/* Two-column aging cards */
.pqb-dash-aging {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 18px; margin-bottom: 22px;
}
.pqb-dash-aging-card {
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 8px 24px rgba(15, 23, 41, 0.05);
}
.pqb-dash-aging-card h3 {
  margin: 0; font-family: 'Playfair Display', Georgia, serif;
  font-weight: 500; font-size: 1.1rem;
  color: var(--pqb-ink-900, #0f172a);
}
.pqb-dash-aging-card .pqb-aging-total {
  font-size: 0.84rem; color: var(--pqb-muted, #64748b);
  margin-top: 10px;
}
.pqb-dash-aging-card .pqb-aging-total strong {
  color: var(--pqb-ink-900, #0f172a);
  font-size: 1.05rem; font-weight: 700;
  margin-left: 4px;
}
.pqb-aging-bar {
  display: flex; height: 12px; border-radius: 6px;
  overflow: hidden;
  margin: 14px 0 16px;
  background: rgba(15, 23, 41, 0.06);
}
.pqb-aging-bar-seg { height: 100%; transition: opacity 0.2s; }
.pqb-aging-bar-seg.current  { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.pqb-aging-bar-seg.b1       { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.pqb-aging-bar-seg.b2       { background: linear-gradient(90deg, #f59e0b, #f97316); }
.pqb-aging-bar-seg.b3       { background: linear-gradient(90deg, #f97316, #ea580c); }
.pqb-aging-bar-seg.b4       { background: linear-gradient(90deg, #ea580c, #dc2626); }

.pqb-aging-buckets {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.pqb-aging-bucket {
  text-align: left;
}
.pqb-aging-bucket .pqb-bucket-label {
  font-size: 0.74rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.pqb-aging-bucket.current  .pqb-bucket-label { color: var(--pqb-green-600, #2563eb); }
.pqb-aging-bucket.overdue  .pqb-bucket-label { color: #dc2626; }
.pqb-aging-bucket.b2 .pqb-bucket-label,
.pqb-aging-bucket.b3 .pqb-bucket-label,
.pqb-aging-bucket.b4 .pqb-bucket-label { color: var(--pqb-muted, #64748b); }
.pqb-aging-bucket .pqb-bucket-amount {
  font-size: 0.92rem; font-weight: 600; color: var(--pqb-ink-900, #0f172a);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.pqb-aging-bucket .pqb-bucket-days {
  font-size: 0.7rem; color: var(--pqb-muted, #64748b);
  margin-top: 2px;
}

/* Cash flow row */
.pqb-dash-cashflow {
  display: grid; grid-template-columns: 1fr 240px;
  gap: 18px;
}
.pqb-dash-cashflow-chart {
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 8px 24px rgba(15, 23, 41, 0.05);
}
.pqb-dash-cashflow-chart .pqb-cf-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.pqb-dash-cashflow-chart h3 {
  margin: 0; font-family: 'Playfair Display', Georgia, serif;
  font-weight: 500; font-size: 1.1rem;
}
.pqb-dash-cashflow-chart select {
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid rgba(15, 23, 41, 0.1);
  background: white; font-family: inherit; font-size: 0.84rem;
}
.pqb-dash-cashflow-chart .pqb-cf-canvas-wrap { height: 220px; position: relative; }
.pqb-dash-cashflow-side {
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(238, 247, 254, 0.65));
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.pqb-cf-side-row { padding: 8px 0; border-bottom: 1px solid rgba(15, 23, 41, 0.06); }
.pqb-cf-side-row:last-child { border-bottom: none; }
.pqb-cf-side-label { font-size: 0.72rem; color: var(--pqb-muted, #64748b); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.pqb-cf-side-value { font-size: 1.1rem; font-weight: 700; color: var(--pqb-ink-900, #0f172a); margin-top: 4px; font-variant-numeric: tabular-nums; }
.pqb-cf-side-value.incoming { color: var(--pqb-green-600, #2563eb); }
.pqb-cf-side-value.outgoing { color: #dc2626; }
.pqb-cf-side-date { font-size: 0.7rem; color: var(--pqb-muted, #64748b); margin-top: 2px; }

/* Responsive */
@media (max-width: 980px) {
  .pqb-dash-aging { grid-template-columns: 1fr; }
  .pqb-dash-cashflow { grid-template-columns: 1fr; }
  .pqb-cmd-search-input { min-width: 200px; }
  .pqb-cmd-search-input:focus { min-width: 200px; }
}

/* ══════════════════════════════════════════════════════════════════
   v4.4.1 — Collapsible sidebar groups + breathing room
   ══════════════════════════════════════════════════════════════════ */

/* Group headers — clickable accordion triggers */
.sidebar .nav-group {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  cursor: pointer !important;
  padding: 18px 22px 8px !important;
  font-size: 0.66rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.18em !important;
  text-transform: uppercase !important;
  color: rgba(255, 255, 255, 0.42) !important;
  user-select: none !important;
  transition: color 0.18s !important;
  border: none !important;
  background: transparent !important;
}
.sidebar .nav-group:hover { color: rgba(255, 255, 255, 0.85) !important; }
.sidebar .nav-group::after {
  content: '⌃';
  font-size: 0.85rem;
  opacity: 0.7;
  transition: transform 0.18s ease;
  margin-left: 8px;
  font-weight: 400;
}
.sidebar .nav-group.collapsed::after { transform: rotate(180deg); }

/* Items hidden when group collapsed — smooth opacity collapse */
.sidebar .nav-item[data-group-state="collapsed"] {
  display: none !important;
}

/* Less squashed items — slightly more breathing room */
.sidebar .nav-item {
  padding: 8px 16px !important;
  margin: 2px 10px !important;
  font-size: 0.86rem !important;
  border-radius: 8px !important;
  line-height: 1.4 !important;
}

/* Active state — more prominent */
.sidebar .nav-item.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(96, 165, 250, 0.12)) !important;
  color: white !important;
  font-weight: 600 !important;
  box-shadow: inset 3px 0 0 var(--pqb-green-500, #3b82f6),
              0 2px 8px rgba(37, 99, 235, 0.12) !important;
}

/* Collapsed sidebar — group headers should hide entirely */
#app.pqb-sidebar-collapsed .sidebar .nav-group {
  height: 1px !important;
  padding: 4px 0 !important;
  margin: 6px 14px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border-radius: 1px;
  color: transparent !important;
  font-size: 0 !important;
}
#app.pqb-sidebar-collapsed .sidebar .nav-group::after { display: none !important; }

/* Sidebar toggle button — make it MORE visible (was getting hidden) */
.pqb-sidebar-toggle {
  position: absolute !important;
  top: 22px !important;
  right: -13px !important;
  width: 26px !important;
  height: 26px !important;
  border-radius: 50% !important;
  background: var(--pqb-green-600, #2563eb) !important;
  border: 2px solid white !important;
  color: white !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  cursor: pointer !important;
  z-index: 200 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
  transition: transform 0.18s, background 0.18s !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.pqb-sidebar-toggle:hover {
  transform: scale(1.12) !important;
  background: var(--pqb-green-700, #1d4ed8) !important;
}

/* ══════════════════════════════════════════════════════════════════
   v4.5.1 — Sidebar toggle no longer clipped + topbar/statusbar polish
   ══════════════════════════════════════════════════════════════════ */

/* Sidebar can let the toggle button poke out at the right edge */
.sidebar {
  overflow: visible !important;  /* was hidden — clipped the toggle button */
}
.sidebar .nav {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}
/* Increase z so the toggle sits above neighbouring content */
.pqb-sidebar-toggle { z-index: 500 !important; }

/* Hide the "All Entities (Consolidated)" dropdown from the topbar —
   it's added by some other module and squashes the search input. */
.topbar select,
.topbar [class*="entity-sel"],
.topbar [class*="entity_sel"],
.topbar [class*="EntitySelector"] {
  display: none !important;
}

/* Hide our own pqb-statusbar — the desktop has its own WinForms
   status strip at the very bottom. Two stacked status bars looks bad. */
.pqb-statusbar { display: none !important; }

/* Reclaim that row — restore #app to flexible main column */
#app {
  grid-template-rows: 1fr !important;
}

/* v6.0.0 - lighter QuickBooks-inspired shell */
#app {
  grid-template-columns: var(--pqb-sidebar-w, 252px) 1fr !important;
  background: #f5f8fc;
}

.sidebar {
  background: #ffffff !important;
  border-right: 1px solid #e3ebf3 !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
}

.sidebar .brand {
  min-height: 72px;
  padding: 18px 20px !important;
  border-bottom: 1px solid #e8eef5 !important;
}

.sidebar .brand-logo-img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #f1f5f9;
  padding: 4px;
}

.sidebar .brand-title {
  color: #0f172a;
  font-size: 1rem;
  font-weight: 800;
}

.sidebar .brand-sub {
  color: #64748b !important;
}

.sidebar .nav {
  padding: 16px 0 18px !important;
  scrollbar-color: #cbd5e1 transparent;
}

.sidebar .nav-group {
  color: #8b98a8 !important;
}

.sidebar .nav-group:hover {
  color: #475569 !important;
}

.sidebar .nav-group::after {
  content: '+' !important;
  color: #94a3b8;
}

.sidebar .nav-group.collapsed::after {
  transform: none !important;
}

.sidebar .nav-item {
  color: #334155 !important;
  padding: 10px 14px !important;
  margin: 3px 12px !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
}

.sidebar .nav-item:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
}

.sidebar .nav-item.active {
  background: #eef4ff !important;
  color: #1d4ed8 !important;
  box-shadow: inset 3px 0 0 #3b82f6 !important;
}

.sidebar .sidebar-footer {
  border-top: 1px solid #e8eef5 !important;
}

.sidebar .user-chip {
  background: #f8fafc !important;
  border: 1px solid #e8eef5 !important;
}

.sidebar .user-name {
  color: #0f172a !important;
}

.sidebar .user-role {
  color: #64748b !important;
}

.pqb-sidebar-toggle {
  top: 20px !important;
  right: -12px !important;
  width: 28px !important;
  height: 28px !important;
  background: #ffffff !important;
  border: 1px solid #d5dee8 !important;
  color: #0f172a !important;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12) !important;
}

.pqb-sidebar-toggle:hover {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
}

.topbar {
  grid-template-columns: minmax(210px, 280px) minmax(320px, 1fr) auto !important;
  gap: 18px !important;
  height: 76px !important;
  padding: 14px 24px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  border-bottom: 1px solid #e3ebf3 !important;
  box-shadow: none !important;
}

.topbar::after {
  display: none !important;
}

.topbar-left {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 4px !important;
}

.topbar-left h1 {
  font-family: Inter, "Segoe UI", sans-serif !important;
  font-size: 1.7rem !important;
  line-height: 1.05 !important;
  font-weight: 800 !important;
}

.page-sub {
  font-size: 0.92rem !important;
  color: #64748b !important;
}

.pqb-cmd {
  justify-content: flex-start !important;
  gap: 12px !important;
  min-width: 0;
}

.pqb-cmd-search {
  width: 100%;
  min-width: 0;
  max-width: 700px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid #cfe0f6;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.05);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.pqb-cmd-search:hover {
  border-color: #93c5fd;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08), 0 8px 18px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.pqb-cmd-search-icon {
  color: #2563eb;
  font-size: 1rem;
  flex: 0 0 auto;
}

.pqb-cmd-search-copy {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  color: #475569;
  font-size: 0.95rem;
}

.pqb-cmd-btn {
  border-radius: 999px !important;
  box-shadow: none !important;
}

.pqb-cmd-btn.pqb-cmd-new {
  padding: 12px 18px !important;
}

.topbar-right {
  gap: 12px !important;
}

.topbar-right .company {
  align-items: flex-start !important;
  padding: 10px 14px !important;
  margin-right: 0 !important;
  border-right: none !important;
  border-radius: 18px !important;
  background: #f8fcf8 !important;
  border: 1px solid #dbe8dd !important;
}

.topbar-right .company-name {
  font-size: 0.92rem !important;
  font-weight: 700 !important;
}

.topbar-right .company-period {
  font-size: 0.78rem !important;
}

.view {
  padding: 24px 28px 36px !important;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }

  .pqb-cmd {
    order: 3;
  }

  .topbar-right {
    justify-content: space-between !important;
  }
}

@media (max-width: 760px) {
  .pqb-cmd {
    flex-wrap: wrap;
  }

  .pqb-cmd-search {
    max-width: none;
  }

  .page-sub {
    display: none;
  }
}
