/* ==========================================================================
   QRify – design systém (světlý, minimalistický, ve stylu Apple)
   ========================================================================== */

:root {
    /* Barvy */
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-2: #fbfbfd;
    --text: #1d1d1f;
    --text-2: #6e6e73;
    --text-3: #86868b;
    --separator: #d2d2d7;
    --separator-soft: #e8e8ed;

    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-soft: #e8f1fd;
    --success: #34c759;
    --success-soft: #e7f8ec;
    --danger: #ff3b30;
    --danger-soft: #ffeceb;
    --warning: #ff9500;

    /* Geometrie */
    --r-sm: 8px;
    --r: 12px;
    --r-lg: 18px;
    --r-xl: 24px;
    --pill: 980px;

    /* Stíny */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04), 0 1px 3px rgba(0, 0, 0, .06);
    --shadow: 0 4px 16px rgba(0, 0, 0, .08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .12);

    --ring: 0 0 0 4px rgba(0, 113, 227, .25);

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
        "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;

    --nav-h: 56px;
    --maxw: 1180px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.02em; margin: 0 0 .4em; line-height: 1.1; }
h1 { font-size: 40px; }
h2 { font-size: 28px; }
h3 { font-size: 21px; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--text-2); }

::selection { background: var(--accent-soft); }

/* ---- Layout ---- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.page { padding: 40px 0 80px; }
.page-head { margin-bottom: 28px; }
.page-head .eyebrow { color: var(--accent); font-weight: 600; font-size: 14px; letter-spacing: .01em; }
.page-head h1 { margin: 4px 0 8px; }
.page-head p { color: var(--text-2); max-width: 60ch; font-size: 17px; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.muted { color: var(--text-2); }
.hidden { display: none !important; }

/* ---- Navigace ---- */
.nav {
    position: sticky; top: 0; z-index: 50;
    height: var(--nav-h);
    background: rgba(255, 255, 255, .8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--separator-soft);
}
.nav-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 22px;
    height: 100%; display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 19px;
    letter-spacing: -.02em; color: var(--text); margin-right: 14px; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 26px; height: 26px; display: grid; place-items: center;
    background: var(--text); color: #fff; border-radius: 7px; }
.brand .logo svg { width: 16px; height: 16px; }
.nav-links { display: flex; gap: 2px; align-items: center; }
.nav-links a { color: var(--text-2); font-size: 15px; font-weight: 500;
    padding: 7px 13px; border-radius: var(--pill); transition: .15s; }
.nav-links a:hover { color: var(--text); background: rgba(0, 0, 0, .04); text-decoration: none; }
.nav-links a.active { color: var(--text); background: rgba(0, 0, 0, .06); }
.nav-spacer { flex: 1; }
.nav-user { color: var(--text-3); font-size: 14px; }

/* ---- Tlačítka ---- */
.btn {
    -webkit-appearance: none; appearance: none; cursor: pointer;
    font-family: inherit; font-size: 15px; font-weight: 500;
    padding: 10px 20px; border-radius: var(--pill);
    border: 1px solid transparent; background: var(--surface); color: var(--text);
    transition: .15s ease; display: inline-flex; align-items: center; gap: 8px;
    line-height: 1; white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--accent); border-color: var(--separator); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #ffe1df; }
.btn-lg { padding: 13px 26px; font-size: 17px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ---- Karty / panely ---- */
.card {
    background: var(--surface); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm); border: 1px solid var(--separator-soft);
    padding: 24px;
}
.card-lg { padding: 32px; border-radius: var(--r-xl); }
.card h3 { margin-bottom: 4px; }
.card .card-sub { color: var(--text-2); font-size: 14px; margin-bottom: 18px; }
.panel { background: var(--surface-2); border: 1px solid var(--separator-soft);
    border-radius: var(--r); padding: 18px; }

.grid { display: grid; gap: 20px; }
@media (min-width: 820px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-side { grid-template-columns: 380px 1fr; align-items: start; }
}

/* ---- Formuláře ---- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > label { font-size: 14px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 13px; color: var(--text-3); }
.input, .textarea, .select {
    font-family: inherit; font-size: 15px; color: var(--text);
    background: var(--surface); border: 1px solid var(--separator);
    border-radius: var(--r-sm); padding: 11px 13px; width: 100%;
    transition: .15s; -webkit-appearance: none; appearance: none;
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.5;
    font-variant-numeric: tabular-nums; }
.input:focus, .textarea:focus, .select:focus { outline: none;
    border-color: var(--accent); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236e6e73' d='M6 8 0 2l1.4-1.4L6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 13px center; padding-right: 36px; }

/* Segmentovaný přepínač (iOS styl) */
.segmented { display: inline-flex; background: rgba(120, 120, 128, .12);
    border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.segmented button { border: none; background: transparent; cursor: pointer;
    font-family: inherit; font-size: 14px; font-weight: 500; color: var(--text);
    padding: 7px 16px; border-radius: 6px; transition: .15s; }
.segmented button.active { background: var(--surface); box-shadow: var(--shadow-sm); }

/* Přepínač (switch) */
.switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: rgba(120,120,128,.16);
    border-radius: var(--pill); transition: .25s; cursor: pointer; }
.switch .track::before { content: ""; position: absolute; height: 27px; width: 27px;
    left: 2px; top: 2px; background: #fff; border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: .25s; }
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::before { transform: translateX(20px); }

/* ---- Badge / chip ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
    font-weight: 600; padding: 3px 9px; border-radius: var(--pill);
    background: rgba(120,120,128,.12); color: var(--text-2); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.success { background: var(--success-soft); color: #248a3d; }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

/* ---- Tabulka ---- */
.table-wrap { overflow: auto; border: 1px solid var(--separator-soft);
    border-radius: var(--r); background: var(--surface); }
table.data { border-collapse: collapse; width: 100%; font-size: 13px;
    font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 9px 12px; text-align: left;
    border-bottom: 1px solid var(--separator-soft); white-space: nowrap; }
table.data thead th { position: sticky; top: 0; background: var(--surface-2);
    font-weight: 600; color: var(--text-2); font-size: 12px; z-index: 1; }
table.data tbody tr:hover { background: var(--accent-soft); }
table.data tbody tr.selected { background: var(--accent-soft); }

/* ---- Toast ---- */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { background: rgba(30,30,32,.92); color: #fff; padding: 12px 20px;
    border-radius: var(--pill); font-size: 14px; font-weight: 500;
    box-shadow: var(--shadow-lg); backdrop-filter: blur(10px);
    animation: toast-in .3s ease; max-width: 90vw; }
.toast.success { background: rgba(40,138,61,.95); }
.toast.error { background: rgba(215,45,38,.95); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* ---- Spinner ---- */
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.35);
    border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.dark { border-color: rgba(0,0,0,.15); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Prázdný stav ---- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty svg { width: 46px; height: 46px; opacity: .5; margin-bottom: 14px; }
.empty h3 { color: var(--text-2); font-weight: 600; }

/* ---- Modal ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4);
    backdrop-filter: blur(4px); z-index: 150; display: grid; place-items: center;
    padding: 20px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--r-xl); padding: 28px;
    width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
    animation: pop .25s cubic-bezier(.2,.8,.3,1.2); }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }

/* ---- Výběr typu štítku ---- */
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-card { text-align: left; cursor: pointer; background: var(--surface-2);
    border: 1.5px solid var(--separator-soft); border-radius: var(--r);
    padding: 13px 14px; display: flex; flex-direction: column; gap: 2px;
    transition: .15s; font-family: inherit; }
.type-card:hover { border-color: var(--separator); background: var(--surface); }
.type-card.active { border-color: var(--accent); background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent) inset; }
.type-nick { font-weight: 600; font-size: 16px; color: var(--text); letter-spacing: -.01em; }
.type-dim { font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.type-desc { font-size: 12px; color: var(--text-3); line-height: 1.3; margin-top: 2px; }
.type-perpage { font-size: 11px; font-weight: 600; color: var(--accent);
    margin-top: 4px; text-transform: uppercase; letter-spacing: .03em; }
.type-card.type-design { border-style: dashed; align-items: flex-start; justify-content: center; }
.type-card.type-design .type-nick { color: var(--accent); }

/* ---- Designér štítku ---- */
.dz-tools { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.dz-tool { cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 500; padding: 6px 12px;
    border-radius: var(--pill); border: 1px solid var(--separator); background: var(--surface); color: var(--text); }
.dz-tool:hover { border-color: var(--accent); color: var(--accent); }
/* WYSIWYG plátno editoru */
.dz-stage { display: grid; grid-template-columns: 22px auto; grid-template-rows: auto 22px;
    justify-content: center; align-items: center; justify-items: center; gap: 6px; margin: 6px 0; }
.dz-hlabel { grid-area: 1 / 1; writing-mode: vertical-rl; transform: rotate(180deg);
    font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dz-canvas-wrap { grid-area: 1 / 2; max-width: 100%; overflow: auto; }
.dz-wlabel { grid-area: 2 / 2; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.dz-canvas { background: #fff; border: 1px solid #b0b0b8;
    box-shadow: 0 22px 55px rgba(0,0,0,.30), 0 6px 16px rgba(0,0,0,.16);
    border-radius: 2px; display: block; touch-action: none; }
.dz-el { cursor: move; }
.dz-handle { cursor: nwse-resize; }
.dz-opts { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 2px 0 12px; font-size: 13px; }
.dz-opts span { font-size: 13px; }
.dz-opts input[type=number] { width: 70px; }
.dz-selbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; background: var(--surface-2);
    border: 1px solid var(--separator-soft); border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.dz-selbar input { width: 62px; }
.dz-selbar .sp { color: var(--text-3); }
.dz-align { display: inline-flex; gap: 3px; align-items: center; }
.dz-align button { border: 1px solid var(--separator); background: var(--surface); cursor: pointer;
    width: 27px; height: 27px; border-radius: 6px; color: var(--text-2); font-size: 13px; line-height: 1; padding: 0; }
.dz-align button:hover { border-color: var(--accent); color: var(--accent); }
.dz-align .gap { width: 5px; }
.arrange-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }
.arrange-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--separator-soft);
    border-radius: var(--r-sm); background: var(--surface-2); }
.arrange-item .grow { font-weight: 500; }
.arrange-item .mv { display: flex; gap: 2px; }
.arrange-item .mv button, .arrange-item .del { border: none; background: rgba(120,120,128,.12); cursor: pointer;
    width: 26px; height: 26px; border-radius: 6px; color: var(--text-2); }
.arrange-item .del:hover { background: var(--danger-soft); color: var(--danger); }

/* ---- Přehled stránek ---- */
.pageinfo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pi { background: var(--surface-2); border: 1px solid var(--separator-soft);
    border-radius: var(--r); padding: 14px 10px; text-align: center; }
.pi-num { display: block; font-size: 26px; font-weight: 600; letter-spacing: -.02em;
    color: var(--text); font-variant-numeric: tabular-nums; }
.pi-lbl { display: block; font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* ---- Náhled PDF ---- */
.preview-card { padding: 0; overflow: hidden; }
.preview-frame { position: relative; width: 100%; height: 760px;
    background: #e9e9ee; display: grid; place-items: center; }
.preview-frame iframe { width: 100%; height: 100%; border: 0; }
.preview-loading { position: absolute; inset: 0; display: flex; flex-direction: column;
    gap: 12px; align-items: center; justify-content: center;
    background: rgba(233,233,238,.8); color: var(--text-2); font-size: 14px; font-weight: 500; }
.btn .spinner { width: 16px; height: 16px; }
@media (max-width: 819px) { .preview-frame { height: 520px; } }

/* ---- Hero ---- */
.hero { text-align: center; padding: 30px 0 18px; }
.hero h1 { font-size: 52px; margin-bottom: 10px; }
.hero p { font-size: 19px; color: var(--text-2); max-width: 56ch; margin: 0 auto; }
@media (max-width: 600px) { .hero h1 { font-size: 38px; } }

/* ---- QR generátor (3 vedle sebe) ---- */
.qr-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .qr-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .qr-grid { grid-template-columns: 1fr 1fr 1fr; } }
.qr-card { position: relative; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.qr-head { height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
    border-bottom: 1px solid var(--separator-soft); background: var(--surface-2); }
.qr-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.qr-card .textarea { border-radius: var(--r); }
.qr-foot { display: flex; align-items: center; gap: 10px; }
.qr-actions { display: flex; gap: 7px; }
.qr-foot .btn { padding: 5px 12px; font-size: 12.5px; }
.qr-box { background: #fff; border: 1px solid var(--separator-soft); border-radius: var(--r);
    padding: 14px; width: 100%; aspect-ratio: 1; display: grid; place-items: center;
    box-shadow: var(--shadow-sm); }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-box.empty-qr { color: var(--text-3); font-size: 13px; text-align: center; }
/* macOS-like červené zavírací kolečko v záhlaví okna (× se objeví při najetí) */
.qr-remove { flex: none; width: 14px; height: 14px; padding: 0; border-radius: 50%;
    background: #ff5f57; border: 1px solid rgba(0,0,0,.10); color: transparent;
    font-size: 9px; line-height: 11px; text-align: center; cursor: pointer; transition: color .12s; }
.qr-remove:hover { color: rgba(0,0,0,.55); }
/* malý (kompaktní) přepínač pro QR kartu */
.switch.sm { width: 38px; height: 23px; }
.switch.sm .track::before { width: 19px; height: 19px; }
.switch.sm input:checked + .track::before { transform: translateX(15px); }
.toggle-row { display: flex; align-items: center; gap: 10px; }
.toggle-row label { font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer; }

/* ---- Toolbar / filtry pozic ---- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-group { display: flex; align-items: center; gap: 7px; }
.filter-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.chip { cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 500;
    padding: 6px 13px; border-radius: var(--pill); border: 1px solid var(--separator);
    background: var(--surface); color: var(--text-2); transition: .12s; white-space: nowrap; }
.chip:hover { border-color: var(--text-3); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.seg-mini { display: inline-flex; background: rgba(120,120,128,.12); border-radius: var(--pill); padding: 2px;
    border: 1px solid var(--separator); }
.seg-mini button { border: none; background: transparent; cursor: pointer; font-family: inherit;
    font-size: 12px; font-weight: 600; color: var(--text-2); padding: 5px 12px; border-radius: var(--pill); }
.seg-mini button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Carousel chipů (jeden řádek, přejíždění do stran s mizením na okraji) */
.chips { display: flex; gap: 7px; flex-wrap: nowrap; overflow-x: auto; flex: 1; min-width: 0;
    scrollbar-width: none; -ms-overflow-style: none; }
/* SEKCE/PRACOVIŠTĚ/PROCES každý na vlastním řádku – zarovnané popisky */
#moreFilters > .filter-group > .filter-label { min-width: 78px; }
.chips::-webkit-scrollbar { height: 0; display: none; }
.chips .chip { flex: none; }
.chips.fade-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent); }
.chips.fade-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 34px), transparent); }
.chips.fade-left.fade-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 34px, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(to right, transparent, #000 34px, #000 calc(100% - 34px), transparent); }

/* multiselect popover */
.ms { position: relative; }
.ms-btn { cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 500;
    padding: 7px 13px; border-radius: var(--pill); border: 1px solid var(--separator);
    background: var(--surface); color: var(--text); display: inline-flex; gap: 6px; align-items: center; }
.ms-btn .cnt { background: var(--accent); color: #fff; border-radius: var(--pill); font-size: 11px;
    padding: 1px 7px; font-weight: 600; }
.ms-pop { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; min-width: 220px;
    background: var(--surface); border: 1px solid var(--separator-soft); border-radius: var(--r);
    box-shadow: var(--shadow-lg); padding: 10px; max-height: 320px; overflow: auto; }
.ms-pop .ms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px,1fr)); gap: 4px; }
.ms-opt { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 7px;
    border-radius: 6px; cursor: pointer; }
.ms-opt:hover { background: var(--surface-2); }
.ms-pop .ms-actions { display: flex; justify-content: space-between; gap: 8px;
    margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--separator-soft); }

/* ---- Stat pilulky ---- */
.stat-pills { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat-pill { background: var(--surface); border: 1px solid var(--separator-soft); border-radius: var(--pill);
    padding: 7px 16px; font-size: 13px; color: var(--text-2); }
.stat-pill b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- Tabulka pozic ---- */
.pos-table-wrap { max-height: 60vh; overflow: auto; border: 1px solid var(--separator-soft);
    border-radius: var(--r); background: var(--surface); }
table.pos { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px;
    font-variant-numeric: tabular-nums; }
table.pos th, table.pos td { padding: 8px 11px; text-align: left; white-space: nowrap;
    border-bottom: 1px solid var(--separator-soft); }
table.pos thead th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600;
    color: var(--text-2); font-size: 12px; z-index: 2; }
table.pos thead th[data-sortcol] { cursor: pointer; user-select: none; }
table.pos thead th[data-sortcol]:hover { color: var(--accent); }
table.pos tbody tr { cursor: pointer; }
/* Barvy podle patra (jen uličky 01–23). 01 nejtmavší béžová → 06 nejsvětlejší; 07–09 a 12 bílé. */
table.pos tbody tr.fl-01 { background: #e7d9bd; --row-bg: #e7d9bd; }
table.pos tbody tr.fl-02 { background: #ece0c8; --row-bg: #ece0c8; }
table.pos tbody tr.fl-03 { background: #f0e7d6; --row-bg: #f0e7d6; }
table.pos tbody tr.fl-04 { background: #f4eee2; --row-bg: #f4eee2; }
table.pos tbody tr.fl-05 { background: #f8f4ec; --row-bg: #f8f4ec; }
table.pos tbody tr.fl-06 { background: #fcfaf5; --row-bg: #fcfaf5; }
table.pos tbody tr.fl-07, table.pos tbody tr.fl-08, table.pos tbody tr.fl-09, table.pos tbody tr.fl-12 { background: #ffffff; --row-bg: #ffffff; }
table.pos tbody tr.fl-10 { background: #d8e7fb; --row-bg: #d8e7fb; } /* modrá */
table.pos tbody tr.fl-11 { background: #e9ddfb; --row-bg: #e9ddfb; } /* fialová */
table.pos tbody tr.fl-13 { background: #d6f2de; --row-bg: #d6f2de; } /* zelená */
table.pos tbody tr.fl-14 { background: #fcf1ba; --row-bg: #fcf1ba; } /* žlutá */
table.pos tbody tr:hover { background: var(--accent-soft); }
table.pos tbody tr.selected { background: var(--accent-soft); }
table.pos .col-check, table.pos .col-pos {
    position: sticky; z-index: 1;
    background: var(--row-bg, var(--surface)); /* přebírá barvu patra; jinak bílá (kryje text při posunu) */
}
table.pos .col-check { left: 0; width: 38px; }
table.pos .col-pos { left: 38px; font-weight: 600; color: var(--text); }
table.pos tbody tr:hover .col-check, table.pos tbody tr:hover .col-pos,
table.pos tbody tr.selected .col-check, table.pos tbody tr.selected .col-pos {
    background: rgba(232, 241, 253, .86);
}
table.pos thead .col-check, table.pos thead .col-pos {
    z-index: 3; background: var(--surface-2);
    -webkit-backdrop-filter: none; backdrop-filter: none;
}
.cell-edit { color: var(--accent); }
.sortcode { border-bottom: 1px dotted var(--text-3); cursor: help; }

input[type=checkbox].cb { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

/* ---- Editační panel (drawer) ---- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); backdrop-filter: blur(3px);
    z-index: 120; animation: fade .2s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 92vw; background: var(--bg);
    z-index: 121; box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
    animation: slidein .28s cubic-bezier(.2,.8,.3,1); }
@keyframes slidein { from { transform: translateX(100%); } }
.drawer-head { padding: 20px 22px; border-bottom: 1px solid var(--separator-soft); background: var(--surface);
    display: flex; align-items: center; justify-content: space-between; }
.drawer-head h3 { margin: 0; }
.drawer-body { padding: 20px 22px; overflow: auto; flex: 1; }
.drawer-foot { padding: 16px 22px; border-top: 1px solid var(--separator-soft); background: var(--surface);
    display: flex; gap: 10px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field-grid .full { grid-column: 1 / -1; }
.x-btn { cursor: pointer; border: none; background: rgba(120,120,128,.12); width: 30px; height: 30px;
    border-radius: 50%; font-size: 17px; color: var(--text-2); display: grid; place-items: center; }
.x-btn:hover { background: rgba(120,120,128,.22); }
.tip { position: fixed; z-index: 200; background: rgba(30,30,32,.95); color: #fff; padding: 8px 12px;
    border-radius: 8px; font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow-lg);
    pointer-events: none; max-width: 260px; }
.tip b { color: #fff; } .tip .t-row { color: rgba(255,255,255,.7); }

/* ---- Stránkovač ---- */
.pager { display: flex; gap: 6px; justify-content: center; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.pg-btn { min-width: 34px; height: 34px; padding: 0 9px; border: 1px solid var(--separator); background: var(--surface);
    border-radius: var(--r-sm); cursor: pointer; font-family: inherit; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.pg-btn:hover:not([disabled]) { border-color: var(--accent); color: var(--accent); }
.pg-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pg-btn[disabled] { opacity: .4; cursor: default; }
.pg-ell { color: var(--text-3); padding: 0 2px; }

/* ---- Trvalý vodorovný jezdec ---- */
.pos-table-wrap.hscroll { max-height: none; overflow-x: scroll; overflow-y: visible; }

/* ---- Stav / vytíženost / obsazenost v Pozicích ---- */
.stav-free { color: var(--text-3); }
.stav-occ { color: #248a3d; font-weight: 600; }
td.occ-cell { white-space: normal; }
.occ-list { display: flex; flex-direction: column; gap: 2px; min-width: 230px; max-width: 340px; }
.occ-item { font-size: 12px; line-height: 1.4; }
.occ-item .pv { display: inline-block; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 4px; padding: 0 5px; margin-right: 5px; }
.occ-item .occ-qty { font-weight: 700; color: var(--text); background: rgba(0, 0, 0, .07);
    border-radius: 5px; padding: 0 6px; margin-left: 3px; white-space: nowrap; }
.util-cell { text-align: center; }
.util { display: inline-block; font-weight: 600; font-variant-numeric: tabular-nums; padding: 2px 8px; border-radius: var(--pill); }
.util-low { background: var(--danger-soft); color: var(--danger); }

/* ---- Nulová anomálie ve skladu ---- */
tr.row-zero td { background: var(--danger-soft); color: var(--danger); }

/* ---- Oblíbené sady filtrů ---- */
.filter-sets { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; padding-top: 12px;
    border-top: 1px solid var(--separator-soft); }
.filter-sets .filter-label { margin-right: 2px; }
.fset { cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: var(--pill);
    border: 1px solid var(--separator); background: var(--surface); color: var(--text); display: inline-flex; align-items: center; gap: 7px; }
.fset:hover { border-color: var(--accent); color: var(--accent); }
.fset .x { color: var(--text-3); font-size: 14px; line-height: 1; }
.fset .x:hover { color: var(--danger); }
