/* ==========================================================================
   BMS — Business Management System
   Corporate dark theme
   ========================================================================== */

:root {
  --bg:       #070d1a;
  --surface:  #0f1829;
  --surface2: #162035;
  --surface3: #1e293b;
  --border:   #1e3a5f;
  --border2:  #2d4a7a;
  --accent:   #3b82f6;
  --accent2:  #06b6d4;
  --green:    #10b981;
  --amber:    #f59e0b;
  --red:      #ef4444;
  --text:     #f1f5f9;
  --text2:    #94a3b8;
  --text3:    #64748b;
  --radius:   10px;
  --radius-lg: 16px;
  --shadow:   0 4px 24px rgba(0,0,0,0.4);
  --glow:     0 0 40px rgba(59,130,246,0.15);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.hidden { display: none !important; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }

/* --------------------------------------------------------------------------
   Loading screen
   -------------------------------------------------------------------------- */

#loading {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  flex-direction: column;
  gap: 16px;
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loading p { color: var(--text2); font-size: 14px; }

/* --------------------------------------------------------------------------
   Shared nav
   -------------------------------------------------------------------------- */

.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  height: 60px;
  background: rgba(7,13,26,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700; color: var(--text);
  letter-spacing: -0.3px;
}

.nav-logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 14px; color: #fff;
}

.nav-logo span { color: var(--text2); font-weight: 400; font-size: 13px; margin-left: 4px; }

.nav-links {
  display: flex; align-items: center; gap: 4px;
}

.nav-link {
  color: var(--text2);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--surface2);
}

.nav-actions { display: flex; align-items: center; gap: 12px; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px rgba(59,130,246,0.3);
}
.btn-primary:hover {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 0 28px rgba(59,130,246,0.45);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}

.btn-google {
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  padding: 12px 28px;
  font-size: 15px;
  border-radius: var(--radius);
}
.btn-google:hover {
  background: #f8f9fa;
  color: #3c4043;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  transform: translateY(-1px);
}

.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: 12px; }

/* --------------------------------------------------------------------------
   Landing page
   -------------------------------------------------------------------------- */

#landing { min-height: 100vh; }

.hero {
  min-height: calc(100vh - 60px);
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 80px 24px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(59,130,246,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(6,182,212,0.06) 0%, transparent 60%);
  pointer-events: none;
}

/* Grid lines background */
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(30,58,95,0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30,58,95,0.3) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 80% at center, black 20%, transparent 80%);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 820px; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.3);
  color: var(--accent2);
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 13px; font-weight: 500;
  margin-bottom: 28px;
  letter-spacing: 0.5px;
}

.hero-badge::before {
  content: '';
  width: 7px; height: 7px;
  background: var(--accent2);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -2px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #f1f5f9 40%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text2);
  max-width: 540px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.hero-actions {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Feature grid
   -------------------------------------------------------------------------- */

.section {
  padding: 80px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.section-label {
  text-align: center;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.section h2 {
  text-align: center;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 16px;
}

.section-sub {
  text-align: center;
  color: var(--text2);
  font-size: 1rem;
  max-width: 520px;
  margin: 0 auto 56px;
  line-height: 1.7;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.feature-card:hover {
  border-color: var(--border2);
  transform: translateY(-3px);
  box-shadow: var(--shadow), var(--glow);
}

.feature-card:hover::before { opacity: 1; }

.feature-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 18px;
}

.feature-card h3 {
  font-size: 17px; font-weight: 700;
  margin-bottom: 10px;
}

.feature-card p {
  color: var(--text2);
  font-size: 14px;
  line-height: 1.7;
}

.icon-blue   { background: rgba(59,130,246,0.15); }
.icon-cyan   { background: rgba(6,182,212,0.15); }
.icon-green  { background: rgba(16,185,129,0.15); }
.icon-amber  { background: rgba(245,158,11,0.15); }
.icon-purple { background: rgba(139,92,246,0.15); }
.icon-red    { background: rgba(239,68,68,0.15); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
}

.footer strong { color: var(--text2); }

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */

#dashboard { min-height: 100vh; }

.dashboard-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.welcome-section {
  margin-bottom: 36px;
}

.welcome-section h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.welcome-section p { color: var(--text2); font-size: 15px; }

/* Stats row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex; align-items: center; gap: 16px;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-info { flex: 1; }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
}

.stat-label {
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px;
}

/* Module grid */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; flex-direction: column; gap: 12px;
  position: relative; overflow: hidden;
}

.module-card:hover {
  border-color: var(--border2);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.module-card.coming-soon {
  opacity: 0.6;
  cursor: default;
}

.module-card.coming-soon:hover {
  transform: none;
  box-shadow: none;
}

.module-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}

.module-card h3 { font-size: 17px; font-weight: 700; }

.module-card p {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.6;
}

.module-tag {
  display: inline-flex; align-items: center;
  background: rgba(245,158,11,0.15);
  color: var(--amber);
  border: 1px solid rgba(245,158,11,0.3);
  font-size: 11px; font-weight: 600;
  padding: 2px 10px;
  border-radius: 100px;
  letter-spacing: 0.5px;
}

.module-arrow {
  position: absolute; right: 24px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3); font-size: 18px;
  transition: color 0.2s, transform 0.2s;
}

.module-card:not(.coming-soon):hover .module-arrow {
  color: var(--accent);
  transform: translateY(-50%) translateX(3px);
}

/* Activity feed */
.activity-section h3 {
  font-size: 17px; font-weight: 700;
  margin-bottom: 16px;
}

.activity-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.activity-item {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-blue  { background: var(--accent); }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-cyan  { background: var(--accent2); }

.activity-text { flex: 1; color: var(--text2); }
.activity-text strong { color: var(--text); }
.activity-time { color: var(--text3); font-size: 12px; }

/* User menu in nav */
.user-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px 6px 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
}

.user-pill:hover {
  border-color: var(--border2);
  background: var(--surface3);
}

.user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%; height: 100%;
  border-radius: 50%; object-fit: cover;
}

.user-dropdown {
  position: absolute; top: 52px; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 200px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 200;
}

.user-dropdown-info {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.user-dropdown-info .name { font-weight: 600; font-size: 14px; }
.user-dropdown-info .email { color: var(--text2); font-size: 12px; margin-top: 2px; }

.user-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px; color: var(--text2);
  transition: background 0.1s, color 0.1s;
}
.user-dropdown-item:hover { background: var(--surface2); color: var(--text); }
.user-dropdown-item.danger { color: var(--red); }
.user-dropdown-item.danger:hover { background: rgba(239,68,68,0.08); }

.user-menu-wrapper { position: relative; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .nav { padding: 0 16px; }
  .nav-links { display: none; }
  .hero-actions { flex-direction: column; align-items: center; }
  .btn-lg { width: 100%; max-width: 320px; }
  .dashboard-main { padding: 24px 16px 60px; }
}

/* --------------------------------------------------------------------------
   Role badges
   -------------------------------------------------------------------------- */

.role-badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600;
  padding: 2px 10px; border-radius: 100px;
  letter-spacing: 0.4px; text-transform: capitalize;
}
.role-pending  { background: rgba(100,116,139,0.18); color: #94a3b8; border: 1px solid rgba(100,116,139,0.3); }
.role-employee { background: rgba(16,185,129,0.14);  color: #34d399;  border: 1px solid rgba(16,185,129,0.3); }
.role-manager  { background: rgba(59,130,246,0.14);  color: #60a5fa;  border: 1px solid rgba(59,130,246,0.3); }
.role-admin    { background: rgba(245,158,11,0.14);  color: #fbbf24;  border: 1px solid rgba(245,158,11,0.3); }

.role-badge-inline { margin-top: 6px; }

/* --------------------------------------------------------------------------
   Awaiting approval page
   -------------------------------------------------------------------------- */

#awaiting { min-height: 100vh; }

.pending-page {
  min-height: calc(100vh - 60px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
}

.pending-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 48px;
  max-width: 480px; width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.pending-icon {
  font-size: 52px; line-height: 1;
  margin-bottom: 24px;
  animation: sway 3s ease-in-out infinite;
}

@keyframes sway {
  0%, 100% { transform: rotate(-5deg); }
  50%       { transform: rotate(5deg); }
}

.pending-card h2 {
  font-size: 1.8rem; font-weight: 700;
  margin-bottom: 16px; letter-spacing: -0.5px;
}

.pending-card p {
  color: var(--text2); font-size: 15px; line-height: 1.7;
  margin-bottom: 12px;
}

.pending-email {
  margin: 20px 0 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  color: var(--text2); font-size: 14px;
  font-family: monospace;
}

/* --------------------------------------------------------------------------
   Admin panel slide-over
   -------------------------------------------------------------------------- */

.admin-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex; justify-content: flex-end;
}

.admin-panel {
  width: min(600px, 100vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.admin-panel-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 28px 28px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.admin-panel-header h2 {
  font-size: 20px; font-weight: 700; margin-bottom: 4px;
}
.admin-panel-header p { color: var(--text2); font-size: 13px; }

.admin-close-btn {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text2); border-radius: 8px;
  width: 32px; height: 32px; cursor: pointer;
  font-size: 16px; line-height: 1;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.admin-close-btn:hover { background: var(--surface3); color: var(--text); }

/* Tabs */
.admin-tabs {
  display: flex; gap: 4px; padding: 16px 28px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.admin-tab {
  background: none; border: none; cursor: pointer;
  color: var(--text2); font-size: 13px; font-weight: 500;
  padding: 8px 14px 12px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  display: flex; align-items: center; gap: 6px;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-badge {
  background: var(--red);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 100px;
  line-height: 1.4;
}

/* User list */
.admin-user-list {
  flex: 1; overflow-y: auto; padding: 16px 28px 28px;
}

.admin-loading {
  text-align: center; color: var(--text2);
  padding: 40px 0; font-size: 14px;
}

.admin-empty {
  text-align: center; color: var(--text3);
  padding: 40px 0; font-size: 14px;
}

.admin-user-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.admin-user-row:last-child { border-bottom: none; }
.admin-user-row.hidden { display: none; }

.admin-user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
  flex-shrink: 0; overflow: hidden;
}

.admin-user-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}

.admin-user-info { flex: 1; min-width: 0; }

.admin-user-info .uname {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.admin-user-info .uemail {
  font-size: 12px; color: var(--text2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.admin-user-info .ujoin {
  font-size: 11px; color: var(--text3); margin-top: 2px;
}

.admin-user-actions {
  display: flex; gap: 6px; flex-shrink: 0; align-items: center;
}

.admin-btn {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text2); border-radius: 6px;
  padding: 5px 11px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.admin-btn:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }
.admin-btn.approve { border-color: rgba(16,185,129,0.4); color: #34d399; }
.admin-btn.approve:hover { background: rgba(16,185,129,0.12); }
.admin-btn.promote { border-color: rgba(59,130,246,0.4); color: #60a5fa; }
.admin-btn.promote:hover { background: rgba(59,130,246,0.12); }
.admin-btn.reject  { border-color: rgba(239,68,68,0.4);  color: #f87171; }
.admin-btn.reject:hover  { background: rgba(239,68,68,0.08); }
.admin-btn.del     { border-color: rgba(239,68,68,0.3);  color: #f87171; padding: 5px 8px; }
.admin-btn.del:hover     { background: rgba(239,68,68,0.08); }

/* ==========================================================================
   SIDEBAR APP LAYOUT
   ========================================================================== */

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.topbar {
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  flex-shrink: 0;
}

.topbar-left  { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.topbar-search {
  flex: 1; max-width: 400px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 14px; height: 34px;
  margin: 0 24px;
}

.search-icon { font-size: 13px; color: var(--text3); }

.search-input {
  background: none; border: none; outline: none;
  color: var(--text2); font-size: 13px;
  width: 100%;
}
.search-input::placeholder { color: var(--text3); }

.topbar-icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text2); font-size: 16px;
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.topbar-icon-btn:hover { background: var(--surface2); }

.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text2); font-size: 18px;
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.sidebar-toggle:hover { background: var(--surface2); }

/* --------------------------------------------------------------------------
   App body layout
   -------------------------------------------------------------------------- */

#app { display: flex; flex-direction: column; height: 100vh; }

.app-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.2s ease, opacity 0.2s ease;
  display: flex; flex-direction: column;
  padding: 12px 0 24px;
}

.sidebar.collapsed { width: 0; opacity: 0; }

.sidebar-section { display: flex; flex-direction: column; }

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 16px;
}

.sidebar-group-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--text3);
  padding: 6px 20px 4px;
}

/* Nav item */
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  cursor: pointer;
  font-size: 13.5px; font-weight: 500;
  color: var(--text2);
  border-radius: 0;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  user-select: none;
}

.sidebar-item:hover { color: var(--text); background: var(--surface2); }

.sidebar-item.active {
  color: var(--accent);
  background: rgba(59,130,246,0.1);
  border-left: 2px solid var(--accent);
  padding-left: 18px;
}

.si-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.si-label { flex: 1; }
.si-chevron {
  font-size: 14px; color: var(--text3);
  transition: transform 0.2s;
  margin-left: auto;
}
.sidebar-item.open .si-chevron { transform: rotate(90deg); }

.si-badge {
  font-size: 10px; font-weight: 700;
  background: rgba(245,158,11,0.15);
  color: var(--amber);
  border: 1px solid rgba(245,158,11,0.3);
  padding: 1px 7px; border-radius: 100px;
  letter-spacing: 0.3px;
}

/* Sub-items */
.sidebar-children {
  display: none;
  flex-direction: column;
  background: rgba(0,0,0,0.15);
  border-left: 2px solid var(--border);
  margin-left: 20px;
  margin-right: 0;
}

.sidebar-children.open { display: flex; }

.sidebar-child {
  padding: 7px 16px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.sidebar-child:hover  { color: var(--text); background: rgba(255,255,255,0.04); }
.sidebar-child.active { color: var(--accent); font-weight: 600; }

/* --------------------------------------------------------------------------
   Content area
   -------------------------------------------------------------------------- */

.content-area {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  padding: 0;
}

/* --------------------------------------------------------------------------
   Page shell (shared by all content pages)
   -------------------------------------------------------------------------- */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 32px 80px;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.page-header p { color: var(--text2); font-size: 14px; }

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text3);
  margin-bottom: 8px;
}
.breadcrumb span { cursor: pointer; }
.breadcrumb span:hover { color: var(--text2); }
.breadcrumb-sep { color: var(--text3); }

/* --------------------------------------------------------------------------
   Coming Soon page
   -------------------------------------------------------------------------- */

.coming-soon-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh; flex-direction: column; text-align: center;
  gap: 16px;
}

.coming-soon-icon { font-size: 56px; }
.coming-soon-page h2 { font-size: 1.6rem; font-weight: 700; }
.coming-soon-page p { color: var(--text2); max-width: 400px; line-height: 1.7; }

/* --------------------------------------------------------------------------
   Dashboard page
   -------------------------------------------------------------------------- */

.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

/* --------------------------------------------------------------------------
   Settings pages
   -------------------------------------------------------------------------- */

.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}

.settings-subnav {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.settings-subnav-item {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.settings-subnav-item:hover { color: var(--text); background: var(--surface2); }
.settings-subnav-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(59,130,246,0.08); }

.settings-content {
  display: flex; flex-direction: column; gap: 20px;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
}

.settings-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.settings-card > p { color: var(--text2); font-size: 14px; margin-bottom: 20px; line-height: 1.6; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }

.form-input {
  width: 100%; padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text); font-size: 14px;
  outline: none; transition: border-color 0.15s;
  font-family: monospace;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text3); font-family: sans-serif; }

.form-hint { font-size: 12px; color: var(--text3); margin-top: 4px; }

.form-actions { display: flex; gap: 10px; margin-top: 4px; }

/* QBO-specific */
.qbo-status-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 14px;
}

.qbo-status-bar.connected {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  color: #34d399;
}

.qbo-status-bar.disconnected {
  background: rgba(100,116,139,0.1);
  border: 1px solid var(--border);
  color: var(--text2);
}

.qbo-status-dot {
  width: 9px; height: 9px;
  border-radius: 50%; flex-shrink: 0;
}
.connected .qbo-status-dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.disconnected .qbo-status-dot { background: var(--text3); }

.qbo-company-name { font-weight: 700; color: var(--text); }

.btn-qbo {
  display: inline-flex; align-items: center; gap: 10px;
  background: #2CA01C;
  color: #fff;
  border: none; border-radius: var(--radius);
  padding: 12px 24px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  text-decoration: none;
}
.btn-qbo:hover { background: #238a17; color: #fff; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(44,160,28,0.3); }
.btn-qbo:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }

.qbo-logo {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 800; font-size: 15px; color: #2CA01C;
}
.qbo-logo span { color: var(--text2); font-size: 13px; font-weight: 400; }

.steps-list { list-style: none; counter-reset: steps; }
.steps-list li {
  counter-increment: steps;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 14px; color: var(--text2); line-height: 1.6;
}
.steps-list li:last-child { border-bottom: none; }
.steps-list li::before {
  content: counter(steps);
  min-width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(59,130,246,0.15);
  color: var(--accent); font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.steps-list li a { color: var(--accent); }
.steps-list li strong { color: var(--text); }

.info-banner {
  display: flex; gap: 12px;
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13px; color: var(--text2); line-height: 1.6;
  margin-bottom: 0;
}
.info-banner-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.success-banner {
  display: flex; gap: 12px;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13px; color: #34d399; line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Responsive sidebar
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .topbar-search { display: none; }
}

@media (max-width: 640px) {
  .sidebar { position: fixed; left: 0; top: 56px; bottom: 0; z-index: 200; transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.mobile-open { transform: translateX(0); }
  .content-area { padding: 0; }
  .page { padding: 20px 16px 60px; }
  .settings-layout { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Company switcher (topbar)
   -------------------------------------------------------------------------- */

.company-switcher-wrapper {
  position: relative;
  margin-left: 4px;
}

.company-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px 5px 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
}
.company-pill:hover { border-color: var(--border2); background: var(--surface3); }

.company-icon {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}

.company-name {
  color: var(--text2);
  overflow: hidden; text-overflow: ellipsis;
}

.company-switcher-wrapper .user-dropdown {
  top: calc(100% + 6px);
  right: auto;
  left: 0;
  min-width: 220px;
}

.user-dropdown-item.company-active {
  color: var(--accent);
  background: rgba(59,130,246,0.08);
}

/* --------------------------------------------------------------------------
   Company list & detail pages
   -------------------------------------------------------------------------- */

.company-card {
  transition: all 0.2s;
}
.company-card:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.company-list-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.company-list-header h3 { font-size: 15px; font-weight: 600; color: var(--text2); }

.company-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 8px; font-size: 13px; color: var(--text3);
}
.company-meta span { display: flex; align-items: center; gap: 4px; }
