:root {
    --bg: #f5efe6;
    --surface: rgba(255, 252, 247, 0.92);
    --surface-strong: #fffdf8;
    --text: #1f1a15;
    --muted: #766456;
    --accent: #c75b39;
    --accent-dark: #8e3b22;
    --green: #217a5b;
    --red: #a84336;
    --gold: #d09b3d;
    --border: rgba(31, 26, 21, 0.08);
    --shadow: 0 20px 45px rgba(92, 62, 39, 0.12);
    font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(208, 155, 61, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(199, 91, 57, 0.2), transparent 24%),
        linear-gradient(180deg, #f8f2ea 0%, #efe2d0 100%);
}

.app-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    padding: 26px;
    border-radius: 28px;
    background: linear-gradient(140deg, rgba(255, 250, 243, 0.95), rgba(250, 237, 220, 0.93));
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
}

.hero h1 {
    margin: 0;
    font-size: clamp(32px, 6vw, 48px);
}

.subtitle {
    max-width: 700px;
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.user-box {
    min-width: 220px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid var(--border);
    display: grid;
    gap: 6px;
}

.user-meta {
    display: grid;
    gap: 4px;
    font-size: 13px;
    color: var(--muted);
}

.summary-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.summary-card {
    padding: 18px;
    border-radius: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.summary-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.summary-card strong {
    font-size: 28px;
}

.summary-card.income strong {
    color: var(--green);
}

.summary-card.expense strong,
.summary-card.debt strong {
    color: var(--red);
}

.summary-card.balance strong {
    color: var(--accent-dark);
}

.tabs {
    display: flex;
    gap: 10px;
    margin: 20px 0 14px;
    flex-wrap: wrap;
}

.tab-button {
    border: none;
    padding: 12px 18px;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    transition: 0.2s ease;
}

.tab-button.active {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.panel-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 16px;
}

.editor-card,
.list-card {
    background: var(--surface);
    border-radius: 26px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.editor-card {
    padding: 22px;
    display: grid;
    gap: 12px;
    align-content: start;
}

.editor-card h2,
.list-card h2 {
    margin: 0;
}

.editor-card label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(118, 100, 86, 0.2);
    background: white;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--text);
}

textarea {
    resize: vertical;
}

button {
    border: none;
    border-radius: 14px;
    padding: 12px 16px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 10px;
}

.form-actions button {
    flex: 1;
    background: var(--accent);
    color: white;
    font-weight: 700;
}

.form-actions .ghost {
    background: rgba(118, 100, 86, 0.1);
    color: var(--text);
}

.checkbox-line {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.checkbox-line input {
    width: auto;
}

.helper-text,
.empty-note {
    color: var(--muted);
    font-size: 14px;
}

.list-card {
    padding: 22px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.record-list,
.goal-list {
    display: grid;
    gap: 12px;
}

.record-item,
.goal-card {
    padding: 16px;
    border-radius: 20px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
}

.record-top,
.goal-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.record-meta,
.goal-meta {
    color: var(--muted);
    font-size: 14px;
    margin-top: 6px;
}

.record-actions,
.goal-actions {
    display: flex;
    gap: 8px;
}

.record-actions button,
.goal-actions button {
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 13px;
}

.record-actions .edit-btn,
.goal-actions .edit-btn {
    background: rgba(208, 155, 61, 0.15);
    color: #6f5018;
}

.record-actions .delete-btn,
.goal-actions .delete-btn {
    background: rgba(168, 67, 54, 0.12);
    color: var(--red);
}

.goal-actions .refresh-btn {
    background: rgba(33, 122, 91, 0.12);
    color: var(--green);
}

.debt-board {
    display: grid;
    gap: 16px;
}

.goal-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
}

.goal-cell {
    position: relative;
    border-radius: 14px;
    padding: 12px 8px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    background: rgba(208, 155, 61, 0.12);
    color: #7a5518;
    cursor: pointer;
    transition: 0.2s ease;
}

.goal-cell.filled {
    background: rgba(33, 122, 91, 0.14);
    color: var(--green);
}

.goal-cell.filled::before,
.goal-cell.filled::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 10%;
    width: 80%;
    height: 3px;
    border-radius: 999px;
    background: rgba(33, 122, 91, 0.72);
}

.goal-cell.filled::before {
    transform: translateY(-50%) rotate(37deg);
}

.goal-cell.filled::after {
    transform: translateY(-50%) rotate(-37deg);
}

.goal-cell span {
    position: relative;
    z-index: 1;
}

.goal-progress {
    margin-top: 10px;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(118, 100, 86, 0.12);
}

.goal-progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--accent));
}

.empty-state {
    padding: 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.55);
    color: var(--muted);
    text-align: center;
}

@media (max-width: 900px) {
    .summary-grid,
    .panel-grid {
        grid-template-columns: 1fr;
    }

    .hero,
    .section-head,
    .record-top,
    .goal-top {
        flex-direction: column;
    }
}
