:root{
    --kcfg-bg: rgba(255,255,255,0.72);
    --kcfg-glass: rgba(255,255,255,0.62);
    --kcfg-border: rgba(15, 23, 42, 0.10);
    --kcfg-text: #0a0a0a;
    --kcfg-muted: rgba(9, 9, 11, 0.62);
    
    --kcfg-shadow: 0 30px 80px rgba(0,0,0,0.18);
    --kcfg-shadow-soft: 0 14px 38px rgba(0,0,0,0.12);
    
    --kcfg-radius-xl: 22px;
    --kcfg-radius-lg: 18px;
    --kcfg-radius-md: 14px;
    
    --kcfg-ring: 0 0 0 1px var(--kcfg-border);
    
    --kcfg-primary: #111827; /* almost-black */
    --kcfg-primary-2: #0f172a;
    --kcfg-primary-soft: rgba(17, 24, 39, 0.08);
    
    --kcfg-good: #16a34a;
    --kcfg-warn: #f59e0b;
    
    --kcfg-fz: 14px;
}

@media (prefers-reduced-motion: reduce){
    .kcfg *{ animation: none !important; transition: none !important; }
}

/* --- Modal container --- */
.kcfg{
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    font-size: var(--kcfg-fz);
    color: var(--kcfg-text);
}

.kcfg.is-open{ display: block; }

.kcfg__backdrop{
    position: absolute;
    inset: 0;
    background:
            radial-gradient(1200px 600px at 20% 10%, rgba(255,255,255,0.60), transparent 55%),
            radial-gradient(900px 500px at 80% 30%, rgba(255,255,255,0.40), transparent 60%),
            rgba(0,0,0,0.52);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    animation: kcfgFadeIn 220ms ease forwards;
}

@keyframes kcfgFadeIn{
    from{ opacity: 0; }
    to{ opacity: 1; }
}

.kcfg__panel{
    position: absolute;
    left: 50%;
    top: 52%;
    transform: translate(-50%, -50%);
    width: min(1320px, calc(100vw - 22px));
    height: min(86vh, 900px);
    border-radius: var(--kcfg-radius-xl);
    background: linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.74));
    box-shadow: var(--kcfg-shadow);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.35);
    opacity: 0;
    animation: kcfgPop 220ms cubic-bezier(.2,.95,.2,1) forwards;
}

@keyframes kcfgPop{
    from{ opacity: 0; transform: translate(-50%, -48%) scale(0.985); }
    to{ opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* --- Header --- */
.kcfg__header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background:
            radial-gradient(700px 220px at 15% 0%, rgba(0,0,0,0.06), transparent 55%),
            linear-gradient(180deg, rgba(255,255,255,0.90), rgba(255,255,255,0.70));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.kcfg__brand{
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.kcfg__chip{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.06);
    border: 1px solid rgba(17, 24, 39, 0.10);
    font-weight: 800;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.kcfg__titleRow{
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.kcfg__title{
    font-size: 16px;
    font-weight: 900;
    letter-spacing: -0.2px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kcfg__beta{
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.10);
    color: rgba(15, 23, 42, 0.72);
}

.kcfg__sub{
    font-size: 12px;
    color: rgba(15, 23, 42, 0.62);
    margin-top: 2px;
    white-space: nowrap;
}

.kcfg__headActions{
    display: flex;
    align-items: center;
    gap: 8px;
}

.kcfg__iconBtn{
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: rgba(255,255,255,0.75);
    box-shadow: 0 8px 18px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 140ms ease, background 140ms ease;
}

.kcfg__iconBtn:hover{ transform: translateY(-1px); background: rgba(255,255,255,0.92); }

.kcfg__close{
    width: 38px;
    height: 38px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255,255,255,0.8);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: transform 140ms ease, background 140ms ease;
}

.kcfg__close:hover{ transform: translateY(-1px); background: rgba(255,255,255,0.95); }

/* --- Body grid --- */
.kcfg__body{
    height: calc(100% - 68px);
    display: grid;
    grid-template-columns: 360px 1fr 360px;
    gap: 12px;
    padding: 12px;
    overflow: hidden;
}

/* columns scroll */
.kcfg__left,
.kcfg__center,
.kcfg__right{
    overflow: auto;
    padding-right: 2px;
    scrollbar-width: thin;
}

.kcfg__left::-webkit-scrollbar,
.kcfg__center::-webkit-scrollbar,
.kcfg__right::-webkit-scrollbar{
    width: 10px;
}
.kcfg__left::-webkit-scrollbar-thumb,
.kcfg__center::-webkit-scrollbar-thumb,
.kcfg__right::-webkit-scrollbar-thumb{
    background: rgba(0,0,0,0.18);
    border-radius: 999px;
    border: 3px solid rgba(255,255,255,0.6);
}

/* --- Cards --- */
.kcfg__card{
    border-radius: var(--kcfg-radius-lg);
    background: var(--kcfg-bg);
    border: 1px solid rgba(15, 23, 42, 0.10);
    box-shadow: var(--kcfg-shadow-soft);
    padding: 14px;
    margin-bottom: 12px;
}

.kcfg__card--glass{
    background: linear-gradient(180deg, rgba(255,255,255,0.62), rgba(255,255,255,0.42));
    border: 1px solid rgba(255,255,255,0.45);
    box-shadow: 0 18px 48px rgba(0,0,0,0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.kcfg__cardHead{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.kcfg__cardTitle{
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.2px;
    color: rgba(15, 23, 42, 0.74);
}

.kcfg__miniActions{
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- Inputs --- */
.kcfg__label{
    font-size: 12px;
    font-weight: 800;
    color: rgba(15, 23, 42, 0.70);
    margin-bottom: 6px;
}

.kcfg__field{ margin-bottom: 12px; }

.kcfg__input{
    width: 100%;
    height: 40px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255,255,255,0.85);
    padding: 0 12px;
    outline: none;
    color: rgba(15, 23, 42, 0.92);
    transition: box-shadow 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.kcfg__input:focus{
    border-color: rgba(15, 23, 42, 0.24);
    box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.08);
}

.kcfg__grid2{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.kcfg__grid3{
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.kcfg__miniTop{
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(15, 23, 42, 0.62);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 6px;
}

/* range */
.kcfg__range{
    width: 100%;
    accent-color: #111827;
    height: 22px;
}

/* --- Segmented controls --- */
.kcfg__seg{
    display: flex;
    gap: 6px;
    padding: 6px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.10);
}

.kcfg__seg button{
    flex: 1;
    height: 38px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: rgba(255,255,255,0.80);
    cursor: pointer;
    font-weight: 900;
    color: rgba(15, 23, 42, 0.70);
    transition: transform 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.kcfg__seg button:hover{ transform: translateY(-1px); }

.kcfg__seg button.is-on{
    background: rgba(17,24,39,0.92);
    color: rgba(255,255,255,0.96);
    box-shadow: 0 14px 26px rgba(0,0,0,0.18);
}

/* --- Checks --- */
.kcfg__check{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: 40px;
    padding: 0 12px;
    border-radius: 14px;
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(15, 23, 42, 0.10);
    font-weight: 700;
    color: rgba(15, 23, 42, 0.75);
}

.kcfg__check input{ width: 16px; height: 16px; }

/* --- Buttons --- */
.kcfg__actions{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.kcfg__btn{
    height: 44px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255,255,255,0.90);
    font-weight: 900;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    text-decoration: none;
    color: rgba(15, 23, 42, 0.92);
}

.kcfg__btn:hover{
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.98);
}

.kcfg__btn--primary{
    background: rgba(17,24,39,0.94);
    color: rgba(255,255,255,0.96);
    border-color: rgba(17,24,39,0.35);
}

.kcfg__btn--primary:hover{
    background: rgba(17,24,39,1);
    box-shadow: 0 18px 36px rgba(0,0,0,0.22);
}

.kcfg__pillBtn{
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255,255,255,0.82);
    padding: 0 10px;
    cursor: pointer;
    font-weight: 900;
    transition: transform 140ms ease, background 140ms ease;
}

.kcfg__pillBtn:hover{ transform: translateY(-1px); background: rgba(255,255,255,0.96); }

.kcfg__note{
    margin-top: 10px;
    font-size: 12px;
    color: rgba(15, 23, 42, 0.58);
}

/* --- Modules list --- */
.kcfg__modules{
    display: grid;
    gap: 10px;
}

.kcfg__modRow{
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255,255,255,0.82);
    padding: 10px;
    display: grid;
    grid-template-columns: 86px 1fr 40px;
    gap: 10px;
    align-items: center;
    transition: transform 140ms ease, box-shadow 140ms ease;
}

.kcfg__modRow:hover{
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(0,0,0,0.12);
}

.kcfg__modType{
    font-size: 11px;
    font-weight: 900;
    color: rgba(15, 23, 42, 0.72);
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 999px;
    padding: 6px 10px;
    width: fit-content;
}

.kcfg__modGrid{
    display: grid;
    grid-template-columns: 1.1fr 0.9fr 0.9fr 1fr;
    gap: 8px;
}

.kcfg__modGrid select{
    height: 36px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255,255,255,0.92);
    padding: 0 10px;
    font-weight: 800;
    color: rgba(15, 23, 42, 0.88);
}

.kcfg__modGrid .kcfg__mini{
    font-size: 11px;
    color: rgba(15, 23, 42, 0.60);
    font-weight: 800;
    padding: 0 2px;
}

.kcfg__trash{
    width: 40px;
    height: 40px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255,255,255,0.92);
    cursor: pointer;
    font-size: 16px;
    transition: transform 140ms ease, background 140ms ease;
}

.kcfg__trash:hover{ transform: translateY(-1px); background: rgba(255,255,255,1); }

/* --- Center preview --- */
.kcfg__plan{
    border-radius: 18px;
    border: 1px dashed rgba(15, 23, 42, 0.20);
    background:
            radial-gradient(900px 300px at 10% 0%, rgba(0,0,0,0.06), transparent 55%),
            linear-gradient(135deg, rgba(255,255,255,0.65), rgba(255,255,255,0.35));
    padding: 12px;
    min-height: 210px;
}

.kcfg__planInner{
    height: 100%;
    border-radius: 16px;
    background: rgba(255,255,255,0.50);
    border: 1px solid rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.kcfg__planHint{
    color: rgba(15, 23, 42, 0.65);
    font-weight: 800;
    font-size: 12px;
    line-height: 1.35;
}

/* elevation */
.kcfg__pill{
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.10);
    font-weight: 900;
    color: rgba(15, 23, 42, 0.72);
    display: inline-flex;
    align-items: center;
}

.kcfg__elevWrap{
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255,255,255,0.82);
    padding: 10px;
    overflow: hidden;
}

.kcfg__elev{
    width: 100%;
    height: 300px;
    display: block;
}

/* --- Right summary --- */
.kcfg__kv{
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 8px 10px;
    margin-top: 6px;
    font-size: 13px;
}

.kcfg__k{
    color: rgba(15, 23, 42, 0.58);
    font-weight: 800;
}

.kcfg__v{
    color: rgba(15, 23, 42, 0.92);
    font-weight: 900;
}

.kcfg__priceBox{
    margin-top: 12px;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: rgba(255,255,255,0.86);
    padding: 12px;
}

.kcfg__row{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    color: rgba(15, 23, 42, 0.84);
    font-weight: 900;
}

.kcfg__row--total{
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid rgba(15, 23, 42, 0.10);
    font-size: 15px;
}

.kcfg__warn{
    margin-top: 10px;
    border-radius: 16px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.12);
    padding: 10px;
}

.kcfg__warnTitle{
    font-weight: 900;
    color: rgba(146, 64, 14, 0.92);
    margin-bottom: 6px;
}

.kcfg__warnList{
    margin: 0;
    padding-left: 18px;
    color: rgba(146, 64, 14, 0.92);
    font-weight: 800;
    font-size: 12px;
}

.hidden{ display: none !important; }

.kcfg__cta{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.kcfg__tiny{
    margin-top: 10px;
    font-size: 12px;
    color: rgba(15, 23, 42, 0.58);
}

.kcfg__presetGrid{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.kcfg__preset{
    height: 44px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255,255,255,0.86);
    cursor: pointer;
    font-weight: 900;
    transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.kcfg__preset:hover{
    transform: translateY(-1px);
    background: rgba(255,255,255,0.98);
    box-shadow: 0 14px 26px rgba(0,0,0,0.10);
}

/* =========================================
   Responsive
   ========================================= */

@media (max-width: 1200px){
    .kcfg__body{
        grid-template-columns: 340px 1fr 340px;
    }
}

@media (max-width: 1024px){
    .kcfg__panel{
        top: 50%;
        height: min(90vh, 980px);
    }
    .kcfg__body{
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .kcfg__left,
    .kcfg__center,
    .kcfg__right{
        overflow: visible;
    }
    .kcfg__left,
    .kcfg__center,
    .kcfg__right{
        padding-right: 0;
    }
}

@media (max-width: 520px){
    .kcfg__title{ font-size: 15px; }
    .kcfg__sub{ display: none; }
    .kcfg__grid2{ grid-template-columns: 1fr; }
    .kcfg__grid3{ grid-template-columns: 1fr; }
    .kcfg__actions{ grid-template-columns: 1fr; }
    .kcfg__cta{ grid-template-columns: 1fr; }
    .kcfg__presetGrid{ grid-template-columns: 1fr; }
}

/* public/assets/kcfg/kcfg.css */

/* ===== Modal visibility + stacking ===== */
.kcfg-modal,
.qm {
    position: fixed;
    inset: 0;
    z-index: 9999; /* nad header, nad vším */
    display: none;
}

.kcfg-modal.is-open,
.qm.is-open {
    display: block;
}

.kcfg-backdrop,
.qm__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(8px);
}

/* Panel / dialog */
.kcfg-panel,
.qm__panel {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(1180px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow: hidden;              /* body bude scrollovat uvnitř */
    border-radius: 20px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 24px 80px rgba(0,0,0,.25);
    border: 1px solid rgba(0,0,0,.06);
}

/* vnitřní scroll */
.kcfg-body,
.qm__body {
    max-height: calc(100vh - 120px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

/* Když je málo místa nahoře (mobile safari safe area) */
@supports (padding: max(0px)) {
    .kcfg-panel,
    .qm__panel {
        max-height: calc(100vh - max(24px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom)));
    }
}

/* ===== Floating CTA (spodní roh) ===== */
.kcfg-fab {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 999px;
    background: #0a0a0a;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 18px 50px rgba(0,0,0,.22);
}

.kcfg-fab:hover { opacity: .95; }
.kcfg-fab:active { transform: translateY(1px); }

@media (min-width: 1024px){
    /* na desktopu klidně schováme FAB, protože je v headeru */
    .kcfg-fab { display: none; }
}

.kcfg-modRow,
.qm__modRow,
.modules-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 768px){
    .kcfg-modRow,
    .qm__modRow,
    .modules-row {
        grid-template-columns: 120px 1fr 1fr 1fr 1fr 80px;
        align-items: center;
    }
}

/* selecty/inputy nesmí přetékat */
.kcfg-modRow select,
.kcfg-modRow input,
.qm__modRow select,
.qm__modRow input,
.modules-row select,
.modules-row input {
    max-width: 100%;
    width: 100%;
}

@media (min-width: 900px){
    .kcfg__modRow{
        grid-template-columns: 120px 1fr 52px;
        align-items:center;
    }
    .kcfg__modGrid{
        grid-template-columns: 140px 90px 110px 140px 90px 140px;
        align-items:center;
    }
}