/* ============================================================================
   Lom — "Instrument" visual system (light).
   Muted neutrals, a single status-trio accent, IBM Plex Sans + Mono,
   tight 3px radii, hairline borders. No candy colors, no pills.
   ============================================================================ */

:root {
	--ground:        #f3f3f0;
	--surface:       #ffffff;
	--surface-alt:   #fafaf8;
	--selected:      #eceae3;
	--hairline:      #dad9d2;
	--hairline-soft: #e6e5df;

	--ink:           #1b1b18;
	--ink-muted:     #6c6b63;
	--ink-faint:     #9a9990;

	/* Status trio, mirroring the physical semaphore. */
	--go:            #3f7d4e;
	--stop:          #b23b3b;
	--back:          #b9852b;

	--accent:        #37506b;   /* muted slate, for focus/selection cues */
	--accent-weak:   #dfe6ee;

	--radius:        3px;
	--font-sans:     'IBM Plex Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
	--font-mono:     'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	height: 100%;
	font-family: var(--font-sans);
	font-size: 14px;
	line-height: 1.45;
	color: var(--ink);
	background: var(--ground);
}

h1, h2, h3, h4 { font-weight: 600; margin: 0; }

/* Monospace for weights, plates, money, IČO — anything read as a figure. */
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

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

/* ----- App shell: collapsible left nav rail + content -------------------- */

.app-shell { display: flex; height: 100vh; overflow: hidden; }

.rail {
	flex: 0 0 auto;
	width: 208px;
	background: var(--surface);
	border-right: 1px solid var(--hairline);
	display: flex;
	flex-direction: column;
	transition: width .12s ease;
}
.rail.collapsed { width: 72px; }

.rail-head {
	display: flex; align-items: center; gap: 10px;
	height: 48px; padding: 0 12px;
	border-bottom: 1px solid var(--hairline);
}
.rail-brand { font-weight: 700; letter-spacing: .04em; font-size: 15px; }
.rail.collapsed .rail-brand,
.rail.collapsed .nav-text { display: none; }

.rail-toggle {
	margin-left: auto; border: none; background: none; cursor: pointer;
	color: var(--ink-muted); font-size: 16px; line-height: 1; padding: 4px;
}
.rail.collapsed .rail-toggle { margin: 0 auto; }

.nav { padding: 8px 0; overflow-y: auto; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.nav-item {
	display: flex; align-items: center; gap: 12px;
	padding: 8px 14px; color: var(--ink-muted);
	border-left: 2px solid transparent; cursor: pointer;
	white-space: nowrap;
}
/* Expandable group header (e.g. Finance) rendered as a button. */
.nav-group-head {
	width: 100%; border: none; background: none; font: inherit; text-align: left;
}
.nav-caret { margin-left: auto; display: inline-flex; align-items: center; color: var(--ink-faint); }
.nav-caret svg { width: 15px; height: 15px; display: block; transition: transform .12s ease; transform: rotate(-90deg); }
.nav-caret.open svg { transform: rotate(0); }
/* Child items of a group: indented. */
.nav-sub { padding-left: 30px; }
.rail.collapsed .nav-caret { display: none; }
.rail.collapsed .nav-sub { padding-left: 14px; }
/* Pin an item (Nastavení) to the bottom of the rail. */
.nav-bottom { margin-top: auto; }
.nav-item:hover { background: var(--surface-alt); color: var(--ink); text-decoration: none; }
.nav-item.active {
	color: var(--ink); background: var(--selected);
	border-left-color: var(--go); font-weight: 500;
}
.nav-icon {
	width: 36px; height: 36px; flex: 0 0 auto; font-size: 30px; line-height: 1;
	display: inline-flex; align-items: center; justify-content: center;
}
.nav-icon svg { width: 34px; height: 34px; display: block; }
.nav-icon img { width: 36px; height: 36px; object-fit: contain; display: block; }
.nav-icon img.tight { width: 30px; height: 30px; }

.content { flex: 1 1 auto; min-width: 0; overflow: auto; display: flex; flex-direction: column; }

/* ----- Reading-pane layout: list on top, detail below -------------------- */

.pane-split { display: flex; flex-direction: column; height: 100%; }
.pane-list { flex: 0 0 45%; min-height: 120px; overflow: auto; }
.pane-detail { flex: 1 1 auto; min-height: 120px; overflow: auto; background: var(--surface-alt); }

/* Full-screen detail: hide the list pane + splitter so the detail fills the height. */
.pane-split.detail-full .pane-list,
.pane-split.detail-full .splitter { display: none; }

/* Draggable divider between list and detail panes. */
.splitter {
	flex: 0 0 7px; cursor: row-resize; background: var(--surface);
	border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
	position: relative;
}
.splitter::after {
	content: ""; position: absolute; left: 50%; top: 50%;
	width: 34px; height: 3px; transform: translate(-50%, -50%);
	border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
}
.splitter:hover, .splitter.dragging { background: var(--accent-weak); }
body.splitter-dragging { cursor: row-resize; user-select: none; }

.toolbar {
	display: flex; align-items: center; gap: 10px;
	padding: 10px 16px; background: var(--surface);
	border-bottom: 1px solid var(--hairline); position: sticky; top: 0; z-index: 30;
}
.toolbar h2 { font-size: 15px; }
.toolbar .spacer { flex: 1 1 auto; }
.count { color: var(--ink-faint); font-size: 12px; }

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

table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td {
	text-align: left; padding: 7px 12px;
	border-bottom: 1px solid var(--hairline-soft); white-space: nowrap;
}
table.grid th {
	position: sticky; top: 0; background: var(--surface);
	font-weight: 500; font-size: 12px; color: var(--ink-muted);
	text-transform: uppercase; letter-spacing: .03em; z-index: 1;
}
table.grid th.mark, table.grid td.mark { width: 1%; padding-right: 0; text-align: center; }
.blocked-mark { color: var(--stop); font-weight: 700; font-family: var(--font-mono); }
table.grid th.sortable { cursor: pointer; user-select: none; }
table.grid th.sortable:hover { color: var(--ink); }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: var(--surface-alt); }
table.grid tbody tr.selected { background: var(--accent-weak); }
/* Accent bar on the first cell — box-shadow on <tr> is ignored by Safari with border-collapse. */
table.grid tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.grid td.num { text-align: left; }

/* Action column: absorb slack and pin the buttons to the row's right edge. */
table.grid th.actions, table.grid td.actions { width: 100%; text-align: right; }
table.grid td.actions .row-actions { display: inline-flex; }

/* ----- Role / status tags (square, hairline, no pills) ------------------- */

.tag {
	display: inline-block; font-size: 11px; font-weight: 600;
	padding: 1px 5px; border: 1px solid var(--hairline);
	border-radius: 2px; color: var(--ink-muted); background: var(--surface);
	margin-right: 4px;
}
.tag.cust { color: var(--accent); border-color: var(--accent-weak); background: var(--accent-weak); }
.tag.trans { color: var(--back); border-color: #efe1c6; background: #f6ecd6; }
.tag.ok { color: var(--go); border-color: #c6e0cd; background: #e7f2ea; }
.tag.stop { color: var(--stop); border-color: #e3c4c4; background: #fbe9e9; }

/* ----- Credit gauge (Firmy list): unpaid balance vs credit limit ---------- */
.credit-gauge {
	position: relative; width: 96px; height: 12px;
	border: 1px solid var(--hairline); border-radius: 2px;
	background: var(--surface); overflow: hidden;
}
.credit-gauge.no-limit { background: repeating-linear-gradient(135deg, transparent, transparent 3px, #f0f0ec 3px, #f0f0ec 4px); }
.credit-fill { height: 100%; background: var(--accent); }
.credit-fill.over { background: var(--stop); }

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

.form { padding: 16px 18px; max-width: 920px; }
/* Sticky action bar pinned to the bottom-right of the detail panel/screen. */
.form-footer {
	position: sticky; bottom: 0; z-index: 5;
	display: flex; justify-content: flex-end; gap: 8px;
	padding: 12px 18px; margin: 14px -18px -16px;
	background: var(--surface); border-top: 1px solid var(--hairline);
}
/* Fill the detail pane so the sticky footer sits at the bottom even when the form
   is short (otherwise it would float right below the content, mid-screen). */
.pane-detail .form { min-height: 100%; display: flex; flex-direction: column; }
.pane-detail .form > .form-footer { margin-top: auto; }

.ov-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; min-height: 26px; }
.ov-head .ov-count { font-size: 12px; color: var(--ink-muted); }
.ov-head .spacer { flex: 1 1 auto; }

.form-section { margin-bottom: 20px; }
.form-section > .legend {
	font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
	color: var(--ink-muted); margin-bottom: 8px; padding-bottom: 4px;
	border-bottom: 1px solid var(--hairline-soft);
}
.grid-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; max-width: 720px; }
.grid3 .field.wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field.wide { grid-column: 1 / -1; }
.field > label { font-size: 12px; color: var(--ink-muted); }

/* Flow layout with per-field widths, so short fields don't stretch. */
.fields { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.fields .field { flex: 0 0 auto; }
.field.w-full { flex: 1 1 100%; }
.field.w-sm { width: 150px; }
.field.w-md { width: 220px; }
.field.grow { flex: 1 1 200px; min-width: 200px; }
.role-row { display: flex; align-items: center; gap: 20px; }
.role-row .check { margin: 0; }
.check-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; padding: 2px; }
.check-list .check { margin: 0; }

/* ----- Tabs (folder style) ----------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--hairline); margin: 18px 0 14px; }
.tab {
	padding: 7px 14px; cursor: pointer; color: var(--ink-muted);
	border: 1px solid transparent; border-bottom: none; background: none;
	font-family: var(--font-sans); font-size: 13px; font-weight: 500;
	border-radius: var(--radius) var(--radius) 0 0;
}
.tab:hover { color: var(--ink); }
.tab.active {
	color: var(--ink); background: var(--surface);
	border-color: var(--hairline); margin-bottom: -1px; border-bottom: 1px solid var(--surface);
}
.tab-panel { min-height: 80px; }
/* Full-screen editor page body. */
.editor-page { padding: 16px 20px; max-width: 1100px; }
.editor {
	margin-top: 14px; border: 1px solid var(--hairline);
	border-radius: var(--radius); padding: 12px; background: var(--surface);
}
/* Inline row editor: replaces a table row in place. */
table.grid tr.editing td { background: var(--accent-weak); padding: 10px 12px; }

input[type=text], input[type=email], input[type=number], input[type=password], select, textarea {
	font-family: var(--font-sans); font-size: 14px; color: var(--ink);
	background: var(--surface); border: 1px solid var(--hairline);
	border-radius: var(--radius); padding: 6px 8px; width: 100%;
}
/* Match select height to text inputs (native selects use the OS control height). */
input[type=text], input[type=email], input[type=number], input[type=password], select {
	height: 33px; line-height: 1.2;
}
select {
	appearance: none; -webkit-appearance: none; padding-right: 26px;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' fill='none' stroke='%236c6b63' stroke-width='1.5'/></svg>");
	background-repeat: no-repeat; background-position: right 9px center;
}
input.mono { font-family: var(--font-mono); }
input:focus, select:focus, textarea:focus {
	outline: none; border-color: var(--accent);
	box-shadow: 0 0 0 2px var(--accent-weak);
}
textarea { resize: vertical; min-height: 56px; }

.check { display: flex; align-items: center; gap: 7px; }
.check input { width: auto; }

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

.btn {
	font-family: var(--font-sans); font-size: 13px; font-weight: 500;
	border: 1px solid var(--hairline); background: var(--surface); color: var(--ink);
	border-radius: var(--radius); padding: 6px 12px; cursor: pointer;
}
.btn:hover { background: var(--surface-alt); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #2c4358; }
.btn.danger { color: var(--stop); border-color: #e3c4c4; }
.btn.danger:hover { background: #f6e9e9; }
.btn.small { padding: 3px 8px; font-size: 12px; }

/* ----- Popup menu (report layouts) --------------------------------------- */
.menu-wrap { position: relative; }
.menu-backdrop { position: fixed; inset: 0; z-index: 65; }
.menu-pop {
	position: absolute; right: 0; top: calc(100% + 6px); z-index: 70;
	min-width: 240px; max-width: 340px;
	background: var(--surface); border: 1px solid var(--hairline); border-radius: 8px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16); padding: 6px;
}
.menu-sep { height: 1px; background: var(--hairline); margin: 6px 4px; }
.menu-label { font-size: 11px; color: var(--ink-faint); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .04em; }
.menu-empty { padding: 4px 10px 6px; color: var(--ink-faint); font-size: 12px; }
.menu-row { display: flex; align-items: stretch; }
.menu-item {
	flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px;
	text-align: left; background: none; border: 0; border-radius: 6px;
	padding: 8px 10px; cursor: pointer; font-size: 13px; color: var(--ink);
}
.menu-item:hover { background: var(--surface-alt); }
.menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-tag { margin-left: auto; color: var(--ink-faint); font-size: 11px; white-space: nowrap; }
.menu-dots {
	flex: 0 0 auto; background: none; border: 0; border-radius: 6px;
	padding: 0 8px; cursor: pointer; color: var(--ink-muted); font-size: 16px; line-height: 1;
}
.menu-dots:hover { background: var(--surface-alt); }

/* ----- Report group header (per-group totals on the header line) --------- */
.rep-group-head { display: flex; align-items: center; gap: 12px; width: 100%; }
.rep-group-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-group-tot { flex: 0 0 auto; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.rep-group-tot.tons { width: 110px; padding-right: 8px; }
.rep-group-tot.money { width: 130px; padding-right: 8px; }
.grp-tools { display: inline-flex; gap: 4px; align-items: center; margin-left: 6px; }

.search {
	max-width: 260px; padding: 6px 9px; border: 1px solid var(--hairline);
	border-radius: var(--radius); background: var(--surface);
}

/* ----- Extended filter panel (DataList) ---------------------------------- */
.filter-toggle {
	position: relative; display: inline-flex; align-items: center; justify-content: center;
	width: 30px; height: 28px; padding: 0; cursor: pointer;
	border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--surface);
	color: var(--ink-muted);
}
.filter-toggle:hover { background: var(--surface-alt); color: var(--ink); }
.filter-toggle svg { width: 17px; height: 17px; display: block; }
.filter-toggle.on { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); }
.filter-badge {
	position: absolute; top: -6px; right: -6px; min-width: 15px; height: 15px; padding: 0 3px;
	font-size: 10px; line-height: 15px; text-align: center; color: #fff; background: var(--accent);
	border-radius: 8px; border: 1.5px solid var(--surface);
}
.filter-chip {
	display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-muted);
	padding: 2px 4px 2px 8px; background: var(--selected); border-radius: 10px; white-space: nowrap;
}
.filter-chip b { font-weight: 500; color: var(--ink); }
.filter-chip button {
	border: none; background: none; cursor: pointer; color: var(--ink-faint);
	font-size: 14px; line-height: 1; padding: 0 2px;
}
.filter-chip button:hover { color: var(--stop); }
.filter-panel {
	flex: 0 0 auto; padding: 12px 16px; background: var(--surface-alt);
	border-bottom: 1px solid var(--hairline);
}
.filter-grid {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 14px;
}
.filter-field { display: flex; flex-direction: column; }
.filter-field.wide { grid-column: 1 / -1; }
.filter-field > label {
	font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
	color: var(--ink-muted); margin-bottom: 3px;
}
.filter-field input, .filter-field select {
	width: 100%; height: 32px; padding: 0 9px; border: 1px solid var(--hairline);
	border-radius: var(--radius); background: var(--surface);
}
.filter-checks { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; min-height: 32px; }
.filter-checks .check input { width: auto; height: auto; }
.filter-range { display: flex; gap: 6px; }
.filter-range input { width: 50%; }
.filter-actions {
	display: flex; align-items: center; margin-top: 12px; padding-top: 10px;
	border-top: 1px solid var(--hairline-soft);
}
.filter-actions .spacer { flex: 1 1 auto; }

/* Read-only value (mirrors an input's box metrics without the control). */
.ro { padding: 6px 0; color: var(--ink); min-height: 20px; }
.ro.over-limit { color: var(--stop); font-weight: 600; }
.audit-changed td { background: #fdf4e3; }
.audit-changed td:last-child { font-weight: 600; }
.right { text-align: right; }
.muted { color: var(--ink-faint); }
table.grid th.right, table.grid td.right { text-align: right; }

/* Searchable select (combobox). */
.combo { position: relative; }
.combo-list {
	position: absolute; z-index: 20; left: 0; top: 100%;
	min-width: 100%; width: max-content; max-width: 420px;
	margin-top: 2px; background: var(--surface); border: 1px solid var(--hairline);
	border-radius: var(--radius); max-height: 260px; overflow-y: auto; overflow-x: hidden;
	box-shadow: 0 6px 16px rgba(0, 0, 0, .10);
}
/* Let the dropdown grow wider than the field so labels fit on one line. */
.combo-item { padding: 6px 9px; cursor: pointer; white-space: nowrap; }
.combo-item:hover { background: var(--surface-alt); }
.combo-item.sel { background: var(--selected); font-weight: 500; }
.combo-empty { padding: 6px 9px; color: var(--ink-faint); }
.combo-divider { border-top: 1px solid var(--hairline); margin: 4px 0; }

/* List panel with a fixed pager pinned to the bottom (table scrolls between). */
.pane-list.paged { display: flex; flex-direction: column; overflow: hidden; }
.pane-list.paged .list-scroll { flex: 1 1 auto; overflow: auto; min-height: 0; }
.pane-list.paged .pager { flex: 0 0 auto; }
.pager {
	display: flex; align-items: center; gap: 12px;
	padding: 8px 14px; border-top: 1px solid var(--hairline); background: var(--surface);
}
.pager .spacer { flex: 1 1 auto; }

/* List-options popover (page size now; column picker later) next to the pager buttons */
.list-options-wrap { position: relative; display: inline-flex; }
.pager .opts-btn { padding: 3px 7px; display: inline-flex; align-items: center; }
.pager .opts-btn svg { width: 14px; height: 14px; display: block; }
.pager .send-btn svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }
.list-options-backdrop { position: fixed; inset: 0; z-index: 40; }
.list-options-panel {
	position: absolute; bottom: calc(100% + 6px); right: 0; z-index: 41;
	min-width: 170px; padding: 10px 12px;
	background: var(--surface); border: 1px solid var(--hairline);
	border-radius: 4px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}
.list-options-panel .opt-label {
	font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase;
	color: var(--ink-faint); margin-bottom: 7px;
}
.opt-sizes { display: flex; gap: 5px; flex-wrap: wrap; }
.opt-size {
	border: 1px solid var(--hairline); background: var(--surface); color: var(--ink);
	border-radius: 3px; padding: 3px 10px; cursor: pointer; font: inherit; font-size: 12px;
}
.opt-size:hover:not(.active) { background: var(--accent-weak); }
.opt-size.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Modal dialog (e.g. e-mail compose) */
.modal-backdrop {
	position: fixed; inset: 0; z-index: 60;
	background: rgba(0, 0, 0, 0.35); display: flex; align-items: center; justify-content: center;
}
.modal {
	width: 560px; max-width: calc(100vw - 32px); max-height: calc(100vh - 64px);
	display: flex; flex-direction: column;
	background: var(--surface); border: 1px solid var(--hairline);
	border-radius: 6px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
}
.modal-head { padding: 14px 16px; border-bottom: 1px solid var(--hairline); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--hairline); display: flex; align-items: center; gap: 8px; }
.modal-foot .spacer { flex: 1 1 auto; }
.modal .field label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.modal .field label.check input { width: auto; }

/* ----- Auth: login screen, splash, rail user, permission grid ------------- */
.auth-splash { display: flex; align-items: center; justify-content: center; height: 100vh; color: var(--ink-faint); }
.login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--surface-alt); }
.login-card {
	width: 320px; background: var(--surface); border: 1px solid var(--hairline);
	border-radius: 6px; padding: 24px; display: flex; flex-direction: column; gap: 4px;
	box-shadow: 0 12px 44px rgba(0, 0, 0, 0.14);
}
.login-brand { font-size: 22px; font-weight: 700; letter-spacing: 0.08em; }
.login-sub { color: var(--ink-faint); margin-bottom: 12px; }
.login-card label { font-size: 12px; color: var(--ink-muted); margin-top: 8px; }
.login-card .btn { margin-top: 16px; }
.login-error { color: var(--stop); font-size: 13px; margin-top: 8px; }

.rail-brand-wrap { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.rail-user { font-size: 11px; color: var(--ink-faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.rail.collapsed .rail-user { display: none; }
.rail-build { font-size: 10px; color: var(--ink-faint); margin-top: 1px; letter-spacing: .02em; }
.rail.collapsed .rail-build { display: none; }
.nav-logout { border: none; background: none; width: 100%; text-align: left; font: inherit; cursor: pointer; color: var(--ink-muted); }

.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 18px; }
.perm-check { display: flex; align-items: center; gap: 6px; }
.perm-check input { width: auto; }
.perm-grid.readonly .perm-row { font-size: 13px; }
.perm-row.off { color: var(--ink-faint); }
.perm-mark { display: inline-block; width: 14px; color: var(--go); }

/* Detail-pane toolbar (top of the detail pane, below the splitter) */
.pane-detail.barred { display: flex; flex-direction: column; overflow: hidden; }
.pane-detail.barred .detail-scroll { flex: 1 1 auto; overflow: auto; min-height: 0; }
.detail-bar {
	display: flex; align-items: center; gap: 10px;
	padding: 6px 14px; border-bottom: 1px solid var(--hairline); background: var(--surface);
	min-height: 34px;
}
.detail-bar .spacer { flex: 1 1 auto; }
.detail-bar .bar-label { font-size: 12px; color: var(--ink-muted); }
.detail-bar .bar-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.detail-bar .icon-btn { padding: 2px 8px; font-size: 15px; line-height: 1; }

.lookup-grid { display: flex; flex-wrap: wrap; gap: 14px; padding: 16px; }
.lookup-card {
	display: flex; flex-direction: column; gap: 6px; width: 260px; padding: 14px 16px;
	border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--surface);
	text-decoration: none; color: var(--ink);
}
.lookup-card:hover { border-color: var(--accent); background: var(--surface-alt); }
.lookup-card .lookup-title { font-weight: 600; }
.lookup-card .lookup-desc { font-size: 12px; color: var(--ink-muted); }

/* ----- Přehled KPI dashboard ----- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.kpi-card {
	display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; min-height: 104px;
	border: 1px solid var(--hairline); border-left: 3px solid var(--accent); border-radius: var(--radius);
	background: var(--surface); text-decoration: none; color: var(--ink);
}
.kpi-card:hover { background: var(--surface-alt); }
.kpi-card.alert { border-left-color: var(--stop); }
.kpi-card.ok { border-left-color: #3d9a5c; }
.kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); }
.kpi-value { font-size: 28px; font-weight: 700; line-height: 1.1; font-family: var(--font-mono); }
.kpi-value .kpi-unit { font-size: 13px; font-weight: 400; font-family: inherit; color: var(--ink-muted); }
.kpi-sub { font-size: 12px; color: var(--ink-muted); margin-top: auto; }

/* Drag & drop reordering (price-list items) */
.grid tr[draggable="true"] { cursor: grab; }
.grid tr[draggable="true"]:active { cursor: grabbing; }
.grid tr.drop-target td { box-shadow: inset 0 2px 0 var(--accent); }
.drag-handle { color: var(--ink-faint); margin-right: 5px; cursor: grab; user-select: none; }

.tree-toggle {
	display: inline-block; cursor: pointer; user-select: none;
	font-size: 25px; line-height: 1; color: var(--ink-muted);
	width: 26px; text-align: center; margin-right: 4px;
}
.tree-toggle:hover { color: var(--ink); }
.grid tr.grp td { background: var(--surface-alt); }
.grid tr.sub .indent { padding-left: 26px; color: var(--ink-muted); }
.grid td.mark { width: 28px; text-align: center; }

.seg { display: inline-flex; border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.seg-btn { border: 0; background: var(--surface); padding: 5px 13px; cursor: pointer; font-size: 13px; color: var(--ink-muted); }
.seg-btn + .seg-btn { border-left: 1px solid var(--hairline); }
.seg-btn.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }

.totals { display: flex; flex-direction: column; gap: 4px; }
.totals > div { display: flex; justify-content: space-between; gap: 20px; }
.totals .grand { font-weight: 700; border-top: 1px solid var(--hairline); padding-top: 4px; margin-top: 2px; }

.hint { color: var(--ink-faint); font-size: 12px; padding: 8px 0; }
.sub-label { display: block; font-size: 11px; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .03em; margin: 4px 0; }
.ro-row { display: flex; align-items: center; gap: 10px; }
.ro-row .ro { flex: 1 1 auto; }
.ro-row input { flex: 1 1 auto; }
.banner-ok { background: #e7f2ea; color: var(--go); border: 1px solid #c6e0cd; border-radius: var(--radius); padding: 8px 12px; margin: 4px 0 10px; font-size: 13px; }
.empty { padding: 40px; text-align: center; color: var(--ink-faint); }

.row-actions { display: flex; gap: 8px; }
.subhead { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.subhead .spacer { flex: 1 1 auto; }

/* ----- Blazor default error UI ------------------------------------------- */

#blazor-error-ui {
	background: #fbe9e9; color: var(--stop); border-top: 1px solid #e3c4c4;
	bottom: 0; display: none; left: 0; padding: 10px 16px; position: fixed;
	width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 14px; top: 10px; }
.loading-progress { display: block; margin: 20vh auto 0; width: 6rem; height: 6rem; }
.loading-progress circle { fill: none; stroke: var(--hairline); stroke-width: .4rem; }
.loading-progress circle:last-child { stroke: var(--go); stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; transition: stroke-dasharray .1s ease; transform: rotate(-90deg); transform-origin: 50% 50%; }
.loading-progress-text { text-align: center; color: var(--ink-muted); }
