:root {
  /* Solaris V2 Professional Sidebar Design System */
  --bg-color: 222, 47%, 4%;
  --bg-surface: 222, 47%, 8%;
  --bg-card: 222, 47%, 12%;
  
  --sidebar-w: 200px; /* Further reduced from 220px */
  
  --accent-h: 160;
  --accent-s: 84%;
  --accent-l: 39%;
  --accent: hsl(var(--accent-h), var(--accent-s), var(--accent-l));
  --accent-glow: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.2);
  
  --text-primary: 210, 40%, 98%;
  --text-secondary: 215, 25%, 72%;
  --text-dim: 215, 16%, 47%;
  
  --green: 142, 71%, 45%;
  --red: 346, 84%, 61%;
  --amber: 38, 92%, 50%;
  
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  
  --font-main: 'DM Sans', sans-serif;
  --font-heading: 'Syne', sans-serif;
  
  --glass-bg: hsla(var(--bg-surface), 0.7);
  --glass-border: hsla(0, 0%, 100%, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

[data-theme="light"] {
  --bg-color: 210, 40%, 96%;
  --bg-surface: 0, 0%, 100%;
  --bg-card: 210, 40%, 98%;
  --text-primary: 222, 47%, 11%;
  --text-secondary: 215, 25%, 27%;
  --text-dim: 215, 16%, 45%;
  --glass-bg: hsla(0, 0%, 100%, 0.8);
  --glass-border: hsla(0, 0%, 0%, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; cursor: default; }

body {
  background-color: hsl(var(--bg-color));
  color: hsl(var(--text-primary));
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 2rem 1rem;
  flex-shrink: 0;
  z-index: 100;
}

.sidebar-logo {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--accent);
  padding: 0 0.5rem;
  margin-bottom: 3rem;
  letter-spacing: -1px;
  white-space: nowrap;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.nav-item {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  color: hsl(var(--text-secondary));
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transition: all 0.3s;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: hsla(0, 0%, 100%, 0.05);
  color: hsl(var(--text-primary));
}

.nav-item.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--glass-border);
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 2rem; /* Reduced from 3rem */
  position: relative;
}

.page {
  display: none;
  max-width: 1200px;
  margin: 0 auto;
}

.page.active {
  display: block;
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Bento & Cards --- */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(100px, auto); /* Reduced from 120px */
  gap: 0.8rem; /* Reduced from 1rem */
  margin-top: 1rem;
}

.bento-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md); /* Reduced from radius-lg */
  padding: 1.2rem; /* Reduced from 1.5rem */
  transition: all 0.3s;
}

.bento-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.grid-w-2 { grid-column: span 2; }
.grid-w-3 { grid-column: span 3; }
.grid-w-4 { grid-column: span 4; }
.grid-h-2 { grid-row: span 2; }

/* --- Stats --- */
.card-label {
  font-family: var(--font-heading);
  font-size: 0.55rem; /* Further reduced */
  font-weight: 700;
  text-transform: uppercase;
  color: hsl(var(--text-dim));
  letter-spacing: 2px;
}

.card-value {
  font-family: var(--font-heading);
  font-size: 1.2rem; /* Reduced from 1.5rem for ultra-compact look */
  font-weight: 700; /* Thinner than 800 */
  margin-top: 0.2rem;
}

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: none; /* Controlled by JS flex/none */
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--bg-card);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  position: relative;
  animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- Charts --- */
.chart-container {
  height: 60px; /* Reduced from 100px */
  display: flex;
  align-items: flex-end;
  gap: 0.3rem;
  margin-top: 0.8rem;
}

.chart-bar {
  flex: 1;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  opacity: 0.8;
  transition: all 0.3s;
}

/* --- Buttons & Inputs --- */
.btn-solar {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  transition: 0.3s;
}

.btn-solar:hover { filter: brightness(1.1); transform: scale(1.02); }

.btn-solar.outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.btn-solar.outline:hover {
  background: var(--accent);
  color: white;
}

/* --- Transaction Tabs --- */
.type-tabs {
  display: flex;
  background: hsla(0, 0%, 0%, 0.2);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.type-tab {
  flex: 1;
  padding: 0.5rem;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: 0.3s;
}

.type-tab.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 10px var(--accent-glow);
}

.form-input-solar {
  background: hsla(0, 0%, 0%, 0.2);
  border: 1px solid var(--glass-border);
  padding: 0.6rem 0.8rem; /* Reduced padding */
  border-radius: var(--radius-sm);
  color: white;
  width: 100%;
  font-size: 0.85rem; /* Reduced font size */
  transition: all 0.2s;
}

/* Hide Spinners (Arrows) on Number Inputs */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.form-input-solar:focus {
  border-color: var(--accent);
  outline: none;
  background: hsla(0, 0%, 0%, 0.4);
}

/* Try to style the dropdown options (browser support varies) */
select.form-input-solar {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

select.form-input-solar option {
  background-color: #0b0e14; /* Deep dark background */
  color: white;
  padding: 12px;
}

/* --- Profile --- */
.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  overflow: hidden;
  margin-bottom: 1.5rem;
  position: relative;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-upload {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 0.6rem;
  padding: 4px 0;
  text-align: center;
  cursor: pointer;
}

.danger-btn {
  background: hsla(var(--red), 0.1);
  color: hsl(var(--red));
  border: 1px solid hsla(var(--red), 0.2);
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  transition: 0.3s;
}

.danger-btn:hover {
  background: hsl(var(--red));
  color: white;
}
.pill {
  padding: 0.3rem 0.6rem;
  background: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.1);
  color: var(--accent);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 700;
}

/* --- Responsive Design Architecture --- */
@media (max-width: 1024px) {
  .sidebar { width: 80px; padding: 2rem 0.5rem; }
  .sidebar-logo, .nav-item span, .sidebar-footer { display: none; }
  .nav-item { justify-content: center; padding: 1.2rem; }
  
  .bento-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .grid-w-4, .grid-w-2 { grid-column: span 2 !important; }
  
  /* Scale down large balance text for tablets */
  #totalLeft { font-size: 2.2rem !important; }
  .card-value { font-size: 1.1rem !important; }
}

@media (max-width: 768px) {
  body {
    flex-direction: column !important;
    padding-bottom: 80px !important;
    overflow-y: auto !important;
  }

  .sidebar {
    display: none !important;
  }

  .main-content {
    padding: 1.5rem 1rem !important;
    height: auto !important;
    overflow: visible !important;
  }

  .bento-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  
  .grid-w-2, .grid-w-3, .grid-w-4 { grid-column: span 1 !important; }
  .grid-h-2 { grid-row: auto !important; }

  /* Responsive Balance & Quick Log */
  #totalLeft { font-size: 2rem !important; }
  .quick-log-inputs { flex-direction: column !important; gap: 0.8rem !important; }
  .quick-log-inputs input, .quick-log-inputs select, .quick-log-inputs button { width: 100% !important; }

  header {
    flex-direction: column !important;
    align-items: center !important;
    gap: 1.5rem !important;
    text-align: center;
  }

  .clock-badge {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Mobile Bottom Nav Bar */
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 75px;
    background: hsla(var(--bg-surface), 0.85);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    z-index: 1500;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: hsl(var(--text-dim));
    font-size: 0.65rem;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0.8rem 0.2rem;
    transition: 0.3s;
    flex: 1;
    font-weight: 600;
  }

  .mobile-nav-item i {
    font-size: 1.3rem;
    font-style: normal;
  }

  .mobile-nav-item.active {
    color: var(--accent);
    transform: translateY(-2px);
  }
}

/* --- Auth Pages --- */
.auth-body {
  background: hsl(var(--bg-color));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  color: hsl(var(--text-primary));
  overflow-y: auto !important;
  padding: 2rem 0;
}

.auth-container {
  width: 100%;
  max-width: 400px;
  padding: 1rem;
}

.auth-card {
  background: hsl(var(--bg-card));
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.auth-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
  color: hsl(var(--text-primary));
}

.auth-subtitle {
  color: hsl(var(--text-dim));
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: hsl(var(--text-dim));
  margin-bottom: 0.4rem;
  letter-spacing: 1.5px;
}

.form-input {
  background: hsla(0, 0%, 0%, 0.05);
  border: 1px solid var(--glass-border);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  color: hsl(var(--text-primary));
  width: 100%;
  font-size: 0.85rem;
  margin-bottom: 1.2rem;
  transition: 0.2s;
}

[data-theme="light"] .form-input {
  background: hsla(0, 0%, 0%, 0.02);
}

.form-input:focus {
  border-color: var(--accent);
  outline: none;
  background: hsla(0, 0%, 0%, 0.1);
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  transition: 0.3s;
  border: none;
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.auth-error {
  background: hsla(var(--red), 0.1);
  color: hsl(var(--red));
  border: 1px solid hsla(var(--red), 0.2);
  padding: 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  margin-bottom: 1.2rem;
  text-align: center;
}

.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.auth-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.footer {
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.6;
  padding: 2rem 1rem;
  margin-top: auto;
  box-sizing: border-box;
}

  /* Mobile adjustments */
  @media (max-width: 600px) {
    .footer {
      font-size: 0.7rem;
      padding: 1.5rem 1rem;
    }
    .auth-container {
      padding: 1rem;
    }
  }
/ *   l o g i c   u p d a t e d   * /  
 