/* ============================================================
   8in.cz — vlídný, klidný, "v dobrých rukou" styl
   Teplé světlé pozadí, uklidňující teal, měkké tvary.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
    /* Teplá, měkká paleta */
    --bg:        #f4f1ea;   /* teplý krém, ne klinická bílá */
    --bg-soft:   #efeadf;
    --card:      #fffdf9;   /* lehce krémová bílá */
    --ink:       #2f3a3a;   /* měkká tmavě šedozelená, ne černá */
    --muted:     #7c8786;
    --line:      #e7e0d3;

    --teal:      #2f9c95;   /* hlavní — klidná, pečující */
    --teal-deep: #277e78;
    --teal-soft: #e3f1ef;

    --apricot:   #f0a868;   /* teplý akcent pro vřelost */

    --ok-bg:  #e6f3ea; --ok-ink:  #2f7d4f;
    --err-bg: #fcebe8; --err-ink: #c0563f;   /* tlumená, ne křiklavá červená */
    --info-bg:#e8eef3; --info-ink:#3f6079;

    --radius:    16px;
    --radius-sm: 11px;
    --shadow:    0 6px 24px rgba(60, 75, 73, 0.08);
    --shadow-sm: 0 2px 10px rgba(60, 75, 73, 0.06);
}

* { box-sizing: border-box; }

/* vždy rezervuj místo pro svislý posuvník → stránka neškube při změně výšky */
html { scrollbar-gutter: stable; overflow-y: scroll; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background:
        radial-gradient(900px 500px at 85% -10%, #fbf4e9 0%, rgba(251,244,233,0) 60%),
        radial-gradient(700px 500px at -5% 0%, #eaf3f1 0%, rgba(234,243,241,0) 55%),
        var(--bg);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Horní lišta ---------- */
.topbar {
    background: rgba(255,253,249,0.85);
    backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid var(--line);
    padding: .9rem 0;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.topbar-contact { font-size: .92rem; color: var(--muted) !important; }
.topbar-contact:hover { color: var(--teal-deep) !important; }
.topbar a { text-decoration: none; color: var(--ink); }
.brand {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    color: var(--teal-deep);
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}
.brand::before {
    content: "";
    width: 22px; height: 22px;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--teal) 0%, #56b8b0 100%);
    box-shadow: inset 0 0 0 3px rgba(255,255,255,.55);
    display: inline-block;
}
.topbar nav a {
    margin-left: 1.3rem;
    color: var(--muted);
    font-weight: 500;
    font-size: .95rem;
    transition: color .15s;
}
.topbar nav a:hover { color: var(--teal-deep); }

/* ---------- Rozvržení ---------- */
.wrap { max-width: 880px; margin: 2.6rem auto; padding: 0 1.4rem; }
.narrow { max-width: 430px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2.1rem;
    box-shadow: var(--shadow);
}

/* jemný "pečující" pruh nahoře u přihlašovací karty */
.card.narrow {
    position: relative;
    overflow: hidden;
}
.card.narrow::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    background: linear-gradient(90deg, var(--teal) 0%, #5fc0b8 50%, var(--apricot) 100%);
}

/* ---------- Typografie ---------- */
h1 {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.7rem;
    margin: 0 0 .5rem;
    letter-spacing: -0.025em;
}
h2 { font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 1.2rem; margin: 0 0 .8rem; }
p.sub { color: var(--muted); margin: 0 0 1.4rem; font-size: 1.02rem; }

/* ---------- Formuláře ---------- */
label {
    display: block;
    font-size: .9rem;
    margin: 1.1rem 0 .35rem;
    font-weight: 600;
    color: #44524f;
}
input[type=text], input[type=email], input[type=password], input[type=tel] {
    width: 100%;
    padding: .75rem .85rem;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #b3bbba; }
input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 4px var(--teal-soft);
}

/* ---------- Tlačítka ---------- */
.btn {
    display: inline-block;
    margin-top: 1.5rem;
    padding: .8rem 1.4rem;
    background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    letter-spacing: .01em;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(47, 156, 149, 0.28);
    transition: transform .12s, box-shadow .15s, filter .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(47,156,149,.34); }
.btn:active { transform: translateY(0); }
.btn.secondary {
    background: #fff;
    color: var(--teal-deep);
    border: 1.5px solid var(--line);
    box-shadow: var(--shadow-sm);
}

/* ---------- Hlášky ---------- */
.alert {
    padding: .85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.2rem;
    font-size: .95rem;
    border: 1px solid transparent;
}
.alert.info { background: var(--info-bg); color: var(--info-ink); border-color: #d7e2ea; }
.alert.ok   { background: var(--ok-bg);   color: var(--ok-ink);   border-color: #cfe7d7; }
.alert.err  { background: var(--err-bg);  color: var(--err-ink);  border-color: #f3d4cd; }
.alert ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.alert li { margin: .15rem 0; }

/* ---------- Drobnosti ---------- */
.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 1rem; }
hr { border: none; border-top: 1px solid var(--line); margin: 1.6rem 0; }
a { color: var(--teal-deep); }
.card.narrow p.center a { font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
    .btn { transition: none; }
    .btn:hover { transform: none; }
}

/* ---------- Seznam osob ---------- */
.person-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1rem;
}
@media (max-width: 480px) {
    .person-grid { grid-template-columns: 1fr; }
}
.person-card {
    display: flex;
    align-items: center;
    gap: .9rem;
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.1rem 1.2rem;
    text-decoration: none;
    color: var(--ink);
}
.person-card:hover {
    transform: none;
}
.person-avatar {
    flex: 0 0 auto;
    width: 46px; height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal) 0%, #5fc0b8 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    text-transform: uppercase;
}
.person-info { flex: 1 1 auto; min-width: 0; }
.person-name {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.person-meta { color: var(--muted); font-size: .85rem; }
.person-arrow { color: var(--muted); font-size: 1.6rem; line-height: 1; }

/* ============================================================
   Karta (veřejná stránka pro nálezce + náhled v editoru)
   ============================================================ */
.public-page {
    background:
        radial-gradient(800px 500px at 50% -10%, #eaf3f1 0%, rgba(234,243,241,0) 60%),
        var(--bg);
    min-height: 100vh;
}
.public-wrap { max-width: 520px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.public-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.public-head {
    padding: 1.6rem 1.6rem 1.3rem;
    border-bottom: 1px solid var(--line);
    text-align: center;
}
.public-badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--teal-deep);
    background: var(--teal-soft);
    padding: .25rem .7rem;
    border-radius: 999px;
    margin-bottom: .6rem;
}
.public-name {
    font-family: 'Nunito', sans-serif;
    font-size: 1.6rem;
    margin: 0;
}

/* Záhlaví karty: jméno + věk + krevní skupina vlevo, foto vpravo */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 0.9rem 1.2rem 1.5rem;  /* menší okraj vpravo (u fotky) */
    border-bottom: 1px solid var(--line);
}
.ch-main { min-width: 0; }
.ch-name {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1.55rem;
    letter-spacing: -0.02em;
    line-height: 1.15;
    word-break: break-word;
}
.ch-meta { margin-top: .25rem; line-height: 1.3; }
.ch-age { color: var(--muted); font-size: 1rem; }
.ch-blood {
    color: #c0392b;
    font-weight: 800;
    font-size: 1.02rem;
    letter-spacing: .01em;
    white-space: nowrap;
}
.ch-photo { flex: 0 0 auto; }
.ch-photo img {
    width: 104px; height: 104px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--line);
    display: block;
}
.ch-photo-empty {
    width: 104px; height: 104px;
    border-radius: 14px;
    border: 1.5px dashed #cdd5d3;
    background: var(--bg-soft);
    color: #b3bdbb;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Kritický blok navrch — oranžový, výrazný ale vlídný */
.card-critical {
    margin: 1.2rem;
    border: 1.5px solid #f1c9a6;
    background: linear-gradient(180deg, #fff6ec 0%, #fffaf4 100%);
    border-radius: var(--radius-sm);
    padding: .3rem 1.1rem;
}

/* Obyčejné položky — prostě pod sebou, bez sekcí */
.card-normal {
    padding: .3rem 1.6rem 1rem;
}

/* Jedna položka: název vlevo, obsah vpravo */
.card-item {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: .7rem 0; border-bottom: 1px solid var(--line);
}
.card-item:last-child { border-bottom: none; }
.card-critical .card-item { border-bottom: 1px dashed #f0d6bd; }
.item-label { color: var(--ink); font-size: 1rem; flex: 0 0 auto; }
.item-value { font-weight: 600; text-align: right; min-width: 0; word-break: break-word; }
.item-value a { color: var(--teal-deep); }
.lock { font-size: .85rem; }

.card-empty { padding: 2rem 1.6rem; text-align: center; color: var(--muted); }

/* PIN box */
.pin-box {
    margin: 1.2rem; padding: 1.2rem;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.pin-box h3 { font-family: 'Nunito', sans-serif; margin: 0 0 .3rem; }

.public-foot {
    padding: 1.1rem; text-align: center;
    border-top: 1px solid var(--line);
    font-size: .8rem;
}

/* ============================================================
   Editor osoby — mobile-first (1 sloupec) -> desktop (3 sloupce)
   ============================================================ */
.editor-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem;
}
.back-link { text-decoration: none; font-size: .92rem; }
.token-chip {
    font-size: .85rem; color: var(--muted);
    background: var(--card); border: 1px solid var(--line);
    padding: .5rem .8rem; border-radius: 999px;
}
.token-chip a { font-weight: 600; }

textarea {
    width: 100%; padding: .75rem .85rem;
    border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    font-size: 1rem; font-family: inherit; background: #fff; color: var(--ink);
    resize: vertical;
}
textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }
select {
    width: 100%; padding: .7rem .85rem;
    border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    font-size: 1rem; font-family: inherit; background: #fff; color: var(--ink);
}
select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }

.field-row { display: flex; gap: 1rem; }
.field-row > div { flex: 1; }

/* hlavička sloupce se seznamem */
.col-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: .6rem; margin-bottom: .8rem; min-height: 2.4rem;
}
.col-head h2 { margin: 0; }

/* tlačítko Nová položka — normální teal, jen menší padding */
.btn-mini {
    flex: 0 0 auto;
    display: inline-block;
    padding: .5rem .9rem;
    background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 100%);
    color: #fff;
    border: none; border-radius: var(--radius-sm);
    font-size: .9rem; font-family: 'Nunito', sans-serif; font-weight: 700;
    text-decoration: none; cursor: pointer;
    box-shadow: 0 3px 10px rgba(47,156,149,.25);
    transition: transform .12s, box-shadow .15s;
}
.btn-mini:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(47,156,149,.32); }

/* tlačítko Použít: šedé když nic nezměněno, zelené při změně (jako Uložit) */
#apply-btn:disabled {
    background: #cfd6d4; color: #fff; box-shadow: none; cursor: default;
}
#apply-btn:disabled:hover { transform: none; box-shadow: none; }
#apply-btn.is-dirty {
    background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 100%);
    cursor: pointer;
}

/* náhled */
.preview-label { font-size: .8rem; margin-bottom: .6rem; }
.preview-label span { font-weight: 400; }
.preview-card {
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

/* seznam položek — jen typ + název + značky */
.item-list { display: flex; flex-direction: column; gap: .45rem; }
.item-row {
    display: flex; align-items: center; gap: .5rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: #fff; transition: border-color .12s;
}
.item-row:hover { border-color: #d5cdbd; }
.item-row.is-active { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-soft); }
.item-click {
    display: flex; align-items: center; gap: .4rem;
    flex: 1; min-width: 0; padding: .65rem .75rem;
    text-decoration: none; color: var(--ink);
}
.item-type {
    display: inline-block; flex: 0 0 auto; font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
    color: var(--teal-deep); background: var(--teal-soft);
    padding: .1rem .45rem; border-radius: 5px;
}
.item-row-label {
    font-weight: 600; min-width: 0; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.lock { font-size: .8rem; flex: 0 0 auto; }
.star { color: var(--apricot); flex: 0 0 auto; }
.del-form { flex: 0 0 auto; margin: 0; padding-right: .4rem; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer; padding: .35rem;
    border-radius: 7px; color: var(--muted);
}
.icon-btn:hover { background: var(--err-bg); color: var(--err-ink); }

/* === ROZVRŽENÍ: mobile-first === */
/* výchozí (mobil): jeden sloupec přes celou šířku */
.editor3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.2rem;
}
.col { min-width: 0; }

/* desktop: tři sloupce, editor vycentrovaný a omezený */
@media (min-width: 920px) {
    .editor3 {
        grid-template-columns: 0.85fr 1.1fr 1fr;
        gap: 1.3rem;
    }
    .preview-card { position: sticky; top: 80px; }
}

/* ---- Save bar (lišta s tlačítkem Uložit) ---- */
.save-bar {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 1rem; margin-bottom: 1rem;
    position: sticky; top: 64px; z-index: 5;
}
.save-bar .btn { margin-top: 0; }
#dirty-flag { font-size: .9rem; }

/* ---- 3b: editor položek ---- */
.field-err { color: var(--err-ink); font-size: .82rem; margin-top: .3rem; min-height: 1em; }
input.invalid { border-color: var(--err-ink); box-shadow: 0 0 0 3px var(--err-bg); }

.list-block { margin-bottom: .9rem; }
.list-block:last-child { margin-bottom: 0; }
.list-block-title {
    font-size: .72rem; font-weight: 800; letter-spacing: .05em;
    text-transform: uppercase; color: var(--muted); margin: .2rem 0 .4rem;
}

.edit-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.2rem; }
.btn-link { background: none; border: none; cursor: pointer; font-family: inherit; font-size: .95rem; }
.btn-link:hover { text-decoration: underline; }

/* zrušení tečkované čáry v kritickém bloku (z minula) */
.card-critical .card-item { border-bottom: none; padding: .55rem 0; }
.card-critical .card-item + .card-item { border-top: 1px solid #f3ddc4; }

/* ---- šipky pro přesun položek ---- */
.move-btns { display: flex; flex-direction: column; flex: 0 0 auto; padding-left: .4rem; }
.move-btn {
    background: none; border: none; cursor: pointer; color: var(--muted);
    font-size: .6rem; line-height: 1; padding: .15rem .2rem; border-radius: 4px;
}
.move-btn:hover:not([disabled]) { background: var(--teal-soft); color: var(--teal-deep); }
.move-btn[disabled] { opacity: .25; cursor: default; }

/* ---- vlastní modal (neuložené změny) ---- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(40,50,48,.45);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
    padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
    background: var(--card); border-radius: var(--radius);
    padding: 1.8rem; max-width: 420px; width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-box h3 { font-family: 'Nunito', sans-serif; margin: 0 0 .5rem; font-size: 1.2rem; }
.modal-actions { display: flex; flex-direction: row; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }
.modal-actions .btn { margin-top: 0; flex: 1 1 auto; min-width: 120px; text-align: center; white-space: nowrap; }
.btn-danger { background: #c0392b; }
.btn-danger:hover { background: #a93226; }
.btn-ghost { background: none; color: var(--muted); box-shadow: none; }
.btn-ghost:hover { background: var(--bg-soft); }

/* ---- velká dávka úprav: položky Adresa/Text doleva, checkbox, seznam ---- */
/* Adresa/Text: vše zarovnané doleva, název tučně nad obsahem */
.card-item-block { display: block; }
.item-label-top { font-weight: 700; color: var(--ink); margin-bottom: .15rem; }
.item-label-lockonly { font-weight: 400; }
.item-value-block { text-align: left; font-weight: 400; word-break: break-word; }
.item-value-block a { color: var(--teal-deep); }

/* checkbox "zobrazit název" v editoru */
.checkbox-row { margin: .2rem 0 1rem; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; font-weight: 400; cursor: pointer; }
.checkbox-label input { width: auto; margin: 0; }

/* seznam položek: název vlevo, nástroje (šipky+koš) vpravo */
.row-tools { display: flex; align-items: center; gap: .1rem; flex: 0 0 auto; padding-right: .4rem; }
.row-tools .move-btn { font-size: .7rem; padding: .2rem .25rem; }

/* záhlaví editoru: tlačítko Zpět nezabírá celou šířku */
.editor-head .btn { margin-top: 0; display: inline-block; width: auto; }

/* ---- mazání osoby na dashboardu ---- */
.person-card-wrap {
    display: flex;
    align-items: stretch;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform .12s, box-shadow .15s, border-color .15s;
    overflow: hidden;
}
.person-card-wrap:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: #d5cdbd;
}
.person-del {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    width: 52px;
    background: none; border: none; border-left: 1px solid var(--line);
    cursor: pointer; color: var(--muted);
    transition: background .15s, color .15s;
}
.person-del:hover { background: var(--err-bg); color: var(--err-ink); }
/* ať koš nepřekrývá šipku » */


/* ---- drobnosti: editor-head, save dirty, srdce ---- */
/* tři tlačítka v hlavičce editoru – rovnoměrně, nezalamovat zbytečně */
.editor-head { flex-wrap: nowrap; }
.editor-head > * { flex: 0 0 auto; }
.editor-head .btn { margin-top: 0; }
#save-btn { min-width: 130px; text-align: center; }

/* Uložit: výchozí šedé/disabled, při změnách zelené (is-dirty) */
#save-btn:disabled {
    background: #cfd6d4; color: #fff; box-shadow: none; cursor: default; opacity: 1;
}
#save-btn.is-dirty {
    background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 100%);
    color: #fff; cursor: pointer;
}

/* srdce u krevní skupiny */
.ch-heart { color: #c0392b; vertical-align: -2px; margin-right: 1px; }
.ch-blood { color: #c0392b; font-weight: 800; white-space: nowrap; }

/* na úzkém mobilu smí hlavička editoru zalomit */
@media (max-width: 560px) {
    .editor-head { flex-wrap: wrap; }
    .editor-head .btn { flex: 1 1 auto; text-align: center; }
}

/* ---- široký pás "Údaje osoby" nad třemi sloupci ---- */
.core-band { margin-bottom: 1.3rem; padding: 1rem 1.2rem; }
.core-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.2fr;  /* jméno širší, datum/skupina užší, foto */
    gap: 1rem;
    align-items: start;
}
.core-field { min-width: 0; display: flex; flex-direction: column; }
.core-field label { margin-top: 0; margin-bottom: .3rem; min-height: 1.2em; }
.core-field input, .core-field select { margin-bottom: 0; }
.core-field .btn { margin-top: 0; }
/* chybová hláška u data nesmí roztahovat řádek */
.core-field .field-err { min-height: 0; margin-top: .25rem; }

/* úzký displej: pole pod sebe */
@media (max-width: 760px) {
    .core-grid { grid-template-columns: 1fr; gap: .5rem; }
    .core-field label { min-height: 0; }
}

/* ============================================================
   Mobilní záložky editoru (přepínání panelů na úzké obrazovce)
   ============================================================ */
.mtabs { display: none; }   /* skryté na desktopu */

@media (max-width: 760px) {
    /* lišta záložek */
    .mtabs {
        display: flex; gap: .4rem; margin-bottom: 1rem;
        background: var(--bg-soft); padding: .35rem; border-radius: 999px;
    }
    .mtab {
        flex: 1; padding: .55rem .4rem; border: none; cursor: pointer;
        background: none; border-radius: 999px;
        font-family: 'Nunito', sans-serif; font-weight: 700; font-size: .9rem;
        color: var(--muted);
    }
    .mtab.is-active { background: #fff; color: var(--teal-deep); box-shadow: var(--shadow-sm); }

    /* ve výchozím stavu (mobil) ukaž jen aktivní panel */
    [data-panel] { display: none; }
    body[data-tab="core"]    [data-panel="core"],
    body[data-tab="list"]    [data-panel="list"],
    body[data-tab="preview"] [data-panel="preview"] { display: block; }

    /* editace položky se na mobilu ukáže jen když je otevřená (JS přidá .editing na body) */
    body[data-tab="list"].editing [data-panel="list"] { display: none; }
    body[data-tab="list"].editing [data-panel="edit"] { display: block; }

    /* tlačítka v hlavičce vedle sebe */
    .editor-head { flex-wrap: nowrap; gap: .6rem; }
    .editor-head .btn { flex: 1 1 0; text-align: center; }
}

/* ---- administrace účtu na dashboardu ---- */
.account-admin h2 { font-size: 1.15rem; margin-bottom: .9rem; }
.admin-links { display: flex; gap: .7rem; flex-wrap: wrap; }
.admin-links .btn { margin-top: 0; }
@media (max-width: 560px) {
    .admin-links { flex-direction: column; }
    .admin-links .btn { width: 100%; text-align: center; }
}

/* ---- crop modál (Cropper.js) ---- */
.crop-box { max-width: 460px; }
.crop-area { width: 100%; max-height: 60vh; margin: .6rem 0 0; }
.crop-area img { display: block; max-width: 100%; }
/* Cropper potřebuje blokový obrázek s omezenou výškou */
.crop-area .cropper-container { margin: 0 auto; }

/* ============================================================
   Fáze 4: náramky + admin
   ============================================================ */
/* sekce náramku v editoru */
.band-row { margin-top: .9rem; padding-top: .9rem; border-top: 1px dashed var(--line); }
.band-linked, .band-unlinked { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.band-label { font-weight: 700; color: var(--ink); }
.band-code { font-family: 'Nunito', monospace; font-weight: 800; letter-spacing: .05em; color: var(--teal-deep); }
#band-code-input { width: 220px; margin: 0; text-transform: uppercase; }
.band-msg { font-size: .85rem; }
.band-msg.ok { color: var(--teal-deep); }
.band-msg.err { color: var(--err-ink); }
.btn-link-danger { background: none; border: none; color: var(--err-ink); cursor: pointer; text-decoration: underline; font-size: .85rem; }

/* badge stavů */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge-free { background: #eef2f1; color: #5f6e6b; }
.badge-linked { background: var(--teal-soft); color: var(--teal-deep); }
.badge-blocked { background: #fde8e6; color: #c0392b; }

/* admin statistiky */
.band-stats { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.band-stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem 1.1rem; font-size: .9rem; color: var(--muted); }
.band-stat .num { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.3rem; color: var(--ink); margin-right: .3rem; }
.band-stat.free .num { color: #5f6e6b; }
.band-stat.linked .num { color: var(--teal-deep); }
.band-stat.blocked .num { color: #c0392b; }

/* admin tabulka */
.band-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.band-table th { text-align: left; padding: .5rem .6rem; border-bottom: 2px solid var(--line); color: var(--muted); font-weight: 700; }
.band-table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
.band-table td.code { font-family: 'Nunito', monospace; font-weight: 800; letter-spacing: .05em; }
@media (max-width: 560px) {
    #band-code-input { width: 100%; }
    .band-table { font-size: .82rem; }
}

/* série: badge vyrobeno + sekundární mini tlačítko */
.badge-produced { background: #e8f0e6; color: #4a7c3f; }
.btn-mini.secondary-mini {
    background: #fff; color: var(--teal-deep);
    border: 1px solid var(--teal); box-shadow: none;
}
.btn-mini.secondary-mini:hover { background: var(--teal-soft); transform: none; box-shadow: none; }

/* vybraná série v seznamu */
.band-table tr.series-active { background: var(--teal-soft); }
.band-table tr.series-active td.code { color: var(--teal-deep); }

/* ---- cookie lišta ---- */
.cookie-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
    background: rgba(40, 54, 52, .97); color: #fff;
    box-shadow: 0 -4px 20px rgba(0,0,0,.18);
}
.cookie-bar-inner {
    max-width: 900px; margin: 0 auto; padding: .9rem 1.2rem;
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.cookie-text { margin: 0; flex: 1 1 280px; font-size: .9rem; line-height: 1.5; }
.cookie-bar .btn { margin: 0; flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 560px) {
    .cookie-bar-inner { padding: .8rem 1rem; }
    .cookie-bar .btn { width: 100%; }
}

/* ---- patička s odkazem Kontakt ---- */
.site-footer {
    text-align: center;
    padding: 2rem 1rem 1.4rem;
    margin-top: 1rem;
}
.site-footer a {
    color: var(--muted);
    text-decoration: none;
    font-size: .85rem;
}
.site-footer a:hover { color: var(--teal-deep); text-decoration: underline; }

/* stránka Kontakt */
.contact-block p { line-height: 1.7; }

/* ---- nová série: formulář ---- */
.series-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}
.danger-mini {
    background: #fff !important; color: var(--err-ink) !important;
    border: 1px solid var(--err-ink) !important; box-shadow: none !important;
}
.danger-mini:hover { background: var(--err-bg) !important; transform: none !important; }

/* ---- ikony akcí u sérií ---- */
.th-actions, .td-actions { text-align: right; }
.series-actions { display: flex; gap: .3rem; align-items: center; justify-content: flex-end; padding-left: 1.5rem; }
.icon-act {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    background: #fff; border: 1px solid var(--line); border-radius: 8px;
    color: var(--teal-deep); cursor: pointer; text-decoration: none;
    transition: background .12s, border-color .12s, color .12s;
}
.icon-act:hover { background: var(--teal-soft); border-color: var(--teal); }
/* zapnutý stav = barevně inverzní */
.icon-act.is-on {
    background: var(--teal-deep); border-color: var(--teal-deep); color: #fff;
}
.icon-act.is-on:hover { background: var(--teal-deep); }
.icon-act.icon-danger { color: var(--err-ink); }
.icon-act.icon-danger:hover { background: var(--err-bg); border-color: var(--err-ink); }

/* ---- editor toast (inline hláška místo alert) ---- */
.editor-toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
    background: #2c3a38; color: #fff;
    padding: .7rem 1.2rem; border-radius: 10px;
    font-size: .92rem; box-shadow: 0 6px 24px rgba(0,0,0,.22);
    opacity: 0; pointer-events: none; z-index: 300;
    transition: opacity .2s, transform .2s; max-width: 90vw; text-align: center;
}
.editor-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.editor-toast.ok { background: var(--teal-deep); }

/* ---- sekce účtu na dashboardu (dole) ---- */
.account-code-big {
    font-family: 'Inter', monospace; letter-spacing: .14em;
    color: var(--teal-deep);
}
.account-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .8rem 2rem;
    margin-bottom: 1.2rem;
}
.account-row { display: flex; flex-direction: column; gap: .1rem; }
.account-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.account-val { font-size: .98rem; color: var(--ink); }
.account-buttons {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
}
.account-buttons-left { display: flex; gap: .6rem; flex-wrap: wrap; }
@media (max-width: 560px) {
    .account-buttons { flex-direction: column; align-items: stretch; }
    .account-buttons-left { flex-direction: column; }
    .account-buttons .btn { text-align: center; }
}

/* nebezpečný odkaz (zrušení účtu) */
.danger-link { color: var(--err-ink) !important; border-color: var(--err-ink) !important; }
.danger-link:hover { background: var(--err-bg) !important; }
