:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --shadow: 0 18px 55px rgba(15, 23, 42, 0.09);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.13), transparent 32rem),
        linear-gradient(135deg, #f8fafc 0%, var(--bg) 48%, #eef2ff 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    width: min(1120px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 32px 0;
}

.center-shell {
    display: grid;
    place-items: center;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #14b8a6);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}

.nav-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 28px;
    align-items: stretch;
}

.hero-copy {
    display: flex;
    min-height: 520px;
    flex-direction: column;
    justify-content: center;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 760px;
    margin-bottom: 16px;
    font-size: 72px;
    line-height: 0.95;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 8px;
    font-size: 24px;
    letter-spacing: 0;
}

.lead {
    max-width: 600px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.65;
}

.panel {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.auth-card,
.entry-card {
    max-width: 440px;
    padding: 28px;
}

.entry-card {
    align-self: center;
}

.card-header {
    margin-bottom: 24px;
}

.card-header p {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.55;
}

.form-stack {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 7px;
}

label {
    color: #374151;
    font-size: 13px;
    font-weight: 800;
}

input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px 14px;
    color: var(--text);
    background: #fff;
    font: inherit;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13);
}

.button,
button {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: var(--radius);
    padding: 13px 16px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.button:hover,
button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #1e40af);
    box-shadow: 0 14px 26px rgba(37, 99, 235, 0.22);
}

.button-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #1e3a8a);
}

.button-secondary {
    color: #1f2937;
    background: #eef2ff;
}

.button-danger {
    color: #ffffff;
    background: #dc2626;
}

.button-danger:hover {
    background: #b91c1c;
}

.button-clear {
    margin-top: 10px;
    background: #f3f4f6;
    color: #374151;
}

.button-ghost {
    width: auto;
    color: #374151;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border);
}

.message {
    border-radius: var(--radius);
    margin: 0 0 16px;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 700;
}

.message-error {
    color: #991b1b;
    background: #fee2e2;
}

.message-success {
    color: #065f46;
    background: #d1fae5;
}

.auth-switch {
    margin-top: 16px;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.auth-switch a {
    color: var(--primary);
    font-weight: 800;
}

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

.stat {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    background: var(--panel);
}

.stat span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stat strong {
    font-size: 36px;
    letter-spacing: 0;
}

.dashboard-card {
    padding: 22px;
}

.chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 8px 12px;
    color: #334155;
    background: var(--panel-soft);
    font-size: 13px;
    font-weight: 800;
}

.chart-wrap {
    position: relative;
    min-height: 430px;
    padding: 22px;
    border-radius: calc(var(--radius) + 6px);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(239, 246, 255, 0.82));
    border: 1px solid rgba(37, 99, 235, 0.12);
}

.chart-wrap canvas {
    width: 100% !important;
    height: 430px !important;
    display: block;
    border-radius: 16px;
    background: transparent;
}

.goal-panel {
    display: grid;
    grid-template-columns: 1fr 1fr 320px;
    gap: 16px;
    margin-bottom: 20px;
}

.goal-card,
.goal-form {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.goal-card strong {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
}

.goal-card p {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.goal-description {
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.progress-track {
    height: 10px;
    border-radius: 999px;
    background: #eef2f7;
    overflow: hidden;
    margin-top: 14px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary), #14b8a6);
    border-radius: 999px;
    width: 0;
    transition: width 260ms ease;
}

.goal-form label {
    display: block;
    margin-bottom: 12px;
    color: #374151;
    font-size: 13px;
    font-weight: 800;
}

.goal-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.goal-input-row input {
    width: 100%;
}

.filter-row {
    margin-bottom: 14px;
    display: flex;
    justify-content: flex-end;
}

.filter-buttons {
    display: flex;
    gap: 8px;
}

.filter-button {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-weight: 800;
    color: var(--text);
}

.filter-button.active {
    background: linear-gradient(135deg, var(--primary), #1d4ed8);
    color: #fff;
    border-color: transparent;
}

.entry-table {
    width: 100%;
    border-collapse: collapse;
}

.entry-table th,
.entry-table td {
    padding: 16px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.entry-table th {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.entry-table td {
    color: var(--text);
    vertical-align: middle;
}

.entry-table .actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.entry-table .actions .button {
    width: auto !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    min-width: 88px;
}

.entry-table .actions form {
    margin: 0;
}

.table-wrap {
    overflow-x: auto;
}

.empty-state.is-visible {
    display: block;
}

.is-positive {
    color: var(--success);
}

.is-negative {
    color: var(--danger);
}

.is-neutral {
    color: var(--muted);
}

@media (max-width: 860px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-copy {
        min-height: auto;
        padding-top: 24px;
    }

    .entry-card {
        max-width: none;
    }

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

@media (max-width: 560px) {
    .app-shell {
        width: min(100% - 22px, 1120px);
        padding: 18px 0;
    }

    .nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav-actions,
    .button-ghost {
        width: 100%;
    }

    .auth-card,
    .entry-card,
    .dashboard-card {
        padding: 20px;
    }

    h1 {
        font-size: 42px;
    }

    .stat strong {
        font-size: 30px;
    }

    .lead {
        font-size: 16px;
    }

    .chart-head {
        flex-direction: column;
    }

    .goal-panel {
        grid-template-columns: 1fr;
    }

    .chart-wrap,
    .chart-wrap canvas {
        min-height: 420px;
        height: 420px !important;
    }

    /* Reduce chart padding on very small screens to give more space */
    .chart-wrap {
        padding: 12px;
    }
}
