/* =========================================================================
   Prohlídky – vzhled aplikace
   Světlý i tmavý motiv. Barvy jsou definované jako proměnné na :root,
   tmavý motiv je jen přepisuje.
   ========================================================================= */

:root {
    /* Barvy značky z loga: tmavě modrá (auto, dům) a žlutá (dělicí proužek). */
    --brand-ink:     #013066;
    --brand-yellow:  #fcc101;

    --bg:            #e8ecf2;
    --bg-glow-1:     rgba(1, 48, 102, 0.07);
    --bg-glow-2:     rgba(252, 193, 1, 0.06);
    --surface:       #ffffff;
    --surface-2:     #f4f6f9;
    --surface-3:     #e7ecf3;
    --border:        #d2d9e4;
    --border-strong: #aeb9ca;
    /* Uzavřená (dokončená/zrušená) zakázka v seznamu – „zapuštěná“ do pozadí. */
    --closed-bg:     #dfe4eb;
    --text:          #13213a;
    --text-muted:    #5f6b7f;
    --accent:        #1d4e98;
    --accent-hover:  #013066;
    --accent-soft:   #e6edf8;
    --on-accent:     #ffffff;

    --st-new:        #1fa974;
    --st-new-bg:     #e4f6ee;
    --st-accepted:   #cf7a17;
    --st-accepted-bg:#fcf0dd;
    --st-uploaded:   #6a5ad8;
    --st-uploaded-bg:#ebe8fb;
    --st-done:       #78808f;
    --st-done-bg:    #eceef3;
    --st-cancelled:  #b0524c;
    --st-cancelled-bg:#f7e7e6;

    --danger:        #d0453e;
    --danger-bg:     #fbe9e8;
    --success:       #1fa974;
    --success-bg:    #e4f6ee;
    --warning:       #cf7a17;
    --warning-bg:    #fcf0dd;

    /* Štítky řádků v evidenci: barva puntíku a pozadí obarveného řádku. */
    --tag-yellow:    #e2b203;
    --tag-yellow-bg: #fdf5c9;
    --tag-orange:    #f0761d;
    --tag-orange-bg: #fde3cf;
    --tag-green:     #2fa65a;
    --tag-green-bg:  #dcf3e3;

    --shadow-sm: 0 1px 2px rgba(19, 33, 58, 0.09);
    --shadow-md: 0 1px 3px rgba(19, 33, 58, 0.10), 0 10px 24px -14px rgba(19, 33, 58, 0.34);
    --shadow-lg: 0 2px 6px rgba(19, 33, 58, 0.10), 0 24px 48px -20px rgba(19, 33, 58, 0.42);

    --radius:    16px;
    --radius-sm: 10px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="dark"] {
    /* Na tmavém pozadí je modrá z loga světlá, žlutá zůstává. */
    --brand-ink:     #dfe8fa;
    --brand-yellow:  #fcc101;

    --bg:            #0a101c;
    --bg-glow-1:     rgba(64, 118, 214, 0.13);
    --bg-glow-2:     rgba(252, 193, 1, 0.05);
    --surface:       #111a2a;
    --surface-2:     #162135;
    --surface-3:     #1c2942;
    --border:        #223049;
    --border-strong: #34445f;
    --text:          #e6ecf6;
    --text-muted:    #93a0b6;
    --accent:        #7aa7ff;
    --accent-hover:  #9bbdff;
    --accent-soft:   #172a4d;
    --on-accent:     #0a101c;
    --closed-bg:     #0d1524;

    --st-new:        #4bd3a0;
    --st-new-bg:     rgba(47, 191, 135, 0.14);
    --st-accepted:   #f0ac53;
    --st-accepted-bg:rgba(232, 150, 58, 0.14);
    --st-uploaded:   #a396ff;
    --st-uploaded-bg:rgba(124, 108, 224, 0.16);
    --st-done:       #8d95a6;
    --st-done-bg:    rgba(141, 149, 166, 0.12);
    --st-cancelled:  #d98a85;
    --st-cancelled-bg:rgba(208, 69, 62, 0.13);

    --danger:        #f2837c;
    --danger-bg:     rgba(208, 69, 62, 0.15);
    --success:       #4bd3a0;
    --success-bg:    rgba(47, 191, 135, 0.14);
    --warning:       #f0ac53;
    --warning-bg:    rgba(232, 150, 58, 0.14);

    --tag-yellow:    #f2cf3c;
    --tag-yellow-bg: rgba(242, 207, 60, 0.17);
    --tag-orange:    #fb8f42;
    --tag-orange-bg: rgba(251, 143, 66, 0.19);
    --tag-green:     #4cc77a;
    --tag-green-bg:  rgba(76, 199, 122, 0.16);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.45), 0 12px 28px -16px rgba(0, 0, 0, 0.9);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.5), 0 28px 56px -24px rgba(0, 0, 0, 1);
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    background-image:
        radial-gradient(900px 500px at 12% -8%, var(--bg-glow-1), transparent 70%),
        radial-gradient(800px 460px at 92% 4%, var(--bg-glow-2), transparent 70%);
    background-attachment: fixed;
    color: var(--text);
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 12px; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p  { margin: 0 0 12px; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ layout */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.topbar__inner {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 20px;
    height: 62px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    margin-right: 12px;
    white-space: nowrap;
}
.brand:hover { text-decoration: none; }
/* Logo (views/partials/logo.php): modrá části = currentColor, proužek žlutý. */
.brand__logo { height: 36px; width: auto; flex: none; color: var(--brand-ink); }
.brand__name { color: var(--brand-ink); font-size: 18px; font-weight: 750; letter-spacing: -0.015em; }

.nav { display: flex; gap: 2px; flex: 1; min-width: 0; }
.nav a {
    padding: 8px 13px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 550;
    white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
/* Aktivní položka: krátká žlutá linka pod textem – stejný motiv jako proužek v logu. */
.nav a { position: relative; }
.nav a.is-active { background: var(--accent-soft); color: var(--brand-ink); }
.nav a.is-active::after {
    content: ""; position: absolute; left: 13px; right: 13px; bottom: 4px;
    height: 2px; border-radius: 2px; background: var(--brand-yellow);
}

.topbar__right { display: flex; align-items: center; gap: 8px; }
.topbar__user { color: var(--text-muted); font-size: 13px; text-align: right; line-height: 1.3; }
.topbar__user strong { display: block; color: var(--text); font-size: 14px; }

.page { max-width: 1040px; margin: 0 auto; padding: 28px 20px 72px; }
.page--narrow { max-width: 760px; }
.page--wide { max-width: 1340px; }   /* evidence – deset sloupců vedle sebe */
.page__head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page__head h1 { margin: 0; }
.page__head p { margin: 4px 0 0; color: var(--text-muted); }
.page__head-actions { margin-left: auto; display: flex; gap: 8px; }

/* ----------------------------------------------------------------- tlačítka */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.12s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}
.btn:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn.is-disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }

.btn--primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: transparent; border-color: var(--border); box-shadow: none; color: var(--text-muted); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); box-shadow: none; }
.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn--sm { padding: 6px 11px; font-size: 13px; }
.btn--block { width: 100%; }

.icon-btn {
    width: 36px; height: 36px;
    padding: 0;
    display: grid; place-items: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

/* -------------------------------------------------------------------- karty */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 22px;
    margin-bottom: 18px;
}
.card__title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card__title h2 { margin: 0; }
.card__title .count,
.card--fold .count {
    font-size: 12px; font-weight: 700;
    padding: 2px 8px; border-radius: 999px;
    background: var(--surface-3); color: var(--text-muted);
}
.count--active { background: var(--accent-soft); color: var(--accent); }

/* Karta, která se dá složit – obsah se ukáže až po rozkliknutí hlavičky. */
.card--fold { padding: 0; }
.card--fold > summary {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 22px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    border-radius: var(--radius);
}
.card--fold > summary::-webkit-details-marker { display: none; }
.card--fold > summary h2 { margin: 0; }
.card--fold > summary::after {
    content: "▾";
    margin-left: auto;
    color: var(--text-muted);
    transition: transform 0.15s var(--ease);
}
.card--fold[open] > summary::after { transform: rotate(180deg); }
.card--fold > summary:hover { background: var(--surface-2); }
.card--fold > *:not(summary) { padding: 0 22px; }
.card--fold > *:not(summary):last-child { padding-bottom: 20px; }

/* ---------------------------------------------------------- seznam zakázek */

.orders { display: flex; flex-direction: column; gap: 14px; }

.order-card {
    position: relative;
    display: block;
    padding: 18px 20px 18px 26px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    color: var(--text);
    overflow: hidden;
    transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), border-color 0.16s var(--ease);
}
.order-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: var(--st-color);
}
.order-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(105deg, var(--st-bg), transparent 42%);
}
.order-card > * { position: relative; z-index: 1; }
.order-card:hover {
    text-decoration: none;
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--st-color) 45%, var(--border));
}
/* Uzavřená zakázka: šedé zapuštěné pozadí, bez stínu a barevného přechodu,
   tlumený text. Na první pohled odlišná i ve světlém motivu. */
.order-card--done {
    background: var(--closed-bg);
    box-shadow: none;
    color: var(--text-muted);
}
.order-card--done::after { display: none; }
.order-card--done .order-card__title { color: var(--text-muted); }
.order-card--done .badge { opacity: 0.8; }
.order-card--done:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }

.order-card__top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.order-card__code { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-muted); }
.order-card__title { font-size: 18px; font-weight: 650; margin: 0 0 2px; }
.order-card__place { color: var(--text-muted); font-size: 14px; }
.order-card__meta {
    display: flex; flex-wrap: wrap; gap: 6px 18px;
    margin-top: 12px; padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 13px; color: var(--text-muted);
}
.order-card__meta span { display: inline-flex; align-items: center; gap: 6px; }

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12.5px; font-weight: 650;
    background: var(--st-bg);
    color: var(--st-color);
    white-space: nowrap;
}
.badge__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--muted { background: var(--surface-3); color: var(--text-muted); }
.badge--type { background: var(--surface-3); color: var(--text-muted); }

.status-new      { --st-color: var(--st-new);      --st-bg: var(--st-new-bg); }
.status-accepted { --st-color: var(--st-accepted); --st-bg: var(--st-accepted-bg); }
.status-uploaded { --st-color: var(--st-uploaded); --st-bg: var(--st-uploaded-bg); }
.status-done      { --st-color: var(--st-done);      --st-bg: var(--st-done-bg); }
.status-cancelled { --st-color: var(--st-cancelled); --st-bg: var(--st-cancelled-bg); }

/* ------------------------------------------------------------------ filtry */

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 13px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 13.5px; font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all 0.15s var(--ease);
}
.chip:hover { text-decoration: none; color: var(--text); border-color: var(--border-strong); }
.chip.is-active { background: var(--st-bg, var(--accent-soft)); color: var(--st-color, var(--accent)); border-color: color-mix(in srgb, var(--st-color, var(--accent)) 40%, transparent); }
.chip__count { font-size: 11.5px; opacity: 0.75; }

.search { margin-left: auto; display: flex; gap: 8px; }

/* ----------------------------------------------------------------- formuláře */

/* Zaškrtávací pole s popisem na dvou řádcích. */
.check {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.check:hover { border-color: var(--border-strong); }
.check:has(input:checked) { border-color: var(--st-new); background: var(--st-new-bg); }
.check input { margin: 3px 0 0; width: 17px; height: 17px; flex: none; accent-color: var(--accent); }

.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; font-weight: 650; color: var(--text-muted); margin-bottom: 6px; }
/* Dovolená dodavatele ve správě účtů. */
.absences { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.absences__title { font-size: 14px; margin: 0 0 8px; }
.absences__list { list-style: none; margin: 0 0 12px; padding: 0; }
.absences__list li { display: flex; justify-content: space-between; align-items: center; gap: 12px;
                     padding: 6px 0; border-bottom: 1px dashed var(--border); }
.absences__add { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.absences__add .field { margin-bottom: 0; }
.absences__add .input { width: auto; }
.absences__note { flex: 1 1 220px; }
.absences__note .input { width: 100%; }

/* Zaškrtávátko přímo v .field nemá převzít vzhled popisku pole. */
.field > label.check { display: flex; font-size: inherit; font-weight: inherit; color: inherit; margin-bottom: 0; }
.field__hint { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }

/* Požadavky na heslo – splněné se zezelenají a odškrtnou. */
.pw-rules { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px;
            font-size: 12.5px; color: var(--text-muted); }
.pw-rules li::before { content: "○"; display: inline-block; width: 1.2em; }
.pw-rules li.is-ok { color: var(--success); }
.pw-rules li.is-ok::before { content: "✓"; }

.input, .select, .textarea {
    width: 100%;
    padding: 10px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 14.5px;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 34px;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }

/* Seznam adres dodavatele – řádky se dají přidávat a odebírat. */
.addresses { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.address-row { display: flex; gap: 8px; align-items: center; }
.address-row .input { flex: 1; min-width: 0; }
.address-row__label { flex: 0 0 190px; }
.address-row .icon-btn { flex: none; }
@media (max-width: 620px) {
    .address-row { flex-wrap: wrap; }
    .address-row__label { flex: 1 1 100%; }
}

/* ---------------------------------------------------------------- hlášky */

.alert {
    display: flex; gap: 10px;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 14px;
    border: 1px solid transparent;
}
.alert--success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert--error   { background: var(--danger-bg);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert--warning { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert--info    { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }

.empty {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}
.empty__icon { font-size: 34px; margin-bottom: 10px; opacity: 0.6; }

/* ------------------------------------------------------------- detail zakázky */

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .detail { grid-template-columns: minmax(0, 1fr); } }

.datalist { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 9px 16px; font-size: 14.5px; }
.datalist dt { color: var(--text-muted); font-size: 13.5px; }
.datalist dd { margin: 0; min-width: 0; word-break: break-word; }
@media (max-width: 520px) { .datalist { grid-template-columns: minmax(0, 1fr); gap: 2px; } .datalist dd { margin-bottom: 8px; } }

/*
 * Varianta pro úzký postranní panel: popisek nad hodnotou. Do dvou sloupců se
 * dlouhý štítek stavu („Nahrané fotky dodavatelem“) nevejde a přetekl by z karty.
 */
.datalist--stacked { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.datalist--stacked dd { margin-bottom: 10px; }
.datalist--stacked dd:last-child { margin-bottom: 0; }
.datalist--stacked .badge { white-space: normal; }

.note-box {
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    white-space: pre-wrap;
    line-height: 1.6;
}

.pdf-link {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    transition: all 0.15s var(--ease);
}
.pdf-link:hover { text-decoration: none; border-color: var(--accent); background: var(--surface); }
.pdf-link__icon {
    width: 38px; height: 38px; flex: none;
    display: grid; place-items: center;
    border-radius: 9px;
    background: var(--danger-bg); color: var(--danger);
    font-size: 12px; font-weight: 800;
}
.pdf-link__meta { font-size: 12.5px; color: var(--text-muted); }

/* ------------------------------------------------------------------ galerie */

.dropzone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 34px 20px;
    text-align: center;
    color: var(--text-muted);
    background: var(--surface-2);
    cursor: pointer;
    transition: all 0.15s var(--ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone__icon { font-size: 30px; margin-bottom: 8px; }
.dropzone strong { color: var(--text); display: block; margin-bottom: 4px; }
.dropzone.is-over strong { color: var(--accent); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 10px; margin-top: 16px; }
.thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface-3);
    border: 1px solid var(--border);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb__remove {
    position: absolute; top: 5px; right: 5px;
    width: 24px; height: 24px;
    border: none; border-radius: 7px;
    background: rgba(12, 14, 19, 0.72);
    color: #fff; cursor: pointer;
    display: grid; place-items: center;
    font-size: 13px; line-height: 1;
    opacity: 0; transition: opacity 0.15s var(--ease);
}
.thumb:hover .thumb__remove { opacity: 1; }
.thumb__size {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 12px 7px 4px;
    font-size: 10.5px; color: #fff;
    background: linear-gradient(transparent, rgba(12, 14, 19, 0.78));
}
.thumb--pending { display: grid; place-items: center; color: var(--text-muted); font-size: 11px; text-align: center; padding: 8px; }
.thumb__doc {
    display: grid; place-items: center; align-content: center; gap: 6px;
    width: 100%; height: 100%; padding: 10px;
    font-size: 10.5px; line-height: 1.3; text-align: center; color: var(--text-muted);
    word-break: break-word; overflow: hidden;
}
.thumb__doc > span {
    padding: 3px 8px; border-radius: 6px;
    background: var(--danger-bg); color: var(--danger);
    font-size: 11px; font-weight: 800;
}
.thumb__bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transition: width 0.25s var(--ease); }

/* -------------------------------------------------------- prohlížeč fotek */

.lb {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 1fr;
    background: #0b0d12;
}
.lb.is-open { display: grid; }

.lb__bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: #11141b;
    color: #e7eaf1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}
.lb__title {
    font-size: 14px; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    min-width: 0;
}
.lb__counter { font-size: 13px; color: #949cb0; white-space: nowrap; }
.lb__tools { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.lb__btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px;
    padding: 0 11px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: #e7eaf1;
    font: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.lb__btn:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.3); text-decoration: none; }
.lb__btn--save { background: var(--accent); border-color: transparent; color: #fff; }
.lb__btn--save:hover { background: var(--accent-hover); }

/*
 * Plocha s fotkou je pozicovaná a fotka v ní leží absolutně. Díky tomu se
 * procenta u max-width/max-height počítají spolehlivě z rozměru plochy –
 * v mřížce s řádkem 1fr to jinak umí přetéct.
 */
.lb__stage {
    grid-column: 1 / -1;
    position: relative;
    padding: 16px;
    min-height: 0;
    overflow: hidden;
}
.lb__img {
    position: absolute;
    inset: 16px;
    margin: auto;
    width: auto; height: auto;
    max-width: calc(100% - 32px);
    max-height: calc(100% - 32px);
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.25s var(--ease);
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.9);
}
/* Po otočení o 90° se prohodí strany – konkrétní meze dopočítá JavaScript. */

.lb__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px; height: 68px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 30px; line-height: 1;
    cursor: pointer;
    transition: background 0.15s var(--ease);
}
.lb__nav:hover { background: rgba(255, 255, 255, 0.2); }
.lb__nav--prev { left: 14px; }
.lb__nav--next { right: 14px; }

.lb__strip {
    grid-column: 1 / -1;
    display: flex; gap: 8px;
    padding: 12px 16px;
    background: #11141b;
    overflow-x: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
}
.lb__thumb {
    width: 64px; height: 64px; flex: none;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid transparent;
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.15s var(--ease), border-color 0.15s var(--ease);
}
.lb__thumb:hover { opacity: 0.85; }
.lb__thumb.is-active { opacity: 1; border-color: var(--accent); }

.lb__status {
    position: absolute;
    left: 50%; bottom: 104px;
    transform: translateX(-50%);
    padding: 9px 16px;
    border-radius: 999px;
    background: rgba(20, 24, 32, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #e7eaf1;
    font-size: 13.5px;
    white-space: nowrap;
}
.lb__status.is-error { border-color: var(--danger); color: var(--danger); }

@media (max-width: 640px) {
    .lb__nav { display: none; }
    .lb__title { display: none; }
    .lb__thumb { width: 52px; height: 52px; }
}

/* ------------------------------------------------------------------ zprávy */

.message { padding: 13px 15px; border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 10px; }
.message__head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 12.5px; color: var(--text-muted); }
.message__head strong { color: var(--text); font-size: 13.5px; }
.message__body { white-space: pre-wrap; line-height: 1.55; }
.message--mine { background: var(--accent-soft); }

.timeline { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.timeline li { position: relative; padding: 0 0 14px 20px; color: var(--text-muted); }
.timeline li::before {
    content: ""; position: absolute; left: 3px; top: 7px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--border-strong);
}
.timeline li:not(:last-child)::after {
    content: ""; position: absolute; left: 6px; top: 16px; bottom: 2px;
    width: 1px; background: var(--border);
}
.timeline strong { color: var(--text); font-weight: 550; display: block; }

/* ------------------------------------------------------------------ tabulka */

/* Tabulka se raději vodorovně posouvá, než aby se lámaly řádky s tlačítky. */
.table { width: 100%; min-width: 800px; border-collapse: collapse; font-size: 14px; }
.table td:last-child, .table th:last-child { white-space: nowrap; }
.table th {
    text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted); font-weight: 700;
    padding: 0 12px 10px; border-bottom: 1px solid var(--border);
}
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.is-inactive { opacity: 0.5; }
.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }

/* ------------------------------------------------------------------ evidence */

/*
 * Jednořádkový přehled zakázek k fakturaci. Barva řádku říká, co s ním je:
 * jantarový = něco chybí vyplnit, šedý = hotový, bledý = prohlídka ještě
 * neproběhla. Pruh vlevo drží stejnou informaci i pro toho, kdo barvy
 * rozlišuje hůř.
 */

.ledger { min-width: 1150px; font-size: 13.5px; }
.ledger th { padding: 0 8px 9px; white-space: normal; vertical-align: bottom; line-height: 1.3; }
.ledger td { padding: 4px 8px; }
.ledger td:last-child, .ledger th:last-child { white-space: normal; }

.ledger__c-date    { width: 86px; white-space: nowrap; font-size: 12.5px; }
.ledger__c-claim   { width: 210px; white-space: nowrap; }
.ledger__c-yn      { width: 98px; }
.ledger .ledger__c-amount { width: 108px; text-align: right; }
.ledger__c-tech    { width: 128px; }
.ledger__c-invoice { width: 110px; }
/* Trasa bývá nejdelší údaj – „Teplice - Ústí nad Labem - Teplice, 60km“. */
.ledger__c-route   { min-width: 275px; }
.ledger__city      { margin-left: 7px; font-size: 12px; }

.ledger tbody tr { --row: transparent; }
.ledger tbody td:first-child { border-left: 3px solid var(--row); }
.ledger tbody tr:hover { background: var(--surface-2); }

.ledger tr.is-missing { --row: var(--warning); background: color-mix(in srgb, var(--warning) 8%, transparent); }
.ledger tr.is-missing:hover { background: color-mix(in srgb, var(--warning) 15%, transparent); }
.ledger tr.is-waiting { --row: var(--border-strong); }
.ledger tr.is-complete { --row: var(--st-done); background: var(--surface-2); color: var(--text-muted); }
.ledger tr.is-cancelled { --row: var(--st-cancelled); color: var(--text-muted); }
.ledger tr.is-complete a, .ledger tr.is-cancelled a { color: var(--text-muted); }
.ledger tr.is-complete:hover, .ledger tr.is-complete:focus-within,
.ledger tr.is-cancelled:hover, .ledger tr.is-cancelled:focus-within { color: var(--text); }
/* Hotový řádek má být klidný – zvýrazněné volby se rozsvítí až najetím myší. */
/* Štítek je ruční označení – přebije pozadí podle stavu. Stav dál
   ukazuje proužek vlevo (--row). */
.ledger tr[data-label="yellow"] { background: var(--tag-yellow-bg); }
.ledger tr[data-label="orange"] { background: var(--tag-orange-bg); }
.ledger tr[data-label="green"]  { background: var(--tag-green-bg); }
.ledger tr[data-label="yellow"]:hover { background: color-mix(in srgb, var(--tag-yellow) 26%, var(--surface)); }
.ledger tr[data-label="orange"]:hover { background: color-mix(in srgb, var(--tag-orange) 26%, var(--surface)); }
.ledger tr[data-label="green"]:hover  { background: color-mix(in srgb, var(--tag-green) 24%, var(--surface)); }

.ledger__c-label { width: 82px; }
.swatches { display: inline-flex; gap: 5px; }
/* .swatches navíc, ať to přebije zaoblení krajních ANO/NE (.opt:first-child …). */
.swatches .opt.swatch span {
    width: 18px; height: 18px; padding: 0; border-radius: 50%;
    border: 2px solid var(--swatch); background: transparent;
}
.swatch--yellow { --swatch: var(--tag-yellow); }
.swatch--orange { --swatch: var(--tag-orange); }
.swatch--green  { --swatch: var(--tag-green); }
.opt.swatch input:hover + span { border-color: var(--swatch); background: color-mix(in srgb, var(--swatch) 35%, transparent); }
.opt.swatch input:checked + span { background: var(--swatch); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--swatch); }

.ledger tr.is-complete .opt input:checked + span { opacity: 0.5; }
.ledger tr.is-complete:hover .opt input:checked + span,
.ledger tr.is-complete:focus-within .opt input:checked + span { opacity: 1; }

/* Dvojice ANO / NE. Nezvolený stav je plnohodnotná třetí možnost: prázdno.
   Zaškrtávátko by ho neumělo odlišit od „ne“. */
.yn-group { display: inline-flex; }
.opt { position: relative; display: inline-flex; }
.opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.opt span {
    display: block; padding: 3px 9px;
    font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
}
.opt:first-child span { border-radius: 7px 0 0 7px; }
.opt:last-child span  { border-radius: 0 7px 7px 0; border-left-width: 0; }
.opt input:hover + span { border-color: var(--border-strong); color: var(--text); }
.opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.opt--yes input:checked + span {
    background: var(--success-bg); color: var(--success);
    border-color: color-mix(in srgb, var(--success) 40%, transparent);
}
.opt--no input:checked + span {
    background: var(--danger-bg); color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}

/* Provedeno se řídí stavem zakázky – přerušovaný rámeček říká „tohle nevyplňuješ ty“. */
.yn {
    display: inline-block; padding: 3px 9px; border-radius: 7px;
    font-size: 11.5px; font-weight: 700;
    border: 1px dashed var(--border-strong); color: var(--text-muted); cursor: help;
}
.yn--yes { color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, transparent); }

.cell {
    width: 100%; min-width: 0; font: inherit; font-size: 13px; color: inherit;
    padding: 4px 7px; border: 1px solid transparent; border-radius: 7px; background: transparent;
}
.cell:hover { border-color: var(--border); background: var(--surface); }
.cell:focus {
    outline: none; border-color: var(--accent); background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.cell--num { text-align: right; }
.cell.is-error { border-color: var(--danger); background: var(--danger-bg); }
/* Prázdné políčko v nedodělaném řádku dá o sobě vědět. */
.ledger tr.is-missing .cell:placeholder-shown {
    border-color: color-mix(in srgb, var(--warning) 45%, transparent); border-style: dashed;
}

.ledger tfoot td { padding-top: 12px; border-top: 2px solid var(--border); }
.ledger__total-label { color: var(--text-muted); text-align: right; }
.ledger .ledger__total { font-size: 15px; font-weight: 700; }

.ledger-legend { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin: -4px 0 12px; }
.ledger-legend__dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.ledger-legend__hint { margin-left: auto; }

/* Potvrzení uložení. Políčka se ukládají sama, tak ať je vidět, že se tak stalo. */
.saver {
    position: fixed; right: 20px; bottom: 20px; z-index: 40;
    padding: 9px 15px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md);
    font-size: 13px; font-weight: 600; color: var(--text-muted);
    opacity: 0; transform: translateY(6px); pointer-events: none;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.saver.is-on { opacity: 1; transform: translateY(0); }
.saver.is-ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.saver.is-error { color: var(--danger); background: var(--danger-bg); border-color: var(--danger); }

/* ------------------------------------------------------------------ přihlášení */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
    width: 100%; max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 34px 30px;
}
.auth-card__brand {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    margin: -4px 0 26px; padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}
.auth-card__logo { height: 76px; width: auto; color: var(--brand-ink); margin-bottom: 14px; }
.auth-card__name { color: var(--brand-ink); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.auth-card__tagline { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }
.auth-card__title { font-size: 19px; }

/* Hlavička stránky /nastaveni. */
.setup-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.setup-brand__sub { color: var(--text-muted); font-size: 14px; margin-left: 4px; }

/* --------------------------------------------------------------- drobnosti */

.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.mono  { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.divider { height: 1px; background: var(--border); margin: 18px 0; border: none; }
.hidden { display: none !important; }
.spin { display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

details.disclosure > summary {
    cursor: pointer; list-style: none;
    color: var(--accent); font-weight: 600; font-size: 14px;
    padding: 6px 0;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "▸ "; display: inline-block; transition: transform 0.15s var(--ease); }
details.disclosure[open] > summary::before { transform: rotate(90deg); }

@media (max-width: 700px) {
    .topbar__inner { height: auto; padding: 10px 16px; flex-wrap: wrap; }
    /* flex-basis 100 % – samotné width by přebilo flex: 1 a menu by se nezalomilo. */
    .nav { order: 3; flex: 0 0 100%; overflow-x: auto; }
    .topbar__right { margin-left: auto; }
    .topbar__user { display: none; }
    .page { padding: 20px 16px 60px; }
    h1 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
