:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #667085;
    --line: #d8dee9;
    --accent: #1769aa;
    --accent-dark: #105184;
    --danger: #b42318;
    --income: #067647;
    --expense: #b54708;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, "Microsoft JhengHei", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
}

.page {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

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

.topbar h1 {
    margin: 0;
    font-size: 26px;
}

.nav {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--muted);
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 18px;
}

.login-panel {
    width: min(420px, calc(100% - 32px));
    margin: 10vh auto;
}

.login-panel h1 {
    margin: 0 0 18px;
    font-size: 24px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field-full {
    grid-column: 1 / -1;
}

label {
    font-size: 14px;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    background: #fff;
    color: var(--text);
}

textarea {
    min-height: 78px;
    resize: vertical;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    padding: 10px 16px;
    min-height: 40px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: var(--accent-dark);
    color: #fff;
}

.button-secondary {
    background: #eef2f7;
    color: var(--text);
}

.button-secondary:hover {
    background: #dfe6ef;
    color: var(--text);
}

.button-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid #f3b3ad;
}

.button-danger:hover {
    background: #fff1f0;
    color: var(--danger);
}

.actions {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}

.summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.metric {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 8px;
}

.metric strong {
    font-size: 24px;
}

.income {
    color: var(--income);
}

.expense {
    color: var(--expense);
}

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

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

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 600;
    background: #fafbfc;
}

.amount {
    text-align: right;
    white-space: nowrap;
}

.notice,
.error {
    border-radius: 6px;
    padding: 11px 12px;
    margin-bottom: 14px;
}

.notice {
    background: #ecfdf3;
    color: #05603a;
}

.error {
    background: #fff1f0;
    color: #912018;
}

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

@media (max-width: 760px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

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

