/* ============================================================
   Pošta Vozákovi — vzhled aplikace
   ------------------------------------------------------------
   Postaveno na brand balíčku: neutrální podklad (inkoust + papír)
   + JEDNA značková barva. Motiv se přepíná atributem
   data-vz-theme na <html>; hodnoty odpovídají tokens.json.
   Ikony jsou tahové SVG (currentColor) — žádná emoji.
   ============================================================ */

/* ---------- písmo (self-hosted, funguje i bez internetu) ---------- */
@font-face {
    font-family: 'Hanken Grotesk';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/hanken-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
                   U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Hanken Grotesk';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/hanken-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
                   U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- barevné motivy (brand balíček) ---------- */
:root {
    --vz-font: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* výchozí motiv: Uhel & papír (černobílý) */
    --brand:     #1B1A18;   /* jediná barevná: značka, akce, aktivní stavy */
    --on-brand:  #F4F1EA;   /* text/ikona na značkové ploše */
    --bg:        #F4F1EA;   /* papír */
    --text:      #1B1A18;   /* inkoust */

    /* neutrály odvozené z inkoustu — v tmavém režimu se přepíšou */
    --surface:   #FFFFFF;
    --surface-2: #FBF9F5;
    --muted:     #6B6862;
    --faint:     #8A877F;
    --hairline:  rgba(27, 26, 24, .12);
    --hover:     rgba(27, 26, 24, .045);
    --tint:      rgba(27, 26, 24, .06);   /* světlý závoj značkové barvy */
    --tint-2:    rgba(27, 26, 24, .13);

    --danger:    #8C2F22;
    --ok:        #2C6E4B;

    --radius:    10px;
    --shadow:    0 1px 2px rgba(27,26,24,.04), 0 8px 24px rgba(27,26,24,.06);
    --topbar-h:  58px;
    --sidebar-w: 244px;
    --list-w:    408px;
}

/* ---- světlý režim: papírový podklad, značková barva jako akcent ---- */
[data-vz-theme="uhel"]     { --brand:#1B1A18; --on-brand:#F4F1EA; --bg:#F4F1EA; --text:#1B1A18; --tint:rgba(27,26,24,.06);  --tint-2:rgba(27,26,24,.13); }
[data-vz-theme="borovice"] { --brand:#1F5041; --on-brand:#F4F1EA; --bg:#F4F1EA; --text:#1B1A18; --tint:rgba(31,80,65,.08);  --tint-2:rgba(31,80,65,.16); }
[data-vz-theme="modr"]     { --brand:#274B6D; --on-brand:#F4F1EA; --bg:#F4F1EA; --text:#1B1A18; --tint:rgba(39,75,109,.08); --tint-2:rgba(39,75,109,.16); }
[data-vz-theme="svestka"]  { --brand:#5B2B4D; --on-brand:#F6F1EC; --bg:#F6F1EC; --text:#1B1A18; --tint:rgba(91,43,77,.08);  --tint-2:rgba(91,43,77,.16); }
[data-vz-theme="vinova"]   { --brand:#6D2A3A; --on-brand:#F6F0EA; --bg:#F6F0EA; --text:#1B1A18; --tint:rgba(109,42,58,.08); --tint-2:rgba(109,42,58,.16); }

/* ---- tmavý režim: inkoustový podklad, značková barva se rozsvítí ----
   Neutrály jsou společné, mění se jen značková barva podle palety.        */
[data-vz-mode="dark"] {
    --bg:        #17181B;
    --text:      #ECE7DD;
    --on-brand:  #17181B;   /* text/ikona NA značkové ploše (a „V" v dlaždici) */
    --surface:   #1E2024;
    --surface-2: #232529;
    --muted:     #9A968D;
    --faint:     #7C7972;
    --hairline:  rgba(236, 231, 221, .14);
    --hover:     rgba(236, 231, 221, .05);
    --danger:    #D98A7B;
    --ok:        #7FBF9B;
    --shadow:    0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}
[data-vz-mode="dark"][data-vz-theme="uhel"]     { --brand:#ECE7DD; --tint:rgba(236,231,221,.08); --tint-2:rgba(236,231,221,.16); }
[data-vz-mode="dark"][data-vz-theme="borovice"] { --brand:#7FC0A6; --tint:rgba(127,192,166,.10); --tint-2:rgba(127,192,166,.20); }
[data-vz-mode="dark"][data-vz-theme="modr"]     { --brand:#93BBE0; --tint:rgba(147,187,224,.10); --tint-2:rgba(147,187,224,.20); }
[data-vz-mode="dark"][data-vz-theme="svestka"]  { --brand:#D69EC6; --tint:rgba(214,158,198,.10); --tint-2:rgba(214,158,198,.20); }
[data-vz-mode="dark"][data-vz-theme="vinova"]   { --brand:#E2A0AC; --tint:rgba(226,160,172,.10); --tint-2:rgba(226,160,172,.20); }

/* ---------- základ ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--vz-font);
    font-size: 15px;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--brand); text-underline-offset: 2px; }

.ico { flex: none; vertical-align: -.2em; }

/* logo */
.vz-tile { flex: none; display: block; }
.vz-tile__plate { fill: currentColor; }
.vz-tile__v { fill: var(--on-brand); }
.vz-lockup { display: inline-flex; align-items: center; gap: .5rem; color: var(--brand); line-height: 1; }
.vz-name { font-weight: 700; letter-spacing: -.02em; }

/* ---------- spouštěcí obrazovka ---------- */
.boot-splash { height: 100%; min-height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 1rem; }
.spinner { width: 28px; height: 28px; border: 2px solid var(--hairline); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- přihlášení ---------- */
.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; }
.login-card .vz-lockup { margin-bottom: 1.8rem; }
.login-card .vz-name { font-size: 1.55rem; }
.login-card h1 { font-size: 1.1rem; margin: 0 0 .2rem; font-weight: 600; }
.login-card .sub { color: var(--muted); font-size: .9rem; margin: 0 0 1.6rem; }
.login-card label { display: block; font-size: .82rem; font-weight: 600; margin: .9rem 0 .3rem; color: var(--muted); }
.login-card input { width: 100%; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 1.5rem; }
.login-err { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); border-radius: 8px; padding: .6rem .8rem; font-size: .87rem; margin-top: 1rem; display: flex; gap: .45rem; align-items: flex-start; }
.login-alt { margin-top: 1.6rem; padding-top: 1.4rem; border-top: 1px solid var(--hairline); }
.login-alt .btn { width: 100%; justify-content: center; }
.login-hint { font-size: .8rem; color: var(--faint); text-align: center; margin-top: .8rem; }
.login-switch { background: none; border: 0; color: var(--brand); font-size: .84rem; cursor: pointer; padding: .3rem 0; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- prvky ---------- */
.btn {
    display: inline-flex; align-items: center; gap: .45rem;
    background: var(--brand); color: var(--on-brand);
    border: 1px solid var(--brand); border-radius: 8px;
    padding: .5rem .95rem; font-size: .9rem; font-weight: 600;
    cursor: pointer; transition: opacity .12s, background .12s;
    white-space: nowrap;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--hairline); }
.btn.ghost:hover { background: var(--hover); opacity: 1; }
.btn.quiet { background: transparent; color: var(--muted); border-color: transparent; }
.btn.quiet:hover { background: var(--hover); color: var(--text); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { padding: .3rem .6rem; font-size: .84rem; gap: .3rem; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 0; cursor: pointer; padding: .4rem;
    border-radius: 7px; color: var(--muted); line-height: 0;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.on { color: var(--brand); }

input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea {
    padding: .52rem .7rem; border: 1px solid var(--hairline); border-radius: 8px;
    background: var(--surface); color: var(--text); width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, [contenteditable]:focus-visible {
    outline: 2px solid var(--brand); outline-offset: 1px;
}
select { cursor: pointer; }
textarea { resize: vertical; }

/* zaškrtávátka — vlastní vzhled, aby ladila s paletou v obou režimech */
input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    width: 16px; height: 16px; flex: none; padding: 0;
    border: 1.5px solid color-mix(in srgb, var(--text) 28%, transparent);
    border-radius: 4px; background: var(--surface);
    cursor: pointer; display: inline-grid; place-content: center;
    transition: background .1s, border-color .1s;
}
input[type="checkbox"]::before {
    content: ''; width: 9px; height: 9px; transform: scale(0);
    background: var(--on-brand);
    clip-path: polygon(14% 44%, 0 65%, 39% 100%, 100% 16%, 84% 0, 39% 68%);
    transition: transform .1s ease-out;
}
input[type="checkbox"]:checked {
    background: var(--brand); border-color: var(--brand);
}
input[type="checkbox"]:checked::before { transform: scale(1); }
input[type="checkbox"]:hover { border-color: var(--brand); }

.chip {
    display: inline-flex; align-items: center; gap: .25rem;
    border-radius: 5px; padding: .05rem .4rem;
    font-size: .7rem; font-weight: 600; letter-spacing: .01em;
    white-space: nowrap; line-height: 1.5;
    border: 1px solid; background: transparent;
}
.chip .rm { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; line-height: 0; opacity: .7; }
.chip .rm:hover { opacity: 1; }

.hint { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.muted { color: var(--faint); }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; }

/* ---------- rozvržení ---------- */
.app { display: grid; grid-template-rows: var(--topbar-h) 1fr; height: 100vh; }

.topbar {
    display: flex; align-items: center; gap: .7rem;
    padding: 0 .9rem; background: var(--surface);
    border-bottom: 1px solid var(--hairline);
}
.topbar .vz-lockup .vz-name { font-size: 1.05rem; }
.topbar .search { flex: 1; max-width: 520px; position: relative; display: flex; align-items: center; }
.topbar .search .ico { position: absolute; left: .65rem; color: var(--faint); pointer-events: none; }
.topbar .search input { padding-left: 2.2rem; background: var(--bg); border-color: transparent; }
.topbar .search input:focus { background: var(--surface); border-color: var(--hairline); }
.topbar .spacer { flex: 1; }
.topbar select.account-switch { width: auto; max-width: 230px; border-color: transparent; background: transparent; font-size: .88rem; color: var(--muted); }
.topbar select.account-switch:hover { background: var(--hover); }
.avatar {
    width: 34px; height: 34px; flex: none; border-radius: 50%;
    background: var(--brand); color: var(--on-brand);
    border: 0; cursor: pointer; font-weight: 700; font-size: .85rem;
}

.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 0; }

/* ---------- boční panel ---------- */
.sidebar { background: var(--bg); border-right: 1px solid var(--hairline); display: flex; flex-direction: column; min-height: 0; }
.sidebar .compose-wrap { padding: .9rem .8rem .5rem; }
.sidebar .compose-wrap .btn { width: 100%; justify-content: center; }
.sidebar nav { overflow-y: auto; padding: .3rem .5rem 1.5rem; flex: 1; }

.side-item {
    display: flex; align-items: center; gap: .6rem; width: 100%;
    text-align: left; background: none; border: 0; border-radius: 8px;
    padding: .48rem .6rem; font-size: .9rem; color: var(--text); cursor: pointer;
}
.side-item:hover { background: var(--hover); }
.side-item.active { background: var(--tint); color: var(--brand); font-weight: 600; }
.side-item .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .cnt { margin-left: auto; font-size: .74rem; color: var(--faint); font-weight: 600; }
.side-item.active .cnt { color: var(--brand); }
.side-item .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; border: 1.5px solid; }

.side-section {
    display: flex; align-items: center; justify-content: space-between;
    margin: 1.2rem .6rem .25rem; font-size: .68rem; font-weight: 700;
    letter-spacing: .09em; text-transform: uppercase; color: var(--faint);
}

/* ---------- hlavní plocha ---------- */
.main { display: grid; grid-template-columns: var(--list-w) 1fr; min-height: 0; }
.pane { min-height: 0; overflow: hidden; display: flex; flex-direction: column; }

/* seznam zpráv */
.list-pane { border-right: 1px solid var(--hairline); background: var(--surface); }
.list-head { display: flex; align-items: center; gap: .5rem; padding: .5rem .8rem; border-bottom: 1px solid var(--hairline); min-height: 48px; }
.list-head .title { font-weight: 600; font-size: .95rem; margin-right: auto; }
.list-scroll { overflow-y: auto; flex: 1; }

.msg-row {
    display: grid; grid-template-columns: auto auto 1fr auto;
    gap: .05rem .6rem; padding: .6rem .8rem;
    border-bottom: 1px solid var(--hairline); cursor: pointer; align-items: center;
}
.msg-row:hover { background: var(--hover); }
.msg-row.active { background: var(--tint); }
.msg-row.active::before { content: ''; position: absolute; left: 0; width: 3px; }
.msg-row.unseen .m-from, .msg-row.unseen .m-subj span { font-weight: 700; color: var(--text); }
.msg-row.unseen .m-date { color: var(--brand); font-weight: 600; }
.msg-row input[type="checkbox"] { grid-row: span 2; }
.msg-row .m-star { grid-row: span 2; }
.msg-row .m-from { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row .m-date { font-size: .75rem; color: var(--faint); white-space: nowrap; }
.msg-row .m-subj { grid-column: 3 / span 2; font-size: .84rem; color: var(--muted); display: flex; gap: .35rem; align-items: center; min-width: 0; }
.msg-row .m-subj span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row .m-subj .chips { display: inline-flex; gap: .25rem; flex: none; }
.msg-row .m-icons { display: inline-flex; gap: .2rem; color: var(--faint); flex: none; }

.list-empty { text-align: center; color: var(--faint); padding: 3.5rem 1.5rem; font-size: .9rem; }
.list-empty .ico { display: block; margin: 0 auto .8rem; opacity: .35; }
.list-foot { border-top: 1px solid var(--hairline); padding: .4rem .8rem; display: flex; align-items: center; justify-content: space-between; font-size: .8rem; color: var(--muted); }

.bulk-bar { display: flex; gap: .3rem; align-items: center; padding: .45rem .8rem; background: var(--tint); border-bottom: 1px solid var(--hairline); flex-wrap: wrap; font-size: .84rem; }
.bulk-bar .count { font-weight: 700; margin-right: .3rem; color: var(--brand); }

/* čtecí panel */
.read-pane { background: var(--bg); }
.read-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--faint); gap: .6rem; font-size: .9rem; }
.read-empty .ico { opacity: .3; }

.msg-view { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.msg-toolbar { display: flex; gap: .25rem; align-items: center; padding: .5rem .8rem; background: var(--surface); border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.msg-toolbar .sep { width: 1px; height: 20px; background: var(--hairline); margin: 0 .25rem; }

.msg-header { background: var(--surface); padding: 1rem 1.1rem; border-bottom: 1px solid var(--hairline); }
.msg-header h2 { margin: 0 0 .6rem; font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; }
.msg-meta { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.msg-meta .who { color: var(--text); font-weight: 600; }
.msg-header .labels-row { margin-top: .6rem; display: flex; gap: .3rem; flex-wrap: wrap; }

.notice { padding: .5rem 1.1rem; font-size: .84rem; display: flex; gap: .6rem; align-items: center; background: var(--tint); border-bottom: 1px solid var(--hairline); color: var(--text); }

.msg-body-wrap { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem; }
.msg-body-frame { width: 100%; border: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); min-height: 220px; display: block; }

.attachments { padding: .7rem 1.1rem; background: var(--surface); border-top: 1px solid var(--hairline); display: flex; gap: .5rem; flex-wrap: wrap; }
.att-item {
    display: inline-flex; align-items: center; gap: .45rem;
    border: 1px solid var(--hairline); border-radius: 8px; padding: .35rem .7rem;
    font-size: .84rem; color: var(--text); text-decoration: none; background: var(--surface);
}
.att-item:hover { background: var(--hover); }

/* ---------- rozbalovací nabídky ---------- */
.dropdown { position: relative; display: inline-flex; }
.dropdown-menu {
    position: absolute; top: calc(100% + 5px); left: 0; z-index: 60;
    background: var(--surface); border: 1px solid var(--hairline);
    border-radius: 10px; box-shadow: var(--shadow);
    min-width: 210px; max-height: 340px; overflow-y: auto; padding: .3rem;
}
.dropdown-menu.right { left: auto; right: 0; }
.dropdown-menu button {
    display: flex; align-items: center; gap: .55rem; width: 100%;
    text-align: left; background: none; border: 0; border-radius: 7px;
    padding: .45rem .55rem; font-size: .88rem; cursor: pointer; color: var(--text);
}
.dropdown-menu button:hover { background: var(--hover); }
.dropdown-menu button .ico { color: var(--muted); }
.dropdown-menu .sep { border-top: 1px solid var(--hairline); margin: .25rem 0; }
.dropdown-menu .swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; border: 1.5px solid; }

/* ---------- modální okna ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(27, 26, 24, .38); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.2); width: 100%; max-width: 520px; max-height: 92vh; display: flex; flex-direction: column; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem .6rem; }
.modal-head h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.modal-body { padding: .4rem 1.2rem 1rem; overflow-y: auto; }
.modal-foot { padding: .8rem 1.2rem 1.1rem; display: flex; gap: .5rem; justify-content: flex-end; }
.modal label { display: block; font-size: .8rem; font-weight: 600; margin: .8rem 0 .25rem; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
.form-grid .full { grid-column: 1 / -1; }
.check-line { display: flex; align-items: flex-start; gap: .5rem; margin-top: .8rem; font-size: .87rem; }
.check-line input { margin-top: .15rem; }
.check-line label { margin: 0; font-weight: 400; color: var(--text); font-size: .87rem; }
.sub-head { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 1.3rem 0 .2rem; }

/* ---------- psaní zprávy ---------- */
.compose-modal { max-width: 760px; height: 88vh; }
.compose-modal .modal-body { display: flex; flex-direction: column; gap: .1rem; flex: 1; min-height: 0; }
.compose-row { display: flex; align-items: center; gap: .6rem; border-bottom: 1px solid var(--hairline); }
.compose-row label { width: 58px; flex: none; margin: 0; text-align: right; }
.compose-row input { border: 0; background: transparent; padding: .55rem 0; }
.compose-row input:focus-visible { outline: none; box-shadow: none; }
.editor-tools { display: flex; gap: .15rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--hairline); }
.compose-editor { flex: 1; min-height: 160px; padding: .9rem 0; overflow-y: auto; font-size: .95rem; line-height: 1.55; }
.compose-editor:focus-visible { outline: none; }
.compose-editor blockquote { border-left: 2px solid var(--hairline); margin: .6em 0; padding-left: 1em; color: var(--muted); }
.compose-atts { display: flex; gap: .4rem; flex-wrap: wrap; padding-top: .5rem; }

/* ---------- nastavení ---------- */
.settings-wrap { grid-column: 1 / -1; overflow-y: auto; padding: 1.5rem 1rem 3rem; }
.settings-card { max-width: 880px; margin: 0 auto; }
.settings-top { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.2rem; }
.settings-top h1 { font-size: 1.3rem; margin: 0; font-weight: 700; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--hairline); margin-bottom: 1.4rem; flex-wrap: wrap; }
.tabs button {
    display: inline-flex; align-items: center; gap: .4rem;
    background: none; border: 0; border-bottom: 2px solid transparent;
    padding: .6rem .7rem; font-size: .9rem; font-weight: 600;
    color: var(--muted); cursor: pointer; margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }

.panel { background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.panel h2 { font-size: 1rem; margin: 0 0 .3rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.panel .lead { color: var(--muted); font-size: .87rem; margin: 0 0 1rem; }

.item-table { width: 100%; border-collapse: collapse; font-size: .89rem; }
.item-table th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); padding: .3rem .5rem; border-bottom: 1px solid var(--hairline); font-weight: 700; }
.item-table td { padding: .6rem .5rem; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.item-table tr:last-child td { border-bottom: 0; }
.actions-cell { text-align: right; white-space: nowrap; }
.actions-cell .btn { margin-left: .3rem; }

/* motivy */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.theme-card { border: 1.5px solid var(--hairline); border-radius: 10px; padding: .7rem; cursor: pointer; background: var(--surface); text-align: left; }
.theme-card:hover { border-color: var(--muted); }
.theme-card.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.theme-card .swatches { display: flex; gap: .3rem; margin-bottom: .5rem; }
.theme-card .sw { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--hairline); }
.theme-card .name { font-size: .85rem; font-weight: 600; }
.theme-card .feel { font-size: .75rem; color: var(--faint); }

/* režim zobrazení */
.mode-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.mode-btn {
    display: inline-flex; align-items: center; gap: .4rem;
    border: 1.5px solid var(--hairline); border-radius: 9px;
    background: var(--surface); color: var(--text);
    padding: .5rem .9rem; font-size: .88rem; font-weight: 600; cursor: pointer;
}
.mode-btn:hover { border-color: var(--muted); }
.mode-btn.active { border-color: var(--brand); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }

/* podpis */
.sig-strip {
    display: flex; align-items: center; gap: 1rem;
    border: 1px solid var(--hairline); border-radius: 10px;
    padding: .7rem .9rem; margin-top: .3rem;
}
.sig-strip-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.sig-strip-info b { font-size: .9rem; }
.sig-strip-info span { font-size: .82rem; }

.sig-styles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; }
.sig-style {
    text-align: left; border: 1.5px solid var(--hairline); border-radius: 10px;
    background: var(--surface); padding: .6rem .8rem; cursor: pointer; color: var(--text);
    display: flex; flex-direction: column; gap: .1rem;
}
.sig-style:hover { border-color: var(--muted); }
.sig-style.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.sig-style .name { font-size: .88rem; font-weight: 700; }
.sig-style .desc { font-size: .76rem; color: var(--faint); }

.sig-preview { border: 1px solid var(--hairline); border-radius: 10px; background: #fff; min-height: 96px; overflow: hidden; }
.sig-frame { width: 100%; border: 0; display: block; min-height: 96px; background: #fff; }

.sig-photo { display: flex; align-items: center; gap: .9rem; }
.sig-photo-box {
    width: 62px; height: 62px; flex: none; border-radius: 10px;
    border: 1px dashed var(--hairline); background: var(--bg);
    display: flex; align-items: center; justify-content: center; color: var(--faint); overflow: hidden;
}
.sig-photo-box img { width: 100%; height: 100%; object-fit: cover; }

/* zabezpečení */
.sec-item { display: flex; align-items: flex-start; gap: .8rem; padding: .9rem 0; border-bottom: 1px solid var(--hairline); }
.sec-item:last-child { border-bottom: 0; }
.sec-item .sec-ico { width: 36px; height: 36px; border-radius: 9px; background: var(--tint); color: var(--brand); display: flex; align-items: center; justify-content: center; flex: none; }
.sec-item .sec-body { flex: 1; min-width: 0; }
.sec-item .sec-body h3 { margin: 0 0 .15rem; font-size: .93rem; font-weight: 700; }
.sec-item .sec-body p { margin: 0; font-size: .84rem; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 5px; border: 1px solid; }
.badge.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.off { color: var(--faint); border-color: var(--hairline); }

.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; margin: .8rem 0; }
.codes code { background: var(--bg); border: 1px solid var(--hairline); border-radius: 6px; padding: .45rem .6rem; font-size: .92rem; letter-spacing: .05em; text-align: center; }

.qr-box { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.qr-box canvas, .qr-box img { border: 1px solid var(--hairline); border-radius: 8px; background: #fff; padding: 8px; }
.secret-line { display: flex; gap: .4rem; align-items: center; }
.secret-line code { background: var(--bg); border: 1px solid var(--hairline); border-radius: 6px; padding: .35rem .5rem; font-size: .84rem; letter-spacing: .08em; word-break: break-all; }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 1.4rem; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.toast {
    display: flex; align-items: center; gap: .5rem;
    background: var(--text); color: var(--bg);
    border-radius: 9px; padding: .6rem 1rem; font-size: .88rem;
    box-shadow: var(--shadow); animation: toast-in .22s ease; max-width: 92vw;
}
.toast.err { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- responzivita ---------- */
@media (max-width: 1150px) { :root { --list-w: 350px; } }

#mv-back { display: none; }

@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w);
        z-index: 80; transform: translateX(-100%); transition: transform .2s;
        box-shadow: var(--shadow); background: var(--surface);
    }
    .sidebar.open { transform: none; }
    .main { grid-template-columns: 1fr; }
    .read-pane { position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 70; display: none; }
    .read-pane.open { display: flex; }
    .topbar .vz-name, .topbar select.account-switch { display: none; }
    #mv-back { display: inline-flex; }
    .codes { grid-template-columns: 1fr; }
}
@media (min-width: 901px) { #nav-toggle { display: none; } }
