/* Konfigurátor - barvy a písmo podle manuálu identity stíní.me (modrošedá #475C6B,
   broskvová #DF9479 jen na hlavní akce a vždy s tmavým textem, text #23343E, pozadí #F8F5F0).
   Ovládání pro prst: tlačítka a pole min. 48 px. */
@font-face { font-family: "Manrope"; src: url("assets/fonts/Manrope-variable.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }

:root {
    --brand: #475C6B;
    --brand-tmava: #36474F;
    --accent: #DF9479;
    --accent-hover: #C4826A;
    --ink: #23343E;
    --warm: #F8F5F0;
    --soft: #E9EFF2;
    --okraj: #D7E0E5;
    --tlumeny: #5E6F7A;
    --chyba: #B13B31;
    --uspech: #2F7A4F;
    --varovani: #9A6A12;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Manrope", Arial, sans-serif; background: var(--warm); color: var(--ink); line-height: 1.45; font-size: 16px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.35rem; font-weight: 800; }
h2 { font-size: 1.1rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 700; }
a { color: var(--brand); }

/* ---------- přihlášení */
.prihlaseni { max-width: 24rem; margin: 0 auto; padding: 2rem 1rem; }
.prihlaseni .logo { display: block; height: 36px; margin: 1rem auto 1.5rem; }
.prihlaseni h1 { margin-bottom: 1rem; }

/* ---------- rozvržení */
.aplikace { max-width: 72rem; margin: 0 auto; padding: 0 1rem 7rem; }
.nacitani { text-align: center; color: var(--tlumeny); padding: 3rem 0; }
.lista { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .5rem; margin: 0 -1rem 1rem; padding: .6rem 1rem; padding-top: max(.6rem, env(safe-area-inset-top)); background: var(--brand); color: #fff; }
.lista h1 { flex: 1; font-size: 1.1rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista .zpet { min-width: 48px; min-height: 48px; margin-left: -.5rem; border: 0; background: none; color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.stav-site { font-size: .75rem; font-weight: 700; padding: .25rem .55rem; border-radius: 999px; background: rgba(255,255,255,.18); white-space: nowrap; }
.stav-site.offline { background: var(--accent); color: var(--ink); }

.karta { background: #fff; border: 1px solid var(--okraj); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.karta > h2 { margin-bottom: .75rem; }
.radek { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.mezera { margin-top: .75rem; }
.tlumene { color: var(--tlumeny); font-size: .875rem; }
.drobne { font-size: .8rem; }
.vpravo { text-align: right; }
.cislo { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- tlačítka */
.tlacitko { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .6rem 1rem; border: 2px solid var(--brand); border-radius: 6px; background: #fff; color: var(--brand); font-weight: 700; text-decoration: none; cursor: pointer; }
.tlacitko:hover { background: var(--soft); }
.tlacitko.hlavni { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.tlacitko.hlavni:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.tlacitko.tmave { background: var(--brand); color: #fff; }
.tlacitko.tmave:hover { background: var(--brand-tmava); }
.tlacitko.nebezpecne { border-color: var(--chyba); color: var(--chyba); }
.tlacitko.siroke { width: 100%; margin-top: 1rem; }
.tlacitko:disabled { opacity: .5; cursor: default; }
.tlacitka { display: flex; flex-wrap: wrap; gap: .5rem; }
.tlacitka > .tlacitko { flex: 1 1 10rem; }
.odkaz { border: 0; background: none; padding: .5rem 0; min-height: 44px; color: var(--brand); font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ---------- formuláře */
.pole { margin-bottom: .9rem; }
.popisek { display: block; font-size: .85rem; font-weight: 700; color: var(--brand); margin-bottom: .3rem; }
.popisek .povinne { color: var(--chyba); }
.napoveda { display: block; font-size: .78rem; color: var(--tlumeny); margin-top: .25rem; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], input[type=time], select, textarea {
    width: 100%; min-height: 48px; padding: .6rem .75rem; border: 1px solid #9AA5AE; border-radius: 6px; background: #fff; font-size: 1.05rem;
}
textarea { min-height: 5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.pole.neplatne input, .pole.neplatne select, .pole.neplatne .volby span { border-color: var(--chyba); }
.pole .chyba-pole { display: block; color: var(--chyba); font-size: .8rem; font-weight: 600; margin-top: .25rem; }
.dve-pole { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .75rem; }

/* Výběr z pár možností jako velká tlačítka (rychlejší než rozbalovací seznam) */
.volby { display: flex; flex-wrap: wrap; gap: .5rem; }
.volby label { flex: 1 1 6rem; display: flex; }
.volby input { position: absolute; opacity: 0; pointer-events: none; }
.volby span { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 48px; padding: .5rem; border: 2px solid var(--okraj); border-radius: 6px; background: #fff; color: var(--brand); font-weight: 700; text-align: center; cursor: pointer; }
.volby input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.volby input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.chyba { color: var(--chyba); font-weight: 600; font-size: .9rem; }
.hlaska { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: .9rem; font-weight: 600; }
.hlaska.chyba { background: #F7E4E2; }
.hlaska.uspech { background: #E3F1E8; color: var(--uspech); }
.hlaska.varovani { background: #F6EBD3; color: var(--varovani); }
.hlaska.info { background: var(--soft); color: var(--brand); }
.hlaska ul { margin: .4rem 0 0; padding-left: 1.2rem; font-weight: 500; }

/* ---------- seznamy */
.seznam { list-style: none; margin: 0; padding: 0; }
.polozka-seznamu { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--okraj); border-radius: 12px; padding: .85rem 1rem; margin-bottom: .6rem; cursor: pointer; }
.polozka-seznamu:hover { border-color: var(--brand); }
.polozka-seznamu .nadpis { font-weight: 700; }
.stitek { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: var(--soft); color: var(--brand); white-space: nowrap; }
.stitek.prijata { background: #F6EBD3; color: var(--varovani); }
.stitek.objednana { background: #E3F1E8; color: var(--uspech); }
.stitek.nesync { background: #fff; border: 1px dashed var(--tlumeny); color: var(--tlumeny); }
.prazdne { text-align: center; color: var(--tlumeny); padding: 2rem 1rem; }

/* ---------- ceny */
.souhrn-cen { border-top: 1px solid var(--okraj); margin-top: .5rem; padding-top: .5rem; }
.souhrn-cen .radek { padding: .2rem 0; }
.souhrn-cen .celkem { font-size: 1.25rem; font-weight: 800; border-top: 2px solid var(--ink); margin-top: .35rem; padding-top: .45rem; }
.spodni-lista { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: #fff; border-top: 1px solid var(--okraj); box-shadow: 0 -4px 16px rgba(35,52,62,.08); padding: .6rem 1rem; padding-bottom: max(.6rem, env(safe-area-inset-bottom)); }
.spodni-lista .vnitrek { max-width: 72rem; margin: 0 auto; display: flex; align-items: center; gap: .75rem; }
.spodni-lista .cena { flex: 1; }
.spodni-lista .cena strong { display: block; font-size: 1.3rem; font-weight: 800; }
.spodni-lista .tlacitko { flex: 0 0 auto; }

.souhrn-cen .mezisoucet { font-weight: 700; border-top: 1px solid var(--okraj); margin-top: .25rem; padding-top: .35rem; }
.cenik { color: var(--tlumeny); text-decoration: line-through; font-size: .85em; }
.sleva { color: var(--uspech); font-weight: 700; font-size: .85em; }
.po-sleve { font-weight: 800; }
.ceny-velke { display: block; font-size: 1.2rem; font-variant-numeric: tabular-nums; }

/* ---------- výrobní listy v zakázce (zaškrtávátko = do nabídky) */
.list-v-zakazce { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0 .5rem; }
.list-v-zakazce .akce-listu { flex: 0 0 100%; margin: -.6rem 0 .5rem; }
.list-v-zakazce .polozka-seznamu { flex: 1; }
.do-nabidky { flex: 0 0 48px; display: flex; align-items: center; justify-content: center; margin-bottom: .6rem; border: 1px solid var(--okraj); border-radius: 12px; background: #fff; cursor: pointer; }
.do-nabidky input { width: 24px; height: 24px; accent-color: var(--brand); cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tlacitka-mala { display: flex; flex-wrap: wrap; gap: 0 1rem; justify-content: flex-end; }
.odkaz.nebezpecny { color: var(--chyba); }
.volby.svisle { flex-direction: column; }
.volby.svisle label { flex: 0 0 auto; }
/* ---------- montážní list: záhlaví a řádková tabulka (jeden řádek = jedna roleta) */
.mistnost h2 { margin: 0; }
.zahlavi-listu { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--okraj); }
@media (min-width: 640px) {
    .zahlavi-listu { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
}
.tabulka-radku { overflow-x: auto; margin: .75rem -1rem .75rem; padding: 0 1rem; -webkit-overflow-scrolling: touch; }
.tabulka-radku table { border-collapse: collapse; font-size: .9rem; }
.tabulka-radku th { padding: .35rem .3rem; text-align: left; font-size: .75rem; font-weight: 700; color: var(--brand); white-space: nowrap; border-bottom: 2px solid var(--okraj); }
.tabulka-radku td { padding: .3rem; border-bottom: 1px solid var(--okraj); vertical-align: middle; }
.tabulka-radku .poradi { position: sticky; left: 0; z-index: 1; background: #fff; text-align: center; font-weight: 800; color: var(--brand); min-width: 2rem; }
.tabulka-radku .bunka { width: auto; min-height: 40px; padding: .35rem .45rem; font-size: .95rem; }
.tabulka-radku select.bunka { max-width: 13rem; }
.tabulka-radku .bunka.chybi { border-color: var(--chyba); background: #FDF3F2; }
.tabulka-radku .cena-bunka { white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.smazat-radek { min-width: 40px; min-height: 40px; border: 0; background: none; color: var(--chyba); font-size: 1.3rem; cursor: pointer; }
.hledani { display: block; margin-bottom: .5rem; }

/* Skryté menu: nenápadná ikona v liště bez popisku */
.skryte-menu { min-width: 40px; min-height: 48px; margin-right: -.5rem; border: 0; background: none; color: rgba(255,255,255,.55); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.dialog { max-height: calc(100vh - 2rem); overflow-y: auto; }

/* ---------- dokumenty (výrobní list, nabídka) */
.dokument { background: #fff; border: 1px solid var(--okraj); border-radius: 12px; padding: 1rem; overflow-x: auto; }
.vyroba-tabulka { width: 100%; border-collapse: collapse; font-size: .85rem; margin-bottom: 1rem; }
.vyroba-tabulka th, .vyroba-tabulka td { border: 1px solid #B8C3CA; padding: .35rem .45rem; text-align: left; vertical-align: top; }
.vyroba-tabulka th { background: var(--soft); font-weight: 700; }
.vyroba-hlavicka { margin-bottom: 1rem; }
.vyroba-skupina { margin: 1.25rem 0 .5rem; }

/* ---------- dialog */
.zavoj { position: fixed; inset: 0; z-index: 20; background: rgba(35,52,62,.45); display: flex; align-items: flex-end; justify-content: center; padding: 1rem; }
.dialog { width: 100%; max-width: 30rem; background: #fff; border-radius: 12px; padding: 1.25rem; margin-bottom: env(safe-area-inset-bottom); }
.dialog h2 { margin-bottom: .75rem; }
@media (min-width: 640px) { .zavoj { align-items: center; } }

@media (max-width: 380px) { .dve-pole { grid-template-columns: 1fr; } }

/* ---------- tisk: jen dokument, bez ovládání (orientaci stránky nastavuje app.js podle dokumentu) */
@media print {
    body { background: #fff; font-size: 11pt; }
    .aplikace { max-width: none; padding: 0; }
    .lista, .spodni-lista, .netisknout { display: none !important; }
    .dokument { border: 0; padding: 0; overflow: visible; }
    .vyroba-tabulka { font-size: 9.5pt; }
    .vyroba-tabulka tr { page-break-inside: avoid; }
}

/* ---------- přepínač obrazovek pod lištou */
.navigace { display: flex; gap: .4rem; overflow-x: auto; margin: -.25rem -1rem 1rem; padding: 0 1rem .25rem; -webkit-overflow-scrolling: touch; }
.navigace button { flex: 0 0 auto; min-height: 44px; padding: .45rem .85rem; border: 2px solid var(--okraj); border-radius: 999px; background: #fff; color: var(--brand); font-weight: 700; white-space: nowrap; cursor: pointer; }
.navigace button.aktivni { background: var(--brand); border-color: var(--brand); color: #fff; }
.navigace .pocet { display: inline-block; min-width: 1.4em; padding: 0 .35em; border-radius: 999px; background: var(--accent); color: var(--ink); font-size: .78rem; text-align: center; }

/* ---------- stavy zakázek, poptávek a termínů */
.stitek.zamereni, .stitek.nabidka, .stitek.montaz { background: #E4ECF5; color: var(--brand); }
.stitek.na-sklade { background: #F6EBD3; color: var(--varovani); }
.stitek.hotovo, .stitek.lead-preveden { background: #E3F1E8; color: var(--uspech); }
.stitek.ztraceno, .stitek.zruseno, .stitek.lead-ztracen { background: #F7E4E2; color: var(--chyba); }
.stitek.lead-novy { background: var(--accent); color: var(--ink); }
.volby.stavy label { flex: 1 1 9rem; }
details.sbalene { margin-top: 1.25rem; }
details.sbalene summary { cursor: pointer; margin-bottom: .6rem; }
details.sbalene summary h2 { display: inline; }
.tlacitka-mala.vlevo { justify-content: flex-start; gap: .5rem; }
.tlacitko.male { min-height: 40px; padding: .35rem .8rem; font-size: .9rem; }

/* ---------- historie, fronta K zavolání, kalendář */
.cas-poptavky { font-size: 1rem; font-weight: 700; color: var(--brand); white-space: nowrap; font-variant-numeric: tabular-nums; }
.historie { list-style: none; margin: 0; padding: 0; }
.historie li { padding: .55rem 0; border-top: 1px solid var(--okraj); }
.volani { list-style: none; }
.volani .nadpis { font-weight: 800; font-size: 1.05rem; }
h2.den { margin: 1.25rem 0 .6rem; text-transform: capitalize; }
.termin { list-style: none; padding: 0; border-left: 6px solid var(--brand); }
.termin.montaz { border-left-color: var(--accent); }
.termin.hotovo { opacity: .65; }
.termin .obsah-terminu { display: block; width: 100%; padding: .85rem 1rem .4rem; border: 0; background: none; text-align: left; cursor: pointer; }
.termin .obsah-terminu .nadpis { font-weight: 800; }
.termin .tlacitka-mala { padding: 0 1rem .75rem; }
#termin-obsazeno ul { margin: .25rem 0 .75rem; padding-left: 1.2rem; }

/* ---------- správa uživatelů */
.uzivatel { padding: .75rem 0; border-bottom: 1px solid var(--okraj); }
.uzivatel:last-child { border-bottom: 0; }
.odkaz-hesla { margin-top: .5rem; }

/* ---------- mapa poptávek (Leaflet) */
.mapa-karta summary { cursor: pointer; list-style: none; }
.mapa-karta summary::-webkit-details-marker { display: none; }
.mapa-karta summary h2 { display: inline; }
.mapa-karta summary h2::after { content: ' ▾'; color: var(--tlumeny); font-size: .85em; }
.mapa-karta:not([open]) summary h2::after { content: ' ▸'; }
.mapa { height: 380px; margin-top: .75rem; border-radius: 8px; border: 1px solid var(--okraj); z-index: 0; }
@media (max-width: 480px) { .mapa { height: 300px; } }
.mapa-legenda { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .5rem; font-size: .8rem; color: var(--tlumeny); }
.mapa-legenda .tecka { display: inline-block; width: .8rem; height: .8rem; margin-right: .35rem; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--okraj); vertical-align: -.1rem; }
.tecka.lead-novy { background: #DF9479; }
.tecka.lead-preveden { background: #475C6B; }
.tecka.lead-ztracen { background: #9AA5AE; }
.leaflet-popup-content { font-family: "Manrope", Arial, sans-serif; font-size: .9rem; line-height: 1.45; }
