:root {
    --bg: #f4f6fa;
    --card: #fff;
    --ink: #1d2433;
    --muted: #6b7385;
    --line: #e3e7ef;
    --brand: #3b5bdb;
    --ok: #2f9e44;
    --bad: #e03131
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: "Segoe UI",Arial,sans-serif;
    background: var(--bg);
    color: var(--ink)
}

.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px 48px
}

h1 {
    font-size: 24px;
    margin: 0 0 4px
}

.sub {
    color: var(--muted);
    margin: 0 0 20px
}

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

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

    .panel h2 {
        font-size: 16px;
        margin: 0 0 14px
    }

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px
}

.field {
    margin-bottom: 12px
}

    .field label {
        display: block;
        font-size: 12px;
        font-weight: 600;
        color: var(--muted);
        margin-bottom: 4px
    }

    .field small {
        color: var(--muted);
        font-size: 11px
    }

    .field input, .field select {
        width: 100%;
        padding: 9px 10px;
        border: 1px solid var(--line);
        border-radius: 8px;
        font-size: 14px
    }

.err {
    color: var(--bad);
    font-size: 12px;
    display: block
}

.btn {
    background: var(--brand);
    color: #fff;
    border: 0;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer
}

    .btn.danger {
        background: var(--bad)
    }

.msg {
    display: block;
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: 8px
}

    .msg.ok {
        background: #ebfbee;
        color: var(--ok)
    }

    .msg.bad {
        background: #fff5f5;
        color: var(--bad)
    }

summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--brand)
}
/* standing card image on the left, category spend on the right */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(250px,1fr));
    gap: 14px
}

.cardlink {
    display: flex;
    gap: 12px;
    color: inherit;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    transition: transform .15s
}

    .cardlink:hover {
        transform: translateY(-2px)
    }

.pic {
    position: relative;
    flex: 0 0 76px;
    width: 76px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center
}

    .pic span {
        color: #fff;
        font-weight: 700;
        font-size: 12px;
        padding: 0 6px;
        text-align: center;
        word-break: break-word
    }

    .pic img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block
    }

    .pic.big {
        flex: none;
        width: 150px;
        height: 236px
    }

        .pic.big span {
            font-size: 15px
        }

.addhead {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line)
}

    .addhead small {
        display: block;
        color: var(--muted);
        font-size: 12px
    }

    .addhead b {
        font-size: 16px
    }

.pic.mini {
    flex: none;
    width: 44px;
    height: 69px;
    border-radius: 6px
}

    .pic.mini span {
        font-size: 8px;
        padding: 0 3px
    }

.info {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    justify-content: space-between
}

    .info .nm {
        font-weight: 700;
        font-size: 14px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        margin-bottom: 4px
    }

.cat, .tot {
    display: flex;
    justify-content: space-between;
    padding: 3px 0
}

    .cat span {
        color: var(--muted)
    }

    .cat b {
        font-weight: 600
    }

.tot {
    border-top: 2px solid var(--line);
    margin-top: 2px;
    font-weight: 700
}

.c0 {
    background: linear-gradient(135deg,#3b5bdb,#5f3dc4)
}

.c1 {
    background: linear-gradient(135deg,#0b7285,#2b8a3e)
}

.c2 {
    background: linear-gradient(135deg,#c2255c,#e8590c)
}

.c3 {
    background: linear-gradient(135deg,#343a40,#1a1b1e)
}

.c4 {
    background: linear-gradient(135deg,#1864ab,#0c8599)
}

.meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px
}

    .meta .n {
        font-weight: 600;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap
    }

    .meta .amt {
        font-weight: 700;
        white-space: nowrap
    }

    .meta small {
        color: var(--muted);
        font-weight: 400
    }

.hero {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 20px;
    align-items: center
}

@media(max-width:760px) {
    .hero, .row {
        grid-template-columns: 1fr
    }
}

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

.stat {
    background: var(--bg);
    border-radius: 10px;
    padding: 12px
}

    .stat span {
        font-size: 12px;
        color: var(--muted);
        display: block
    }

    .stat b {
        font-size: 18px
    }

        .stat b span {
            font-size: 18px;
            color: var(--ink)
        }

.tw {
    overflow-x: auto
}

table.grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px
}

    table.grid th {
        text-align: left;
        font-size: 12px;
        text-transform: uppercase;
        color: var(--muted);
        border-bottom: 2px solid var(--line);
        padding: 8px
    }

    table.grid td {
        padding: 9px 8px;
        border-bottom: 1px solid var(--line)
    }

    table.grid input[type=text] {
        width: 100%;
        padding: 6px;
        border: 1px solid var(--line);
        border-radius: 6px
    }

.num {
    text-align: right !important
}

.purchase {
    color: var(--bad) !important;
    font-weight: 600
}

.payment {
    color: var(--ok) !important;
    font-weight: 600
}

.empty {
    color: var(--muted);
    padding: 16px;
    text-align: center
}

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

.toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px
}

    .toolbar h2 {
        margin: 0 auto 0 0
    }

.btn.danger-ghost {
    background: none;
    color: var(--bad);
    border: 1px solid var(--line)
}

    .btn.danger-ghost:disabled {
        opacity: .4;
        cursor: default
    }

.settle {
    color: var(--ok);
    font-weight: 600
}

.settled {
    color: var(--muted);
    font-weight: 600
}

.desc {
    color: var(--ink);
    line-height: 1.5;
    font-size: 14px
}

.descbox {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    resize: vertical
}

.descacts {
    margin-top: 10px;
    display: flex;
    gap: 10px
}

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