/* =====================================================================
   O krok CRM 3.0 – styly
   Zásady: velké dotykové plochy (min. 44–48 px), čitelné písmo 16 px,
   jasné stavy fokusu, nic důležitého jen na hover.
   ===================================================================== */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(fonts/inter-latin-ext-wght-normal.woff2) format('woff2');
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url(fonts/inter-latin-wght-normal.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --primary: #2a9a92;
    --primary-600: #23847d;
    --primary-700: #1c6b65;
    --primary-50: #ebf7f6;
    --primary-100: #d3efec;
    --ink: #17252b;
    --ink-2: #3c4d55;
    --muted: #66767e;
    --line: #dde5e8;
    --line-2: #eef2f4;
    --bg: #f4f7f8;
    --surface: #ffffff;
    --danger: #c8372d;
    --danger-50: #fdeeec;
    --warning: #b9770e;
    --warning-50: #fff6e5;
    --success: #1f8a4c;
    --success-50: #e8f6ee;
    --info: #2563a8;
    --info-50: #eaf2fb;
    --violet: #6a46b8;
    --violet-50: #f1ecfb;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-1: 0 1px 2px rgba(16, 38, 45, .06), 0 1px 3px rgba(16, 38, 45, .05);
    --shadow-2: 0 4px 14px rgba(16, 38, 45, .08);
    --shadow-3: 0 18px 50px rgba(16, 38, 45, .22);
    --sb-w: 252px;
    --sb-w-collapsed: 76px;
    --topbar-h: 64px;
    --bottomnav-h: 68px;
    --tap: 48px;
    --focus: 0 0 0 3px rgba(42, 154, 146, .35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 12px); }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--primary-700); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--primary-600); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.12rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .6em; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 9999; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.hide-sm {}
.small-ic { font-size: .72em; opacity: .7; }
.link-break { word-break: break-word; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }

/* ---------- Sidebar (desktop) ---------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sb-w); z-index: 50;
    background: linear-gradient(180deg, #1f6f69 0%, #19524e 100%);
    color: #e9f6f5; display: flex; flex-direction: column;
    transition: width .2s ease;
}
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 14px 14px 18px; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; white-space: nowrap; overflow: hidden; }
.brand:hover { color: #fff; }
.brand small { font-weight: 500; opacity: .7; font-size: .8rem; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: rgba(255, 255, 255, .16); display: inline-grid; place-items: center; flex: 0 0 auto; color: #fff; }
.brand-mark-lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.7rem; background: var(--primary); }
.sb-toggle { width: 36px; height: 36px; border: 0; border-radius: 9px; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; flex: 0 0 auto; }
.sb-toggle:hover { background: rgba(255, 255, 255, .2); }
.sb-nav { flex: 1; overflow-y: auto; padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.sb-nav a, .sb-link {
    display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 10px;
    color: rgba(255, 255, 255, .84); text-decoration: none; font-weight: 500; font-size: .97rem;
    background: none; border: 0; width: 100%; cursor: pointer; font-family: inherit; text-align: left; position: relative;
}
.sb-nav a i, .sb-link i { width: 22px; text-align: center; font-size: 1.05rem; flex: 0 0 auto; }
.sb-nav a:hover, .sb-link:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.sb-nav a.active { background: #fff; color: var(--primary-700); font-weight: 650; }
.sb-sep { height: 1px; background: rgba(255, 255, 255, .14); margin: 10px 6px; }
.sb-foot { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .12); display: flex; flex-direction: column; gap: 4px; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 8px 8px; }
.sb-user-name { display: flex; flex-direction: column; font-weight: 600; font-size: .92rem; line-height: 1.25; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sb-user-name small { font-weight: 400; opacity: .7; font-size: .78rem; }
.sb-user .avatar { background: rgba(255, 255, 255, .18); color: #fff; }
.sb-logout-form { margin: 0; }
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; border-radius: 11px; background: #e4572e; color: #fff; font-size: .74rem; font-weight: 700; display: inline-grid; place-items: center; padding: 0 6px; }

.sb-collapsed .sidebar { width: var(--sb-w-collapsed); }
.sb-collapsed .sidebar .brand-text, .sb-collapsed .sb-nav span:not(.nav-badge), .sb-collapsed .sb-link span, .sb-collapsed .sb-user-name { display: none; }
.sb-collapsed .sb-head { flex-direction: column; padding: 14px 10px; }
.sb-collapsed .sb-toggle i { transform: rotate(180deg); }
.sb-collapsed .sb-nav a, .sb-collapsed .sb-link { justify-content: center; padding: 0; }
.sb-collapsed .nav-badge { position: absolute; top: 4px; right: 6px; min-width: 18px; height: 18px; font-size: .66rem; }
.sb-collapsed .sb-user { justify-content: center; }

/* ---------- App shell ---------- */
.app { margin-left: var(--sb-w); min-height: 100vh; transition: margin-left .2s ease; }
.sb-collapsed .app { margin-left: var(--sb-w-collapsed); }
.topbar {
    position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
    display: flex; align-items: center; gap: 12px; padding: 0 24px;
    background: rgba(244, 247, 248, .92); backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--line);
}
.topbar-brand, .topbar-back { display: none; }
.topbar-brand .brand-mark { background: var(--primary); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.net-status { background: var(--warning-50); color: var(--warning); border-radius: 20px; padding: 6px 12px; font-size: .85rem; font-weight: 600; }
.main { padding: 24px; max-width: 1320px; margin: 0 auto; outline: none; }

/* Globální hledání */
.gsearch { position: relative; flex: 1; max-width: 520px; }
.gsearch > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.gsearch input { width: 100%; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: #fff; padding: 0 16px 0 40px; font: inherit; font-size: 16px; color: var(--ink); }
.gsearch input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.gsearch-results { position: absolute; top: 50px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3); max-height: 70vh; overflow: auto; padding: 6px; z-index: 60; }
.gs-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; min-height: 52px; }
.gs-item:hover, .gs-item.focus { background: var(--primary-50); color: var(--ink); }
.gs-item small { display: block; color: var(--muted); }
.gs-head { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; font-weight: 650; }
.gs-empty { padding: 16px; color: var(--muted); text-align: center; }

/* ---------- Spodní navigace + sheet (mobil) ---------- */
.bottomnav { display: none; }
.sheet { position: fixed; inset: 0; z-index: 200; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 25, 30, .45); animation: fadeIn .15s; }
.sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 20px 20px 0 0;
    padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); max-height: 85vh; overflow: auto; animation: slideUp .2s ease;
}
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
.sheet-user { display: flex; gap: 12px; align-items: center; padding: 8px 10px 14px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.sheet-user small { display: block; color: var(--muted); }
.sheet-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px; padding: 0 12px; border: 0; background: none; font: inherit; font-size: 1.02rem; color: var(--ink); text-decoration: none; border-radius: 12px; cursor: pointer; }
.sheet-item i { width: 24px; text-align: center; color: var(--primary-600); font-size: 1.1rem; }
.sheet-item:hover { background: var(--line-2); color: var(--ink); }
.sheet-item.danger, .sheet-item.danger i { color: var(--danger); }
.sheet form { margin: 0; }

@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tlačítka ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2; cursor: pointer; text-decoration: none;
    background: #fff; color: var(--ink); border-color: var(--line); transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent; user-select: none; white-space: nowrap;
}
.btn:hover { background: var(--line-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #ad2c23; color: #fff; }
.btn-danger-ghost { color: var(--danger); border-color: #f1c9c5; background: #fff; }
.btn-danger-ghost:hover { background: var(--danger-50); color: var(--danger); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #18703d; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-soft { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-700); }
.btn-soft:hover { background: var(--primary-100); color: var(--primary-700); }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 1.02rem; border-radius: 12px; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: .88rem; }
.btn-block { width: 100%; }
.is-loading::after { content: ''; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.icon-btn {
    width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid transparent;
    background: transparent; color: var(--ink-2); cursor: pointer; font-size: 1.05rem; text-decoration: none; flex: 0 0 auto;
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn.danger:hover { background: var(--danger-50); color: var(--danger); }
.icon-btn.on { color: #c47f00; background: #fff4da; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.copy-wrap { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.btn-copy {
    width: 36px; height: 36px; flex: 0 0 auto; display: inline-grid; place-items: center; border-radius: 8px;
    border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; font-size: .92rem;
}
.btn-copy:hover { border-color: var(--primary); color: var(--primary-700); background: var(--primary-50); }
.btn-copy.copied { background: var(--success); border-color: var(--success); color: #fff; }

/* ---------- Formuláře ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.field .req { color: var(--danger); }
.field .hint { font-size: .82rem; color: var(--muted); }
.input, select.input, textarea.input {
    width: 100%; min-height: var(--tap); padding: 11px 14px; border: 1.5px solid #cdd8dc; border-radius: 10px;
    font: inherit; font-size: 16px; color: var(--ink); background: #fff; transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:hover { border-color: #b3c2c7; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(200, 55, 45, .15); }
select.input {
    appearance: none; -webkit-appearance: none; padding-right: 42px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%233c4d55' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
.input[readonly] { background: var(--line-2); }
.input-group { display: flex; gap: 6px; align-items: center; }
.input-group .input { flex: 1; }
.field-error { color: var(--danger); font-size: .85rem; font-weight: 500; }
.counter { font-size: .78rem; color: var(--muted); text-align: right; }

.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; min-height: var(--tap); padding: 12px 14px; border-radius: 10px; border: 1.5px solid #cdd8dc; background: #fff; user-select: none; }
.check:hover { border-color: var(--primary); }
.check input { width: 22px; height: 22px; accent-color: var(--primary); flex: 0 0 auto; margin: 1px 0 0; cursor: pointer; }
.check.big span { font-size: .95rem; }
.check:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.check i { color: var(--primary-600); margin-right: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; pointer-events: none; }
.chip span {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 22px;
    border: 1.5px solid #cdd8dc; background: #fff; cursor: pointer; font-weight: 500; font-size: .95rem; user-select: none;
}
.chip span::before { content: '\f067'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: .75rem; color: var(--muted); }
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip input:checked + span::before { content: '\f00c'; color: #fff; }
.chip input:focus-visible + span { box-shadow: var(--focus); }

.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px 18px; }
.form-grid > .w-xs { grid-column: span 2; }
.form-grid > .w-sm { grid-column: span 4; }
.form-grid > .w-md { grid-column: span 5; }
.form-grid > .w-lg { grid-column: span 7; }
.form-grid > .w-full, .form-grid > .field:not([class*='w-']) { grid-column: 1 / -1; }
.form-grid > .w-half { grid-column: span 6; }

.dis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; align-items: start; }
.dis-item { display: flex; flex-direction: column; gap: 6px; }
.dis-item .input { min-height: 44px; padding: 8px 12px; }

.form-section { scroll-margin-top: 140px; }
.form-wrap { max-width: 1040px; margin: 0 auto; }
.section-nav {
    position: sticky; top: var(--topbar-h); z-index: 30; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0;
    background: var(--bg); margin: 0 0 8px;
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a { flex: 0 0 auto; padding: 0 14px; min-height: 38px; display: inline-flex; align-items: center; gap: 6px; border-radius: 19px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-size: .88rem; font-weight: 550; }
.section-nav a:hover, .section-nav a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.savebar {
    position: sticky; bottom: 0; z-index: 35; margin: 20px -24px -24px; padding: 14px 24px calc(14px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); border-top: 1px solid var(--line);
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.savebar .spacer { flex: 1; }
.save-state { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); }
.save-state .dot { width: 9px; height: 9px; border-radius: 50%; background: #b9c5c9; }
.save-state.ok .dot { background: var(--success); }
.save-state.saving .dot { background: var(--info); animation: pulse 1s infinite; }
.save-state.err .dot { background: var(--danger); }
.save-state.err { color: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Karty, nadpisy stránek ---------- */
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { display: flex; align-items: center; gap: 12px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.page-head .count { font-size: .9rem; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 2px 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); margin-bottom: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); min-height: 60px; }
.card-head h2 { display: flex; align-items: center; gap: 10px; font-size: 1.04rem; }
.card-head h2 i { color: var(--primary-600); width: 20px; text-align: center; }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; }
.card-body { padding: 18px; }
.card.warn { border-color: #f1d49a; background: #fffaf0; }
.card.warn .card-head { border-color: #f6e5bf; }
.card.warn .card-head h2, .card.warn .card-head h2 i { color: #9a5d00; }
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
.pad-xl { padding: 40px 24px; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 500; border: 1px solid; }
.alert i { margin-top: 3px; }
.alert-success { background: var(--success-50); color: #17663a; border-color: #bfe5cd; }
.alert-error { background: var(--danger-50); color: #9f2a22; border-color: #f2c4bf; }
.alert-info { background: var(--info-50); color: #1d4f86; border-color: #c8dcf2; }
.alert-warning { background: var(--warning-50); color: #8a5806; border-color: #f2dcac; }
.alert .btn { margin-left: auto; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: .8rem; font-weight: 600; line-height: 1.5; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.badge-neutral { background: #eef2f4; color: #46575e; }
.badge-info { background: var(--info-50); color: var(--info); }
.badge-warning { background: var(--warning-50); color: #8a5806; }
.badge-violet { background: var(--violet-50); color: var(--violet); }
.badge-success { background: var(--success-50); color: #17663a; }
.badge-danger { background: var(--danger-50); color: var(--danger); }
.badge-muted { background: #f0f0f0; color: #777; }
.badge-primary { background: var(--primary-50); color: var(--primary-700); }
.badge-tg { background: #fdeaea; color: #b4231a; }
.badge-outline { background: #fff; border: 1px solid var(--line); }

.dis-icons { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); flex-wrap: wrap; }
.dis-degree { display: inline-grid; place-items: center; min-width: 28px; height: 24px; padding: 0 6px; border-radius: 6px; background: var(--violet-50); color: var(--violet); font-size: .75rem; font-weight: 750; }

/* ---------- Avatary ---------- */
.avatar { border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: var(--primary-100); }
.avatar-initials { display: inline-grid; place-items: center; color: var(--primary-700); font-weight: 700; }
.avatar-sm { width: 36px; height: 36px; font-size: .85rem; }
.avatar-md { width: 48px; height: 48px; font-size: 1rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.25rem; }
.avatar-xl { width: 96px; height: 96px; font-size: 1.8rem; }
.logo { object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 12px; flex: 0 0 auto; }
.logo-empty { display: inline-grid; place-items: center; color: #9db0b6; background: var(--line-2); }
.logo-sm { width: 40px; height: 40px; border-radius: 9px; padding: 3px; }
.logo-md { width: 52px; height: 52px; padding: 4px; }
.logo-lg { width: 72px; height: 72px; padding: 6px; font-size: 1.4rem; }
.logo-xl { width: 104px; height: 104px; padding: 8px; font-size: 2rem; }

/* ---------- Filtry ---------- */
.filters { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow-1); }
.filters-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .input { min-height: 44px; padding-top: 8px; padding-bottom: 8px; width: auto; min-width: 150px; }
.filters .f-search { flex: 1 1 260px; position: relative; }
.filters .f-search .input { width: 100%; padding-left: 40px; }
.filters .f-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filters .check { min-height: 44px; padding: 9px 12px; }
.filters-more { display: contents; }
.filter-toggle { display: none; }
.f-active { border-color: var(--primary) !important; background-color: var(--primary-50) !important; }
.results-bar { display: flex; align-items: center; gap: 10px; margin: 0 2px 12px; color: var(--muted); font-size: .92rem; flex-wrap: wrap; }
.results-bar .seg { margin-left: auto; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg a, .seg button { min-height: 38px; min-width: 42px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--muted); text-decoration: none; border: 0; background: none; cursor: pointer; }
.seg .on { background: var(--primary); color: #fff; }

/* ---------- Mřížka karet záznamů ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.ecard {
    position: relative; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-1);
    display: flex; flex-direction: column; transition: box-shadow .15s, border-color .15s; min-width: 0;
}
.ecard:hover { box-shadow: var(--shadow-2); border-color: #c9d6da; }
.ecard-link { display: flex; flex-direction: column; gap: 10px; padding: 16px; color: inherit; text-decoration: none; flex: 1; min-width: 0; }
.ecard-link:hover { color: inherit; }
.ecard-top { display: flex; gap: 12px; align-items: center; padding-right: 44px; min-width: 0; }
.ecard-title { font-weight: 650; font-size: 1.02rem; line-height: 1.3; word-break: break-word; }
.ecard-sub { color: var(--muted); font-size: .86rem; }
.ecard-lines { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--ink-2); min-width: 0; }
.ecard-lines > div { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.ecard-lines i { width: 16px; color: var(--muted); text-align: center; flex: 0 0 auto; }
.ecard-lines span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ecard-note { background: var(--line-2); color: var(--ink-2); border-radius: 8px; padding: 6px 10px; font-size: .86rem; display: flex; gap: 8px; }
.ecard-note span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ecard-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.pin-btn { position: absolute; top: 10px; right: 10px; z-index: 2; }
.pin-btn.on i { transform: rotate(-30deg); }
.ecard.is-pinned { border-color: #f1d49a; }

/* Tabulka */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow-1); }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fafcfc; white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: #f7fbfb; }
.table .cell-name { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.table .cell-name a { color: var(--ink); text-decoration: none; }
.table .t-note { color: var(--ink-2); font-size: .86rem; max-width: 260px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.pager-wrap { margin: 20px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.load-more { max-width: 520px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.pg-nums { display: flex; gap: 6px; align-items: center; }
.pg-btn { min-width: 48px; height: 48px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; }
.pg-btn:hover { border-color: var(--primary); color: var(--primary-700); background: var(--primary-50); }
.pg-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pg-btn.disabled { opacity: .35; pointer-events: none; }
.pg-gap { color: var(--muted); padding: 0 2px; }
.pg-jump { display: none; }
.pg-jump .input { min-height: 48px; width: auto; padding-left: 10px; padding-right: 34px; background-position: right 10px center; }
.pager-info { color: var(--muted); font-size: .9rem; margin: 0; }
.letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 12px; }
.letters a { min-width: 40px; height: 40px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 10px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .92rem; }
.letters a:hover { border-color: var(--primary); color: var(--primary-700); }
.letters a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.letters-select { display: none; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty i { font-size: 2rem; color: #b7c6cb; margin-bottom: 10px; display: block; }
.empty p { margin: 0 0 12px; }

/* ---------- Detail ---------- */
.detail-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow-1); }
.detail-head .who { flex: 1 1 260px; min-width: 0; }
.detail-head h1 { font-size: 1.5rem; word-break: break-word; }
.detail-head .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; color: var(--muted); font-size: .92rem; }
.detail-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.detail-side { position: sticky; top: calc(var(--topbar-h) + 16px); }
.deleted-banner { background: var(--danger-50); border: 1px solid #f2c4bf; color: #9f2a22; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-weight: 500; }
.deleted-banner .btn { margin-left: auto; }

.info { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 22px; margin: 0; }
.info > div { min-width: 0; }
.info dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; margin-bottom: 2px; }
.info dd { margin: 0; word-break: break-word; }
.info .full { grid-column: 1 / -1; }
.info dd small { color: var(--muted); display: block; }
.prewrap { white-space: pre-wrap; }
.sub-h { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.sub-h:first-child { margin-top: 0; }
.dis-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.dis-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--violet-50); }
.dis-row i { color: var(--violet); margin-top: 4px; width: 18px; text-align: center; }
.dis-row small { display: block; color: var(--ink-2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Kontaktní osoby */
.persons { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.person { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; background: #fbfdfd; min-width: 0; }
.person-name { font-weight: 650; }
.person-pos { color: var(--muted); font-size: .88rem; margin-top: -4px; }
.person-line { display: flex; gap: 10px; align-items: center; font-size: .94rem; min-width: 0; }
.person-line > i { width: 16px; color: var(--muted); text-align: center; flex: 0 0 auto; }
.person-line .lbl { font-size: .75rem; color: var(--muted); background: var(--line-2); border-radius: 6px; padding: 1px 6px; }

/* Repeater kontaktních osob ve formuláři */
.person-edit { border: 1.5px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; background: #fbfdfd; }
.person-edit-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.person-edit-head strong { font-size: .95rem; }
.person-edit-head .actions { margin-left: auto; display: flex; gap: 4px; }
.email-rows { display: flex; flex-direction: column; gap: 8px; }
.email-row { display: grid; grid-template-columns: 1fr 160px 44px; gap: 8px; align-items: center; }

/* Poznámky */
.composer { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.composer textarea { min-height: 90px; }
.composer-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.composer-actions .save-state { margin-right: auto; }
.notes { display: flex; flex-direction: column; gap: 12px; }
.note { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.note.mine { border-left: 4px solid var(--primary); }
.note-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.note-author { font-weight: 650; font-size: .92rem; }
.note-date { color: var(--muted); font-size: .84rem; }
.note-actions { margin-left: auto; display: flex; gap: 2px; }
.note-actions .icon-btn { width: 40px; height: 40px; font-size: .95rem; }
.note-text { white-space: pre-wrap; word-break: break-word; user-select: text; -webkit-user-select: text; cursor: text; line-height: 1.6; }
.note.clamped .note-text { max-height: 9.6em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.note-more { margin-top: 6px; }
.note-edit textarea { min-height: 140px; }
.notes-filter { display: flex; gap: 8px; margin-bottom: 12px; }

/* Úkoly */
.tasks { display: flex; flex-direction: column; gap: 8px; }
.task {
    display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px; border: 1px solid var(--line);
    background: #fff; cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit; position: relative;
}
.task:hover { border-color: #bfd0d4; box-shadow: var(--shadow-1); }
.task .prio { width: 6px; align-self: stretch; border-radius: 3px; flex: 0 0 auto; background: #c3cfd3; }
.task.p-high .prio { background: var(--danger); }
.task.p-medium .prio { background: #e0a320; }
.task.p-low .prio { background: #8fb7d9; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; line-height: 1.35; word-break: break-word; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .84rem; margin-top: 4px; }
.task-meta i { margin-right: 4px; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task.unread { background: #f3fbfa; border-color: var(--primary-100); }
.task.unread::after { content: ''; position: absolute; top: 12px; right: 12px; width: 10px; height: 10px; border-radius: 50%; background: #e4572e; }
.task .overdue { color: var(--danger); font-weight: 600; }
.status { display: inline-flex; padding: 2px 9px; border-radius: 12px; font-size: .76rem; font-weight: 650; }
.st-pending { background: #eef2f4; color: #46575e; }
.st-in_progress { background: var(--info-50); color: var(--info); }
.st-completed { background: var(--success-50); color: #17663a; }
.st-canceled { background: #f0f0f0; color: #888; }
.status-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.status-picker label { position: relative; }
.status-picker input { position: absolute; opacity: 0; }
.status-picker span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 48px; border-radius: 10px; border: 1.5px solid #cdd8dc; font-weight: 600; font-size: .9rem; cursor: pointer; padding: 4px; }
.status-picker input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.status-picker input:focus-visible + span { box-shadow: var(--focus); }

/* Dokumenty */
.docs { display: flex; flex-direction: column; gap: 8px; }
.doc { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.doc-ic { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary-700); font-size: 1.2rem; flex: 0 0 auto; }
.doc-body { flex: 1; min-width: 0; }
.doc-name { font-weight: 600; word-break: break-word; }
.doc-meta { color: var(--muted); font-size: .82rem; }
.doc-actions { display: flex; gap: 2px; }
.dropzone { border: 2px dashed #c3d1d5; border-radius: 14px; padding: 24px; text-align: center; color: var(--muted); cursor: pointer; background: #fafcfc; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-50); color: var(--primary-700); }
.dropzone i { font-size: 1.8rem; display: block; margin-bottom: 8px; }

/* Zaměstnání */
.jobs { display: flex; flex-direction: column; gap: 10px; }
.job { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.job.ended { opacity: .7; }
.job-body { flex: 1; min-width: 0; }
.job-body a { font-weight: 650; color: var(--ink); text-decoration: none; }
.job-body small { display: block; color: var(--muted); }

.meta-list { display: flex; flex-direction: column; gap: 8px; font-size: .9rem; margin: 0; }
.meta-list > div { display: flex; justify-content: space-between; gap: 10px; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; text-align: right; font-weight: 500; }

/* Foto upload */
.photo-field { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.photo-preview { width: 104px; height: 104px; border-radius: 50%; background: var(--line-2); display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); color: #a6b6bb; font-size: 2rem; flex: 0 0 auto; }
.photo-preview.square { border-radius: 16px; background: #fff; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview.square img { object-fit: contain; }
.cropper-box { width: 100%; height: min(60vh, 460px); background: #1d2a2f; border-radius: 12px; overflow: hidden; }
.cropper-box img { display: block; max-width: 100%; }
.crop-tools { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.crop-zoom { width: 100%; margin-top: 12px; accent-color: var(--primary); height: 32px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 25, 30, .5); animation: fadeIn .15s; }
.modal-dialog {
    position: relative; background: #fff; border-radius: 18px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px);
    display: flex; flex-direction: column; box-shadow: var(--shadow-3); animation: pop .18s ease;
}
.modal-dialog.lg { max-width: 760px; }
.modal-dialog.xl { max-width: 980px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px 22px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { font-size: 1.15rem; flex: 1; word-break: break-word; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-2); }
.modal-foot .left { margin-right: auto; }
.modal-danger .modal-head h2 { color: var(--danger); }
body.modal-open { overflow: hidden; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: 400; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; background: var(--ink); color: #fff; padding: 14px 16px; border-radius: 12px; box-shadow: var(--shadow-3); animation: pop .2s; font-weight: 500; }
.toast.success i { color: #6ee09d; }
.toast.error { background: #8f1f18; }
.toast.warning i { color: #ffcf6b; }
.toast button { margin-left: auto; background: none; border: 0; color: #fff; opacity: .7; cursor: pointer; font-size: 1rem; min-width: 32px; min-height: 32px; }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.quick a { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 14px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; box-shadow: var(--shadow-1); min-height: 64px; }
.quick a i { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary-700); font-size: 1.05rem; flex: 0 0 auto; }
.quick a:hover { border-color: var(--primary); }
.mini-list { display: flex; flex-direction: column; }
.mini { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none; min-height: 60px; border-radius: 8px; }
.mini:last-child { border-bottom: 0; }
.mini:hover { background: #f7fbfb; color: var(--ink); }
.mini-body { flex: 1; min-width: 0; }
.mini-title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-sub { display: block; color: var(--muted); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .fa-thumbtack { color: #c47f00; transform: rotate(-30deg); }
.tabs { display: flex; gap: 4px; background: var(--line-2); border-radius: 12px; padding: 4px; margin-bottom: 14px; overflow-x: auto; }
.tabs button, .tabs a { flex: 1 0 auto; min-height: 42px; border: 0; background: none; border-radius: 9px; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font-size: .93rem; }
.tabs .on { background: #fff; color: var(--primary-700); box-shadow: var(--shadow-1); }
.tabs .cnt { background: var(--line); border-radius: 10px; padding: 0 7px; font-size: .78rem; }
.tabs .on .cnt { background: var(--primary-100); }

/* ---------- Login ---------- */
.login-body { min-height: 100vh; background: radial-gradient(1200px 600px at 10% 0%, #d7f0ed 0%, transparent 60%), linear-gradient(160deg, #eaf6f5, #f4f7f8 60%); display: flex; }
.login-wrap { margin: auto; width: 100%; max-width: 440px; padding: 24px 16px; }
.login-card { background: #fff; border-radius: 22px; padding: 32px 28px; box-shadow: var(--shadow-3); border: 1px solid var(--line); }
.login-head { text-align: center; margin-bottom: 22px; }
.login-head h1 { margin-top: 14px; font-size: 1.6rem; }
.login-head p { color: var(--muted); margin: 4px 0 0; }
.login-foot { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 18px; }

/* ---------- Ostatní ---------- */
.kv-table { width: 100%; border-collapse: collapse; }
.kv-table td { padding: 10px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.settings-nav { margin-bottom: 18px; }
.tool { display: flex; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.tool:last-child { border-bottom: 0; }
.tool-body { flex: 1 1 300px; }
.tool-body p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; background: var(--line-2); padding: 2px 6px; border-radius: 6px; }
.recovery { background: var(--info-50); border: 1px solid #c8dcf2; color: #1d4f86; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 500; }
.recovery .btn-group { margin-left: auto; }
.ac-list { position: absolute; z-index: 70; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-3); max-height: 300px; overflow: auto; padding: 4px; left: 0; right: 0; top: 100%; margin-top: 4px; }
.ac-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; min-height: 48px; display: flex; flex-direction: column; justify-content: center; }
.ac-item small { color: var(--muted); }
.ac-item:hover, .ac-item.focus { background: var(--primary-50); }
.rel { position: relative; }
.region-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--primary-700); background: var(--primary-50); border-radius: 8px; padding: 4px 10px; }
.audit-desc { max-width: 520px; word-break: break-word; }

/* =====================================================================
   Responzivita
   ===================================================================== */
@media (max-width: 1180px) {
    .detail-grid { grid-template-columns: minmax(0, 1fr) 320px; }
    .quick { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1023px) {
    .sidebar { display: none; }
    .app, .sb-collapsed .app { margin-left: 0; }
    .topbar { padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
    .topbar-brand, .topbar-back { display: inline-grid; }
    .topbar-back { width: 44px; height: 44px; }
    .gsearch { max-width: none; }
    .main { padding: 16px 14px calc(var(--bottomnav-h) + 24px + env(safe-area-inset-bottom)); }
    .bottomnav {
        display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
        background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 18px rgba(16, 38, 45, .06);
    }
    .bottomnav a, .bottomnav button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--bottomnav-h);
        color: var(--muted); text-decoration: none; font-size: .74rem; font-weight: 600; border: 0; background: none; font-family: inherit; position: relative; cursor: pointer;
    }
    .bottomnav i { font-size: 1.3rem; }
    .bottomnav .active { color: var(--primary-700); }
    .bottomnav .active i { background: var(--primary-50); border-radius: 14px; padding: 4px 16px; }
    .bottomnav .nav-badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: .66rem; }
    .toasts { left: 16px; right: 16px; bottom: calc(var(--bottomnav-h) + 14px + env(safe-area-inset-bottom)); max-width: none; }
    .detail-grid, .dash-grid { grid-template-columns: 1fr; }
    .detail-side { position: static; }
    .savebar { margin: 20px -14px calc(-1 * (var(--bottomnav-h) + 24px)); bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); padding: 12px 14px; }
    .section-nav { top: calc(var(--topbar-h) + env(safe-area-inset-top)); }
}

@media (max-width: 760px) {
    h1 { font-size: 1.35rem; }
    .hide-sm { display: none; }
    .form-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
    .form-grid > .w-xs, .form-grid > .w-sm { grid-column: span 1; }
    .form-grid > .w-md, .form-grid > .w-lg, .form-grid > .w-half { grid-column: 1 / -1; }
    .card-body { padding: 14px; }
    .card-head { padding: 12px 14px; }
    .page-head .actions { margin-left: 0; width: 100%; }
    .page-head .actions .btn { flex: 1; }
    .filter-toggle { display: inline-flex; }
    .filters .f-search { flex: 1 1 100%; }
    .filters-row .input, .filters-row .check { flex: 1 1 calc(50% - 5px); min-width: 0; }
    .filters:not(.open) .filters-more { display: none; }
    .filters.open .filters-more { display: contents; }
    .filters .filters-row > .btn { flex: 1 1 calc(50% - 5px); }
    .cards-grid { grid-template-columns: 1fr; }
    .detail-head { padding: 14px; gap: 14px; }
    .detail-head h1 { font-size: 1.3rem; }
    .detail-head .actions { width: 100%; }
    .detail-head .actions .btn { flex: 1; }
    .modal { padding: 0; align-items: flex-end; }
    .modal-dialog, .modal-dialog.lg, .modal-dialog.xl { max-width: none; border-radius: 20px 20px 0 0; max-height: 94vh; animation: slideUp .22s ease; }
    .modal-foot .btn { flex: 1; }
    .modal-foot .left { margin-right: 0; }
    .row2 { grid-template-columns: 1fr; }
    .pg-nums { display: none; }
    .pg-jump { display: block; flex: 1; }
    .pg-jump .input { width: 100%; }
    .pager { flex-wrap: nowrap; width: 100%; }
    .letters { display: none; }
    .letters-select { display: block; margin-bottom: 12px; }
    .section-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; }
    .section-nav a { min-height: 44px; }
    .status-picker { grid-template-columns: 1fr 1fr; }
    .email-row { grid-template-columns: 1fr 44px; }
    .email-row .lbl-input { grid-column: 1; }
    .table-wrap.resp { background: none; border: 0; box-shadow: none; }
    .table.resp thead { display: none; }
    .table.resp, .table.resp tbody, .table.resp tr, .table.resp td { display: block; width: 100%; }
    .table.resp tr { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 8px 4px; }
    .table.resp td { border: 0; padding: 4px 12px; }
    .table.resp td[data-l]::before { content: attr(data-l); display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
    .quick a { padding: 12px; font-size: .92rem; }
    .savebar .btn { flex: 1; }
    .savebar .spacer { display: none; }
    .savebar .save-state { width: 100%; justify-content: center; }
}

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

@media print {
    .sidebar, .topbar, .bottomnav, .actions, .savebar, .section-nav, .btn, .icon-btn, .btn-copy { display: none !important; }
    .app { margin: 0 !important; }
    .detail-grid { grid-template-columns: 1fr; }
    .card { box-shadow: none; break-inside: avoid; }
}
[data-note-state]:not(.ok):not(.saving):not(.err) { visibility: hidden; }
.progress { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; margin: 8px 0; }
.progress-bar { height: 100%; width: 0; background: var(--primary); border-radius: 5px; transition: width .2s; }

/* ---------- Dlaždice údajů v detailu ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 10px; }
.tile { background: #f6f9fa; border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 14px; min-width: 0; }
.tile.wide { grid-column: 1 / -1; }
.tile-l { font-size: .8rem; color: var(--muted); display: flex; gap: 7px; align-items: center; margin-bottom: 2px; }
.tile-l i { color: var(--primary-600); width: 15px; text-align: center; }
.tile-v { font-weight: 600; word-break: break-word; }
.tile-v.txt { font-weight: 400; white-space: pre-wrap; line-height: 1.55; }
.tile-v small { display: block; font-weight: 400; color: var(--muted); white-space: pre-wrap; }
.tile-v .copy-wrap a { font-weight: 600; }
.tile.dis { background: var(--violet-50); border-color: #e4dbf6; }
.tile.dis .tile-l i { color: var(--violet); }
.tile.hl { background: var(--primary-50); border-color: var(--primary-100); }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr; } }

/* Zdravotní omezení ve formuláři – zaškrtnutí + upřesnění v jednom rámečku */
.dis-card { border: 1.5px solid #cdd8dc; border-radius: 12px; background: #fff; overflow: hidden; }
.dis-card.on { border-color: var(--violet); background: var(--violet-50); }
.dis-card-head { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 0 14px; cursor: pointer; font-weight: 600; user-select: none; }
.dis-card-head input { width: 22px; height: 22px; accent-color: var(--violet); flex: 0 0 auto; margin: 0; }
.dis-card-head i { color: var(--violet); width: 20px; text-align: center; }
.dis-card-note { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.dis-card-note[hidden] { display: none; }
.dis-card-note label { font-size: .82rem; font-weight: 600; color: var(--violet); }
.dis-card-note .input { min-height: 72px; background: #fff; }

/* Vícenásobný výběr ve filtrech */
.msel { position: relative; }
.msel > summary { list-style: none; cursor: pointer; display: flex; align-items: center; min-height: 44px; padding: 8px 40px 8px 14px; min-width: 170px; user-select: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%233c4d55' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; }
.msel > summary::-webkit-details-marker { display: none; }
.msel.f-active > summary { border-color: var(--primary); background-color: var(--primary-50); }
.msel-panel { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; width: 320px; max-height: 70vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3); padding: 8px; }
.msel-group { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 10px 4px; }
.msel-item { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 10px; border-radius: 10px; cursor: pointer; }
.msel-item:hover { background: var(--line-2); }
.msel-item input { width: 22px; height: 22px; accent-color: var(--primary); flex: 0 0 auto; margin: 0; }
.msel-mode { border-top: 1px solid var(--line-2); margin-top: 6px; padding: 10px; display: flex; flex-direction: column; gap: 8px; font-size: .9rem; }
.msel-mode span { color: var(--muted); }
.msel-mode label { display: flex; gap: 10px; align-items: center; min-height: 36px; cursor: pointer; }
.msel-mode input { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; }
.msel-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 8px 4px 2px; position: sticky; bottom: -8px; background: #fff; }
@media (max-width: 760px) {
    .msel { flex: 1 1 100%; }
    .msel > summary { width: 100%; }
    .msel-panel { position: static; width: 100%; max-height: none; box-shadow: none; margin-top: 6px; }
}

.card.note-card { border-color: var(--primary-100); background: var(--primary-50); }
.card.note-card .card-head { border-color: var(--primary-100); }
.bulkbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 14px; }
.bug-check { width: 24px; height: 24px; accent-color: var(--primary); margin: 0; cursor: pointer; }

/* Číselníky */
.opt-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.opt-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px; border: 1px solid var(--line-2); border-radius: 12px; background: #fbfdfd; }
.opt-row.off .input { color: var(--muted); text-decoration: line-through; }
.opt-row .input { flex: 1 1 220px; min-height: 44px; }
.opt-move { display: flex; }
.opt-move .icon-btn[disabled] { opacity: .25; pointer-events: none; }
.opt-used { min-width: 90px; }
.opt-add { display: flex; gap: 8px; }
.opt-add .input { flex: 1; }
.imp-banner { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 36; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: #fff4da; border: 1px solid #f1d49a; color: #7a4f00; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-weight: 500; box-shadow: var(--shadow-2); }
.imp-banner .btn { margin-left: auto; }
.perms { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 4px; margin: 16px 0 0; }
.perms legend { font-weight: 650; padding: 0 6px; }
.perms-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .perms-grid { grid-template-columns: 1fr; } }

/* Karty klientů: štítky v jednom řádku, ikony postižení v dalším – řádky vždy stejně vysoké */
.ecard-foot-rows { flex-direction: column; align-items: stretch; gap: 6px; flex-wrap: nowrap; }
.ecard-row { display: flex; align-items: center; gap: 8px; min-height: 28px; flex-wrap: nowrap; overflow: hidden; }
.ecard-badges .badge { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
