/* CRM — obecné komponenty: tokeny, layout s postranním panelem, karty, tlačítka, štítky, skóre,
   záložky, tabulky, formuláře, flash. Obrazovky mají vlastní www/assets/<oblast>.css přes {block styles}. */
:root {
    --bg: #F2F4F6;
    --card: #FFFFFF;
    --ink: #17202A;
    --muted: #5A6672;
    --line: #D8DEE4;
    --blue: #0C4A6E;
    --blue-dark: #083650;
    --blue-soft: #E1EDF5;
    --green: #2F6B3A;
    --green-soft: #E3F0E4;
    --amber: #7A4608;
    --amber-soft: #F6E9D6;
    --red: #8E2A2A;
    --red-soft: #F5E1E1;
    --touch: 44px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--blue); }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.note { font-size: 12px; color: var(--muted); }

/* ---------- Přístupnost ---------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 8px;
    top: -60px;
    z-index: 10;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--blue-dark);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus { top: 8px; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
main:focus { outline: none; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.app > * { min-width: 0; }

.side {
    background: var(--card);
    border-right: 1px solid var(--line);
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.brand {
    font-weight: 800;
    color: var(--blue-dark);
    font-size: 18px;
    padding: 4px 10px 14px;
    text-decoration: none;
}
.side a,
.side .later {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 10px;
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
}
.side a[aria-current="page"] { background: var(--blue-soft); color: var(--blue-dark); }
.side .later { opacity: .55; cursor: default; }
.side .cnt { font-size: 12px; background: var(--blue); color: #fff; border-radius: 10px; padding: 1px 7px; }
.side-user {
    margin-top: auto;
    padding: 12px 10px 0;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}
.side-user-name { font-weight: 600; }

.main { padding: 20px 24px 40px; max-width: 1100px; width: 100%; min-width: 0; }

/* Přihlášení a chybové stránky: bez postranního panelu. */
.app-header, .app-shell { width: 100%; max-width: 480px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.app-header { display: flex; align-items: center; min-height: 56px; }
.app-shell { display: flex; flex-direction: column; gap: 12px; padding-bottom: 40px; }

.hdr { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.title { font-size: 22px; font-weight: 750; }
.sub { color: var(--muted); font-size: 13px; }

/* ---------- Tlačítka ---------- */
.btn,
button.btn,
input[type="submit"].btn {
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: var(--blue);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}
.btn.sec { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.btn.ok { background: var(--green); }
.btn:disabled, .btn.is-loading { opacity: .6; cursor: progress; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn {
    min-height: 32px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--blue);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    text-decoration: underline;
}

/* ---------- Karty, nadpisy sekcí, štítky ---------- */
.card { background: var(--card); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.sec-h { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: .03em; }
.t-pub { background: #E8E3F3; color: #4A3A7A; }
.t-priv { background: var(--blue-soft); color: var(--blue-dark); }
.t-opp { background: var(--amber-soft); color: var(--amber); }
.t-new { background: var(--blue); color: #fff; }

/* ---------- Skóre ---------- */
.score { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; flex: none; }
.s-hi { background: var(--green-soft); color: var(--green); }
.s-mid { background: var(--amber-soft); color: var(--amber); }
.s-lo { background: var(--red-soft); color: var(--red); }
.s-off { background: #ECEFF2; color: var(--muted); font-size: 12px; }

/* ---------- Záložky ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    border: 1.5px solid var(--line);
    background: var(--card);
    border-radius: 18px;
    padding: 6px 12px;
    font-weight: 600;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
}
.tab.on, .tab[aria-current="page"] { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- Klíč–hodnota ---------- */
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Tabulky ---------- */
.table-wrap { overflow-x: auto; max-width: 100%; position: relative; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 6px 8px; }
td { padding: 8px; border-top: 1px solid var(--line); vertical-align: top; }

/* ---------- Formuláře ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label, label.lbl { font-weight: 600; font-size: 14px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"],
input[type="datetime-local"], input[type="search"], input[type="url"], input[type="tel"], input[type="file"],
select, textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: var(--ink);
    font: inherit;
}
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--blue); }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-height: var(--touch); }
.hint { font-size: 12px; color: var(--muted); }
.error, .errors { color: var(--red); font-size: 13px; }
ul.errors { margin: 0 0 10px; padding-left: 18px; }

/* ---------- Flash ---------- */
.flash { border-radius: 10px; padding: 10px 14px; background: var(--blue-soft); color: var(--blue-dark); margin-bottom: 12px; font-weight: 600; }
.flash-success { background: var(--green-soft); color: var(--green); }
.flash-warning { background: var(--amber-soft); color: var(--amber); }
.flash-error { background: var(--red-soft); color: var(--red); }

/* ---------- Úzká obrazovka ---------- */
@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; }
    .side { flex-direction: row; align-items: center; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
    .brand { padding: 8px 10px; white-space: nowrap; }
    .side a, .side .later { white-space: nowrap; min-height: var(--touch); }
    .side-user { margin-top: 0; margin-left: auto; padding: 0 10px; border-top: 0; flex-direction: row; align-items: center; gap: 10px; white-space: nowrap; }
    .main { padding: 16px; }
    .hdr { align-items: flex-start; }
    .btn, button.btn, input[type="submit"].btn, .tab { min-height: var(--touch); }
}
