/*
 * memodok – user interface.
 * A dense, precise working tool for bookkeepers: a deep ink bar on top with
 * one electric-blue signal line, crisp white surfaces below. Blue marks what
 * can be acted on (primary action, links, focus, codes); green, red and amber
 * are reserved for state (posted, returned, draft).
 */

:root {
    --ink: #101828;
    --muted: #526070;
    --faint: #8794a6;
    --line: #d5dce5;
    --line-soft: #e7ebf0;
    --bg: #f2f4f8;
    --surface: #ffffff;
    --bar: #0e2440;
    --bar-deep: #0a1b31;
    --bar-text: #c9d6e8;
    --bar-accent: var(--brand);
    --bar-current: #6ea8ff;
    --brand: #1f6feb;
    --brand-hover: #1858c4;
    --brand-soft: #eaf2fe;
    --brand-ink: #0b3d91;
    --posted: #2e7d4f;
    --posted-soft: #e6f3eb;
    --returned: #b42318;
    --returned-soft: #fdecea;
    /* Status: u pripremi blue, završeno green, vraćeno red (only returned is red). */
    --draft: #1d4ed8;
    --draft-soft: #e8effc;
    --warning-soft: #fdf3dc;
    --focus: 0 0 0 3px rgba(31, 111, 235, .28);
    --radius: 6px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
    --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Compact like the Windows UI (Segoe UI 9–10pt); most sizes below are in rem and follow this. */
html { font-size: 14px; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.4;
    font-feature-settings: "tnum" 1;
}

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

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 3px; }

h1 { font-size: 1.35rem; font-weight: 600; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 1.1rem 0 .45rem; }
p { margin: .4rem 0; }

.muted { color: var(--muted); }
.small { font-size: .87rem; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Top bar ---------- */

.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: stretch; gap: .25rem;
    height: 40px; padding: 0 .75rem;
    background: linear-gradient(180deg, var(--bar) 0%, var(--bar-deep) 100%); color: #fff;
    /* The signal line: the bar's single accent. */
    box-shadow: inset 0 -2px 0 var(--bar-accent), 0 1px 3px rgba(10, 27, 49, .25);
}

.brand {
    display: flex; align-items: center; gap: .5rem;
    padding-right: 1rem; margin-right: .5rem;
    border-right: 1px solid rgba(255, 255, 255, .15);
    color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: .01em;
}
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; }

.topbar .spacer { flex: 1; }

/* Areas: the bar's colour tells which level a page belongs to (superadmin, agency admin, work on clients). */
body.area-superadmin { --bar: #5a1418; --bar-deep: #3f0d10; --bar-text: #f0cfd1; --bar-accent: #e5484d; --bar-current: #ff9a9e; }
body.area-admin { --bar: #12452c; --bar-deep: #0b301e; --bar-text: #cde8d9; --bar-accent: #3fb97a; --bar-current: #8fe0b4; }
.area-badge {
    align-self: center; margin-right: .5rem; padding: .15rem .5rem;
    border: 1px solid rgba(255, 255, 255, .35); border-radius: 4px;
    font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff;
}
.menu-link { display: flex; align-items: center; padding: 0 .7rem; color: var(--bar-text); font-weight: 500; white-space: nowrap; }
.menu-link:hover { color: #fff; background: rgba(255, 255, 255, .07); text-decoration: none; }
.menu-link.current { color: #fff; box-shadow: inset 0 -3px 0 var(--bar-current); }

/* Dropdown menus: <details class="menu"> so they work with keyboard and without JS. */
.menu { position: relative; display: flex; }
.menu > summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; gap: .35rem;
    padding: 0 .7rem; color: var(--bar-text); font-weight: 500; white-space: nowrap;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after {
    content: ""; width: 0; height: 0; margin-left: .1rem;
    border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor;
    opacity: .7;
}
.menu > summary:hover, .menu[open] > summary { color: #fff; background: rgba(255, 255, 255, .07); }
.menu.current > summary { color: #fff; box-shadow: inset 0 -3px 0 var(--bar-current); }

.menu-panel {
    position: absolute; top: 100%; left: 0; min-width: 260px;
    margin-top: 2px; padding: .4rem 0;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line); border-top: 2px solid var(--bar-accent); border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 12px 32px rgba(10, 27, 49, .18);
}
.menu-panel.right { left: auto; right: 0; }
.menu-panel .group { padding: .35rem 0; }
.menu-panel .group + .group { border-top: 1px solid var(--line-soft); }
.menu-panel .group-title { padding: .2rem 1rem .25rem; font-size: .8rem; color: var(--faint); }
.menu-panel a, .menu-panel button.link {
    display: flex; justify-content: space-between; gap: 1rem;
    width: 100%; padding: .32rem 1rem; color: var(--ink);
    background: none; border: 0; font: inherit; text-align: left; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button.link:hover { background: var(--brand-soft); text-decoration: none; }
.menu-panel a.active { font-weight: 600; color: var(--brand); }
.menu-panel .menu-soon { display: block; padding: .3rem .7rem; color: var(--muted, #888); cursor: default; }
.menu-panel .menu-soon::after { content: ' (uskoro)'; font-size: .85em; }
.sef-status.sef-done { background: #eceef1; color: #6b7480; border-color: #d5d9de; }
.sef-kind-avans { color: #8a5a00; font-weight: 600; }
.sef-kind-smanjenje { color: #b42318; }
.sef-kind-povecanje { color: #1d6f42; }
.menu-panel .disabled { display: block; padding: .42rem 1rem; color: var(--faint); }
.menu-panel .hint { color: var(--faint); font-size: .85rem; }

/* Client switcher */
.client-menu > summary { max-width: 420px; }
.client-menu > summary::after { display: none; }
/* Framed like the area badge; amber when the year of work is not this year. */
.context-box {
    display: flex; align-items: center; gap: .5rem; max-width: 100%;
    padding: .2rem .55rem; border: 1px solid rgba(255, 255, 255, .35); border-radius: 4px; color: #fff;
}
.context-box .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-box .year { padding-left: .5rem; border-left: 1px solid rgba(255, 255, 255, .35); font-weight: 700; font-variant-numeric: tabular-nums; }
.context-box.past-year { background: #f5b83d; border-color: #f5b83d; color: #3d2a00; }
.context-box.past-year .year { border-left-color: rgba(61, 42, 0, .35); }
.client-menu .menu-panel { width: 360px; max-height: 70vh; overflow: auto; }
.year-list { display: flex; flex-wrap: wrap; gap: .35rem; padding: .2rem 1rem .4rem; }
.year-list button {
    padding: .2rem .6rem; border: 1px solid var(--line); border-radius: 4px; background: var(--surface);
    font: inherit; font-variant-numeric: tabular-nums; cursor: pointer;
}
.year-list button:hover { background: var(--brand-soft); }
.year-list button.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.client-menu input[type=search] { margin: .2rem .75rem .5rem; width: calc(100% - 1.5rem); }

/* ---------- Page ---------- */

.page { max-width: 1600px; margin: 0 auto; padding: .8rem 1.1rem 2rem; }
.page.narrow { max-width: 860px; }

.page-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    margin-bottom: .7rem;
}
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .15rem; }
.crumbs a { color: var(--muted); }
.crumbs span + span::before { content: "/"; margin: 0 .45rem; color: var(--faint); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.panel {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: .75rem .9rem; margin-bottom: .7rem; box-shadow: var(--shadow);
}
.panel > h2:first-child { margin-top: 0; }
/* clip, not hidden: hidden would make the panel a scroll container and break the sticky table header. */
.panel.flush { padding: 0; overflow: clip; }

/* ---------- Alerts ---------- */

.alert { padding: .5rem .8rem; border-radius: var(--radius); margin-bottom: .7rem; border: 1px solid; }
.alert ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.alert-error { background: var(--returned-soft); border-color: #f2c4bf; color: #7a1a12; }
.alert-success { background: var(--posted-soft); border-color: #bfe0cb; color: #1d5636; }
.alert-info { background: var(--brand-soft); border-color: #c4d9fb; color: var(--brand-ink); }
.alert-warning { background: var(--warning-soft); border-color: #f0dba8; color: #6b4206; }

/* Below the minimum wage: a red frame that blinks until the bookkeeper decides. */
@keyframes minimum-blink { 50% { outline-color: transparent; } }
.minimum-alert { outline: 3px solid var(--returned); outline-offset: -1px; animation: minimum-blink 1s step-end infinite; }
.minimum-alert .data { background: var(--surface); }
tr.below-minimum > td { background: var(--returned-soft); }
tr.below-minimum { outline: 2px solid var(--returned); outline-offset: -2px; animation: minimum-blink 1s step-end infinite; }
@media (prefers-reduced-motion: reduce) {
    .minimum-alert, tr.below-minimum { animation: none; }
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    height: 28px; padding: 0 .8rem;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); color: var(--ink);
    font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { color: var(--returned); border-color: #f2c4bf; }
.btn-danger:hover { background: var(--returned-soft); border-color: var(--returned); }
.btn-sm { height: 24px; padding: 0 .55rem; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */

label, .label { display: block; font-size: .87rem; font-weight: 600; color: var(--muted); margin: 0 0 .15rem; }

input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=month], input[type=search], input[type=file], select, textarea {
    width: 100%; height: 28px; padding: 0 .5rem;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: #fff; color: var(--ink); font: inherit;
}
textarea { height: auto; min-height: 4rem; padding: .35rem .5rem; }
input[type=file] { padding: .3rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-hover); box-shadow: var(--focus); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--ink); }
input.invalid, select.invalid { border-color: var(--returned); background: #fff8f7; }

.form-grid { display: grid; gap: .55rem .8rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.field-error { color: var(--returned); font-size: .85rem; margin-top: .2rem; }

.check { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; color: var(--ink); font-size: .95rem; margin: 0; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

.toolbar { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .6rem; }
.toolbar .field { min-width: 170px; }
.toolbar .grow { flex: 1; min-width: 240px; }

.form-actions { display: flex; gap: .5rem; margin-top: .7rem; flex-wrap: wrap; }

/* ---------- Tables ---------- */

table.data { width: 100%; border-collapse: collapse; background: var(--surface); }
table.data th, table.data td { padding: .28rem .55rem; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
table.data thead th {
    position: sticky; top: 40px; z-index: 5;
    background: #f7f9fb; color: var(--muted); font-size: .85rem; font-weight: 600;
    border-bottom: 1px solid var(--line);
}
table.data tbody tr:hover td { background: #f7f9fc; }
table.data td.empty { color: var(--muted); padding: 1rem .55rem; }
table.data tfoot td { background: #f7f9fb; font-weight: 600; border-top: 1px solid var(--line); }
table.data tr.inactive td { color: var(--faint); }
table.data tr.heading td { font-weight: 600; }

/* The state rail: the one strong colour signal in lists. */
table.data td.rail { width: 4px; padding: 0; }
tr.state-posted td.rail { background: var(--posted); }
tr.state-returned td.rail { background: var(--returned); }
tr.state-draft td.rail { background: var(--draft); }
tr.state-returned td, tr.state-returned td a { color: var(--returned); }
tr.state-draft td { color: #1e3a8a; }

.badge {
    display: inline-block; padding: .08rem .55rem; border-radius: 999px;
    font-size: .8rem; font-weight: 600; white-space: nowrap; vertical-align: middle;
    background: var(--bg); color: var(--muted); border: 1px solid var(--line);
}
.badge-posted { background: var(--posted-soft); color: var(--posted); border-color: #bfe0cb; }
.badge-returned { background: var(--returned-soft); color: var(--returned); border-color: #f2c4bf; }
.badge-draft { background: var(--draft-soft); color: var(--draft); border-color: #c3d3f5; }

/* Red banner under the top bar: fixed-term contracts ending (agency, 03.11.2026). */
.contract-banner {
    background: #b42318; color: #fff; padding: .45rem 1rem; font-size: .9rem; line-height: 1.5;
}
.contract-banner a { color: #fff; text-decoration: underline; font-weight: 600; }
.contract-banner .hint { opacity: .9; margin-left: .4rem; }
.inline-form { display: flex; gap: .4rem; align-items: center; margin: 0; }

/* Employees by the kind of run they are paid in. */
.badge.pay-employment { background: #e8f0fb; color: #1f4f8f; border-color: #c4d6f0; }
.badge.pay-founders { background: #f1eafa; color: #5b2e91; border-color: #d9c8ef; }
.badge.pay-other { background: #fdf0e3; color: #8a4b0f; border-color: #f2d3b0; }
tr.pay-employment td:first-child { box-shadow: inset 3px 0 0 #6b9be0; }
tr.pay-founders td:first-child { box-shadow: inset 3px 0 0 #a07cd6; }
tr.pay-other td:first-child { box-shadow: inset 3px 0 0 #e0a15e; }

/* Account codes and other ledger codes: the bookkeeper's landmark. */
.code { font-weight: 600; color: var(--brand-ink); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
a.code { color: var(--brand); }
.negative { color: var(--returned); }

.pagination-wrap { margin-top: .9rem; }
.pagination-wrap nav { display: flex; gap: .3rem; flex-wrap: wrap; }
.pagination { align-items: center; }
.pagination .pg { display: inline-block; min-width: 1.9rem; padding: .15rem .45rem; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); text-align: center; text-decoration: none; }
.pagination .pg.current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .pg.disabled { color: var(--faint); }
.pagination .muted { margin-left: .5rem; }

/* ---------- Reports ---------- */
.report-filter .field { min-width: 130px; }
.report-filter .field.narrow { min-width: 90px; width: 90px; }
.report-filter .checks-inline { display: flex; flex-direction: column; gap: .2rem; padding-bottom: .2rem; }
.picker { position: relative; }
.picker > summary { list-style: none; }
.picker > summary::-webkit-details-marker { display: none; }
.picker-panel {
    position: absolute; top: 100%; right: 0; z-index: 20; margin-top: 2px;
    display: grid; grid-template-columns: repeat(2, minmax(150px, auto)); gap: .3rem 1rem; padding: .6rem .8rem;
    background: var(--surface); border: 1px solid var(--line); border-top: 2px solid var(--brand);
    border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 12px 32px rgba(10, 27, 49, .18);
}
.picker-panel .check { font-size: .85rem; white-space: nowrap; }
table.data.compact th, table.data.compact td { padding: .22rem .45rem; font-size: .85rem; }
table.data tr.group-date td { background: #eef2f8; font-weight: 700; color: var(--brand-ink); }
table.data tr.group-account td { font-weight: 600; padding-top: .45rem; }
table.data tr.subtotal td { font-weight: 600; background: #fafbfc; }
table.data tr.date-total td { border-bottom: 1px solid var(--line); }
table.data tr.level-1 td { background: #eef2f8; border-bottom: 1px solid var(--line); }
table.data tr.level-2 td { background: #f4f6fa; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: .6rem; }
.match-grid .panel { margin: 0; }
.btn.btn-small { padding: .1rem .5rem; font-size: .8rem; }
@media (max-width: 1100px) { .match-grid { grid-template-columns: 1fr; } }

/* ---------- Line entry grid (journal entries, bank statements) ---------- */

.grid-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table.lines { border-collapse: collapse; width: 100%; }
table.lines th { background: #f7f9fb; color: var(--muted); font-size: .82rem; font-weight: 600; text-align: left; padding: .4rem .35rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.lines td { padding: .18rem .2rem; border-bottom: 1px solid var(--line-soft); }
table.lines td.n { color: var(--faint); text-align: right; padding-right: .5rem; width: 2rem; }
table.lines input { height: 26px; padding: 0 .4rem; border-color: transparent; background: transparent; }
table.lines input:hover { border-color: var(--line); }
table.lines input:focus { background: #fff; border-color: var(--brand-hover); }
table.lines input.amount { text-align: right; }
table.lines tr.has-error td { background: #fff4f2; }
table.lines tr.needs-account td { background: var(--warning-soft); }
table.lines td.an-name { min-width: 12rem; max-width: 16rem; padding: 0 .5rem; color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.lines tfoot td { padding: .5rem .4rem; font-weight: 600; background: #f7f9fb; border-top: 1px solid var(--line); }
table.lines .fx { display: none; }
table.lines.show-fx .fx { display: table-cell; }
input.w3 { width: 4rem } input.w4 { width: 5rem } input.w5 { width: 6rem } input.w6 { width: 7rem }
input.w7 { width: 8.5rem } input.w8 { width: 12.5rem } input.w10 { width: 14rem } input.w12 { width: 18rem } select.w12 { width: 18rem }
.line-hint { min-height: 1.4rem; font-size: .88rem; color: var(--muted); margin-top: .4rem; }

/* ---------- Date fields (DD.MM.YYYY., see js/dates.js) ---------- */

.date-field { position: relative; display: inline-flex; align-items: center; width: 100%; }
.date-field .date-text { padding-right: 2rem; font-variant-numeric: tabular-nums; }
.date-field .date-text.w7 { width: 8.5rem; }
.date-pick {
    position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
    width: 26px; height: 22px; border: 0; background: transparent; cursor: pointer; border-radius: 4px;
    /* calendar glyph */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23526070' stroke-width='1.7' stroke-linecap='round'%3E%3Crect x='3.5' y='5' width='17' height='15' rx='2'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center; background-size: 16px;
}
.date-pick:hover { background-color: var(--brand-soft); }
fieldset:disabled .date-pick { display: none; }
.date-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
table.lines .date-field, table.rows .date-field { width: auto; }
table.rows .date-field .date-text { width: 9.5rem; }

/* ---------- Home pages ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.stat {
    display: flex; flex-direction: column; gap: .2rem;
    padding: .55rem .8rem; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat-label { font-size: .82rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-value small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.stat-alert { border-left: 3px solid var(--returned); }
.stat-alert .stat-value { color: var(--returned); }
.meter { display: block; height: 4px; background: var(--line-soft); border-radius: 2px; overflow: hidden; margin-top: .2rem; }
.meter > span { display: block; height: 100%; background: var(--brand); }

.columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: .8rem; }
.link-list { display: flex; flex-direction: column; padding: .4rem 0; }
.link-list a { display: flex; flex-direction: column; padding: .45rem .9rem; color: var(--ink); font-weight: 600; }
.link-list a + a { border-top: 1px solid var(--line-soft); }
.link-list a:hover { background: var(--brand-soft); text-decoration: none; }
.nowrap { white-space: nowrap; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; margin-top: .75rem; }
.tile {
    display: flex; flex-direction: column; gap: .25rem; padding: .7rem .85rem;
    border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: var(--radius);
    background: #fbfcfe; color: var(--ink);
}
.tile:hover { border-color: var(--brand); text-decoration: none; background: var(--brand-soft); }
.tile-title { font-weight: 600; font-size: 1.02rem; }
.tile-text { color: var(--muted); font-size: .9rem; }

@media (max-width: 960px) {
    .columns { grid-template-columns: 1fr; }
}

/* ---------- Register forms with tabs (employees) ---------- */

.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 2px solid var(--brand); margin: 0 0 -1px; }
.tabs a {
    text-decoration: none; display: inline-block;
    font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
    padding: .35rem .85rem; border: 1px solid var(--line); border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0; background: var(--line-soft); color: var(--muted);
}
.tabs a:hover { color: var(--ink); background: #fff; }
.tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tabs a.has-error { color: var(--returned); }
.tabs a.has-error.active { color: #fff; background: var(--returned); border-color: var(--returned); }
.tabs .count { font-weight: 500; opacity: .75; }
.tab-panel { border-top-left-radius: 0; }

.form-grid .span2 { grid-column: span 2; }
.form-grid.compact { gap: .6rem .9rem; margin-top: .6rem; }
.form-grid .checks { display: flex; flex-direction: column; gap: .35rem; }
.inline { display: flex; gap: .4rem; align-items: center; }
.inline > input:not(.w3):not(.w7), .inline > select { flex: 1; min-width: 0; }
.section-title { font-size: .95rem; font-weight: 600; margin: .9rem 0 .45rem; padding-top: .6rem; border-top: 1px solid var(--line-soft); }
.readout { height: 28px; display: flex; align-items: center; padding: 0 .6rem; background: var(--bg); border-radius: var(--radius); font-variant-numeric: tabular-nums; }

table.rows { border-collapse: collapse; margin-bottom: .5rem; }
table.rows th { text-align: left; font-size: .82rem; color: var(--muted); font-weight: 600; padding: .2rem .4rem .3rem 0; }
table.rows td { padding: .2rem .4rem .2rem 0; vertical-align: top; }
table.rows input[type=date] { width: 11rem; }
.btn-icon { width: 26px; padding: 0; font-size: 1.1rem; line-height: 1; color: var(--muted); }
.btn-icon:hover { color: var(--returned); border-color: var(--returned); }
fieldset:disabled [data-repeater-remove] { display: none; }

.deduction { border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: var(--radius); padding: .55rem .7rem; margin-bottom: .55rem; background: #fbfcfe; }
.deduction-head { display: flex; gap: .6rem; align-items: center; }
.deduction-head select { width: auto; }
.deduction-head .grow { flex: 1; }

@media (max-width: 760px) {
    .form-grid .span2 { grid-column: auto; }
}

/* ---------- Guest pages (sign-in) ---------- */

.guest {
    min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem;
    background: radial-gradient(1200px 600px at 50% -10%, #17365e 0%, var(--bar) 45%, var(--bar-deep) 100%);
}
.guest-card {
    width: 100%; max-width: 400px; background: var(--surface); border-radius: 10px; padding: 2rem;
    border-top: 3px solid var(--brand); box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.guest-card .brand-line { display: flex; align-items: center; gap: .5rem; color: var(--bar); font-weight: 700; font-size: 1.15rem; margin-bottom: 1.5rem; }
.guest-card .brand-line svg { width: 26px; height: 26px; }
.guest-card h1 { font-size: 1.25rem; margin-bottom: 1rem; }
.guest-card .field { margin-bottom: .9rem; }

@media (max-width: 760px) {
    .topbar { overflow-x: auto; }
    .page { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* Chart of accounts: the list on top, the selected account below (as in TIM-ERP). */
.panel.chart-list { max-height: 46vh; overflow: auto; }
.chart-list table.data thead th { top: 0; }
.chart-list tbody tr { cursor: pointer; }
.chart-list tbody tr.selected td { background: var(--brand-soft); }
.chart-bar { display: flex; gap: .4rem; align-items: center; margin: .5rem 0; }
.chart-detail fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.chart-detail fieldset[disabled] input:not([type=checkbox]), .chart-detail fieldset[disabled] select { background: #f4f6f9; color: var(--ink); }
.chart-fields { display: grid; grid-template-columns: 7.5rem minmax(0, 40rem); gap: .35rem .6rem; align-items: center; }
.chart-fields label, .chart-checks > label { margin: 0; }
.chart-checks { display: grid; grid-template-columns: 11rem minmax(0, 18rem); gap: .35rem .6rem; align-items: center; margin-top: .7rem; }
.chart-flags { display: flex; flex-direction: column; gap: .35rem; margin-top: .6rem; }
.chart-links { display: flex; gap: 1rem; margin-top: .8rem; }
@media (max-width: 640px) {
    .chart-fields, .chart-checks { grid-template-columns: 1fr; }
}

/* Payroll runs: header beside the items, as in TIM-ERP. */
.split-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.split-2 .panel + .panel { margin-top: .6rem; }

/* Payroll run: steps and the header folded into one line (03.11.2026). */
.run-steps { display: flex; flex-wrap: wrap; gap: .3rem; list-style: none; margin: 0 0 .8rem; padding: 0; counter-reset: none; }
.run-steps li {
    display: flex; align-items: center; gap: .35rem; padding: .25rem .7rem .25rem .3rem;
    border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--muted); font-size: .85rem;
}
.run-steps .n {
    display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 50%;
    background: var(--line); color: var(--muted); font-size: .75rem; font-weight: 700;
}
.run-steps li.done { color: var(--posted); border-color: #bfe0cb; background: var(--posted-soft); }
.run-steps li.done .n { background: var(--posted); color: #fff; }
.run-steps li.current { color: #1f4f8f; border-color: #6b9be0; background: #e8f0fb; font-weight: 600; }
.run-steps li.current .n { background: #2563eb; color: #fff; }
.run-header > summary {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .8rem; cursor: pointer; list-style: none;
    padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.run-header > summary::-webkit-details-marker { display: none; }
.run-header[open] > summary { margin-bottom: .6rem; }
.run-header .sum-main { font-weight: 600; }
.run-header .sum-meta { color: var(--muted); font-size: .9rem; }
.run-header .sum-toggle { margin-left: auto; color: #2563eb; font-size: .9rem; }
.run-layout.header-closed { grid-template-columns: minmax(0, 1fr); }
.more-menu { position: relative; z-index: 45; }
.more-menu > summary { list-style: none; }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-menu .menu-panel { right: 0; left: auto; min-width: 12rem; z-index: 45; }
.more-menu .link { display: block; width: 100%; text-align: left; padding: .35rem .6rem; }
.more-menu .link.danger { color: var(--returned); }
.kv { width: 100%; border-collapse: collapse; }
.kv th { text-align: left; font-weight: 500; padding: .2rem .4rem; color: var(--muted, #555); }
.kv td { padding: .2rem .4rem; }
.kv.sections th[colspan] { color: var(--ink); font-weight: 600; padding-top: .5rem; }
.dialog { border: 1px solid #c9d0da; border-radius: 6px; padding: 1rem 1.2rem; max-width: 34rem; width: 100%; }
.dialog::backdrop { background: rgba(20, 30, 45, .35); }
.dialog h2 { margin: 0 0 .5rem; font-size: 1.05rem; }
.dialog-wide { max-width: 56rem; }
.table-scroll { overflow: auto; }
/* Inside its own scroll box a table's header sticks to the box, not below the page's top bar. */
.table-scroll table.data thead th { top: 0; }
/* Posting dialog (as TIM-ERP's "Knjiženje"): documents above, the selected one's entry below. */
.post-dialog .post-docs { height: 10rem; border: 1px solid #e1e5eb; }
.post-dialog [data-post-row] { cursor: pointer; }
.post-dialog [data-post-row].selected td { background: var(--brand-soft); }
.post-dialog .row-error td { color: var(--returned); }
.post-dialog input[type=date], .post-dialog select { font: inherit; padding: .1rem .2rem; }
.post-dialog .post-default { display: flex; gap: .5rem; align-items: center; margin: .5rem 0; }
.post-dialog .post-lines-title { text-align: center; font-weight: 600; border: 1px solid #e1e5eb; border-bottom: 0; padding: .15rem; margin-top: .3rem; }
.post-dialog .post-lines .table-scroll { height: 13rem; border: 1px solid #e1e5eb; }
.post-dialog td.debit { color: #0f7b7b; }
.post-dialog td.credit { color: #9b1c1c; }
/* A document whose entry was deleted ("vraćeno") is red on its list, as in TIM-ERP. */
tr.row-returned td { background: #fde3e1; }
.col-check { width: 1.6rem; text-align: center; }
.check-list { display: flex; flex-direction: column; gap: .3rem; max-height: 55vh; overflow: auto; margin: .5rem 0; padding: .4rem; border: 1px solid #e1e5eb; border-radius: 4px; }
@media (max-width: 960px) { .split-2 { grid-template-columns: 1fr; } }
/* ---------- Payment order entry, laid out as the printed "Nalog za prenos" ---------- */

.slip {
    display: grid; grid-template-columns: 52fr 48fr; gap: 1.4rem;
    max-width: 62rem; padding: .9rem 1.1rem 1rem; margin-bottom: 1rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.slip-label { margin: .45rem 0 .15rem; font-size: .78rem; color: var(--muted); }
.slip-box { display: flex; flex-direction: column; gap: .3rem; padding: .35rem; border: 1px solid var(--faint); border-radius: 3px; }
.slip-row { display: flex; gap: .4rem; align-items: flex-end; }
.slip-row > div { min-width: 0; }
.slip-title { text-align: right; font-weight: 700; font-size: 1.05rem; letter-spacing: .04em; }
.slip input, .slip textarea { width: 100%; }
@media (max-width: 760px) { .slip { grid-template-columns: 1fr; } }

/* ---------- "Obrada u toku..." (layouts/app) ---------- */

.busy { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; padding-top: 22vh; background: rgba(16, 24, 40, .12); cursor: progress; }
.busy[hidden] { display: none; }
.busy-box { display: inline-flex; align-items: center; gap: .6rem; padding: .7rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(10, 27, 49, .18); font-weight: 600; }
.busy-spin { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: busy-spin .8s linear infinite; }
@keyframes busy-spin { to { transform: rotate(360deg); } }

/* Items of a run by what they pay: work, compensations (sick leave…), 109/110/111 added by hand. */
tr.item-work > td:first-child { box-shadow: inset 3px 0 0 #6b9be0; }
tr.item-compensation > td:first-child { box-shadow: inset 3px 0 0 #4fae7b; }
tr.item-benefit > td:first-child { box-shadow: inset 3px 0 0 #e0a15e; }
.item-legend { display: flex; gap: .9rem; padding: .3rem .6rem; }
.item-legend span { padding-left: .45rem; }
.item-legend .item-work { box-shadow: inset 3px 0 0 #6b9be0; }
.item-legend .item-compensation { box-shadow: inset 3px 0 0 #4fae7b; }
.item-legend .item-benefit { box-shadow: inset 3px 0 0 #e0a15e; }

/* Account blockade dot (NBS, public/js/nbs.js): grey = not checked, green = none or never
   in enforced collection, orange = was blocked, red blinking = blocked. */
.blockade-dot {
    display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
    width: 1.15rem; height: 1.15rem; margin: 0 .2rem; padding: 0; border: 0; border-radius: 999px;
    background: transparent; cursor: pointer;
}
.blockade-dot:hover, .blockade-dot:focus-visible { background: rgba(0, 0, 0, .07); outline: 0; }
.blockade-dot::before { content: ""; width: .6rem; height: .6rem; border-radius: 999px; border: 2px solid #b6bec8; box-sizing: border-box; }
.blockade-dot.none::before, .blockade-dot.unlisted::before { background: #2f9e5b; border-color: #2f9e5b; }
.blockade-dot.earlier::before { background: #e08a1e; border-color: #e08a1e; }
.blockade-dot.blocked::before { background: #d92d20; border-color: #d92d20; animation: blockade-blink 1s steps(1) infinite; }
.blockade-dot.error::before { border-style: dashed; }
.blockade-dot.checking::before { animation: blockade-blink .5s steps(1) infinite; }
@keyframes blockade-blink { 50% { opacity: .15; } }
@media (prefers-reduced-motion: reduce) { .blockade-dot.blocked::before, .blockade-dot.checking::before { animation: none; } }
.blockade-popup {
    position: absolute; z-index: 50; max-width: 20rem; padding: .55rem .7rem; font-size: .9rem; line-height: 1.4;
    background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
}
.blockade-popup .blockade-title { font-weight: 600; margin-bottom: .25rem; }
.blockade-popup ul { margin: .2rem 0; padding-left: 1.1rem; }

/* Home page task list (dashboard.partials.tasks). */
.task-firms { display: grid; grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); gap: .6rem; }
.task-firm h3 { margin: 0 0 .3rem; font-size: 1rem; }
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li { padding: .15rem 0 .15rem 1rem; position: relative; }
.tasks li::before { content: "•"; position: absolute; left: .2rem; color: var(--muted); }
.tasks li.task-urgent::before { content: "!"; color: var(--returned); font-weight: 700; }
.tasks li.task-urgent a { color: var(--returned); font-weight: 600; }
.task-idle { margin-top: .6rem; }

/* Ctrl+K search (public/js/search.js). */
.search-trigger { display: inline-flex; align-items: center; gap: .4rem; margin-right: .5rem; padding: .2rem .5rem; font: inherit; font-size: .85rem;
    color: inherit; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); border-radius: var(--radius); cursor: pointer; }
.search-trigger kbd { font: inherit; font-size: .75rem; opacity: .8; }
.quick-search { max-width: 40rem; padding: .6rem; margin-top: 12vh; }
.quick-search > input { width: 100%; font-size: 1rem; padding: .45rem .6rem; }
.qs-results { max-height: 55vh; overflow-y: auto; margin-top: .4rem; }
.qs-group { font-size: .78rem; font-weight: 600; color: var(--muted); padding: .4rem .5rem .15rem; }
.qs-item { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem .5rem; color: var(--ink); border-radius: 4px; }
.qs-item.active { background: var(--line-soft); }
.qs-hint { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.qs-empty { padding: .5rem; color: var(--muted); }
.qs-help { margin-top: .4rem; padding: 0 .5rem; }

/* Search-as-you-type (public/js/lookup.js). */
.lookup-box { position: fixed; z-index: 1000; max-height: 18rem; overflow-y: auto; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: .2rem 0; }
.lookup-item { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem .6rem; cursor: pointer; white-space: nowrap; }
.lookup-item.active { background: var(--line-soft); }
.lookup-item.create { color: var(--brand); font-weight: 600; border-top: 1px solid var(--line-soft); }
.lookup-hint { color: var(--muted); font-size: .82rem; }

/* Stock document: the header folded to one line, the totals strip (inventory/documents/form). */
.doc-summary { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; align-items: center; padding: .45rem .8rem; }
.form-grid.compact-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .4rem .7rem; }
.form-grid.compact-grid .wide { grid-column: span 2; }
.doc-totals { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; padding: .35rem .8rem; margin: .4rem 0; font-size: .92rem; color: var(--muted); }
.doc-totals b { color: var(--ink); font-variant-numeric: tabular-nums; margin-left: .3rem; }

/* Amounts sit on the right edge in every field, as in every column (agency, 05.11.2026). */
input.amount, input[inputmode=decimal], input[inputmode=numeric], input[type=number] { text-align: right; font-variant-numeric: tabular-nums; }
/* table.data's own th/td rule (text-align: left) is stronger than .num, so the columns say it again. */
table.data th.num, table.data td.num { text-align: right; }

/* Lines of a stock document: fields without a frame until they are entered, the active one coloured,
   typed and computed values on one line; the article name wider, on two lines when long. */
table.doc-lines { width: 100%; border-collapse: collapse; }
table.doc-lines th { background: #f7f9fb; color: var(--muted); font-size: .82rem; font-weight: 600; text-align: left; padding: .35rem .35rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.doc-lines th.num { text-align: right; }
table.doc-lines td { height: 30px; padding: 0 .2rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; font-variant-numeric: tabular-nums; }
table.doc-lines td.num { text-align: right; padding-right: .45rem; white-space: nowrap; }
table.doc-lines td.name { min-width: 18rem; max-width: 30rem; padding: .15rem .45rem; font-size: .95rem; line-height: 1.2;
    display: table-cell; overflow: hidden; }
table.doc-lines td.name { -webkit-line-clamp: 2; }
table.doc-lines input, table.doc-lines select { height: 26px; padding: 0 .35rem; border: 1px solid transparent; background: transparent; box-shadow: none; }
table.doc-lines select { padding-right: 1.2rem; }
table.doc-lines input:hover, table.doc-lines select:hover { border-color: var(--line-soft); }
table.doc-lines input:focus, table.doc-lines select:focus { background: #fff6d6; border-color: var(--brand-hover); box-shadow: none; }
table.doc-lines tr:focus-within td { background: #f5f8ff; }
table.doc-lines tr:focus-within td:has(input:focus), table.doc-lines tr:focus-within td:has(select:focus) { background: #fff6d6; }

/* The folded header in two rows (inventory/documents/form). */
.doc-summary { display: block; padding: .4rem .8rem; }
.doc-summary-row { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; padding: .12rem 0; }
.doc-summary-row .lbl { color: var(--muted); font-size: .82rem; margin-left: .6rem; }
.doc-summary-row .lbl:first-child { margin-left: 0; }
.vat-recap table { max-width: 52rem; }
/* The side parts under a document's lines, as tabs (partials/doc-tabs). */
.doc-tabs { margin-top: .8rem; border-bottom-width: 1px; }
.doc-tabs + .tab-panel, .tab-panel.doc-tab { margin-top: 0; }
.tab-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 999px; margin-right: .35rem; vertical-align: middle; }
.tab-dot-ok { background: #2f9e5b; }
.tab-dot-diff { background: #d92d20; }

/* SEF incoming invoices: the list above, the chosen invoice below (inventory/sef/index). */
.sef-split { display: flex; flex-direction: column; gap: .6rem; }
.panel.flush.sef-list { max-height: 19.5rem; overflow-y: auto; } /* about 10 rows; resources/views/inventory/sef/index.blade.php sets it exactly */
.sef-tabs { border-bottom-width: 1px; }
.sef-tabs a.attention:not(.active) { color: #1d4ed8; background: #e3eeff; border-color: #bcd3fb; }
.sef-list table.data thead th { top: 0; z-index: 1; } /* inside its own scroll, not under the top bar */
.sef-list tr.selected td { background: #fff6d6; }
.sef-status { display: inline-block; padding: 0 .45rem; border-radius: 10px; font-size: .8rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.sef-new { background: #e3eeff; color: #1d4ed8; border-color: #bcd3fb; }
.sef-seen { background: #eef1f6; color: #3b4a5e; border-color: #d6dde8; }
.sef-approved { background: var(--posted-soft); color: #1d5636; border-color: #bfe0cb; }
.sef-rejected { background: var(--returned-soft); color: #7a1a12; border-color: #f2c4bf; }
.sef-cancelled, .sef-storno, .sef-deleted { background: var(--warning-soft); color: #6b4206; border-color: #f0dba8; }
.sef-sent, .sef-sending, .sef-draft { background: #e3eeff; color: #1d4ed8; border-color: #bcd3fb; }
.sef-paid, .sef-overdue, .sef-archived { background: var(--posted-soft); color: #1d5636; border-color: #bfe0cb; }
.sef-mistake, .sef-pending { background: var(--returned-soft); color: #7a1a12; border-color: #f2c4bf; }
.sef-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.sef-actions form { display: inline; }
.sef-load { display: flex; gap: .4rem; margin-top: .3rem; }
.btn.sef-accept { background: var(--posted); border-color: var(--posted); color: #fff; }
.btn.sef-accept:hover { background: #24663f; border-color: #24663f; }
.btn.sef-reject { background: var(--returned); border-color: var(--returned); color: #fff; }
.btn.sef-reject:hover { background: #8f1c13; border-color: #8f1c13; }

/* A calculation line from an SEF invoice: the supplier's data under it; marked while it has no article of ours. */
table.doc-lines tr.sef-sub td { height: auto; padding: .1rem .45rem .35rem; font-size: .84rem; color: var(--muted); border-bottom: 1px solid var(--line-soft); }
table.doc-lines tr.sef-missing td { background: #fff4f2; }
table.doc-lines tr.sef-missing + tr.sef-sub td { background: #fff4f2; }
.sef-tag { display: inline-block; padding: 0 .35rem; margin-right: .35rem; border-radius: 3px; background: #e3eeff; color: #1d4ed8; font-size: .75rem; font-weight: 600; }
.sef-links { max-width: 60rem; }

/* SEF comparison (resources/views/sef/compare.blade.php): green frame when our VAT recap agrees with the invoice, red when not.
   After .panel, and with its class, so the panel's own border does not win. */
.panel.sef-compare { border: 2px solid transparent; }
.panel.sef-compare-ok { border-color: #7cc196; }
.panel.sef-compare-ok table.data thead th { background: #eef8f1; }
.panel.sef-compare-diff { border-color: #e0918d; }
.panel.sef-compare-diff table.data thead th { background: #fcefee; }

/* Run steps as the action bar (payroll run; docs/ui.md). */
.run-steps li { padding: 0; }
.run-steps .step { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem .25rem .3rem; border: 0; background: none; font: inherit; color: inherit; border-radius: inherit; }
.run-steps button.step { cursor: pointer; }
.run-steps button.step:hover:not(:disabled) { text-decoration: underline; }
.run-steps button.step:disabled { cursor: not-allowed; opacity: .6; }
.doc-totals .strong b { font-size: 1.05rem; }
.run-totals { margin-top: 0; }

/* Top bar: section menus in a <nav>; when they do not fit they go under "☰ Meni" (public/js/topbar.js). */
.main-menus { display: flex; align-items: stretch; }
.topbar { overflow: visible; min-width: 0; }
.burger > summary::after { display: none; }
.burger-panel { min-width: 280px; max-height: calc(100vh - 60px); overflow-y: auto; padding: .2rem 0; }
.burger-panel .main-menus { flex-direction: column; }
.burger-panel .menu { display: block; }
.burger-panel .menu > summary { color: var(--ink); padding: .5rem 1rem; font-weight: 600; }
.burger-panel .menu > summary:hover, .burger-panel .menu[open] > summary { background: var(--brand-soft); color: var(--ink); }
.burger-panel .menu.current > summary { box-shadow: inset 3px 0 0 var(--bar-accent); }
.burger-panel .menu + .menu { border-top: 1px solid var(--line-soft); }
.burger-panel .menu-panel { position: static; box-shadow: none; border: 0; border-radius: 0; margin: 0; padding: 0 0 .3rem .6rem; min-width: 0; }
.topbar.collapsed .search-trigger kbd { display: none; }
@media (max-width: 900px) { .client-menu > summary { max-width: 220px; } }


/* A list with the chosen record under it (docs/ui.md §3; public/js/list-preview.js). */
.list-tabs { border-bottom-width: 1px; margin-top: .4rem; }
.list-tabs a.tab-returned:not(.active) { color: var(--returned); }
.panel.flush.list-scroll { max-height: 21rem; overflow-y: auto; margin-top: 0; border-top-left-radius: 0; } /* about ten rows */
.list-scroll table.data thead th { top: 0; z-index: 1; }
.list-scroll table:focus { outline: none; }
.list-scroll table:focus tr.selected td { background: #ffe9a8; }
.list-scroll tr.selected td { background: #fff6d6; }
.list-scroll tbody tr[data-href] { cursor: default; }
.list-preview { margin-top: .6rem; }
.list-preview:empty { display: none; }

/* Input VAT record by document (sef/vat/documents): green the same, red a difference, grey not an e-invoice. */
table.epp-documents tr.state-posted td:not(.rail) { background: var(--posted-soft); }
table.epp-documents tr.state-returned td:not(.rail) { background: var(--returned-soft); }
table.epp-documents tr.state-other td.rail { background: #c4cad3; }
table.epp-documents tr.state-other td { color: #5b6472; }
/* No preview below this list: it may take the screen's height. */
.panel.flush.list-scroll.epp-scroll { max-height: calc(100vh - 230px); }

/* Lines with an entry row (docs/ui.md §2.6, outgoing invoice): the row being typed on top, framed and
   coloured; the lines below as a quiet list without fields, zebra, the line being changed marked. */
.line-entry { padding: .45rem .8rem .35rem; margin-bottom: .5rem; border-left: 3px solid var(--brand); background: #fbfcff; }
.line-entry-head { display: flex; gap: .8rem; align-items: baseline; margin-bottom: .3rem; min-height: 1.2rem; }
.line-entry-fields { display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: flex-end; }
.line-entry-fields label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: .1rem; margin: 0; }
.line-entry-fields input, .line-entry-fields select { height: 28px; }
.line-entry-fields input:focus, .line-entry-fields select:focus { background: #fff6d6; }
.line-entry-fields .item input { width: 14rem; }
.line-entry-fields .qty input { width: 6rem; }
.line-entry-fields .price input { width: 8rem; }
.line-entry-fields .disc input { width: 4.5rem; }
.line-entry-fields .rate select { width: 6.5rem; }
.line-entry-fields .kind select { width: 7rem; }
.line-entry-fields .vat-kind select { width: 15rem; }
.line-entry-fields .descr { flex: 1 1 12rem; }
.line-entry-fields .descr input { width: 100%; }
table.doc-lines.line-list td { padding-left: .45rem; padding-right: .45rem; }
table.doc-lines td.empty { color: var(--muted); padding: .8rem; }
.line-entry-sum { display: flex; gap: 1rem; align-items: center; height: 28px; margin-left: auto; color: var(--muted); font-size: .9rem; }
.line-entry-sum b { color: var(--ink); font-variant-numeric: tabular-nums; margin-left: .25rem; }
.line-entry-actions { display: flex; gap: .4rem; align-items: center; height: 28px; }
.line-entry-help { margin-top: .3rem; }
table.line-list tbody tr[data-row] { cursor: pointer; }
table.line-list tbody tr[data-row]:nth-child(even) td { background: #fafbfc; }
table.line-list tbody tr[data-row]:hover td { background: #f1f5fd; }
table.line-list tbody tr[data-row]:focus { outline: none; }
table.line-list tbody tr[data-row]:focus td { background: #e8f0fe; }
table.line-list tbody tr.editing td { background: #fff6d6 !important; }
table.line-list tbody tr.line-error td { background: #fff4f2; }
table.doc-lines.line-list td.name { min-width: 12rem; }
table.line-list td.name .code { margin-right: .35rem; }
table.line-list td.name .field-error { font-size: .82rem; }
table.line-list td.error { color: var(--returned); font-weight: 600; }
.doc-totals.line-totals { justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 0; }
@media (max-width: 760px) { .line-entry-sum { margin-left: 0; } .line-entry-fields .item input { width: 100%; } .line-entry-fields .item { flex-basis: 100%; } }
.line-entry [hidden] { display: none !important; }
.line-entry-note { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: .1rem; margin: .35rem 0 0; }
.line-entry-note textarea { width: 100%; min-height: 2.6rem; resize: vertical; font-size: .9rem; }
table.line-list td.name .line-note { white-space: pre-line; color: var(--muted); font-size: .84rem; line-height: 1.25; max-height: 3.8em; overflow: hidden; }
table.line-list td.name .line-note:empty { display: none; }
.doc-texts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .5rem .8rem; padding: .5rem .8rem; }
.doc-texts label { display: flex; flex-direction: column; gap: .15rem; margin: 0; font-size: .85rem; }
.doc-texts textarea { width: 100%; min-height: 4.2rem; resize: vertical; }

/* The customer card beside the customer field (public/js/partner-card.js). */
.partner-card { display: flex; gap: .8rem; align-items: flex-start; justify-content: space-between; padding: .35rem .6rem; border: 1px solid var(--line-soft);
    border-radius: var(--radius); background: #fbfcff; font-size: .88rem; line-height: 1.35; min-height: 2.4rem; }
.partner-card [data-pc-body] { min-width: 0; }
.form-grid.compact-grid .partner-card { grid-column: span 3; }
.partner-card [hidden] { display: none !important; }
dialog.wide-dialog { max-width: min(760px, calc(100vw - 2rem)); }
