/* Nimesildid — nimekiri, redaktor ja printimine.
   Aktsent = saidi --accent-color; pehme taust omaette tokenina. Paber (eelvaade, stiilide
   pisipildid) on ALATI hele — see on väljatrükk, mitte saidi UI. */
:root {
    --ns-accent-soft: rgba(0, 209, 178, 0.12);
    --ns-warn-text: #8a5a00;
    --ns-paper-shadow: 0 1px 2px rgba(17, 17, 26, .10), 0 6px 16px rgba(17, 17, 26, .10);
    --shadow-1: 0 1px 2px rgba(17, 17, 26, .06), 0 4px 12px rgba(17, 17, 26, .08);
    --shadow-2: 0 2px 4px rgba(17, 17, 26, .08), 0 12px 24px rgba(17, 17, 26, .12);
}
[data-theme="dark"] {
    --ns-accent-soft: rgba(34, 211, 238, 0.14);
    --ns-warn-text: #fde68a;
    --ns-paper-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ns-accent-soft: rgba(34, 211, 238, 0.14);
        --ns-warn-text: #fde68a;
        --ns-paper-shadow: 0 2px 10px rgba(0, 0, 0, .5);
    }
}

.ns-section { padding: 24px 16px 48px; }
.ns-container { max-width: 1240px; }

/* ---------- Ehitusplokid ---------- */
.ns-icon-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms cubic-bezier(0.4, 0, 0.2, 1), color 150ms;
}
.ns-icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.ns-icon-btn:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.ns-badge {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--ns-accent-soft);
    color: var(--accent-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.ns-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ns-pill:empty { display: none; }
.ns-pill.is-warn { color: var(--ns-warn-text); border-color: currentColor; }
.ns-help { font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.ns-optional { font-size: 13px; font-weight: 400; color: var(--text-muted); margin-left: 4px; }
.ns-label { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; display: block; }
.ns-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: var(--ns-accent-soft);
    color: var(--text-primary);
    font-size: 14px;
}
.ns-notice > span { flex: 1 1 240px; }
.ns-notice > i { color: var(--accent-color); }
.ns-notice.is-hidden { display: none; }

/* ---------- Nimekiri ---------- */
.ns-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}
.ns-page-head > div { flex: 1 1 260px; min-width: 0; }
.ns-h1 {
    font-size: clamp(1.4rem, 2.6vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.2;
}
.ns-sub { color: var(--text-secondary); font-size: 15px; margin-top: 4px; }
.ns-new-btn { font-weight: 600; border-radius: 8px; }

.ns-list { display: grid; gap: 12px; }
.ns-item {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-1);
    animation: ns-in 250ms cubic-bezier(0, 0, 0.2, 1) backwards;
    animation-delay: calc(var(--i, 0) * 35ms);
    transition: box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1), border-color 150ms;
}
@keyframes ns-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .ns-item { animation: none; } }
@media (hover: hover) {
    .ns-item:hover { box-shadow: var(--shadow-2); border-color: var(--border-color); }
    .ns-item:hover .ns-item-link { text-decoration: underline; }
}
.ns-item-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--ns-accent-soft);
    color: var(--accent-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}
.ns-item-main { flex: 1 1 200px; min-width: 0; }
.ns-item-title { font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.ns-item-link { color: inherit; text-decoration: none; }
.ns-item-link::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
.ns-item .dk-actions { position: relative; z-index: 1; flex: 0 1 220px; }
.ns-item-meta { font-size: 13px; color: var(--text-muted); }
.ns-empty {
    max-width: 480px;
    margin: 32px auto;
    padding: 32px 24px;
    text-align: center;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
}

/* ---------- Redaktor ---------- */
.ns-ebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
/* Pealkirjal vähemalt ~200 px: kitsas veerus murduvad olek ja Salvesta järgmisele reale */
.ns-title-input {
    flex: 1 1 200px;
    min-width: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 6px 8px;
    font-family: inherit;
}
.ns-title-input:hover { border-color: var(--border-color); }
.ns-title-input:focus { outline: none; border-color: var(--accent-color); background: var(--bg-card); }
.ns-title-input::placeholder { color: var(--text-muted); font-weight: 600; }
.ns-save-status {
    font-size: 13px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.ns-save-status i { font-size: 12px; }
.ns-save-status .fa-check { color: var(--accent-color); }
.ns-save-status.is-dirty { color: var(--ns-warn-text); }
.ns-ebar .ns-icon-btn#nsMoreBtn { margin-left: auto; }
@media (max-width: 600px) {
    .ns-save-status span {
        position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
        overflow: hidden; clip: rect(0 0 0 0); border: 0;
    }
}
.ns-save-btn { border-radius: 8px; font-weight: 600; }
.ns-save-btn.is-hidden, .ns-icon-btn.is-hidden { display: none; }

.ns-ed-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
@media (min-width: 1024px) {
    .ns-ed-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
    .ns-ed-preview { position: sticky; top: 16px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
    .ns-ed-preview .ns-paper-wrap { flex: 1 1 auto; min-height: 0; }
}
.ns-ed-form { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ns-card {
    padding: 16px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-1);
}
.ns-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.ns-card-head .ns-h2 { margin-bottom: 0; }
.ns-h2 { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; }
.ns-h2 label { cursor: pointer; }
.ns-card .textarea, .ns-card .input, .ns-card select { font-size: 16px; }   /* iOS ei suurenda fookusel */
.ns-modes { border: 0; padding: 0; margin: 0 0 12px; }
.ns-modes.is-hidden { display: none; }
.ns-reload { margin-top: 6px; padding-left: 0; }

/* Segmendivalik (raadionupud nuppudena) */
.ns-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.ns-seg label { position: relative; cursor: pointer; }
.ns-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ns-seg span {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    transition: background 150ms, border-color 150ms;
}
.ns-seg input:checked + span { background: var(--ns-accent-soft); border-color: var(--accent-color); font-weight: 600; }
.ns-seg input:focus-visible + span { outline: 2px solid var(--accent-color); outline-offset: 2px; }
@media (hover: hover) { .ns-seg span:hover { border-color: var(--accent-color); } }

/* Stiilid */
.ns-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 14px; }
.ns-style-opt { position: relative; cursor: pointer; }
.ns-style-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ns-style-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    transition: border-color 150ms, background 150ms;
}
.ns-style-opt input:checked + .ns-style-card { border-color: var(--accent-color); background: var(--ns-accent-soft); box-shadow: inset 0 0 0 1px var(--accent-color); }
.ns-style-opt input:focus-visible + .ns-style-card { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.ns-style-thumb {
    width: 100%;
    max-width: 120px;
    aspect-ratio: 277 / 89;
    border-radius: 4px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: var(--ns-d, #1e3a8a);
    font-size: 15px;
    font-family: var(--ns-font, Arial, sans-serif);
}
.ns-style-thumb b { font-weight: var(--ns-fw, 700); }
.ns-style-card > span:last-child { overflow-wrap: anywhere; line-height: 1.2; }
.ns-style-thumb[data-style="lihtne"] { border: 1px solid #111111; color: #111111; }
.ns-style-thumb[data-style="riba"] { border: 1px solid var(--ns-a, #2563eb); padding-bottom: 8px; }
.ns-style-thumb[data-style="riba"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 18%; background: var(--ns-a, #2563eb); }
.ns-style-thumb[data-style="raam"] { border: 3px solid var(--ns-a, #2563eb); background: var(--ns-tn, #eff6ff); border-radius: 8px; }
.ns-style-thumb[data-style="taisvarv"] { background: var(--ns-a, #2563eb); color: var(--ns-on, #ffffff); border-radius: 5px; }
.ns-style-thumb[data-style="kulgplokk"] { border: 1px solid var(--ns-a, #2563eb); padding-left: 24%; }
.ns-style-thumb[data-style="kulgplokk"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 24%; background: var(--ns-a, #2563eb); }
.ns-style-thumb[data-style="tapiline"] { border: 1px solid var(--ns-a, #2563eb); }
.ns-style-thumb[data-style="tapiline"]::before,
.ns-style-thumb[data-style="tapiline"]::after {
    content: ""; position: absolute; left: 0; right: 0; height: 18%;
    background: radial-gradient(circle, var(--ns-a, #2563eb) 1.2px, transparent 1.6px) 0 50% / 5px 5px, var(--ns-tn, #eff6ff);
}
.ns-style-thumb[data-style="tapiline"]::before { top: 0; }
.ns-style-thumb[data-style="tapiline"]::after { bottom: 0; }
.ns-style-thumb[data-style="nurgad"] {
    background:
        linear-gradient(var(--ns-a, #2563eb), var(--ns-a, #2563eb)) top left / 14px 2px no-repeat,
        linear-gradient(var(--ns-a, #2563eb), var(--ns-a, #2563eb)) top left / 2px 10px no-repeat,
        linear-gradient(var(--ns-a, #2563eb), var(--ns-a, #2563eb)) top right / 14px 2px no-repeat,
        linear-gradient(var(--ns-a, #2563eb), var(--ns-a, #2563eb)) top right / 2px 10px no-repeat,
        linear-gradient(var(--ns-a, #2563eb), var(--ns-a, #2563eb)) bottom left / 14px 2px no-repeat,
        linear-gradient(var(--ns-a, #2563eb), var(--ns-a, #2563eb)) bottom left / 2px 10px no-repeat,
        linear-gradient(var(--ns-a, #2563eb), var(--ns-a, #2563eb)) bottom right / 14px 2px no-repeat,
        linear-gradient(var(--ns-a, #2563eb), var(--ns-a, #2563eb)) bottom right / 2px 10px no-repeat,
        #ffffff;
}
.ns-style-thumb[data-style="topelt"] { border: 2px solid var(--ns-d, #1e3a8a); box-shadow: inset 0 0 0 2px #ffffff, inset 0 0 0 3px var(--ns-d, #1e3a8a); border-radius: 2px; }

/* Fondid: iga valik on kirjutatud iseenda fondiga (render.js injectFontFaces) */
.ns-fonts-field { border: 0; padding: 0; margin: 0 0 14px; }
.ns-fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; }
.ns-font-opt { position: relative; cursor: pointer; }
.ns-font-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ns-font-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 4px 6px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.1;
    text-align: center;
    transition: border-color 150ms, background 150ms;
}
.ns-font-opt input:checked + .ns-font-card { border-color: var(--accent-color); background: var(--ns-accent-soft); box-shadow: inset 0 0 0 1px var(--accent-color); }
.ns-font-opt input:focus-visible + .ns-font-card { outline: 2px solid var(--accent-color); outline-offset: 2px; }
@media (hover: hover) { .ns-font-card:hover { border-color: var(--accent-color); } }
/* Font ja paksus tulevad render.js FONTS-ist (app.js); siin ainult väikese silmaga kirjade suurendus */
.ns-font-card[data-font="patrick"], .ns-font-card[data-font="caveat"], .ns-font-card[data-font="kalam"],
.ns-font-card[data-font="dancing"], .ns-font-card[data-font="cormorant"] { font-size: 18px; }
.ns-font-card[data-font="amatic"] { font-size: 21px; }
.ns-font-tabs .ns-pic-tab.has-pick::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--accent-color);
    vertical-align: middle;
}

/* Värvid */
.ns-colors { border: 0; padding: 0; margin: 0; }
.ns-colors.is-hidden { display: none; }
.ns-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ns-swatch { position: relative; cursor: pointer; }
.ns-swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ns-swatch span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
    box-shadow: 0 0 0 1px var(--border-color);
    transition: box-shadow 150ms;
}
.ns-swatch input:checked + span { box-shadow: 0 0 0 2px var(--text-primary); }
.ns-swatch input:focus-visible + span { outline: 2px solid var(--accent-color); outline-offset: 3px; }
.ns-swatch-custom span { background: conic-gradient(#ef4444, #f59e0b, #10b981, #3b82f6, #8b5cf6, #ef4444); color: #ffffff; font-size: 12px; text-shadow: 0 0 2px rgba(0, 0, 0, 0.7); }
.ns-swatch-custom input:checked + span { background: var(--ns-custom, #2563eb); }
/* Oma värv = ÜKS nupp: läbipaistev värvivalija katab ringi, klõps avab brauseri värvivalija */
.ns-swatch-custom .ns-color-input { inset: 0; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 50%; cursor: pointer; }
.ns-swatch-custom:has(.ns-color-input:focus-visible) span { outline: 2px solid var(--accent-color); outline-offset: 3px; }

/* Ürituse info: logo nupp + väljad */
.ns-event-row { display: flex; gap: 12px; align-items: flex-start; }
.ns-event-fields { flex: 1 1 auto; min-width: 0; }
.ns-pic-chip.ns-logo-btn { flex-direction: column; justify-content: center; gap: 4px; flex: 0 0 auto; width: 76px; min-height: 76px; padding: 6px; border-radius: 12px; }
.ns-pic-chip.ns-logo-btn .ns-pic-thumb { width: 44px; height: 44px; border-radius: 10px; }
.ns-logo-btn .ns-pic-name { font-size: 12px; }

/* Nimede suurus */
.ns-size-field { border: 0; padding: 0; margin: 0 0 14px; }
.ns-size-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 14px; color: var(--text-primary); }
.ns-size-row input[type="range"] { flex: 1 1 auto; min-width: 0; accent-color: var(--accent-color); }
.ns-size-row output { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }

/* Pildid nime kaupa: kiibid (pilt + nimi) ja valija hüpikaken (dkFloat) */
.ns-pic-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.ns-pic-tools .button { margin-bottom: 0; }
.ns-pic-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 260px; overflow-y: auto; padding: 2px; }
.ns-pic-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-height: 40px;
    padding: 3px 10px 3px 3px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 150ms, background 150ms;
}
@media (hover: hover) { .ns-pic-chip:hover { border-color: var(--accent-color); } }
.ns-pic-chip:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.ns-pic-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;              /* must joonpilt vajab ka tumedas režiimis heledat põhja */
    border: 1px dashed #9ca3af;
    color: #6b7280;
    font-size: 12px;
}
.ns-pic-chip.has-pic .ns-pic-thumb { border-style: solid; border-color: #d1d5db; }
.ns-pic-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-credit { margin-top: 8px; font-size: 12px; }
.ns-pic-pop {
    width: min(360px, calc(100vw - 24px));
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.ns-pic-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.ns-pic-pop-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.ns-pic-pop-head .button { margin-bottom: 0; flex: 0 0 auto; }
.ns-pic-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.ns-pic-tab {
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.ns-pic-tab.is-active { background: var(--ns-accent-soft); border-color: var(--accent-color); font-weight: 600; }
.ns-pic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 4px; max-height: 240px; overflow-y: auto; }
.ns-pic-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid transparent;
    background: #ffffff;
    cursor: pointer;
}
@media (hover: hover) { .ns-pic-cell:hover { border-color: var(--accent-color); } }
.ns-pic-cell.is-active { border-color: var(--accent-color); box-shadow: inset 0 0 0 1px var(--accent-color); }
.ns-pic-cell:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 1px; }
.ns-pic-cell img { width: 80%; height: 80%; }
/* Oma pilt (foto): täidab lahtri, keskelt kärbitud */
.ns-pic-cell.is-photo { overflow: hidden; padding: 0; }
.ns-pic-cell.is-photo img { width: 100%; height: 100%; object-fit: cover; }
.ns-pic-thumb.is-photo { overflow: hidden; border-style: solid; }
.ns-pic-thumb.is-photo img { width: 100%; height: 100%; object-fit: cover; }
.ns-pic-upload { border: 1px dashed var(--accent-color); color: var(--accent-color); font-size: 18px; background: var(--bg-card); }
.ns-pic-upload.is-loading { pointer-events: none; opacity: .5; }
.ns-pic-upload.is-loading i { animation: ns-spin 1s linear infinite; }
@keyframes ns-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ns-pic-upload.is-loading i { animation: none; } }
.ns-pic-own-note { grid-column: 1 / -1; margin: 4px 0; }
.ns-pic-tab.is-own { border-style: dashed; }

/* Formaadid: skeem (paber jääb ka tumedas režiimis valgeks) + nimi + mõõt */
.ns-formats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ns-format-opt { position: relative; cursor: pointer; }
.ns-format-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ns-format-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    height: 100%;
    padding: 8px 6px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: border-color 150ms, background 150ms;
}
.ns-format-opt input:checked + .ns-format-card { border-color: var(--accent-color); background: var(--ns-accent-soft); box-shadow: inset 0 0 0 1px var(--accent-color); }
.ns-format-opt input:focus-visible + .ns-format-card { outline: 2px solid var(--accent-color); outline-offset: 2px; }
@media (hover: hover) { .ns-format-card:hover { border-color: var(--accent-color); } }
.ns-format-thumb { display: block; height: 44px; width: auto; margin-bottom: 4px; }
.ns-ft-page { fill: #ffffff; stroke: #9ca3af; stroke-width: 4; }
.ns-ft-flap { fill: #e5e7eb; }
.ns-ft-bar { fill: var(--accent-color); }
.ns-ft-cut { stroke: #6b7280; stroke-width: 3; }
.ns-ft-fold { stroke: #6b7280; stroke-width: 3; stroke-dasharray: 10 7; }
.ns-format-name { font-size: 13px; font-weight: 600; line-height: 1.25; color: var(--text-primary); }
.ns-format-meta { font-size: 12px; color: var(--text-secondary); }
#nsBackField.is-hidden, #nsGuidesHelp.is-hidden { display: none; }
.ns-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-primary); }
.ns-check:hover { color: var(--text-primary); }

/* ---------- Eelvaade ---------- */
.ns-ed-preview {
    padding: 16px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-1);
    min-width: 0;
}
.ns-prev-head { display: flex; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.ns-prev-head .ns-h2 { margin-bottom: 0; }
.ns-paper-wrap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    overflow: auto;
    max-height: 70vh;
}
@media (min-width: 1024px) { .ns-paper-wrap { max-height: none; } }
.ns-sheet { background: #ffffff; border-radius: 2px; box-shadow: var(--ns-paper-shadow); line-height: 0; }
.ns-sheet svg { display: block; width: 100%; height: auto; }
.ns-paper-wrap.is-sample { grid-template-columns: minmax(0, 1fr); }
.ns-paper-wrap.is-sample .ns-sheet { opacity: .55; }
/* Püstised lehed (A4 püsti): kitsamad pisipildid, näidis mitte üle ekraani kõrguse */
.ns-paper-wrap:not(.is-sample)[data-format="tent2"], .ns-paper-wrap:not(.is-sample)[data-format="badge"] { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.ns-paper-wrap.is-sample[data-format="tent2"] .ns-sheet, .ns-paper-wrap.is-sample[data-format="badge"] .ns-sheet { width: 100%; max-width: 340px; margin: 0 auto; }
.ns-print-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.ns-print-tip { flex: 1 1 240px; }
.ns-print-tip i { color: var(--accent-color); margin-right: 4px; }
.ns-print-actions { margin-left: auto; }
.ns-print-actions .button { border-radius: 8px; height: 38px; }
.ns-print-actions .button.is-primary { font-weight: 600; }
@media (max-width: 600px) {
    .ns-print-actions { width: 100%; flex-wrap: nowrap; }
    .ns-print-actions .button { flex: 1 1 0; }
}

#nsPrint { display: none; }
@media print {
    body.ns-printing > *:not(#nsPrint) { display: none !important; }
    body.ns-printing { background: #fff !important; margin: 0; padding: 0 !important; }
    body.ns-printing #nsPrint { display: block; }
    .ns-print-page { width: 297mm; height: 210mm; break-after: page; page-break-after: always; overflow: hidden; }
    .ns-print-page:last-child { break-after: auto; page-break-after: auto; }
    .ns-print-page svg { display: block; width: 100%; height: 100%; }
}
