:root { font-family: Arial, sans-serif; background: #f3f6f8; color: #1f2933; }
:root[data-theme="dark"] { background: #111827; color: #e5e7eb; }
body { margin: 0; }
main { box-sizing: border-box; max-width: 900px; margin: 2rem auto; padding: 1.5rem; background: #fff; border-radius: 10px; box-shadow: 0 2px 12px rgba(31, 41, 51, .08); }
:root[data-theme="dark"] main { background: #1f2937; box-shadow: 0 2px 12px rgba(0, 0, 0, .25); }
h1 { margin-top: 0; color: #176b87; }
.landing-page { max-width: 980px; padding: 0; overflow: hidden; }
.landing-hero { position: relative; padding: clamp(2.5rem, 8vw, 5.5rem); background: radial-gradient(circle at 85% 15%, rgba(23, 107, 135, .2), transparent 30%), linear-gradient(135deg, #eaf3f6, #f8fbfc 65%, #dcecf1); }
.landing-hero h1 { position: relative; z-index: 1; max-width: 650px; margin: .55rem 0 1.35rem; font-size: clamp(2rem, 6vw, 3.8rem); line-height: 1.15; letter-spacing: -.03em; }
.landing-intro { max-width: 600px; margin-bottom: 0; font-size: 1.1rem; line-height: 1.85; letter-spacing: .01em; }
.landing-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.5rem; }
.landing-actions a { margin: 0; }
.secondary-action { display: inline-block; padding: .65rem .9rem; border: 1px solid #176b87; border-radius: 7px; color: #176b87; text-decoration: none; font-weight: 600; }
.secondary-action:hover { background: #d5e8ed; }
.landing-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: #dbe5e9; }
.landing-features article { display: flex; flex-direction: column; gap: .65rem; padding: 1.5rem 1.3rem; background: #fff; }
.landing-features strong { letter-spacing: .02em; }
.landing-features span { color: #52606d; line-height: 1.65; }
:root[data-theme="dark"] .landing-hero { background: linear-gradient(135deg, #263b47, #1f2937); }
:root[data-theme="dark"] .landing-features article { background: #1f2937; }
:root[data-theme="dark"] .landing-features span { color: #cbd5e1; }
.welcome-panel { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .85rem 1rem; margin-bottom: 1rem; background: linear-gradient(135deg, #eaf3f6, #f8fbfc); border-radius: 10px; }
.welcome-panel h1 { margin: .15rem 0; font-size: clamp(1.2rem, 3vw, 1.7rem); }
.welcome-panel p { margin-bottom: 0; }
.eyebrow { margin: 0; color: #176b87; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.today-date { white-space: nowrap; }
:root[data-theme="dark"] .welcome-panel { background: linear-gradient(135deg, #263b47, #1f2937); }
a { color: #176b87; }
.home-link { margin: 0 0 1.25rem; text-align: left; }
.home-link a { font-weight: 600; text-decoration: none; }
label { display: block; margin-top: 1rem; font-weight: 600; }
input, select, textarea, button { box-sizing: border-box; width: 100%; margin-top: .35rem; padding: .7rem; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; }
form { box-sizing: border-box; max-width: 100%; }
input[type="date"], input[type="month"] { display: block; max-width: 100%; min-width: 0; }
form input[type="date"], form input[type="month"] { width: 100%; }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { background: #374151; color: #f9fafb; border-color: #6b7280; }
button { width: auto; margin-top: 1.25rem; background: #176b87; color: #fff; border: 0; cursor: pointer; }
[role="alert"] { color: #a52626; }
[role="status"] { color: #176b4d; font-weight: 600; }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { padding: .7rem; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: top; }
th { background: #eaf3f6; }
:root[data-theme="dark"] th { background: #374151; }
.actions-column { text-align: right; }
.actions-column form { margin: 0; }
.actions-column button { margin: 0; background: #a52626; }
.actions-column a { display: inline-block; margin-right: .6rem; }
#theme-toggle { float: none; }
.theme-toggle { position: fixed; z-index: 10; top: 1rem; right: 1rem; display: flex; align-items: center; justify-content: space-between; width: 4.2rem; height: 2.15rem; margin: 0; padding: .25rem; border: 1px solid #cbd5e1; border-radius: 2rem; background: #eaf3f6; color: #176b87; }
.theme-toggle span { line-height: 1; }
.theme-knob { position: absolute; left: .25rem; width: 1.55rem; height: 1.55rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s ease; }
.theme-toggle.is-dark .theme-knob { transform: translateX(2rem); }
:root[data-theme="dark"] .theme-toggle { background: #374151; color: #f9fafb; border-color: #6b7280; }
.main-nav { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 1rem 0 1.5rem; line-height: 1; }
.main-nav span { display: flex; flex-wrap: wrap; gap: .55rem; }
.main-nav a { display: inline-block; padding: .6rem .85rem; border-radius: 7px; background: #eaf3f6; color: #176b87; text-decoration: none; font-weight: 600; }
.main-nav a:hover { background: #d5e8ed; }
.main-nav .primary-link { background: #176b87; color: #fff; }
.main-nav .primary-link:hover { background: #12566c; }
.main-nav .logout-form { margin: 0 0 0 auto; }
.main-nav .logout-link { margin-left: auto; border: 0; background: #a52626; color: #fff; }
.main-nav .logout-link:hover { background: #842020; }
.primary-action { display: inline-block; padding: .65rem .9rem; border-radius: 7px; background: #176b87; color: #fff; text-decoration: none; font-weight: 600; }
.primary-action:hover { background: #12566c; }
.site-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #dbe5e9; color: #52606d; font-size: .85rem; text-align: center; line-height: 1.6; }
.site-footer p { margin: .2rem 0; }
.budget-prompt { display: flex; align-items: center; gap: .8rem; padding: .8rem; background: #fff8e6; border-left: 4px solid #d69e2e; border-radius: 6px; }
.budget-prompt .primary-action { white-space: nowrap; }
:root[data-theme="dark"] .budget-prompt { background: #423a26; }
.cf-turnstile { margin-top: 1.25rem; margin-bottom: .75rem; }
.filter-form { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; padding: .7rem .85rem; background: #f3f6f8; border-radius: 8px; }
.filter-title { font-weight: 600; white-space: nowrap; }
.filter-form label { display: inline; margin: 0; font-weight: 600; white-space: nowrap; }
.filter-form select, .filter-form input[type="date"] { width: auto; min-width: 9rem; margin: 0; }
.filter-form button { margin: 0; }
.filter-actions { display: flex; flex-basis: 100%; align-items: center; justify-content: flex-end; gap: .7rem; }
.apply-filter { background: #176b87; color: #fff; }
.clear-filter { padding-bottom: .7rem; white-space: nowrap; }
.clear-filter { padding: .7rem .8rem; border-radius: 6px; background: #a52626; color: #fff; text-decoration: none; font-weight: 600; }
:root[data-theme="dark"] .filter-form { background: #374151; }
:root[data-theme="dark"] .main-nav a { background: #374151; color: #e5e7eb; }
:root[data-theme="dark"] .main-nav .primary-link, :root[data-theme="dark"] .main-nav .logout-link { color: #fff; }
.main-nav { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 1rem 0 1.5rem; line-height: 1; }
.main-nav span { display: flex; flex-wrap: wrap; gap: .55rem; }
.main-nav a { display: inline-block; padding: .6rem .85rem; border-radius: 7px; background: #eaf3f6; color: #176b87; text-decoration: none; font-weight: 600; }
.main-nav a:hover { background: #d5e8ed; }
.main-nav .primary-link { background: #176b87; color: #fff; }
.main-nav .primary-link:hover { background: #12566c; }
.main-nav .logout-link { margin-left: auto; border: 0; background: #a52626; color: #fff; }
.main-nav .logout-link:hover { background: #842020; }
:root[data-theme="dark"] .main-nav a { background: #374151; color: #e5e7eb; }
:root[data-theme="dark"] .main-nav .primary-link, :root[data-theme="dark"] .main-nav .logout-link { color: #fff; }
.summary-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.summary-card { padding: 1rem; background: #eaf3f6; border-radius: 8px; }
.summary-card span, .summary-card strong { display: block; }
.summary-card strong { margin-top: .4rem; font-size: 1.35rem; color: #176b87; }
:root[data-theme="dark"] .summary-card { background: #374151; }
@media (max-width: 700px) { .summary-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .landing-page { margin: 0; border-radius: 0; } .landing-hero { padding: 2rem 1.25rem; } .landing-intro { font-size: 1rem; } .landing-actions { flex-direction: column; } .landing-actions a { text-align: center; } .landing-features { grid-template-columns: 1fr; } }
@media (max-width: 600px) { main { margin: 0; border-radius: 0; padding: 1rem; } table { display: block; overflow-x: auto; white-space: nowrap; } nav { line-height: 2; } }
@media (max-width: 600px) {
    .welcome-panel { align-items: stretch; flex-direction: column; }
    .today-date { white-space: normal; }
    .main-nav { align-items: stretch; flex-direction: column; }
    .main-nav span { align-items: stretch; flex-direction: column; }
    .main-nav a { text-align: center; }
    .main-nav .logout-link { align-self: flex-end; }
    .filter-form { align-items: stretch; flex-direction: column; }
    .filter-form > * { min-width: 0; max-width: 100%; }
    .filter-title, .filter-form label, .filter-form select, .filter-form input[type="date"], .filter-form button, .filter-actions, .clear-filter { width: 100%; }
    .filter-form label { display: block; text-align: left; }
    input[type="date"], input[type="month"], .filter-form select { box-sizing: border-box; max-width: 100%; min-width: 0; width: 100%; }
    form input[type="date"], form input[type="month"] { display: block; box-sizing: border-box; width: calc(100% - .5rem) !important; max-width: calc(100% - .5rem) !important; min-width: 0 !important; font-size: 16px; }
    form { max-width: 100%; overflow: hidden; }
    .clear-filter { padding: .6rem; text-align: center; }
    .filter-actions { flex-direction: column; gap: .5rem; }
    .filter-actions .clear-filter { width: auto; align-self: flex-end; }
    table { display: block; overflow: visible; white-space: normal; }
    table thead { display: none; }
    table tbody, table tr, table td { display: block; width: auto; }
    table tr { margin-bottom: 1rem; padding: .6rem; border: 1px solid #dbe5e9; border-radius: 8px; }
    table td { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem; text-align: right; }
    table td::before { content: attr(data-label); font-weight: 600; text-align: left; }
    table td.actions-column { justify-content: flex-end; }
    table td.actions-column::before { display: none; }
    .categories-table thead { display: none; }
    .categories-table tbody, .categories-table tr { display: block; }
    .categories-table tr { display: flex; align-items: center; justify-content: space-between; margin-bottom: .55rem; padding: .45rem .6rem; }
    .categories-table td { display: block; padding: .35rem; text-align: left; }
    .categories-table td.actions-column { display: block; flex: 0 0 auto; }
    .main-nav { align-items: center; flex-direction: row; flex-wrap: wrap; }
    .main-nav span { align-items: center; flex-direction: row; }
    .main-nav a { padding: .5rem .65rem; }
    .main-nav .logout-link { align-self: center; }
    .budget-prompt { align-items: flex-start; flex-direction: column; }
}
