:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --ink: #1c2530;
    --muted: #6b7785;
    --line: #e4e8ed;
    --brand: #0f766e;
    --brand-dark: #0b5a54;
    --danger: #c0392b;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.topbar { background: var(--brand); color: #fff; }
.topbar-in { display: flex; align-items: baseline; gap: 14px; padding-top: 14px; padding-bottom: 14px; }
.brand { color: #fff; font-weight: 700; font-size: 1.25rem; text-decoration: none; }
.tagline { opacity: .85; font-size: .9rem; }

main.wrap { padding-top: 20px; padding-bottom: 40px; }

/* Ringkasan */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card-label { color: var(--muted); font-size: .82rem; }
.card-value { font-size: 1.35rem; font-weight: 700; margin-top: 2px; }

/* Layout */
.grid { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel.narrow { max-width: 480px; margin: 0 auto; }
h2 { margin: 0 0 14px; font-size: 1.1rem; }
h3 { margin: 0 0 10px; font-size: .95rem; }
.mt { margin-top: 24px; }
.muted { color: var(--muted); font-size: .9rem; }

/* Form */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
input, select, button { font: inherit; }
input[type=text], input[type=number], input[type=date], input[type=month], input[type=search], select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #cfd6de;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }

.btn {
    display: inline-block;
    padding: 9px 16px;
    border: 1px solid #cfd6de;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
    font-size: .92rem;
}
.btn:hover { background: #f1f4f7; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; }
.row { display: flex; gap: 10px; }

/* Filter */
.filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filter input[type=month] { width: auto; }
.filter select { width: auto; }
.filter input[type=search] { flex: 1; min-width: 140px; width: auto; }

/* Riwayat */
.day { margin-bottom: 16px; }
.day-head {
    display: flex; justify-content: space-between;
    padding: 6px 0; border-bottom: 2px solid var(--line);
    font-size: .92rem;
}
.items { list-style: none; margin: 0; padding: 0; }
.items li {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--line);
}
.item-title { font-weight: 600; word-break: break-word; }
.tag {
    display: inline-block; margin-top: 3px;
    background: #e6f4f2; color: var(--brand-dark);
    border-radius: 999px; padding: 1px 9px; font-size: .75rem;
}
.item-side { text-align: right; white-space: nowrap; }
.amount { font-weight: 700; }
.actions { margin-top: 3px; font-size: .82rem; display: flex; gap: 10px; justify-content: flex-end; }
.actions a { color: var(--brand); text-decoration: none; }
.actions a:hover { text-decoration: underline; }
form.inline { display: inline; margin: 0; }
.link-danger { background: none; border: 0; padding: 0; color: var(--danger); cursor: pointer; font-size: inherit; }
.link-danger:hover { text-decoration: underline; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* Rekap kategori */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bar-head { display: flex; justify-content: space-between; font-size: .85rem; gap: 8px; }
.bar-head small { color: var(--muted); }
.bar { height: 8px; background: #e9edf1; border-radius: 999px; margin-top: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 999px; }

/* Alert */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: .92rem; }
.alert-ok { background: #e3f5ec; color: #1b6b45; border: 1px solid #bfe5d0; }
.alert-err { background: #fdecea; color: #922b21; border: 1px solid #f5c6c0; }

.footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 18px 0 30px; }

/* Akun */
.userbox { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.topbar .btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); padding: 5px 12px; font-size: .85rem; }
.topbar .btn:hover { background: rgba(255, 255, 255, .15); }
input[type=password] {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #cfd6de;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}
.auth { max-width: 420px; margin: 24px auto; }
.auth .btn-primary { width: 100%; }
.auth-alt { text-align: center; margin: 14px 0 0; font-size: .9rem; color: var(--muted); }
.auth-alt a { color: var(--brand); }
.hint { font-size: .78rem; color: var(--muted); }
@media (max-width: 480px) { .userbox .halo { display: none; } }

/* Responsif */
@media (max-width: 900px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
    .grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .tagline { display: none; }
    .card-value { font-size: 1.1rem; }
}
