/* ================================================================
   OBCHODNÍ BOARD – vychází z design systému Gelappu (slate / modrá)
================================================================ */
:root {
  --bg-base: #1a1d2e;
  --bg-surface: #222538;
  --bg-card: #2a2d42;
  --bg-card-hover: #313550;
  --bg-input: #1e2135;
  --accent: #4d8ef5;
  --accent-hover: #3a7de8;
  --accent-dim: rgba(77, 142, 245, .18);
  --accent-muted: rgba(77, 142, 245, .09);
  --success: #2dd36f;
  --success-dim: rgba(45, 211, 111, .14);
  --warning: #ffc409;
  --warning-dim: rgba(255, 196, 9, .14);
  --danger: #f04747;
  --danger-dim: rgba(240, 71, 71, .14);
  --text-primary: #eef0f8;
  --text-secondary: #a0aabf;
  --text-muted: #6b7592;
  --border: rgba(255, 255, 255, .11);
  --border-strong: rgba(255, 255, 255, .20);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .35);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .45);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --ease: cubic-bezier(.4, 0, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 18px; }
h3 { font-size: 14px; }
.tlumene { color: var(--text-secondary); }
.mini { font-size: 12px; color: var(--text-muted); }
.chyba { color: var(--danger); min-height: 1.2em; margin: 0; }

/* ---------- ovládací prvky ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-strong); background: var(--bg-card);
  color: var(--text-primary); border-radius: var(--radius-sm);
  padding: 7px 12px; font: inherit; font-weight: 550; cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-card-hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-hlavni { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-hlavni:hover { background: var(--accent-hover); }
.btn-tichy { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-tichy:hover { background: var(--bg-card); color: var(--text-primary); }
.btn-nebezpeci { color: var(--danger); }
.btn-nebezpeci:hover { background: var(--danger-dim); }
.btn-maly { padding: 4px 8px; font-size: 12px; }

input, select, textarea {
  width: 100%; background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 10px; font: inherit;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, button:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(77, 142, 245, .25);
}
label { display: grid; gap: 4px; font-size: 12px; color: var(--text-secondary); font-weight: 500; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---------- přihlášení ---------- */
.prihlaseni { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.prihlaseni-karta {
  width: min(380px, 100%); display: grid; gap: 14px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-lg);
}
.prihlaseni-karta .logo { font-size: 20px; }
.prihlaseni-karta p { margin: 0; }
.prostredi-info { font-size: 12px; text-align: center; color: var(--text-muted); }

.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.logo-znak {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  background: linear-gradient(90deg, #fff 0 22%, transparent 22% 39%, rgba(255,255,255,.8) 39% 61%, transparent 61% 78%, rgba(255,255,255,.6) 78%) 5px 6px / 14px 12px no-repeat, var(--accent);
}
.stitek-prostredi {
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: .04em;
}
.stitek-prostredi.test { background: var(--warning-dim); color: var(--warning); }
.stitek-prostredi.demo { background: var(--accent-dim); color: var(--accent); }
.stitek-prostredi.prod { display: none; }

/* ---------- hlavička ---------- */
.hlavicka {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 10px 20px; background: var(--bg-surface); border-bottom: 1px solid var(--border);
}
.zalozky { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.zalozky button {
  background: none; border: 0; color: var(--text-secondary); font: inherit; font-weight: 550;
  padding: 7px 12px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
}
.zalozky button:hover { color: var(--text-primary); background: var(--bg-card); }
.zalozky button.aktivni { color: var(--text-primary); background: var(--accent-dim); }
.uzivatel { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); white-space: nowrap; }

.obsah { padding: 16px 20px 40px; }

/* ---------- lišta filtrů ---------- */
.lista { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.lista input[type="search"] { width: 260px; }
.lista select { width: auto; }
.lista .mezera { flex: 1; }
.prepinac { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); flex-direction: row; }

/* ---------- kanban ---------- */
.kanban {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr);
  gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start;
}
.sloupec {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; max-height: calc(100vh - 170px); min-height: 200px;
}
.sloupec-hlava { padding: 10px 12px 8px; border-bottom: 1px solid var(--border); }
.sloupec-hlava .radek { display: flex; align-items: center; gap: 8px; }
.sloupec-hlava h3 { flex: 1; }
.pocet { font-size: 12px; color: var(--text-secondary); background: var(--bg-card); border-radius: 99px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.sloupec-hlava .mini { margin-top: 2px; font-variant-numeric: tabular-nums; }
.sloupec[data-faze="zakaznik"] .sloupec-hlava { box-shadow: inset 0 3px 0 var(--success); border-radius: var(--radius) var(--radius) 0 0; }
.sloupec[data-faze="ztraceno"] { opacity: .85; }
.karty { padding: 8px; display: grid; gap: 8px; overflow-y: auto; flex: 1; align-content: start; min-height: 60px; }
.sloupec.cil .karty { background: var(--accent-muted); outline: 2px dashed var(--accent); outline-offset: -6px; border-radius: var(--radius); }

.karta {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 10px; cursor: pointer; display: grid; gap: 6px;
  transition: background .15s var(--ease), border-color .15s var(--ease);
  user-select: none;
}
.karta:hover { background: var(--bg-card-hover); border-color: var(--border-strong); }
.karta:focus-visible { outline: 2px solid var(--accent); }
.karta.taha { opacity: .4; }
.karta-hlava { display: flex; gap: 6px; align-items: flex-start; }
.karta-firma { font-weight: 600; flex: 1; overflow-wrap: anywhere; }
.karta-popis { color: var(--text-secondary); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.karta-pata { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.karta-pata .mezera { flex: 1; }
.karta.nova { border-left: 3px solid var(--accent); }

.cip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 550;
  padding: 1px 7px; border-radius: 99px; background: var(--bg-input); color: var(--text-secondary);
  white-space: nowrap;
}
.cip-web { background: var(--accent-dim); color: #9cc0ff; }
.cip-termin { background: var(--bg-input); }
.cip-po-terminu { background: var(--danger-dim); color: #ff8a8a; }
.cip-zakaznik { background: var(--success-dim); color: var(--success); }
.cip-odpoved { background: var(--warning-dim); color: var(--warning); }
.cip-navrh { background: rgba(176, 132, 255, .16); color: #c7a8ff; }

/* návrhy AI a e-maily v detailu */
.navrh { background: rgba(176, 132, 255, .08); border: 1px solid rgba(176, 132, 255, .35); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 6px; }
.navrh-zmena { font-weight: 600; }
.navrh .radek { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.emaily { display: grid; gap: 6px; }
.email { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); }
.email > summary { list-style: none; cursor: pointer; padding: 8px 10px; display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: start; }
.email > summary::-webkit-details-marker { display: none; }
.email[open] > summary { border-bottom: 1px solid var(--border); }
.email-smer { font-size: 13px; line-height: 20px; }
.email-hlava { min-width: 0; }
.email-predmet { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-shrnuti { color: var(--text-secondary); font-size: 12.5px; }
.email-datum { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.email-telo { padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; max-height: 420px; overflow-y: auto; }
.email-meta { padding: 0 12px 10px; font-size: 12px; color: var(--text-muted); display: grid; gap: 2px; }
.email.odeslany .email-smer { color: var(--accent); }
.email.prijaty .email-smer { color: var(--success); }
.skore { display: inline-flex; gap: 2px; }
.skore i { width: 6px; height: 6px; border-radius: 2px; background: var(--border-strong); }
.skore i.ano { background: var(--accent); }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 10px; font-weight: 700; background: #3a4060; color: var(--text-primary); flex: none;
}
.prazdny { color: var(--text-muted); font-size: 12px; text-align: center; padding: 14px 6px; }

/* ---------- výsuvný panel detailu ---------- */
.panel-pozadi { position: fixed; inset: 0; background: rgba(10, 12, 24, .55); z-index: 40; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); z-index: 41;
  background: var(--bg-surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: vyjed .2s var(--ease);
}
@keyframes vyjed { from { transform: translateX(30px); opacity: 0; } }
.panel-hlava { padding: 16px 20px 12px; border-bottom: 1px solid var(--border); display: grid; gap: 10px; }
.panel-hlava .radek { display: flex; gap: 10px; align-items: flex-start; }
.panel-hlava h2 { flex: 1; overflow-wrap: anywhere; }
.panel-telo { overflow-y: auto; padding: 16px 20px 24px; display: grid; gap: 20px; align-content: start; flex: 1; }
.faze-volba { display: flex; flex-wrap: wrap; gap: 4px; }
.faze-volba button {
  border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text-secondary);
  border-radius: 99px; padding: 4px 11px; font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer;
}
.faze-volba button:hover { color: var(--text-primary); }
.faze-volba button.aktivni { background: var(--accent); border-color: var(--accent); color: #fff; }
.faze-volba button[data-faze="zakaznik"].aktivni { background: #1f9e55; border-color: #1f9e55; }
.faze-volba button[data-faze="ztraceno"].aktivni { background: #6b7592; border-color: #6b7592; }

.sekce { display: grid; gap: 10px; }
.sekce > h3 { color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.mrizka { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.mrizka .cela { grid-column: 1 / -1; }
.zprava-web {
  background: var(--bg-input); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.agent-box { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 6px; font-size: 13px; }
.agent-box dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; }
.agent-box dt { color: var(--text-muted); }
.agent-box dd { margin: 0; overflow-wrap: anywhere; }

.historie { display: grid; gap: 0; }
.udalost { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.udalost:first-child { border-top: 0; }
.udalost-ikona { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--bg-card); }
.udalost-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.udalost .mini { display: flex; gap: 8px; align-items: center; }
.nova-poznamka { display: grid; gap: 8px; }
.nova-poznamka .radek { display: flex; justify-content: flex-end; gap: 8px; }
.panel-pata { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.panel-pata .mezera { flex: 1; }
.ulozeno { font-size: 12px; color: var(--success); opacity: 0; transition: opacity .3s; }
.ulozeno.vidi { opacity: 1; }

/* ---------- karty obsahu (souhrn, import, přístupy) ---------- */
.plocha { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.mrizka-souhrn { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 12px; }
.dlazdice { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; }
.dlazdice .popis { color: var(--text-secondary); font-size: 12.5px; }
.dlazdice .cislo { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dlazdice .pozn { font-size: 12px; color: var(--text-muted); }
.dva-sloupce { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); margin-bottom: 12px; }
.plocha > h2, .plocha > h3 { margin-bottom: 12px; }

.trychtyr { display: grid; gap: 8px; }
.trychtyr-radek { display: grid; grid-template-columns: 90px 1fr 92px; gap: 10px; align-items: center; font-variant-numeric: tabular-nums; }
.trychtyr-radek .nazev { color: var(--text-secondary); font-size: 13px; }
.trychtyr-radek .hodnota { text-align: right; font-size: 13px; }
.trychtyr-radek .hodnota small { color: var(--text-muted); display: block; font-size: 11.5px; }
.pruh-draha { height: 18px; position: relative; }
.pruh { height: 100%; min-width: 2px; background: var(--accent); border-radius: 0 4px 4px 0; transition: width .4s var(--ease); }
.trychtyr-radek:hover .pruh { background: #6aa3ff; }
.trychtyr-radek[data-faze="ztraceno"] .pruh { background: #4a5170; }

table.tabulka { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabulka th, .tabulka td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tabulka th { color: var(--text-muted); font-weight: 550; font-size: 12px; }
.tabulka td.cislo, .tabulka th.cislo { text-align: right; }
.tabulka tbody tr:hover { background: var(--bg-card); }
.tabulka tr.klik { cursor: pointer; }
.posun-tabulky { overflow-x: auto; }

/* import */
.upusteni {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 28px; text-align: center;
  display: grid; gap: 10px; justify-items: center; color: var(--text-secondary); cursor: pointer;
}
.upusteni.nad { border-color: var(--accent); background: var(--accent-muted); }
.stav-importu { font-size: 12px; font-weight: 600; }
.stav-novy { color: var(--success); }
.stav-zmena { color: var(--warning); }
.stav-beze { color: var(--text-muted); }
.stav-chyba { color: var(--danger); }

/* přístupy */
.klic-box { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; overflow-wrap: anywhere; user-select: all; }
pre.kod { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; margin: 0; white-space: pre; }

/* dialog nové karty */
dialog.dialog {
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-surface);
  color: var(--text-primary); padding: 0; width: min(520px, calc(100% - 32px)); box-shadow: var(--shadow-lg);
}
dialog.dialog-siroky { width: min(680px, calc(100% - 32px)); }
dialog.dialog .tabulka th { width: 110px; }
dialog.dialog::backdrop { background: rgba(10, 12, 24, .6); }
dialog.dialog form { display: grid; gap: 14px; padding: 20px; }
dialog.dialog .radek { display: flex; justify-content: flex-end; gap: 8px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 60;
  background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 10px 16px; box-shadow: var(--shadow-md); transition: all .25s var(--ease); max-width: calc(100% - 32px);
}
.toast.vidi { opacity: 1; transform: translate(-50%, 0); }
.toast-chyba { border-color: var(--danger); }
.toast-ok::before { content: "✓ "; color: var(--success); font-weight: 700; }

.nacitani { color: var(--text-muted); padding: 40px; text-align: center; }

/* ---------- mobil ---------- */
@media (max-width: 760px) {
  .hlavicka { flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; }
  .zalozky { order: 3; flex-basis: 100%; }
  .uzivatel { margin-left: auto; }
  #u-jmeno { display: none; }
  .obsah { padding: 12px 16px 32px; }
  .lista input[type="search"] { width: 100%; }
  .kanban { grid-auto-columns: 82%; scroll-snap-type: x mandatory; }
  .sloupec { scroll-snap-align: start; max-height: none; }
  .mrizka { grid-template-columns: 1fr; }
  .dva-sloupce { grid-template-columns: 1fr; }
  .panel-hlava, .panel-telo, .panel-pata { padding-left: 16px; padding-right: 16px; }
}
