/*
 * Client Hub – přepisy a doplňky nad vavrik.light (PRIRUCKA § 3 a § 11).
 * Načítá se PO vavrik-light.css. Do souborů design systému se nesahá; vše
 * specifické pro tuto appku je tady a používá jen tokeny systému.
 * Barevná varianta: data-theme="violet" (CMS / publishing).
 */

/* ---------- Pomocné ---------- */
.grow { flex: 1 1 auto; min-width: 0; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); }
.break { word-break: break-all; }
.narrow { max-width: 640px; }
.center-block { display: flex; justify-content: center; text-align: center; margin-bottom: var(--space-4); }
.text-success { color: var(--success); }
.cluster.tight { gap: var(--space-1); }
.inline-form { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.toolbar-desc { margin: var(--space-1) 0 0; }
.row-title { font-weight: 600; color: var(--text); margin-right: var(--space-2); }
.row-title:hover { color: var(--brand); }
.list-label { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--muted); margin: var(--space-4) 0 var(--space-2); }
.list-label:first-child { margin-top: 0; }
.list-group + .list-label { margin-top: var(--space-5); }

/* Logo v sidebaru je odkaz na přehled – nesmí převzít barvu odkazů. */
a.sidebar-brand, a.sidebar-brand:hover { color: #fff; text-decoration: none; }

/* ---------- Hlavička: hledání ---------- */
.header-search { flex: 0 1 26rem; margin-right: auto; }
.header-search input { width: 100%; height: var(--control-h-header); min-height: 0; }

/* ---------- Karty ---------- */
.card.card-flush { padding: 0; overflow: hidden; }
.card.card-flush .card-pad { padding: var(--space-4) var(--space-5) 0; }
.card.card-flush .table-wrap table { min-width: 640px; }
.stack > .card { margin-bottom: 0; }

.badge > .bi { margin-right: 0.3rem; }

/* ---------- Klient: barevná tečka (barvu nastaví app.js z data-color, CSP nepovoluje inline styly) ---------- */
.client-chip { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text); }
.client-dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: var(--radius-full); background: var(--brand); flex-shrink: 0; vertical-align: middle; }
.client-dot.lg { width: 1rem; height: 1rem; border-radius: 4px; }

/* ---------- Stav jako select ve tvaru badge ---------- */
.status-select {
    appearance: none; -webkit-appearance: none; border: 0; cursor: pointer; font: inherit;
    font-size: var(--text-xs); font-weight: 600; min-height: 0; height: auto; width: auto;
    padding: 0.2rem 1.5rem 0.2rem 0.6rem; border-radius: var(--radius-full);
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 0.75rem) 55%, calc(100% - 0.5rem) 55%;
    background-size: 0.25rem 0.25rem; background-repeat: no-repeat;
}
.status-select:focus-visible { box-shadow: var(--shadow-focus); outline: none; }

/* ---------- Filtry ---------- */
.filters.card { align-items: center; }
.filters-search { flex: 1 1 16rem; }
.filters-search input { width: 100%; }
.filters select { width: auto; }
.switch-row { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.switch-row label:not(.switch) { margin: 0; cursor: pointer; font-weight: 500; color: var(--text-secondary); }

/* ---------- Formulář entity ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-5); }
.form-grid .span-all { grid-column: 1 / -1; }
.form-grid .field > input:not([type=checkbox]):not([type=color]), .form-grid .field > select, .form-grid .field > textarea { width: 100%; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

/* Vícenásobný výběr (sítě, oprávnění) jako přepínací štítky – skrytý checkbox + label, funguje bez JS. */
.chip-choices { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip-choices input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-choices label {
    display: inline-flex; align-items: center; margin: 0; padding: 0.35rem 0.8rem; cursor: pointer;
    border: 1px solid var(--border-strong); border-radius: var(--radius-full); background: var(--card);
    font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary);
    transition: background-color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}
.chip-choices label:hover { border-color: var(--brand); }
.chip-choices input:checked + label { background: var(--brand-light); border-color: var(--brand); color: var(--brand-darker); }
.chip-choices input:focus-visible + label { box-shadow: var(--shadow-focus); }

/* ---------- Detail ---------- */
/* Údaje v bočním panelu: popisek nad hodnotou (panel je úzký, dlouhé popisky by hodnotu zmáčkly). */
.props { margin: 0; font-size: var(--text-sm); }
.props dt { color: var(--muted); font-size: var(--text-xs); font-weight: 600; margin-bottom: var(--space-1); }
.props dd { margin: 0 0 var(--space-4); overflow-wrap: anywhere; }
.props dd:last-child { margin-bottom: 0; }
.prose { overflow-wrap: anywhere; line-height: var(--leading-normal); }
.caption { font-size: var(--text-md); line-height: 1.65; background: var(--bg-inset); border-radius: var(--radius); padding: var(--space-4) var(--space-5); }
.is-done { text-decoration: line-through; color: var(--muted); }
.inline-add { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-top: var(--space-3); }
.inline-add input[type=text], .inline-add input[type=url], .inline-add select { flex: 1 1 14rem; width: auto; }
.inline-add input[type=date] { flex: 0 0 auto; width: auto; }
.inline-add .btn { flex: 0 0 auto; }
.card > .inline-add:first-of-type { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.new-linked { margin-top: var(--space-4); font-size: var(--text-sm); }
.new-linked .tag:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.attach-form { margin-top: var(--space-4); }
.attach-form .file-drop { display: flex; cursor: pointer; }
.attach-form .file-drop input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.thumb img { width: 2.75rem; height: 2.75rem; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.att-body { display: flex; flex-direction: column; overflow-wrap: anywhere; }
details.changes { margin-top: var(--space-1); font-size: var(--text-xs); color: var(--muted); }
details.changes summary { cursor: pointer; }
details.changes ul { margin: var(--space-1) 0 0; padding-left: var(--space-4); overflow-wrap: anywhere; }

/* ---------- Agenda (přehled) ---------- */
.agenda-row { gap: var(--space-3); }
.agenda-time { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted); min-width: 4.2rem; white-space: nowrap; }
.agenda-body { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.agenda-body strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-row.is-overdue strong { color: var(--danger); }
@media (max-width: 640px) {
    .agenda-row { flex-wrap: wrap; row-gap: var(--space-1); }
    .agenda-body { flex: 1 1 calc(100% - 3.5rem); }
    .agenda-body strong { white-space: normal; }
    .agenda-time { order: 3; min-width: 0; margin-left: calc(2rem + var(--space-3)); }
    .agenda-row .badge { order: 4; }
}

/* ---------- Kalendář ---------- */
.calendar-nav { justify-content: space-between; margin-bottom: var(--space-4); }
.calendar-title { margin: 0; min-width: 10rem; text-align: center; font-size: var(--text-lg); }
.calendar-legend { gap: var(--space-2); }
.calendar-legend .calendar-chip { cursor: default; }
.calendar-legend .calendar-chip:hover { transform: none; filter: none; }
.chip-time { font-family: var(--font-mono); font-weight: 500; opacity: 0.75; }
.calendar-chip span:last-child { overflow: hidden; text-overflow: ellipsis; }

/* ---------- Tabulka tokenů ---------- */
tr.is-revoked td { opacity: 0.55; }

/* ---------- Auth / 2FA ---------- */
.auth-brand-on-dark .brand-mark { background: rgba(255, 255, 255, 0.16); }
.auth-brand-on-dark .brand-name { color: #fff; }
.auth-split-panel .auth-brand { justify-content: flex-start; }
.auth-split-panel p { color: inherit; }
.code-input { font-family: var(--font-mono); font-size: var(--text-xl); letter-spacing: 0.3em; text-align: center; }
.steps { padding-left: var(--space-5); font-size: var(--text-sm); color: var(--text-secondary); }
.steps li { margin-bottom: var(--space-1); }
.qr { display: flex; justify-content: center; margin: var(--space-4) 0 var(--space-2); }
.qr img { background: #fff; padding: var(--space-2); border-radius: var(--radius); border: 1px solid var(--border); }
.secret { font-size: var(--text-md); letter-spacing: 0.08em; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); list-style: none; padding: 0; margin: var(--space-4) 0; }
.codes code { font-size: var(--text-md); display: block; text-align: center; padding: var(--space-2); }

/* ---------- Chybová stránka ---------- */
.full-empty .error-code { font-size: var(--text-3xl); font-weight: 800; color: var(--muted); margin-top: var(--space-3); }
.debug { text-align: left; white-space: pre-wrap; font-size: var(--text-xs); background: var(--bg-inset); padding: var(--space-4); border-radius: var(--radius); overflow: auto; max-height: 60vh; margin-top: var(--space-6); }

/* ---------- Veřejná stránka (/privacy) ---------- */
.public-page { max-width: 760px; margin: 0 auto; padding: var(--space-6) var(--space-4) var(--space-8); }
.public-brand { display: inline-flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-5); color: var(--text); font-weight: 700; text-decoration: none; }
.public-brand:hover { text-decoration: none; color: var(--brand); }
.public-page .prose h1 { margin-top: 0; }
.public-page .prose h2 { margin-top: var(--space-6); font-size: var(--text-lg); }
.public-page .prose ul { padding-left: var(--space-5); }
.public-page .prose li { margin-bottom: var(--space-2); }
.public-brand .brand-mark { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--radius); background: var(--brand); color: #fff; font-size: var(--text-sm); }

/* ---------- Přihlášení přes Google ---------- */
.auth-divider { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-4) 0; color: var(--muted); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.center-text { text-align: center; }

/* ---------- Sdílení ---------- */
.share-link { width: 100%; margin-bottom: var(--space-2); font-family: var(--font-mono); font-size: var(--text-xs); }
.field > .switch-row + .hint { display: block; margin-top: var(--space-1); }
