/* Nabídkový systém CACAN - vzhled podle odsouhlaseného mockupu
   (odsouhlaseno 9. 8. 2026). Světlý styl, brand cyan #01ADD7, Neo Sans Pro
   pro nadpisy a záhlaví nabídky, zbytek system-ui. */

@font-face {
  font-family: 'Neo Sans Pro';
  src: url('../assets/NeoSansPro-Regular.otf') format('opentype');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Neo Sans Pro';
  src: url('../assets/NeoSansPro-Medium.otf') format('opentype');
  font-weight: 600; font-display: swap;
}
@font-face {
  font-family: 'Neo Sans Pro';
  src: url('../assets/NeoSansPro-Bold.otf') format('opentype');
  font-weight: 800; font-display: swap;
}

:root {
  --bg: #f2f5f7; --card: #ffffff; --ink: #1c2b33; --dim: #5d6f7a; --faint: #93a4ae;
  --line: #dfe7ec; --cyan: #01ADD7; --cyan-dark: #0189ab; --cyan-soft: #e5f6fb;
  --ok: #2e8b57; --warn: #c0622b; --bad: #c0392b; --produkt-bg: #e3ecf1; --r: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px; line-height: 1.5; padding: 24px 16px 80px;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1180px; margin: 0 auto; }
.screen {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 10px 30px -18px rgba(28, 43, 51, .25); padding: 26px 28px; margin-bottom: 44px;
}
.hidden { display: none !important; }

/* ---------------------------------------------------------------- hlavička */
.apphead {
  display: flex; align-items: center; gap: 18px; padding-bottom: 18px;
  border-bottom: 2px solid var(--cyan); margin-bottom: 22px;
}
.applogo { height: 24px; display: block; opacity: .92; }
.apphead h2 { font-size: 1.25rem; font-family: 'Neo Sans Pro', system-ui, sans-serif; }
.apphead .sub { font-size: .8rem; color: var(--faint); }
.apphead .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* ---------------------------------------------------------------- tlačítka */
.btn {
  display: inline-block; border: none; border-radius: 10px; padding: 13px 22px;
  font-family: inherit; font-size: 1rem; font-weight: 700; cursor: pointer;
  background: none; color: inherit; transition: filter .12s, background .12s;
}
.btn:hover { filter: brightness(.95); }
.btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.btn.primary { background: var(--cyan); color: #fff; }
.btn.big { font-size: 1.1rem; padding: 16px 28px; }
.btn.ghost { background: none; border: 1.5px solid var(--line); color: var(--dim); }
.btn.ghost:hover { background: var(--cyan-soft); }
.btn.small { padding: 8px 14px; font-size: .85rem; }
.btn.danger { color: var(--bad); }
.btn.arm { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ----------------------------------------------------------------- seznam */
table.list { width: 100%; border-collapse: collapse; font-size: .98rem; }
.list th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.list td { padding: 15px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list tr:hover td { background: var(--cyan-soft); }
.list .c { font-variant-numeric: tabular-nums; color: var(--dim); }
.list .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.list tr.konci td { background: #fffaf0; }
.list tr.konci:hover td { background: #fff3dd; }
.list .zakaznik { font-weight: 700; }
.list .platnost { font-size: .78rem; color: var(--warn); display: block; margin-top: 2px; }
.list .platnost.klid { color: var(--faint); }
.pill {
  font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 99px;
  cursor: pointer; border: none; font-family: inherit; white-space: nowrap;
}
.pill.sent { background: #e7f4ec; color: var(--ok); }
.pill.draft { background: #fdf1e6; color: var(--warn); }
.pill.won { background: #dff3e5; color: #1c6b3a; }
.pill.lost { background: #f2f2f2; color: #6b6b6b; }
.rowbtns { white-space: nowrap; text-align: right; }
.rowbtns .btn { margin-left: 4px; }
.emptylist { padding: 34px 10px; text-align: center; color: var(--dim); font-size: 1.05rem; }
.footbar {
  margin-top: 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 16px;
}
.footbar .zaloha-info { color: var(--faint); font-size: .85rem; margin-left: auto; }
.pruh {
  background: #fff6e0; border: 1px solid #e5c96b; border-radius: 10px;
  padding: 11px 16px; font-size: .9rem; color: #7a5c00; margin-bottom: 18px;
}
.pruh.red { background: #fdecea; border-color: #e9a49c; color: #96281b; }
.pruh.info { background: var(--cyan-soft); border-color: #a8dced; color: #075e75; }
.pruh b { display: block; margin-bottom: 2px; }
.pruh .btn { margin-top: 8px; margin-right: 6px; }

/* ----------------------------------------------------------------- editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 28px; align-items: start; }
/* pod ~1000 px se náhled přesune pod formulář, ať se nic nemačká */
@media (max-width: 1000px) { .editor { grid-template-columns: minmax(0, 1fr); } }
.sec { margin-bottom: 26px; }
.sec h3 {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--cyan-dark);
  font-weight: 800; margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
label.f { display: block; font-size: .78rem; font-weight: 600; color: var(--dim); margin-bottom: 4px; }
.inp {
  width: 100%; border: 1.5px solid var(--line); border-radius: 9px; padding: 11px 12px;
  font-size: 1rem; font-family: inherit; background: #fff; color: var(--ink);
}
.inp:focus { outline: 2px solid var(--cyan); border-color: var(--cyan); }
textarea.inp { resize: vertical; min-height: 90px; line-height: 1.55; font-size: .95rem; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.chip {
  border: 1.5px solid var(--line); border-radius: 99px; background: #fff; padding: 9px 16px;
  font-size: .9rem; font-weight: 600; color: var(--dim); cursor: pointer; font-family: inherit;
}
.chip.on { background: var(--cyan); border-color: var(--cyan); color: #fff; }
.check {
  display: flex; gap: 9px; align-items: center; font-size: .95rem; margin-top: 12px;
  font-weight: 600; color: var(--dim); cursor: pointer; user-select: none;
}
.box {
  width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--cyan);
  background: var(--cyan); position: relative;
}
.check .box { flex: none; }
.box.off { background: #fff; border-color: var(--line); }
.box:not(.off)::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(42deg);
}

/* ---------------------------------------------------------------- položky */
.items { width: 100%; border-collapse: collapse; font-size: .92rem; table-layout: fixed; }
.items th {
  text-align: left; font-size: .7rem; text-transform: uppercase; color: var(--faint); padding: 6px 8px;
}
.items td { padding: 10px 5px; border-top: 1px solid var(--line); vertical-align: middle; }
.items input {
  width: 100%; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px;
  font: inherit; background: transparent; color: inherit;
}
.items input:hover { border-color: var(--line); background: #fff; }
.items input:focus { outline: 2px solid var(--cyan); background: #fff; }
.items .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.items .num input { text-align: right; }
.items .qty { width: 56px; text-align: center; }
.items .qty input { text-align: center; }
.items .nazev-cell { display: flex; align-items: center; gap: 9px; }
.items .katalogcena { font-size: .7rem; color: var(--faint); padding: 0 8px 4px; display: block; }
.items .ks-nesouhlas { color: var(--warn); font-weight: 700; }
.thumb {
  width: 38px; height: 30px; object-fit: contain; flex: none;
  background: var(--produkt-bg); border-radius: 6px; padding: 2px;
}
span.thumb { background: none; }
.del {
  color: var(--bad); font-weight: 800; cursor: pointer; padding: 4px 9px; border-radius: 6px;
  border: none; background: none; font-family: inherit; font-size: .95rem;
}
.del.arm { background: var(--bad); color: #fff; font-size: .78rem; padding: 5px 9px; }
.addrow { margin-top: 12px; display: flex; gap: 10px; position: relative; }
.search { flex: 1; position: relative; }
.search .inp { padding-left: 38px; }
.search::before { content: "🔍"; position: absolute; left: 11px; top: 11px; font-size: .9rem; opacity: .5; }
.naseptavac {
  position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 4px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 10px;
  box-shadow: 0 14px 30px -12px rgba(28, 43, 51, .3); max-height: 320px; overflow-y: auto;
}
.naseptavac .polozka {
  padding: 10px 14px; cursor: pointer; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #f0f4f6;
}
.naseptavac .polozka:hover, .naseptavac .polozka.aktivni { background: var(--cyan-soft); }
.naseptavac .polozka .stitek {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--faint);
  border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; margin-left: auto; white-space: nowrap;
}
.naseptavac .polozka .cena { font-variant-numeric: tabular-nums; color: var(--dim); font-size: .88rem; }
.naseptavac .prazdno { padding: 14px; color: var(--faint); font-size: .9rem; }
.priplatky { margin-top: 10px; padding: 12px 14px; background: var(--cyan-soft); border-radius: var(--r); }
.priplatky .nadpis { font-size: .8rem; font-weight: 700; color: var(--cyan-dark); margin-bottom: 8px; }
.priplatky .btn { margin: 0 6px 6px 0; background: #fff; }
.hintline { font-size: .78rem; color: var(--faint); margin-top: 6px; }

/* -------------------------------------------------------------- parametry */
.par { display: flex; flex-direction: column; gap: 16px; }
.parbox { border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.parbox .t { font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stepper {
  display: inline-flex; align-items: center; border: 1.5px solid var(--line);
  border-radius: 9px; overflow: hidden;
}
.stepper button {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: var(--cyan-soft); color: var(--cyan-dark); font-size: 1.3rem; cursor: pointer;
  border: none; font-family: inherit; font-weight: 700;
}
.stepper button:hover { background: #d3eef7; }
.stepper span { width: 48px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.mrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .98rem; }
.mrow .total { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.mrow .total.neg { color: var(--bad); }
.mrow input.inp { width: 110px; text-align: right; }
.mrow input.inp.silne { font-weight: 800; }

/* ------------------------------------------------------------------ texty */
.textbox {
  border: 1.5px solid var(--line); border-radius: var(--r); padding: 12px 14px;
  font-size: .92rem; background: #fbfdfe; margin-bottom: 10px; line-height: 1.55;
}
.textbox .lbl {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--cyan-dark);
  font-weight: 800; margin-bottom: 5px; display: flex; justify-content: space-between;
  align-items: center; gap: 10px; flex-wrap: wrap;
}
.textbox .lbl em { color: var(--warn); font-style: normal; }
.textbox textarea {
  width: 100%; border: 1px solid transparent; background: transparent; font: inherit;
  color: inherit; resize: vertical; line-height: 1.55; padding: 4px; border-radius: 6px;
}
.textbox textarea:hover { border-color: var(--line); background: #fff; }
.textbox textarea:focus { outline: 2px solid var(--cyan); background: #fff; }
.mailnahled { white-space: pre-wrap; font-size: .9rem; color: var(--ink); }

/* ----------------------------------------------------------------- náhled */
.preview { position: sticky; top: 20px; align-self: start; min-width: 0; }
/* na úzkém okně (mobil = v2) ať scrolluje náhled, ne celá stránka */
@media (max-width: 700px) {
  .preview { overflow-x: auto; }
  .a4 { min-width: 460px; }
  .items { min-width: 460px; }
  .sec:has(.items) { overflow-x: auto; }
}
.previewhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.previewhead h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.a4 {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 26px -14px rgba(28, 43, 51, .35); padding: 26px 26px 20px;
  font-size: .72rem; line-height: 1.5; color: var(--ink);
}
.a4 .head {
  display: flex; justify-content: space-between; align-items: flex-end;
  border-bottom: 3px solid var(--cyan); padding-bottom: 12px; margin-bottom: 12px;
}
.a4 .head img { height: 34px; display: block; }
.a4 .head .doc { text-align: right; }
.a4 .head .l1 {
  font-size: 1.05rem; font-weight: 800; font-family: 'Neo Sans Pro', system-ui, sans-serif;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink);
}
.a4 .head .l2 { color: var(--dim); }
.a4 .cust { font-weight: 800; font-size: .85rem; margin-bottom: 2px; }
.a4 table { width: 100%; border-collapse: collapse; margin: 8px 0; font-variant-numeric: tabular-nums; }
.a4 th {
  font-size: .6rem; text-transform: uppercase; color: var(--faint); text-align: right;
  padding: 4px 5px; border-bottom: 1px solid var(--line);
}
.a4 th:first-child, .a4 td:first-child { text-align: left; }
.a4 td { padding: 5px; border-bottom: 1px solid #eef2f5; text-align: right; }
.a4.loose td { padding: 9px 5px; }
.a4.loose .sum td { padding: 5px; }
.a4 .neg { color: var(--bad); }
.a4 .sum td { border-bottom: none; padding: 3px 5px; }
.a4 .sum .big { font-size: .95rem; font-weight: 800; color: var(--cyan-dark); }
.a4 .args {
  margin: 10px 0; padding: 10px 12px; background: #f7fbfd; border-left: 3px solid var(--cyan);
  border-radius: 0 6px 6px 0; overflow: hidden;
}
.a4 .args img {
  float: right; width: 78px; margin: 0 0 6px 10px; background: var(--produkt-bg);
  border-radius: 6px; padding: 4px;
}
/* svítidlo s nejvyšší hodnotou v nabídce = hlavní vizuál, dostane víc prostoru */
.a4 .args.hero { background: #f2fafd; border-left-width: 4px; }
.a4 .args.hero img {
  width: 168px; padding: 8px; margin: 0 0 8px 14px; border-radius: 8px;
}
.a4 .args.hero b { font-size: 1.05em; }
.a4 .args b { display: block; margin-bottom: 2px; }
.a4 .foot {
  border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px;
  color: var(--faint); font-size: .62rem; line-height: 1.6;
}
.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ toast */
#toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 13px 24px; border-radius: 12px;
  font-weight: 700; font-size: .95rem; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 100;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5);
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------------------------------------------- modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(28, 43, 51, .45); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 16px; padding: 26px 28px; max-width: 560px; width: 100%;
  box-shadow: 0 26px 60px -20px rgba(0, 0, 0, .5);
}
.modal h3 { font-size: 1.15rem; margin-bottom: 12px; font-family: 'Neo Sans Pro', system-ui, sans-serif; }
.modal p { margin-bottom: 12px; color: var(--dim); font-size: .95rem; }
.modal .srovnani {
  background: var(--bg); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; font-size: .92rem;
}
.modal .srovnani div { margin-bottom: 6px; }
.modal .srovnani .varovani { color: var(--bad); font-weight: 700; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* --------------------------------------------------------------- blokace */
.blok {
  max-width: 620px; margin: 60px auto; background: #fff; border-radius: 16px;
  padding: 34px 36px; text-align: center; box-shadow: 0 10px 30px -18px rgba(28, 43, 51, .25);
}
.blok h2 { font-family: 'Neo Sans Pro', system-ui, sans-serif; margin-bottom: 12px; }
.blok p { color: var(--dim); margin-bottom: 18px; }
