@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=Zilla+Slab:wght@500;600;700&display=swap');

:root {
    --ink: #232420;
    --paper: #F5F1E4;
    --paper-dim: #EAE4D1;
    --panel: #1F2E2A;
    --panel-dark: #16211D;
    --brass: #C9A227;
    --brass-bright: #E0B93A;
    --line: #D8D0B8;
    --ok: #4C7A5E;
    --warn: #B5502E;
    --radius: 10px;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;
    --sans: 'IBM Plex Sans', system-ui, sans-serif;
    --display: 'Zilla Slab', Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.5;
}

a { color: inherit; }

.topbar {
    background: var(--panel);
    color: var(--paper);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 3px solid var(--brass);
}

.topbar .brand {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand .dial {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--brass);
    box-shadow: 0 0 0 3px rgba(201,162,39,0.25);
    display: inline-block;
}

.topbar nav {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.topbar nav a, .topbar .user {
    color: var(--paper);
    text-decoration: none;
    font-size: 0.92rem;
    padding: 8px 12px;
    border-radius: 6px;
    opacity: 0.85;
}

.topbar nav a:hover { opacity: 1; background: rgba(255,255,255,0.08); }
.topbar .user { opacity: 0.6; font-family: var(--mono); font-size: 0.82rem; }

.wrap {
    max-width: 980px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}

h1 {
    font-family: var(--display);
    font-size: 1.9rem;
    margin: 0 0 6px;
}

h2 {
    font-family: var(--display);
    font-size: 1.3rem;
    margin: 0 0 14px;
}

.eyebrow {
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    color: var(--warn);
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
}

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 22px;
}

.card + .card { margin-top: 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .grid.cols-2 { grid-template-columns: 1fr; } }

/* --- Meter odometer display: signature element --- */
.odometer {
    display: inline-flex;
    background: var(--panel-dark);
    border-radius: 6px;
    padding: 6px 10px;
    gap: 2px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
}
.odometer .digit {
    font-family: var(--mono);
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--brass-bright);
    background: rgba(0,0,0,0.35);
    border-radius: 3px;
    padding: 3px 3px;
    min-width: 1.1em;
    text-align: center;
    letter-spacing: 0;
}
.odometer .digit.dim { color: rgba(224,185,58,0.35); }
.odometer .unit {
    align-self: center;
    color: var(--paper-dim);
    font-family: var(--mono);
    font-size: 0.68rem;
    margin-left: 8px;
    opacity: 0.7;
}

table.ledger {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.94rem;
}
table.ledger th {
    text-align: left;
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7A7461;
    border-bottom: 2px solid var(--ink);
    padding: 8px 10px;
    font-weight: 600;
}
table.ledger td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
table.ledger tr:last-child td { border-bottom: none; }
table.ledger td.num, table.ledger th.num { font-family: var(--mono); text-align: right; }
table.ledger tr.total td {
    font-weight: 700;
    border-top: 2px solid var(--ink);
    border-bottom: none;
    font-family: var(--mono);
}

input[type=text], input[type=number], input[type=password], input[type=date], select {
    font-family: var(--sans);
    font-size: 0.95rem;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper);
    color: var(--ink);
    width: 100%;
}
input[type=number] { font-family: var(--mono); }
input:focus, select:focus, button:focus, a.btn:focus {
    outline: 3px solid rgba(201,162,39,0.5);
    outline-offset: 1px;
}
label { font-size: 0.85rem; font-weight: 600; display: block; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.hint { font-size: 0.8rem; color: #7A7461; margin-top: 4px; }

.btn {
    display: inline-block;
    font-family: var(--sans);
    font-weight: 600;
    font-size: 0.92rem;
    padding: 10px 18px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    background: var(--panel);
    color: var(--paper);
}
.btn:hover { background: var(--panel-dark); }
.btn.brass { background: var(--brass); color: var(--panel-dark); }
.btn.brass:hover { background: var(--brass-bright); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--paper-dim); }
.btn.danger { background: var(--warn); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 0.82rem; }

.badge {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    border-radius: 100px;
    font-weight: 600;
}
.badge.draft { background: #F3E4C8; color: #8A5A1E; }
.badge.confirmed { background: #DCEBE1; color: var(--ok); }
.badge.locked { background: #EAE4D1; color: #7A7461; }

.period-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.period-nav .current {
    font-family: var(--display);
    font-size: 1.35rem;
    font-weight: 600;
    min-width: 170px;
    text-align: center;
}

.flash {
    padding: 12px 16px;
    border-radius: 7px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}
.flash.ok { background: #DCEBE1; color: var(--ok); }
.flash.error { background: #F6DCD3; color: var(--warn); }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--panel);
    padding: 20px;
}
.login-card {
    background: var(--paper);
    border-radius: 14px;
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-card h1 { text-align: center; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: #7A7461; font-size: 0.88rem; margin-bottom: 28px; }

.objects-list { display: grid; gap: 14px; }
.object-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    text-decoration: none;
    color: var(--ink);
}
.object-row:hover { border-color: var(--brass); }
.object-row .name { font-weight: 600; font-family: var(--display); font-size: 1.1rem; }
.object-row .meta { font-size: 0.82rem; color: #7A7461; font-family: var(--mono); }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #7A7461;
}

footer.note {
    text-align: center;
    font-size: 0.78rem;
    color: #9A927A;
    margin-top: 40px;
}

.stack-sm > * + * { margin-top: 10px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
