/*
 * Dark only, like the rest of the roud.cz applications. Colours are custom
 * properties so a light theme could be added without touching a template.
 */
:root {
    --bg:          #0f1115;
    --surface:     #171a21;
    --surface-2:   #1e222b;
    --surface-3:   #262b36;
    --border:      #2a2f3a;
    --border-soft: #21252e;
    --text:        #e6e8ec;
    --text-muted:  #9aa1ad;
    --text-faint:  #6b7280;
    --accent:      #4f8cff;
    --accent-soft: #1b2942;
    --ok:          #3fa66b;
    --warn:        #e0a13a;
    --danger:      #e0603a;
    --up:          #3fa66b;
    --down:        #ff5c5c;

    --radius:   10px;
    --radius-s: 7px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- Topbar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar__inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; height: 54px; display: flex; align-items: center; gap: 14px; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { color: var(--text-muted); padding: 6px 11px; border-radius: var(--radius-s); font-size: 15.5px; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.is-active { background: var(--accent-soft); color: var(--text); }
.env-badge { background: var(--warn); color: #000; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; }

.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu__face { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--text); display: flex; align-items: center; justify-content: center; font-weight: 600; }
.usermenu__list { position: absolute; right: 0; top: 42px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-width: 240px; box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.usermenu__who { display: flex; flex-direction: column; padding: 4px 6px 10px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.usermenu__list form button { width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 8px 6px; font: inherit; cursor: pointer; border-radius: var(--radius-s); }
.usermenu__list form button:hover { background: var(--surface-3); }

/* ---------- Layout ---------- */
.main { max-width: 1200px; margin: 0 auto; padding: 22px 20px 80px; }
.main--bare { max-width: 520px; padding-top: 72px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
h1 { font-size: 24px; font-weight: 650; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 17px; font-weight: 600; margin: 26px 0 10px; }
.muted { color: var(--text-muted); font-weight: 500; }
.faint { color: var(--text-faint); font-size: 14px; }
.nowrap { white-space: nowrap; }
.inline { display: inline; margin: 0; }
p { margin: 8px 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
details.card summary { cursor: pointer; color: var(--text-muted); }
details.card[open] summary { margin-bottom: 10px; }
.pre { font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-word; margin: 0; line-height: 1.45; }
.pre .error { color: var(--down); font-weight: 600; }

/* ---------- Flashes ---------- */
.flashes { margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: var(--radius-s); border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 8px; }
.flash--ok { border-color: var(--ok); }
.flash--error { border-color: var(--danger); }

/* ---------- Filters and chips ---------- */
.filters { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.filters__month { display: flex; align-items: center; gap: 10px; }
.filters__month strong { min-width: 130px; text-align: center; text-transform: capitalize; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.chip { padding: 4px 11px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); font-size: 14px; border: 1px solid transparent; }
.chip:hover { text-decoration: none; color: var(--text); }
.chip.is-active { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.chip--warn.is-active { border-color: var(--warn); background: #3a2d14; }
.chips__select select { max-width: 220px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: top; }
.table th { color: var(--text-muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.table tbody tr:hover { background: var(--surface); }
.table tfoot td { font-weight: 600; border-top: 2px solid var(--border); border-bottom: 0; }
.table .num { text-align: right; }
.table .amount { font-variant-numeric: tabular-nums; }
.table--narrow { max-width: 560px; }
.table--compact td { padding: 4px 10px; }
.table .faint { display: block; }
tr.is-deleted td { opacity: .45; text-decoration: line-through; }
tr.is-deleted td .faint { text-decoration: none; }
tr.has-errors td { color: var(--warn); }
tr.kind--transfer td, tr.kind--excluded td { color: var(--text-muted); }
tr.kind--asset td:first-child { font-style: italic; }
.pct { display: inline-block; min-width: 58px; text-align: right; font-size: 12.5px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.pct--up { color: var(--up); }
.pct--down { color: var(--down); }
.table--sums td:first-child { width: 28%; }
.rule__part { display: inline-block; margin: 0 10px 2px 0; }

/* ---------- Forms ---------- */
.form__row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.form__row label { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; color: var(--text-muted); flex: 1 1 160px; }
.form__row label.form__wide { flex: 3 1 320px; }
.form__row input.form__wide { flex: 3 1 320px; }
.form__row--rule { align-items: center; }
.form__row--rule .form__check { flex: 0 0 190px; }
.form__check { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--text) !important; }
input[type=text], input[type=date], input[type=number], select {
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-s);
    padding: 7px 10px; font: inherit; font-size: 15px; width: 100%;
}
input:disabled, select:disabled { opacity: .6; }
.form__actions { display: flex; gap: 10px; margin-top: 6px; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0 0; font-size: 14px; }
.meta dt { color: var(--text-faint); }
.meta dd { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 18px; }

/* ---------- Buttons and badges ---------- */
.btn { display: inline-block; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 8px 14px; font: inherit; font-size: 15px; cursor: pointer; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: #3a78ee; }
.btn--danger { border-color: var(--danger); color: var(--danger); }
.btn--small { padding: 5px 10px; font-size: 14px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--text); vertical-align: middle; margin-left: 6px; }
.badge--ok { background: #163a25; color: var(--up); }
.badge--warn { background: #3a2d14; color: var(--warn); }
.badge--muted { background: var(--surface-3); color: var(--text-muted); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }

/* ---------- Auth and errors ---------- */
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; text-align: center; }
.auth-card h1 { margin-bottom: 8px; }
.auth-card .btn { margin-top: 14px; }
.error-detail { text-align: left; font-family: var(--mono); font-size: 13px; white-space: pre-wrap; color: var(--warn); }

@media (max-width: 720px) {
    .topbar__inner { padding: 0 10px; }
    .main { padding: 14px 10px 60px; }
    .table { font-size: 14px; }
    .table th, .table td { padding: 6px 6px; }
    .form__row--rule .form__check { flex-basis: 100%; }
}
