/* Mobile first: the tracker is used from a phone, the desktop is the exception. */

:root {
    --bg: #0f1216;
    --card: #171c22;
    --line: #262d36;
    --text: #e8edf2;
    --muted: #93a1b0;
    --accent: #4c9aff;
    --ok: #3ecf8e;
    --bad: #ff6b6b;
    --radius: 14px;
    --tap: 48px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0 0 5.5rem;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body.centered {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

main { padding: 0 1rem; max-width: 720px; margin: 0 auto; }

h1 { font-size: 1.3rem; margin: 1rem 0 .5rem; }
h2 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; color: var(--muted); font-weight: 600; }

/* ------------------------------------------------------------- top bar --- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 5;
}

.brand { color: var(--text); font-weight: 700; text-decoration: none; }

/* ---------------------------------------------------------------- card --- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
}

.card.narrow { width: 100%; max-width: 380px; }

.total .label { color: var(--muted); margin: 0 0 .25rem; font-size: .85rem; }
.total .big { margin: 0; font-size: 2rem; font-weight: 700; letter-spacing: -.02em; }

/* ---------------------------------------------------------------- list --- */

.list { list-style: none; margin: 0; padding: 0; }

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: var(--tap);
    padding: .65rem 0;
    border-bottom: 1px solid var(--line);
}

.row.archived { opacity: .45; }

.row-main {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text);
    min-width: 0;
    flex: 1;
}

.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }

.row-amounts {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .15rem;
    white-space: nowrap;
}

.qty { font-variant-numeric: tabular-nums; font-weight: 600; }
.qty.out { color: var(--bad); }
.qty.in { color: var(--ok); }
.eur { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.eur.over { color: var(--bad); }

.empty { padding: 1rem 0; color: var(--muted); }

/* --------------------------------------------------------------- forms --- */

label {
    display: block;
    margin: .75rem 0;
    color: var(--muted);
    font-size: .85rem;
}

label.checkbox { display: flex; align-items: center; gap: .5rem; }

input, select, button {
    font: inherit;
    color: var(--text);
}

input[type="text"], input[type="number"], input[type="date"],
input[type="time"], input[type="password"], select {
    display: block;
    width: 100%;
    margin-top: .3rem;
    min-height: var(--tap);
    padding: .5rem .75rem;
    background: #0c0f13;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.two { display: flex; gap: .75rem; }
.two > * { flex: 1; min-width: 0; }

button, .button {
    min-height: var(--tap);
    padding: .6rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--card);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    display: inline-block;
}

button.primary { background: var(--accent); border-color: var(--accent); color: #06101f; font-weight: 700; }
button.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
button.link, .link { background: none; border: none; color: var(--accent); padding: 0; min-height: 0; }
button.small { font-size: .8rem; }
.wide { width: 100%; display: block; margin-top: .5rem; }

.hint { color: var(--muted); font-size: .8rem; margin: .5rem 0 0; }
.warn { color: #ffcf6b; font-size: .85rem; }

/* ---------------------------------------------------------------- tabs --- */

.tabs { display: flex; gap: .5rem; margin: 1rem 0; overflow-x: auto; }

.tabs a {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    padding: .6rem .75rem;
    min-height: var(--tap);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
}

.tabs a.active { background: var(--card); color: var(--text); border-color: var(--accent); }

.monthnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1rem 0;
    font-weight: 600;
}

.monthnav a {
    min-width: var(--tap);
    min-height: var(--tap);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    text-decoration: none;
    font-size: 1.4rem;
}

/* --------------------------------------------------------------- flash --- */

.flash-area { padding: 0 1rem; max-width: 720px; margin: 0 auto; }
.flash { padding: .6rem .8rem; border-radius: 10px; margin: .75rem 0; font-size: .9rem; }
.flash.ok { background: rgba(62, 207, 142, .12); color: var(--ok); }
.flash.err { background: rgba(255, 107, 107, .12); color: var(--bad); }

/* ---------------------------------------------------------- bottom nav --- */

.bottomnav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: .4rem .25rem calc(.4rem + env(safe-area-inset-bottom));
    background: var(--card);
    border-top: 1px solid var(--line);
}

.bottomnav a {
    flex: 1;
    text-align: center;
    color: var(--muted);
    text-decoration: none;
    font-size: .75rem;
    min-height: var(--tap);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottomnav a.add {
    color: #06101f;
    background: var(--accent);
    border-radius: 50%;
    max-width: 52px;
    height: 52px;
    font-size: 1.6rem;
    font-weight: 700;
}

.budget-row { align-items: flex-start; }
.budget-row .row-amounts { align-items: flex-end; }

@media (min-width: 720px) {
    body { padding-bottom: 1rem; }
    .bottomnav { position: static; border-radius: var(--radius); margin: 1rem auto; max-width: 720px; }
}
