:root {
  --ink: #202123;
  --muted: #6e6e80;
  --line: #e5e5e5;
  --paper: #ffffff;
  --white: #ffffff;
  --mint: #f3f3f3;
  --mint-deep: #0a84ff;
  --coral: #f2c6c2;
  --cream: #f3f0e8;
  --deep: #202123;
  --shadow: 0 12px 32px rgba(0, 0, 0, .07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif; transition: background .25s, color .25s; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 244px; padding: 34px 24px 26px; background: #f7f7f8; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--deep); color: #fff; font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; }
.brand-copy { position: absolute; top: 36px; left: 72px; display: flex; gap: 5px; flex-direction: column; font-family: 'Space Grotesk', sans-serif; font-size: 17px; line-height: .9; }
.brand-copy strong { color: var(--ink); }
.nav-links { display: grid; gap: 8px; margin-top: 98px; }
.nav-links a { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 12px; color: #656565; font-size: 14px; text-decoration: none; transition: background .2s, color .2s; }
.nav-links a span { width: 19px; text-align: center; font-size: 19px; }
.nav-links a:hover, .nav-links a.active { background: #ececec; color: var(--ink); font-weight: 600; }
.sidebar-bottom { margin-top: auto; }
.sidebar-credit { margin: 0 0 12px; padding: 0 14px; color: var(--muted); font-size: 11px; }
.sidebar-account { position: relative; }
.sidebar-account-row { display: flex; align-items: center; gap: 8px; }
.profile-chip { display: inline-flex; flex: 1; align-items: center; gap: 8px; min-width: 0; border: 0; border-radius: 12px; padding: 8px 9px; background: #ececec; color: var(--ink); text-align: left; transition: background .2s; }
.profile-chip:hover { background: #e2e2e2; }
.profile-avatar { display: grid; flex: 0 0 auto; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: #a56bd4; color: #fff; font-size: 10px; font-weight: 700; }
.profile-name { min-width: 0; flex: 1; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.profile-chevron { color: var(--muted); font-size: 15px; }
.profile-menu { position: absolute; bottom: calc(100% + 10px); left: 0; z-index: 5; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); box-shadow: 0 14px 35px rgba(0, 0, 0, .16); }
.profile-menu[hidden] { display: none; }
.profile-menu-header { display: flex; align-items: center; gap: 9px; padding: 5px 5px 12px; border-bottom: 1px solid var(--line); }
.profile-menu-header strong { display: block; max-width: 155px; overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-status { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.main-content { width: calc(100% - 244px); max-width: 1400px; margin-left: 244px; padding: 54px 7vw 64px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 42px; }
.eyebrow { margin: 0 0 10px; color: var(--mint-deep); font-size: 10px; font-weight: 700; letter-spacing: .15em; }
h1, h2 { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif; letter-spacing: -.045em; }
h1 { font-size: clamp(34px, 4vw, 52px); line-height: 1; }
h2 { font-size: 22px; }
.accent-dot { color: var(--coral); }
.subtitle { margin: 13px 0 0; color: var(--muted); font-size: 14px; }
.setup-banner { margin: -18px 0 26px; padding: 13px 16px; border: 1px solid #eadcb9; border-radius: 12px; background: var(--cream); color: #76643b; font-size: 12px; line-height: 1.5; }
.setup-banner strong { color: var(--ink); }
.top-actions { display: flex; align-items: center; gap: 16px; }
.google-button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--white); color: var(--ink); font-size: 11px; font-weight: 700; transition: background .2s, border-color .2s; }
.google-button:hover { border-color: #c9d8d0; background: #f5faf6; }
.google-button span { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #fff; color: #4285f4; font-family: Arial, sans-serif; font-size: 14px; font-weight: 700; }
.logout-button, .theme-button { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; transition: background .2s, color .2s, border-color .2s; }
.logout-button:hover, .theme-button:hover { border-color: #c9d8d0; background: var(--white); color: var(--ink); }
.theme-button { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 43px; height: 43px; padding: 0; gap: 6px; }
.theme-button span:first-child { font-size: 16px; line-height: 1; }
.theme-button #theme-label { display: none; }
.profile-menu .google-button, .profile-menu .logout-button { width: 100%; justify-content: center; margin-top: 10px; }
.primary-button { border: 0; border-radius: 10px; padding: 13px 18px; background: #0a84ff; color: #fff; font-weight: 700; box-shadow: 0 8px 18px rgba(10,132,255,.18); transition: transform .2s, background .2s, box-shadow .2s; }
.primary-button:hover { background: #0077ed; box-shadow: 0 10px 22px rgba(10,132,255,.25); transform: translateY(-1px); }
.primary-button span { margin-right: 5px; font-size: 18px; vertical-align: -1px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; margin-bottom: 30px; }
.view-screen[hidden] { display: none; }
.overview-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 20px; }
.overview-card { min-height: 230px; }
.overview-card h2 { max-width: 320px; font-size: 27px; line-height: 1.05; }
.overview-copy { max-width: 340px; margin: 16px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.compact-heading { margin-bottom: 12px; }
.overview-salary-list { display: grid; gap: 0; }
.overview-salary-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.overview-salary-row span { display: block; color: var(--muted); font-size: 11px; }
.overview-salary-row strong { display: block; margin-top: 4px; font-family: 'Space Grotesk', sans-serif; font-size: 14px; }
.summary-card { min-height: 185px; padding: 24px 25px; border-radius: 20px; box-shadow: var(--shadow); }
.dark-card { background: var(--deep); color: white; }
.coral-card { background: var(--coral); }
.cream-card { background: var(--cream); }
.card-label { display: flex; align-items: center; gap: 10px; color: rgba(28,40,38,.7); font-size: 12px; font-weight: 600; }
.dark-card .card-label { color: rgba(255,255,255,.7); }
.icon-circle { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; font-size: 13px; font-weight: 700; }
.icon-circle.white { background: rgba(255,255,255,.14); color: white; }
.icon-circle.coral { background: rgba(255,255,255,.48); color: #a25248; }
.icon-circle.green { background: rgba(79,140,113,.16); color: var(--mint-deep); }
.summary-value { margin: 31px 0 7px; font-family: 'Space Grotesk', sans-serif; font-size: clamp(27px, 3vw, 37px); font-weight: 700; letter-spacing: -.06em; }
.summary-card p { margin: 0; color: rgba(28,40,38,.62); font-size: 12px; }
.dark-card p { color: rgba(255,255,255,.56); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 30px; align-items: start; }
.panel { padding: 26px; border: 1px solid var(--line); border-radius: 20px; background: color-mix(in srgb, var(--white) 88%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.panel-heading .eyebrow { margin-bottom: 7px; }
.record-count { color: var(--muted); font-size: 12px; }
.text-button { border: 0; padding: 3px 0; background: transparent; color: var(--mint-deep); font-size: 13px; font-weight: 700; }
.panel-intro { margin: -7px 0 22px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.salary-list { display: grid; gap: 12px; }
.salary-entry { border-top: 1px solid var(--line); }
.salary-item { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 12px; padding: 16px 0; }
.salary-date { color: var(--muted); font-size: 11px; }
.salary-amount { margin-top: 4px; font-family: 'Space Grotesk', sans-serif; font-size: 16px; font-weight: 700; }
.salary-breakdown { text-align: right; }
.salary-breakdown strong { display: block; font-size: 14px; }
.salary-breakdown span { color: var(--muted); font-size: 11px; }
.history-button, .add-deduction { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: transparent; color: var(--mint-deep); font-size: 11px; font-weight: 700; }
.history-button:hover, .history-button.active { background: var(--cream); border-color: #eadcb9; }
.add-deduction { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: transparent; color: var(--mint-deep); font-size: 11px; font-weight: 700; }
.add-deduction:hover { background: var(--mint); border-color: var(--mint); }
.expense-history { margin: 0 0 12px; padding: 15px 16px; border-radius: 12px; background: #f7f9f5; }
.history-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.history-heading strong { color: var(--ink); font-size: 12px; }
.expense-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.expense-row > div { min-width: 0; }
.expense-row strong { display: block; font-size: 12px; }
.expense-row span { display: block; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.expense-amount { font-family: 'Space Grotesk', sans-serif; }
.delete-expense { border: 0; padding: 0 4px; background: transparent; color: #bf8077; font-size: 18px; line-height: 1; }
.history-empty { padding: 8px 0 2px; color: var(--muted); font-size: 12px; }
.category-list { display: grid; gap: 5px; }
.category-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 13px; }
.category-name { display: flex; align-items: center; gap: 9px; }
.category-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.category-row:nth-child(2n) .category-dot { background: var(--mint-deep); }
.category-row:nth-child(3n) .category-dot { background: #ddbf65; }
.category-badge { color: var(--muted); font-size: 10px; }
.remove-category { border: 0; padding: 0; background: transparent; color: #bf8077; font-size: 16px; line-height: 1; }
.empty-state { padding: 31px 12px; border: 1px dashed #d9ded8; border-radius: 12px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.5; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); font-family: 'Space Grotesk', sans-serif; font-size: 15px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(18, 34, 30, .45); backdrop-filter: blur(5px); }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: min(100%, 430px); padding: 34px; border-radius: 20px; background: var(--white); box-shadow: 0 30px 80px rgba(16, 31, 27, .25); }
.modal h2 { font-size: 28px; }
.modal-copy { margin: 10px 0 25px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.close-button { position: absolute; top: 16px; right: 19px; border: 0; background: transparent; color: var(--muted); font-size: 27px; line-height: 1; }
form { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #51615b; font-size: 12px; font-weight: 600; }
.optional { color: #9ba49f; font-weight: 400; }
input, select { width: 100%; border: 1px solid #dfe4de; border-radius: 10px; padding: 12px 13px; outline: none; background: #fbfcf9; color: var(--ink); font-size: 14px; }
input:focus, select:focus { border-color: var(--mint-deep); box-shadow: 0 0 0 3px rgba(79,140,113,.12); }
.full-width { width: 100%; margin-top: 5px; }
.toast { position: fixed; top: 22px; right: 22px; z-index: 20; max-width: 320px; padding: 13px 16px; border-radius: 11px; background: var(--deep); color: white; box-shadow: var(--shadow); font-size: 13px; opacity: 0; pointer-events: none; transform: translateY(-12px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
body.dark-mode { --ink: #ececec; --muted: #b4b4b4; --line: #424242; --paper: #212121; --white: #2f2f2f; --mint: #2f2f2f; --mint-deep: #76b7ff; --coral: #704947; --cream: #39352a; --deep: #171717; --shadow: 0 12px 32px rgba(0,0,0,.28); }
body.dark-mode .sidebar { background: #171717; border-right: 1px solid #2b2b2b; }
body.dark-mode .brand-mark { background: #ececec; color: #171717; }
body.dark-mode .brand-copy strong { color: #ececec; }
body.dark-mode .nav-links a { color: #b4b4b4; }
body.dark-mode .nav-links a:hover, body.dark-mode .nav-links a.active { background: #2f2f2f; color: #fff; }
body.dark-mode .sidebar-credit { color: #8e8e8e; }
body.dark-mode .profile-chip { background: #2f2f2f; color: #ececec; }
body.dark-mode .profile-chip:hover { background: #3a3a3a; }
body.dark-mode .profile-name { color: #ececec; }
body.dark-mode .profile-menu { background: #2f2f2f; border-color: #424242; }
body.dark-mode .google-button, body.dark-mode .logout-button:hover, body.dark-mode .theme-button:hover { background: #2f2f2f; }
body.dark-mode input, body.dark-mode select { border-color: var(--line); background: #2f2f2f; color: var(--ink); }
body.dark-mode .expense-history { background: #292929; }
body.dark-mode .summary-card p { color: rgba(255,255,255,.62); }
@media (max-width: 900px) { .sidebar { width: 190px; } .main-content { width: calc(100% - 190px); margin-left: 190px; padding: 40px 30px; } .brand-copy { left: 62px; } .content-grid, .overview-grid { grid-template-columns: 1fr; } }
@media (max-width: 680px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; top: 0; z-index: 30; width: 100%; height: auto; padding: 14px 16px 10px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
  .brand-copy { position: static; gap: 2px; font-size: 15px; }
  .sidebar-bottom { margin: 0; grid-column: 3; }
  .sidebar-credit { display: none; }
  .sidebar-account-row { gap: 6px; }
  .profile-chip { flex: 0 0 auto; width: 42px; padding: 7px; justify-content: center; }
  .profile-name, .profile-chevron { display: none; }
  .theme-button { width: 42px; height: 42px; }
  .profile-menu { position: absolute; top: calc(100% + 10px); right: 0; bottom: auto; left: auto; width: min(280px, calc(100vw - 32px)); }
  .account-status { display: block; }
  .nav-links { grid-column: 1 / -1; display: flex; gap: 6px; width: 100%; margin-top: 6px; overflow-x: auto; scrollbar-width: none; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { flex: 0 0 auto; padding: 9px 11px; font-size: 12px; }
  .nav-links a span { width: auto; font-size: 15px; }
  .main-content { width: 100%; margin-left: 0; padding: 28px 16px 42px; }
  .topbar { align-items: start; flex-direction: column; margin-bottom: 28px; }
  .top-actions { width: 100%; }
  .top-actions .primary-button { width: 100%; }
  h1 { font-size: clamp(35px, 12vw, 46px); }
  .subtitle { max-width: 290px; }
  .summary-grid { grid-template-columns: 1fr; gap: 12px; }
  .summary-card { min-height: 145px; padding: 21px; }
  .summary-value { margin-top: 20px; }
  .overview-grid { gap: 14px; }
  .overview-card { min-height: 0; }
  .overview-card h2 { font-size: 24px; }
  .salary-item { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .salary-breakdown { grid-column: 1 / 2; text-align: left; }
  .history-button, .add-deduction { grid-column: 2 / 3; min-height: 36px; }
  .history-button { grid-row: 1; }
  .add-deduction { grid-row: 2; }
  .expense-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .panel { padding: 21px 18px; }
  .panel-heading { align-items: flex-start; gap: 12px; }
  .modal-backdrop { align-items: end; padding: 12px; }
  .modal { width: 100%; max-height: calc(100dvh - 24px); overflow-y: auto; padding: 28px 20px; border-radius: 18px; }
  input, select { min-height: 46px; font-size: 16px; }
  .toast { top: auto; right: 14px; bottom: 14px; left: 14px; max-width: none; }
}
