:root {
  color-scheme: dark;
  --bg: #060816;
  --panel: rgba(9, 15, 29, 0.92);
  --panel-strong: rgba(14, 21, 38, 0.98);
  --text: #f8fafc;
  --muted: #9fb0ca;
  --accent: #6ee7f9;
  --accent-2: #8b5cf6;
  --border: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(110, 231, 249, 0.24), transparent 28%),
    radial-gradient(circle at bottom right, rgba(139, 92, 246, 0.22), transparent 35%),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 24px);
}

.hero-card,
.auth-card {
  width: min(980px, 100%);
  display: grid;
  gap: clamp(20px, 3vw, 28px);
  background: linear-gradient(135deg, rgba(10, 17, 32, 0.96), rgba(15, 25, 43, 0.96));
  border: 1px solid var(--border);
  border-radius: clamp(20px, 3vw, 32px);
  padding: clamp(18px, 3vw, 28px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-logo {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 22px;
  margin-bottom: 16px;
  box-shadow: 0 14px 34px rgba(250, 204, 21, 0.22);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  line-height: 1.07;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.tagline {
  margin: 14px 0 22px;
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  color: var(--muted);
  max-width: 560px;
  line-height: 1.7;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(12px, 2vw, 16px);
  margin-bottom: 24px;
}

.feature-card {
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-radius: 18px;
  padding: 16px;
  min-height: 120px;
}

.feature-card h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.cta-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: fit-content;
  padding: 14px 24px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #060816;
  text-decoration: none;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(110, 231, 249, 0.2);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(110, 231, 249, 0.26);
}

.auth-page {
  align-items: center;
}

.auth-card {
  width: min(520px, 100%);
}

.auth-header {
  text-align: center;
}

.auth-logo {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 20px;
  margin-bottom: 14px;
  box-shadow: 0 12px 30px rgba(250, 204, 21, 0.2);
}

.auth-subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 13px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.google-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  color: #4285f4;
  font-weight: 800;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--muted);
  margin: 4px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.auth-divider span {
  padding: 0 10px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(110, 231, 249, 0.18);
}

.auth-submit {
  margin-top: 6px;
  border: 0;
  cursor: pointer;
}

.auth-switch {
  text-align: center;
  color: var(--muted);
  margin: 0;
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
  background: var(--bg);
  color: var(--text);
  width: 100%;
  max-width: 100vw;
}

.app-shell > * {
  min-width: 0;
}

.sidebar {
  background: rgba(7, 12, 24, 0.95);
  border-right: 1px solid rgba(255,255,255,0.08);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.sidebar-top {
  display: grid;
  gap: 20px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.brand-row h2 {
  margin: 0;
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(250, 204, 21, 0.32);
  background: #000;
}

.settings-btn,
.panel-btn,
.nav-link,
.task-done {
  border: 0;
  border-radius: 999px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}

.settings-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
}

.settings-panel.open {
  display: flex;
}

.contact-panel {
  display: none;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
}

.contact-panel.open {
  display: grid;
}

.contact-panel a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.profile-upload {
  display: grid;
  place-items: center;
  cursor: pointer;
  gap: 10px;
}

.profile-upload input {
  display: none;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,0.2);
  background: linear-gradient(135deg, rgba(110, 231, 249, 0.18), rgba(139, 92, 246, 0.25));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
  position: relative;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.profile-avatar img[src=""] {
  display: none;
}

.profile-avatar img.hidden {
  display: none;
}

.avatar-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.avatar-fallback.hidden {
  display: none;
}

.upload-hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-info {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.profile-info h3 {
  margin: 0;
}

.quote-box {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 0.9rem;
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dashboard-main {
  padding: clamp(20px, 3vw, 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.welcome-card,
.task-card {
  width: min(760px, 100%);
  background: linear-gradient(135deg, rgba(15,23,42,0.95), rgba(8,15,29,0.95));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.28);
}

.task-card {
  margin-top: 8px;
  border-top: 3px solid rgba(110, 231, 249, 0.45);
  min-width: 0;
}

.welcome-card h1,
.task-card h1 {
  margin: 0 0 10px;
}

.welcome-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.task-page {
  grid-template-columns: 240px 1fr;
}

.task-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.task-form {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.task-form > label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.task-form input,
.task-form textarea,
.task-form select {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.task-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.task-dates label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  padding: 14px;
  border-radius: 14px;
  min-width: 0;
}

.task-item > div {
  min-width: 0;
}

.task-item h3 {
  margin: 0 0 6px;
}

.task-item p,
.task-item small {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.success-message {
  color: #86efac;
  font-weight: 700;
}

.error-message {
  color: #fca5a5;
}

.blog-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.blog-item {
  align-items: flex-start;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 20px 0;
}

.budget-card {
  width: min(900px, 100%);
}

.budget-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.budget-summary article {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
}

.budget-summary span {
  color: var(--muted);
  font-size: 0.9rem;
}

.budget-summary strong {
  font-size: clamp(1.2rem, 3vw, 1.65rem);
  overflow-wrap: anywhere;
}

.budget-form {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.budget-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.budget-settings-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.budget-chart-wrap {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

.budget-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.budget-chart-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.budget-chart-head span {
  color: var(--muted);
  font-weight: 700;
}

.expense-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 12px;
  min-height: 230px;
  align-items: end;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
}

.expense-bar-item {
  display: grid;
  grid-template-rows: 150px auto auto;
  gap: 8px;
  min-width: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.expense-bar-item strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.expense-bar-item span {
  overflow-wrap: anywhere;
}

.expense-bar-track {
  display: flex;
  align-items: end;
  justify-content: center;
  min-width: 0;
  height: 150px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  overflow: hidden;
}

.expense-bar {
  width: min(44px, 68%);
  min-height: 8px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

body.light-theme {
  --bg: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
}

body.light-theme .sidebar,
body.light-theme .welcome-card,
body.light-theme .task-card {
  background: #ffffff;
  color: var(--text);
}

body.light-theme .settings-btn,
body.light-theme .panel-btn,
body.light-theme .nav-link,
body.light-theme .task-done {
  background: #e2e8f0;
  color: var(--text);
}

body.light-theme .quote-box {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.08);
}

body.light-theme .contact-panel {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
}

body.light-theme .budget-summary article,
body.light-theme .expense-chart,
body.light-theme .expense-bar-track {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
}

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.auth-modal-overlay.active {
  display: flex;
}

.auth-modal {
  width: min(420px, 100%);
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.auth-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
}

.auth-modal-text {
  margin: 0 0 14px;
  color: var(--muted);
}

.google-email-form {
  display: grid;
  gap: 10px;
}

.google-email-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.google-email-form button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #020617;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .app-shell,
  .task-page {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 18px clamp(14px, 3vw, 24px);
    gap: 18px;
  }

  .sidebar-top {
    gap: 16px;
  }

  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: 100%;
  }

  .sidebar-nav .nav-link {
    text-align: center;
  }

  .profile-avatar {
    width: 96px;
    height: 96px;
  }

  .dashboard-main {
    padding: clamp(14px, 3vw, 24px);
    align-items: center;
  }

  .welcome-card,
  .task-card {
    width: min(760px, 100%);
    max-width: 100%;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 12px;
  }

  .hero-card {
    padding: 18px;
    border-radius: 22px;
  }

  .hero-copy {
    align-items: center;
    text-align: center;
  }

  .tagline {
    max-width: 100%;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .cta-button {
    width: 100%;
  }

  .app-shell {
    min-height: 100dvh;
  }

  .sidebar {
    padding: 14px 12px;
  }

  .brand-row {
    align-items: flex-start;
  }

  .brand-row h2 {
    font-size: 1.1rem;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    border-radius: 10px;
  }

  .settings-btn,
  .panel-btn,
  .nav-link,
  .task-done {
    padding: 10px 11px;
    font-size: 0.9rem;
    white-space: normal;
  }

  .settings-panel.open {
    display: grid;
    grid-template-columns: 1fr;
  }

  .sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-info {
    gap: 8px;
  }

  .quote-box {
    width: 100%;
  }

  .dashboard-main {
    padding: 12px;
    gap: 14px;
  }

  .welcome-card,
  .task-card {
    border-radius: 16px;
    padding: 16px;
    width: 100%;
    max-width: calc(100vw - 24px);
  }

  .welcome-card h1,
  .task-card h1 {
    font-size: clamp(1.75rem, 9vw, 2.2rem);
  }

  .task-head {
    display: grid;
    gap: 10px;
  }

  .task-dates {
    grid-template-columns: 1fr;
  }

  .budget-settings-grid {
    grid-template-columns: 1fr;
  }

  .budget-summary {
    grid-template-columns: 1fr;
  }

  .budget-chart-head {
    align-items: flex-start;
  }

  .expense-chart {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 210px;
    padding: 12px;
  }

  .expense-bar-item {
    grid-template-rows: 120px auto auto;
  }

  .expense-bar-track {
    height: 120px;
  }

  .task-item,
  .blog-item {
    display: grid;
    align-items: stretch;
  }

  .task-done {
    width: 100%;
  }

  .blog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .budget-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
