/* Nový web GPM — společné prvky stránek, které zapisují (app-kit.js): tlačítka, hlášky, okna, formuláře, tabulky s akcemi
   a doplňky kostry adminu. Staví na proměnných z gpm.css a na vzhledu adminu (.adm, .fld, .inp, .pill, .note).
   Hranice jako v css-mobile.css: ≤ 1180 tablet na šířku · ≤ 900 tablet na výšku · ≤ 640 telefon. Popis tříd: port/KIT.md. */

/* ═════════ tlačítka jako <button> ═════════ */
button.btn { margin: 0; justify-content: center; cursor: pointer; -webkit-appearance: none; appearance: none; }
button.btn:not(.ghost) { border: 0; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.btn.dng { background: #ff5d6c; color: #fff; }
:where(.adm, .gmp, .mep, .kit-modal) .btn.dng:hover { box-shadow: 0 12px 28px -12px rgba(255,93,108,.85); }
.btn.ghost.dng { background: rgba(255,93,108,.06); border-color: rgba(255,93,108,.5); color: var(--loss); }
.btn.ghost.dng:hover { background: rgba(255,93,108,.14); border-color: rgba(255,93,108,.8); box-shadow: none; }
.btn.kit-busy { opacity: .75; }
.kit-spin { flex: none; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: kit-spin .7s linear infinite; }
@keyframes kit-spin { to { transform: rotate(360deg); } }
.kit-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ═════════ hlášky (G.toast) ═════════ */
#kit-toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 240; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: max-content; max-width: min(720px, calc(100vw - 32px)); pointer-events: none; }
:root:has(.kf-bar.sticky) #kit-toasts { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }      /* nad lištou s tlačítky, ať nezakryje Save */
.kit-toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; max-width: 100%; padding: 12px 10px 12px 15px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18); background: #17171d;
  box-shadow: 0 24px 60px rgba(0,0,0,.65); color: var(--ink2); font-size: 14px; line-height: 1.45; animation: vt-in .25s var(--e) both; }
.kit-toast .kit-ti { flex: none; width: 20px; height: 20px; margin-top: 1px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font: 800 12px/1 var(--fm); font-style: normal; }
.kit-toast .kit-tx { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.kit-toast .kit-tx b { color: #fff; font-weight: 700; }
.kit-toast .kit-ta { flex: none; margin-top: 3px; color: #fff; font: 800 11.5px var(--fd); font-stretch: 112%; letter-spacing: .1em; text-transform: uppercase; text-decoration: underline; text-underline-offset: 3px; }
.kit-toast .kit-tc { flex: none; width: 28px; height: 28px; margin: -3px 0; padding: 0; border: 0; border-radius: 8px; background: none; color: inherit; opacity: .7; font: 700 18px/1 var(--fm); cursor: pointer; }
.kit-toast .kit-tc:hover { opacity: 1; background: rgba(255,255,255,.1); }
.kit-toast.ok { border-color: rgba(61,220,151,.5); background: #10211b; color: #d6f5e7; } .kit-toast.ok .kit-ti { background: var(--win); color: #06231a; }
.kit-toast.err { border-color: rgba(255,93,108,.6); background: #2a1216; color: #ffd7da; } .kit-toast.err .kit-ti { background: #ff5d6c; color: #fff; }

/* ═════════ okna (G.modal, G.confirm, G.prompt) ═════════ */
html.kit-open { overflow: hidden; }
.kit-layer { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: max(9vh, 24px) 20px 24px; }
.kit-veil { position: absolute; inset: 0; background: rgba(6,6,9,.72); animation: vt-fade-in .2s ease both; }
.kit-modal { position: relative; display: flex; flex-direction: column; width: 540px; max-width: 100%; max-height: calc(100vh - max(9vh, 24px) - 24px); max-height: calc(100dvh - max(9vh, 24px) - 24px);
  border-radius: 16px; border: 1px solid rgba(255,255,255,.16); background: #15151b; box-shadow: 0 30px 80px rgba(0,0,0,.7); outline: none; animation: vt-in .3s var(--e) both; }
.kit-modal.sm { width: 450px; } .kit-modal.lg { width: 760px; } .kit-modal.xl { width: 1040px; }
.kit-modal.dng { border-color: rgba(255,93,108,.45); }
.km-h { flex: none; display: flex; align-items: flex-start; gap: 12px; padding: 22px 18px 0 26px; }
.km-h .km-t { flex: 1 1 auto; min-width: 0; margin: 2px 0 0; color: #fff; font: 900 17px/1.2 var(--fd); font-stretch: 120%; letter-spacing: .06em; text-transform: uppercase; overflow-wrap: anywhere; }
.km-h .lbl { flex: none; margin-top: 7px; }
.km-x { flex: none; width: 34px; height: 34px; margin: -6px 0 0; padding: 0; border: 0; border-radius: 9px; background: none; color: var(--mut); font: 500 22px/1 var(--fm); cursor: pointer; transition: background-color .15s, color .15s; }
.km-x:hover { background: rgba(255,255,255,.08); color: #fff; }
.km-b { flex: 1 1 auto; min-height: 0; padding: 14px 26px 24px; overflow-y: auto; overscroll-behavior: contain; color: var(--ink2); }
.km-text { margin: 0; color: var(--ink2); font-size: 14.5px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.km-text + .km-text, .km-b > .km-text + * { margin-top: 12px; }
.km-word { margin-top: 16px; }
/* slovo k opsání se musí ukázat přesně tak, jak se má napsat — žádná velká písmena ze stylu popisku */
.km-word label { text-transform: none; letter-spacing: .02em; }
.km-f { flex: none; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 14px 26px 20px; border-top: 1px solid var(--line); }
.kit-modal.km-locked .km-x { opacity: .3; pointer-events: none; }

/* ═════════ formuláře (G.f.*) ═════════ */
.kf { position: relative; align-content: start; }
.kf > label, .kf-lab { color: var(--mut); font: 500 10.5px/1.2 var(--fm); letter-spacing: .14em; text-transform: uppercase; }
.kf-req { color: var(--acc); font-weight: 700; }
.kf-tag { margin-left: 8px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); color: var(--mut); font-size: 9.5px; letter-spacing: .08em; }
.kin { display: block; width: 100%; min-width: 0; height: 40px; margin: 0; padding: 0 13px; border-radius: 9px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.04); color: #fff;
  font: 600 14px var(--fb); outline: none; transition: border-color .15s, background-color .15s, box-shadow .15s; }
input.kin { -webkit-appearance: none; appearance: none; }
.kin::placeholder { color: #6f7284; font-weight: 500; }
.kin:hover { border-color: rgba(255,255,255,.28); }
.kin:focus { border-color: var(--acc); background: rgba(255,255,255,.07); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 18%, transparent); }
.kin:disabled { opacity: .5; cursor: default; }
.kin[readonly] { border-style: dashed; color: var(--mut); }
select.kin { padding-right: 8px; color-scheme: dark; cursor: pointer; } select.kin option, select.kin optgroup { background: #16161c; color: #fff; }
textarea.kin { height: auto; min-height: 92px; padding: 10px 13px; line-height: 1.45; resize: vertical; }
.kin.kin-n { font-family: var(--fm); letter-spacing: .02em; }
.kin-u { position: relative; display: block; } .kin-u > .kin { padding-right: 46px; }
.kin-u > i { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--mut); font: 500 12px/1 var(--fm); font-style: normal; pointer-events: none; }
.kf.bad .kin, .kin[aria-invalid="true"] { border-color: var(--loss); background: rgba(255,93,108,.06); }
.kf.bad .kin:focus { box-shadow: 0 0 0 3px rgba(255,93,108,.2); }
.kf-hint { color: var(--mut); font-size: 12.5px; line-height: 1.4; }
.kf-err { color: #ff8a95; font-size: 12.5px; font-weight: 600; line-height: 1.4; } .kf-err[hidden] { display: none; }
.kf-row { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 14px 16px; align-items: start; }
.kf-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; } .kf-body > * { min-width: 0; margin-top: 0; }
/* zaškrtávací políčko */
.kf-chk { position: relative; display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.kf-chk input { position: absolute; left: 0; top: 0; width: 22px; height: 22px; margin: 0; opacity: 0; cursor: pointer; }
.kf-chk > i { flex: none; width: 20px; height: 20px; margin-top: 1px; display: grid; place-items: center; border-radius: 6px; border: 1.5px solid rgba(255,255,255,.3); background: rgba(255,255,255,.04); transition: background-color .15s, border-color .15s; }
.kf-chk:hover > i { border-color: rgba(255,255,255,.5); }
.kf-chk input:checked + i { border-color: var(--acc); background: var(--acc); }
.kf-chk input:checked + i::after { content: ""; width: 10px; height: 5px; border: solid var(--on); border-width: 0 0 2.5px 2.5px; transform: translateY(-1.5px) rotate(-45deg); }
.kf-chk input:focus-visible + i { outline: 2px solid var(--acc); outline-offset: 2px; }
.kf-chk input:disabled ~ * { opacity: .5; }
.kf-chk b { display: block; color: #fff; font: 600 14.5px/1.35 var(--fb); } .kf-chk small { display: block; margin-top: 3px; color: var(--mut); font: 400 12.5px/1.4 var(--fb); }
.kf-chk.bad > i { border-color: var(--loss); } .kf-chk small.kf-err { color: #ff8a95; font-weight: 600; } .kf-chk small.kf-err[hidden] { display: none; }
/* přepínač z několika možností */
.kf-seg { display: inline-flex; justify-self: start; max-width: 100%; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; background: rgba(255,255,255,.04); overflow: hidden; }
.kf-seg label { position: relative; display: flex; flex: 0 1 auto; min-width: 0; margin: 0; cursor: pointer; }
.kf-seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.kf-seg span { display: flex; align-items: center; justify-content: center; height: 38px; min-width: 0; padding: 0 15px; color: var(--mut); font: 700 11.5px/1 var(--fd); font-stretch: 112%; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
  transition: background-color .15s, color .15s; }
.kf-seg label + label span { border-left: 1px solid rgba(255,255,255,.1); }
.kf-seg input:hover + span { background: rgba(255,255,255,.08); color: #fff; }
.kf-seg input:checked + span { background: var(--grad); color: var(--on); }
.kf-seg input:focus-visible + span { outline: 2px solid var(--acc); outline-offset: -2px; }
.kf-seg input:disabled + span { opacity: .5; }
/* oddíl formuláře */
.kf-sec + .kf-sec { margin-top: 20px; }
.kf-sec > h3 + .kf-desc { margin-top: -6px; }
.kf-desc { margin: 0 0 18px; max-width: 780px; color: var(--mut); font-size: 13.5px; line-height: 1.5; }
.kf-sec.danger > h3 { color: var(--loss); }
/* upozornění */
.kf-notebox { align-items: flex-start; margin-bottom: 20px; line-height: 1.45; } .kf-notebox > span { flex: none; font-size: 17px; line-height: 1.25; } .kf-notebox b { color: #fff; }
.kf-notebox.bad { border-color: rgba(255,93,108,.55); background: rgba(255,93,108,.09); color: #ffd7da; } .kf-notebox.bad > span { color: #ff8a95; font-weight: 800; }
/* lišta s tlačítky */
.kf-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-top: 20px; }
.kf-bar .kf-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-left: auto; }
.kf-bar .kf-note { min-width: 0; color: var(--mut); font-size: 13px; line-height: 1.4; }
.kf-unsaved { display: none; align-items: center; gap: 8px; color: var(--gold); font: 600 11px/1 var(--fm); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.kf-unsaved::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.is-dirty .kf-unsaved { display: inline-flex; }
.kf-bar.sticky { position: sticky; bottom: 0; z-index: 30; margin: 20px -14px 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: rgba(11,11,14,.94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
/* prázdný stav */
.kf-empty:not(.card) { padding: 30px 16px; text-align: center; } .kf-empty:not(.card) b { display: block; color: #fff; font: 800 17px var(--fb); } .kf-empty:not(.card) p { margin: 8px 0 0; color: var(--mut); }
.kf-eact { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }

/* ═════════ tabulka s akcemi (G.f.table) ═════════ */
.kt-wrap { min-width: 0; }
.kt td { vertical-align: middle; }
.kt th.kt-ah, .kt td.kt-acts { width: 1px; padding-right: 0; white-space: nowrap; }      /* ne v procentech: na tabletu se šířka tabulky počítá z obsahu a procenta by ji roztáhla stonásobně */
.kt td.kt-acts > span { display: inline-flex; justify-content: flex-end; gap: 6px; }
.kt .btn.sm { height: 30px; padding: 0 11px; font-size: 11px; }
.kt td .kin { height: 34px; }
.kt tr.kt-none td { color: var(--mut); font-family: var(--fb); }

/* ═════════ přístup a kostra adminu ═════════ */
.kit-gate p { max-width: 620px; margin-left: auto; margin-right: auto; line-height: 1.55; } .kit-gate strong { color: #fff; font-weight: 700; }
.kit-gate .kit-gate-hint { font-size: 13px; }
.kit-gate .row { justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.atop { min-height: 36px; }      /* nadpis stojí stejně vysoko, ať stránka vpravo nahoře tlačítka má, nebo ne */
.adesc { margin: -10px 0 20px; max-width: 820px; color: var(--mut); font-size: 14.5px; line-height: 1.5; }
.amain > .kf-notebox:first-of-type { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  .kit-toast, .kit-veil, .kit-modal { animation: none; }
}

/* ═════════ tablet na šířku a užší: dotyk ═════════ */
@media (max-width: 1180px) {
  .kin { height: 44px; } textarea.kin { height: auto; }
  .kf-seg span { height: 42px; }
  .kt .btn.sm { height: 36px; padding: 0 13px; }
  .kt td .kin { height: 40px; }
  .km-x { width: 40px; height: 40px; margin-top: -9px; }
  .kit-toast .kit-tc { width: 36px; height: 36px; margin: -7px 0; }
}

/* ═════════ tablet na výšku ═════════ */
@media (max-width: 900px) {
  /* nabídka adminu je řada posouvaná do strany: když pokračuje za okraj, pravý kraj se ztrácí */
  .amenu.kit-more { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent); }
  .kit-modal.lg, .kit-modal.xl { width: 100%; }
}

/* ═════════ telefon ═════════ */
@media (max-width: 640px) {
  /* 16 px v každém poli: iPhone jinak při ťuknutí přiblíží celou stránku */
  .kin, .adm input:not([type="checkbox"]):not([type="radio"]), .adm select, .adm textarea, .gmp input:not([type="checkbox"]):not([type="radio"]), .gmp select, .gmp textarea,
  .mep input:not([type="checkbox"]):not([type="radio"]), .mep select, .mep textarea, .kit-modal input:not([type="checkbox"]):not([type="radio"]), .kit-modal select, .kit-modal textarea { font-size: 16px; }
  .kf > label, .kf-lab { font-size: 11px; letter-spacing: .1em; }
  .kf-row { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .kf-row.p2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
  .kf-seg { display: flex; justify-self: stretch; } .kf-seg label { flex: 1 1 0; } .kf-seg span { flex: 1 1 auto; padding: 0 8px; font-size: 11px; letter-spacing: .06em; }
  .kf-desc { margin-bottom: 16px; }
  .kf-bar .kf-btns { flex: 1 1 100%; } .kf-bar .kf-btns .btn { flex: 1 1 auto; height: 44px; }
  .kf-eact .btn { flex: 1 1 auto; justify-content: center; }
  .adesc { margin-top: -4px; font-size: 14px; }
  #kit-toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: auto; max-width: none; transform: none; align-items: stretch; }
  :root:has(.kf-bar.sticky) #kit-toasts { bottom: calc(82px + env(safe-area-inset-bottom, 0px)); }
  /* okno přes celou šířku, obsah se posouvá uvnitř, tlačítka zůstávají dole na dosah palce */
  .kit-layer { padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
  .kit-modal, .kit-modal.sm, .kit-modal.lg, .kit-modal.xl { width: 100%; max-height: calc(100vh - 24px); max-height: calc(100dvh - max(12px, env(safe-area-inset-top, 0px)) - max(12px, env(safe-area-inset-bottom, 0px))); }
  .km-h { padding: 18px 10px 0 16px; } .km-h .km-t { font-size: 16px; }
  .km-b { padding: 12px 16px 18px; }
  .km-f { padding: 12px 16px 14px; } .km-f .btn { flex: 1 1 auto; height: 44px; }
  /* tabulka jako karty pod sebou (G.f.table se stack: true): první buňka je nadpis karty, ostatní „popisek: hodnota“ */
  table.t.kt.kt-stack, table.t.kt.kt-stack > tbody { display: block; min-width: 0; width: auto; overflow: visible; }
  .kt.kt-stack tr.kt-h { display: none; }
  .kt.kt-stack tr:not(.kt-h) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 13px 14px; margin-top: 8px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.02); }
  .kt.kt-stack tr.sel { border-color: rgba(242,212,104,.5); }
  .kt.kt-stack td { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 0; border: 0; background: none !important; box-shadow: none !important; white-space: normal; text-align: left; }
  .kt.kt-stack td:first-child { flex: 1 1 100%; }
  .kt.kt-stack td:not(:first-child):not(.kt-acts)::before { content: attr(data-th); flex: none; color: var(--mut); font: 500 10.5px/1 var(--fm); letter-spacing: .08em; text-transform: uppercase; }
  .kt.kt-stack td.kt-acts { flex: 1 1 100%; width: auto; } .kt.kt-stack td.kt-acts > span { display: flex; flex: 1 1 auto; } .kt.kt-stack td.kt-acts .btn { flex: 1 1 auto; height: 40px; }
  .kt.kt-stack tr.kt-none { display: block; }
  .kit-gate .row .btn { flex: 1 1 auto; justify-content: center; }
}
