:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-hover: #eef1f5;
  --bg-sel: #e5f0f8;
  --bg-sel-strong: #d3e6f4;
  --line: #e4e7ec;
  --text: #1b1f24;
  --text-2: #5b6470;
  --text-3: #8a929c;
  --accent: #1375bc;
  --accent-text: #ffffff;
  --danger: #dc2626;
  --star: #f59e0b;
  --unread-dot: #1375bc;
  --shadow: 0 10px 30px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .08);
  --radius: 8px;
  --row-h: 68px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181d; --bg-soft: #1c1f25; --bg-hover: #23272f; --bg-sel: #1f2c45; --bg-sel-strong: #24365a;
    --line: #2b3039; --text: #e6e8eb; --text-2: #a4acb7; --text-3: #737c88; --accent: #4f8cff;
    --unread-dot: #4f8cff; --shadow: 0 10px 30px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  --bg: #16181d; --bg-soft: #1c1f25; --bg-hover: #23272f; --bg-sel: #1f2c45; --bg-sel-strong: #24365a;
  --line: #2b3039; --text: #e6e8eb; --text-2: #a4acb7; --text-3: #737c88; --accent: #4f8cff;
  --unread-dot: #4f8cff; --shadow: 0 10px 30px rgba(0,0,0,.5);
}
:root[data-density="compact"] { --row-h: 44px; }

/* posuvníky podle zvoleného vzhledu (i když se liší od systému) */
:root { color-scheme: light; --scroll: #c4c9d1; --scroll-hover: #a3aab5; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --scroll: #3b414c; --scroll-hover: #4c5462; }
}
:root[data-theme="dark"] { color-scheme: dark; --scroll: #3b414c; --scroll-hover: #4c5462; }
* { scrollbar-color: var(--scroll) transparent; }
*:hover { scrollbar-color: var(--scroll-hover) transparent; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.4 var(--font); overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--text-3); }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- přihlášení ---------- */
/* jako administrace sznette: box výš než na střed (volné místo nad:pod = 40:60) */
.login { display: flex; flex-direction: column; align-items: center; min-height: 100vh; background: var(--bg-soft); padding: 16px; overflow-y: auto; }
.login::before { content: ''; flex: 2 0 0; }
.login::after { content: ''; flex: 3 0 0; }
.login form { width: 100%; max-width: 340px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 30px 28px; box-shadow: var(--shadow); }
.login-head { margin-bottom: 22px; }
.login-logo { display: block; width: 78%; max-width: 250px; height: auto; margin: -6px 0 0 -3px; }
.login-head p { margin: 10px 0 0; color: var(--text-2); font-size: 13px; }
.login label { display: block; font-size: 13px; color: var(--text-2); margin: 14px 0 6px; }
.login input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.login input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.pwwrap { position: relative; display: block; }
.pwwrap input { padding-right: 40px !important; }
.pweye { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); cursor: pointer; }
.pweye:hover { color: var(--text); background: var(--bg-hover); }
.pweye .i { width: 18px; height: 18px; }
.login .err:not(:empty) { color: var(--danger); margin-top: 14px; font-size: 13px; padding: 8px 12px; border: 1px solid var(--danger); border-radius: 6px; background: color-mix(in srgb, var(--danger) 8%, transparent); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); white-space: nowrap; }
.btn:hover { background: var(--bg-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.wide { width: 100%; justify-content: center; padding: 11px; margin-top: 20px; }
.btn:disabled { opacity: .6; cursor: default; }
.ibtn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); }
.ibtn:hover { background: var(--bg-hover); color: var(--text); }
.ibtn.on { color: var(--star); }

/* ---------- rozvržení ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(320px, 440px) 1fr; grid-template-rows: 52px 1fr; height: 100vh; height: 100dvh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.brand { width: 204px; display: flex; align-items: center; flex: none; }
.brand-logo { display: block; height: 38px; width: auto; margin-left: -4px; }
.search { flex: 1; max-width: 680px; position: relative; }
.search input { width: 100%; height: 36px; padding: 0 12px 0 36px; border-radius: 18px; border: 1px solid transparent; background: var(--bg-soft); }
.search input:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.search.drop input { border: 2px dashed var(--accent); background: var(--bg); }
.search svg { position: absolute; left: 11px; top: 9px; color: var(--text-3); }
.search .hint { position: absolute; right: 10px; top: 8px; min-width: 20px; height: 20px; padding: 0 6px; display: flex; align-items: center; justify-content: center; font: 12px ui-monospace, monospace; color: var(--text-3); background: var(--bg); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; pointer-events: none; }
/* nápověda klávesy jen u prázdného pole bez kurzoru */
.search input:focus ~ .hint, .search input:not(:placeholder-shown) ~ .hint { display: none; }
.top .spacer { flex: 1; }
.syncinfo { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.syncinfo.err { color: var(--danger); }
.syncinfo.link { cursor: pointer; text-decoration: underline; }
.who { font-size: 13px; color: var(--text-2); }

.side { border-right: 1px solid var(--line); overflow-y: auto; padding: 12px 8px; background: var(--bg-soft); }
.compose-btn { width: 100%; justify-content: center; margin-bottom: 14px; padding: 10px; }
.folder { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--text-2); cursor: pointer; user-select: none; }
.folder:hover { background: var(--bg-hover); }
.folder.active { background: var(--bg-sel-strong); color: var(--text); font-weight: 600; }
.folder.drop { outline: 2px dashed var(--accent); }
.folder .n { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text); }
.folder .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side h4 { margin: 18px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; }

/* ---------- seznam ---------- */
.listpane { position: relative; display: flex; flex-direction: column; border-right: 1px solid var(--line); min-width: 0; min-height: 0; }
/* přetažení šířky seznamu (jen počítač, šířka v cookie wm-listw) – CSS ji drží v rozumných mezích i při změně okna */
@media (min-width: 901px) { .shell.list-sized { grid-template-columns: 232px clamp(280px, var(--list-w), calc(100% - 232px - 360px)) 1fr; } }
.list-resize { position: absolute; top: 0; bottom: 0; right: -4px; width: 8px; cursor: ew-resize; z-index: 5; touch-action: none; }
.list-resize::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background .15s; }
.list-resize:hover::after, .shell.resizing .list-resize::after { background: var(--accent); }
.shell.resizing { cursor: ew-resize; user-select: none; }
.shell.resizing iframe { pointer-events: none; }
.listhead { display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); min-height: 48px; }
.listhead h2 { margin: 0; font-size: 15px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listhead .meta { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.filters { display: flex; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
.chip { flex: none; white-space: nowrap; padding: 3px 10px; border-radius: 12px; border: 1px solid var(--line); background: transparent; font-size: 12px; color: var(--text-2); }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.attsort { margin-left: auto; flex: none; padding: 2px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text-2); font: inherit; font-size: 12px; }
.bulk { display: flex; align-items: center; gap: 2px; padding: 4px 8px; border-bottom: 1px solid var(--line); background: var(--bg-sel); }
.bulk span { font-size: 13px; margin-right: auto; padding-left: 6px; }
/* při výběru zpráv nahradí lišta akcí řádek filtrů (jako v Android aplikaci), seznam neposkočí dolů */
.filters:has(+ .bulk:not(.hidden)) { display: none; }
.scroller { flex: 1; overflow-y: auto; position: relative; contain: strict; }
.scroller .spacer { position: relative; width: 100%; }
.row { position: absolute; left: 0; right: 0; height: var(--row-h); padding: 8px 12px 8px 26px; border-bottom: 1px solid var(--line); cursor: default; user-select: none; overflow: hidden; }
.row:hover { background: var(--bg-hover); }
.row.sel { background: var(--bg-sel); }
/* dotyk: podržení řádku vybírá zprávu – bez systémové nabídky a označování textu */
.row { -webkit-touch-callout: none; -webkit-user-select: none; }
@media (hover: none) and (pointer: coarse) {
  .bulk { min-height: 50px; padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
  .bulk span { font-size: 15px; font-weight: 600; }
  .bulk .ibtn { flex: none; width: 44px; height: 44px; }
}
.row.cur { box-shadow: inset 3px 0 0 var(--accent); }
.row .l1 { display: flex; gap: 8px; align-items: baseline; }
.row .from { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.row .date { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.row .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.row .snip { color: var(--text-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.unread .from, .row.unread .subj { color: var(--text); font-weight: 650; }
.row.unread::before { content: ""; position: absolute; left: 10px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--unread-dot); }
.row .ic { display: inline-flex; gap: 4px; color: var(--text-3); }
.row .ic svg { width: 14px; height: 14px; }
.row .ic .star { color: var(--star); }
.row .fbadge { font-size: 11px; padding: 0 6px; border-radius: 8px; background: var(--bg-soft); border: 1px solid var(--line); color: var(--text-2); }
.row.ghost .from, .row.ghost .subj { color: var(--text-3); }
:root[data-density="compact"] .row .snip { display: none; }
:root[data-density="compact"] .row { padding-top: 4px; padding-bottom: 4px; }
:root[data-density="compact"] .row.unread::before { top: 10px; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-3); }

/* ---------- čtení ---------- */
.reader { min-width: 0; min-height: 0; overflow-y: auto; background: var(--bg); }
.reader .placeholder { display: grid; place-items: center; height: 100%; color: var(--text-3); text-align: center; padding: 20px; }
.placeholder kbd, .help kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; font: 12px ui-monospace, monospace; background: var(--bg-soft); }
.toolbar { position: sticky; top: 0; z-index: 2; display: flex; gap: 2px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--bg); align-items: center; }
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.toolbar .grow { flex: 1; }
.msg { padding: 20px 28px 40px; max-width: 1100px; }
.msg h1 { font-size: 21px; margin: 0 0 16px; font-weight: 650; line-height: 1.3; word-break: break-word; }
.hdr { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; font-size: 15px; }
.hdr .who2 { flex: 1; min-width: 0; }
.hdr .nm { font-weight: 600; }
.hdr .em { color: var(--text-3); font-size: 13px; }
.hdr .rc { color: var(--text-2); font-size: 13px; margin-top: 2px; word-break: break-word; }
.hdr .dt { color: var(--text-3); font-size: 13px; white-space: nowrap; }
.banner { display: flex; gap: 10px; align-items: center; padding: 8px 12px; margin-bottom: 12px; border-radius: var(--radius); background: var(--bg-soft); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.banner button { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 600; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
/* pozvánka do kalendáře (text/calendar) */
.invite { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--bg-soft); font-size: 13.5px; }
.invite.cancelled { border-left-color: var(--text-3); }
.invite.cancelled .inv-title { text-decoration: line-through; color: var(--text-2); }
.inv-h { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .02em; }
.invite.cancelled .inv-h { color: var(--text-3); }
.inv-h .i { width: 15px; height: 15px; }
.inv-h .muted { color: var(--text-2); font-weight: 400; text-transform: none; letter-spacing: 0; }
.inv-title { font-size: 15px; font-weight: 600; margin: 6px 0 8px; }
.inv-row { display: grid; grid-template-columns: 80px 1fr; gap: 8px; padding: 2px 0; }
.inv-row .muted { color: var(--text-2); }
.inv-row > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.inv-state { color: var(--text-2); }
div.inv-state { margin-top: 8px; }
.inv-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.inv-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 8px; font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.inv-badge .i { width: 15px; height: 15px; }
.inv-badge.accepted { background: #188038; border-color: #188038; color: #fff; }
.inv-badge.declined { background: #c5221f; border-color: #c5221f; color: #fff; }
/* odpověď na pozvánku: jeden řádek */
.invite.compact { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 9px 12px; border-left-color: #188038; }
.invite.compact.declined { border-left-color: #c5221f; }
.invite.compact > .i { width: 16px; height: 16px; color: #188038; flex: none; }
.invite.compact.declined > .i { color: #c5221f; }
.invite.compact .muted { color: var(--text-2); }
.inv-orig { display: block; margin: 0 0 12px; padding: 0; border: 0; background: none; color: var(--accent); font-size: 13px; }
.inv-orig:hover { text-decoration: underline; }
.att { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); max-width: 280px; }
.att:hover { background: var(--bg-hover); }
.att .an { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.att .as { color: var(--text-3); font-size: 12px; white-space: nowrap; }
iframe.body { width: 100%; border: 0; display: block; min-height: 60px; background: #fff; border-radius: 6px; box-sizing: border-box; }
.loading { color: var(--text-3); padding: 30px 0; }

/* ---------- psaní ---------- */
.composer { position: fixed; right: 24px; bottom: 0; width: min(760px, calc(100vw - 48px)); height: min(640px, calc(100vh - 60px)); background: var(--bg); border: 1px solid var(--line); border-radius: 12px 12px 0 0; box-shadow: var(--shadow); display: flex; flex-direction: column; z-index: 50; }
/* přetažené okno (poloha z JS v --cx/--cy); zvětšené okno a mobil mají přednost (pravidla níže) */
.composer.moved { left: var(--cx); top: var(--cy); right: auto; bottom: auto; border-radius: 12px; }
.composer.moved::after { border-radius: 12px; }
.composer:not(.max) .ch { cursor: move; user-select: none; }
/* upozornění na chybějící jméno odesílatele (tlačítka mají vlastní vzhled, ne odkazový z .banner button) */
.composer .namehint { margin: 8px 12px 4px; align-items: flex-start; }
.namehint .nh-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.namehint .nh-form .inp { flex: 1 1 180px; height: 30px; }
.namehint .btn.primary { padding: 5px 12px; background: var(--accent); border: 1px solid var(--accent); color: var(--accent-text); }
.namehint .nh-skip { color: var(--text-2); font-weight: 400; }
.namehint .ibtn { color: var(--text-3); width: 28px; height: 28px; margin: -4px -6px 0 0; }
/* ztlumený zvuk v horní liště: ikona přeškrtnutého reproduktoru, ať je stav vidět */
.ibtn.muted-on { color: var(--text-3); }
.composer.max { inset: 30px 60px 0 60px; width: auto; height: auto; border-radius: 12px 12px 0 0; }
.composer .ch { display: flex; align-items: center; padding: 8px 8px 8px 16px; background: var(--bg-soft); border-radius: 12px 12px 0 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.composer .ch span { flex: 1; }
.cf { display: flex; align-items: center; border-bottom: 1px solid var(--line); padding: 0 12px; position: relative; }
.cf label { color: var(--text-3); width: 56px; font-size: 13px; }
.cf input { flex: 1; border: 0; padding: 10px 0; background: transparent; outline: none; }
.cf .toggles button { border: 0; background: none; color: var(--text-3); font-size: 13px; }
.cf .toggles button:hover { color: var(--text); }
.etools { display: flex; gap: 2px; padding: 4px 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.etools .ibtn { width: 30px; height: 28px; font-weight: 700; }
.etools .ibtn:disabled { opacity: .35; cursor: default; background: transparent; }
.etools .esep { width: 1px; margin: 4px 4px; background: var(--line); }
.editor { flex: 1; overflow-y: auto; padding: 14px 16px; outline: none; line-height: 1.5; position: relative; contain: paint; } /* citovaný obsah nesmí přesahovat přes UI */
.editor blockquote { margin: 0 0 0 4px; padding-left: 12px; border-left: 3px solid var(--line); color: var(--text-2); }
.editor .sig { color: var(--text-2); }
.cfoot { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: nowrap; }
.cfoot .grow { flex: 1; min-width: 0; }
/* stav (Ukládám…, Koncept uložen) se v úzkém okně zkrátí – patička se nesmí zalomit */
.cfoot .status { font-size: 12px; color: var(--text-3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.cfoot > .btn, .cfoot > .ibtn { flex: none; }
.upl { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
.upl .att { padding: 4px 8px; }
.upl .att button { border: 0; background: none; color: var(--text-3); padding: 0 0 0 4px; }
.composer.dragover::after { content: "Pusťte soubory pro přiložení"; position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 2px dashed var(--accent); border-radius: 12px 12px 0 0; font-weight: 600; color: var(--accent); }
.ac { position: absolute; top: 100%; left: 60px; right: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 5; max-height: 260px; overflow-y: auto; }
.ac div { padding: 7px 12px; cursor: pointer; }
.ac div.on, .ac div:hover { background: var(--bg-sel); }
.ac small { color: var(--text-3); margin-left: 6px; }

/* ---------- modaly, menu, toasty ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 80; padding: 16px; }
.modal { background: var(--bg); border-radius: 12px; box-shadow: var(--shadow); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 22px 24px; }
.modal h3 { margin: 0 0 16px; }
.modal label, .form label { display: block; font-size: 13px; color: var(--text-2); margin: 12px 0 6px; }
/* jednotná pole formulářů – v dialozích (.modal) i mimo ně (.form, např. kontakt) */
.modal input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=search]):not([type=color]), .modal textarea, .modal select,
.form input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=search]):not([type=color]), .form textarea, .form select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text); }
.modal input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=search]):not([type=color]):focus, .modal textarea:focus, .modal select:focus,
.form input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=search]):not([type=color]):focus, .form textarea:focus, .form select:focus { outline: none; border-color: var(--accent); }
.modal textarea, .form textarea { min-height: 110px; resize: vertical; }
.modal .row2 { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal .chk { display: flex; gap: 8px; align-items: center; color: var(--text); }
/* nastavení: pevná velikost – přepínání záložek nesmí okno zvětšovat/zmenšovat */
.modal.wide { max-width: 720px; height: min(640px, calc(100vh - 32px)); display: flex; flex-direction: column; overflow: hidden; }
.modal.wide .tabbody { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab { border: 0; background: none; padding: 8px 10px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.modal .hint { font-size: 12px; color: var(--text-3); margin: 6px 0 4px; line-height: 1.5; }
.modal .chk { margin-top: 16px; }
.fwlist { margin: 10px 0; }
.fwrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.fwrow .btn { padding: 4px 10px; font-size: 12px; }
.fwadd { display: flex; gap: 8px; }
.fwadd input { flex: 1; }
.help table { width: 100%; border-collapse: collapse; font-size: 13px; }
.help td { padding: 4px 0; }
.menu { position: fixed; z-index: 90; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px; min-width: 200px; max-height: 60vh; overflow-y: auto; }
.menu div { padding: 7px 12px; border-radius: 5px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.menu div:hover { background: var(--bg-hover); }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; align-items: center; }
.toast { background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; display: flex; gap: 14px; align-items: center; position: relative; overflow: hidden; }
/* linka zbývajícího času u akce (Zpět): plynule se zkracuje do konce */
/* text toastu v jednom řádku (předmět · odesílatel), dlouhý se zkrátí */
.toast.act > span:first-child { min-width: 0; max-width: min(640px, 70vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast .tbar { position: absolute; left: 0; bottom: 0; width: 100%; height: 3px; background: #8cc4ea; transform-origin: left; animation: tbar linear forwards; }
@keyframes tbar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.toast.err { background: var(--danger); }
.toast button { background: none; border: 0; color: #8cc4ea; font-weight: 600; padding: 0; }

/* ---------- přepínač vzhledu ---------- */
.login-corner { position: fixed; top: 12px; right: 12px; }
.menu div.on { color: var(--accent); font-weight: 600; }
.menu .tick { margin-left: auto; width: 16px; height: 16px; }
.menu h5 { margin: 8px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; }
.menu small { margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.menu .grow { flex: 1; }

/* ---------- seznam: VIP, konverzace, odložení ---------- */
.vipbadge { font-size: 10px; font-weight: 700; letter-spacing: .04em; color: #b45309; background: color-mix(in srgb, #f59e0b 18%, transparent); border-radius: 4px; padding: 0 4px; flex: none; }
.row .count { font-size: 11px; color: var(--text-3); border: 1px solid var(--line); border-radius: 8px; padding: 0 6px; flex: none; }
.row .date.snz { color: var(--accent); display: inline-flex; align-items: center; gap: 3px; }
.row .date.snz svg { width: 12px; height: 12px; }
.side .folder .x { margin-left: auto; border: 0; background: none; color: var(--text-3); padding: 0 2px; visibility: hidden; }
.side .folder:hover .x { visibility: visible; }

/* ---------- čtení: karty konverzace ---------- */
.threadinfo { font-size: 12px; color: var(--text-3); margin: -8px 0 12px; display: flex; gap: 10px; align-items: baseline; }

/* konverzace v bublinách (Nastavení → Zobrazení konverzace) */
.chat { --bub-in: #efeff2; }
:root[data-theme="dark"] .chat { --bub-in: #2c3038; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chat { --bub-in: #2c3038; } }
.chat-h { display: flex; align-items: center; gap: 8px; margin: -6px 0 2px; color: var(--text-3); font-size: 13px; }
.chat-day { text-align: center; color: var(--text-3); font-size: 12px; margin: 14px 0 12px; }
.cb { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; margin-bottom: 16px; padding: 0 12% 0 40px; }
.cb.out { align-items: flex-end; padding: 0 0 0 18%; }
.cb.orig { align-items: stretch; padding-right: 0; }
.cb.out.orig { padding-left: 0; }
.cb.orig .card { margin-bottom: 0; }
.cb-bub { max-width: 100%; min-width: 0; box-sizing: border-box; padding: 9px 15px; border-radius: 18px; background: var(--bub-in); color: var(--text); font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.cb-bub.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 14; overflow: hidden; }
.cb-bub.empty { color: var(--text-3); font-style: italic; }
.cb.out .cb-bub { background: var(--accent); color: var(--accent-text); }
.cb.out .cb-bub a { color: var(--accent-text); text-decoration: underline; }
.cb.cur .cb-bub { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.cb-meta { display: flex; align-items: center; gap: 9px; margin-top: 5px; min-width: 0; max-width: 100%; color: var(--text-3); font-size: 12px; }
.cb-meta .avatar.sm { position: absolute; left: 0; bottom: 18px; width: 30px; height: 30px; font-size: 13px; }
.cb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.cb-meta .link { color: var(--text-2); font-size: 12px; }
.cb-meta .link:hover { color: var(--accent); }
.cb-meta .link[hidden] { display: none; }
.cb-att svg { width: 14px; height: 14px; vertical-align: -2px; }
.devtag { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px; background: #f59e0b; color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; letter-spacing: .04em; vertical-align: 1px; text-transform: none; }
.chat .link, .threadinfo .link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.chat .link:hover, .threadinfo .link:hover { text-decoration: underline; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; background: var(--bg); }
.card:not(.open) .hdr { margin-bottom: 0; }
.card .hdr.clickable { cursor: pointer; }
.card:not(.open) .rc.snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
.card .dt { display: flex; align-items: center; gap: 4px; }
.vipbtn { border: 1px solid var(--line); background: none; color: var(--text-3); font-size: 10px; font-weight: 700; border-radius: 4px; padding: 0 5px; margin-left: 4px; vertical-align: 1px; }
.vipbtn:hover { color: var(--text); }
.vipbtn.on { color: #b45309; border-color: color-mix(in srgb, #f59e0b 50%, transparent); background: color-mix(in srgb, #f59e0b 15%, transparent); }
.btn.small { padding: 4px 10px; font-size: 12px; }

/* varování před phishingem */
.banner svg { width: 18px; height: 18px; flex: none; }
.banner .btext { flex: 1; min-width: 0; }
.banner.warn-danger { border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: color-mix(in srgb, var(--danger) 10%, var(--bg)); color: var(--text); }
.banner.warn-danger svg { color: var(--danger); }
.banner.warn-warn { border-color: color-mix(in srgb, #f59e0b 55%, transparent); background: color-mix(in srgb, #f59e0b 10%, var(--bg)); color: var(--text); }
.banner.warn-warn svg { color: #d97706; }
.banner.warn-info { background: transparent; border-style: dashed; color: var(--text-3); }

/* ---------- pravidla ---------- */
.rulerow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rulerow .grow { flex: 1; min-width: 0; }
.rulerow .hint { margin: 2px 0 0; }
.condrow { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.condrow select, .condrow input { padding: 6px 8px !important; }
.condrow input { flex: 1; min-width: 0; }
.modal h4.sub, .form h4.sub { margin: 22px 0 6px; font-size: 14px; }
.modal label > select { width: auto; display: inline-block; margin-left: 4px; }

/* ---------- našeptávač hledání ---------- */
.search .search-ac { left: 0; right: 0; top: 40px; }
.search-ac small { float: right; }

/* ---------- přehled příloh (zabírá seznam i čtecí panel) ---------- */
.shell.attmode .listpane { display: none; }
.shell.attmode .reader { grid-column: 2 / -1; display: block; padding: 16px 24px; }
.shell.attmode .filters { border: 0; padding: 4px 0 12px; }
.attgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.attcard { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); display: flex; flex-direction: column; position: relative; }
.attcard.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.attchk { position: absolute; top: 8px; left: 8px; z-index: 1; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; opacity: .75; }
.attcard:hover .attchk, .attchk:checked { opacity: 1; }
.attbulk { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 24px; padding: 10px 14px; border-radius: 10px 10px 0 0; background: var(--bg-sel); box-shadow: 0 -4px 14px rgba(0,0,0,.12); font-size: 13px; }
.attbulk .grow { flex: 1; min-width: 140px; }
.attbulk .btn .i { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.attthumb { display: grid; place-items: center; height: 120px; background: var(--bg-soft); overflow: hidden; text-decoration: none; }
.attthumb img { width: 100%; height: 100%; object-fit: cover; }
.atticon { display: grid; place-items: center; gap: 4px; color: var(--text-3); font-size: 11px; font-weight: 700; }
.atticon svg { width: 34px; height: 34px; }
.atticon.k-pdf { color: #dc2626; } .atticon.k-doc { color: #2563eb; } .atticon.k-archive { color: #a16207; } .atticon.k-image { color: #16a34a; }
.attinfo { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attinfo .an { font-size: 13px; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.attinfo .as { font-size: 12px; color: var(--text-3); display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.attinfo .attdel { width: 26px; height: 26px; color: var(--text-3); opacity: .6; }
.attinfo .attdel:hover { opacity: 1; color: var(--danger); }
.attinfo .attdel .i { width: 15px; height: 15px; }
.attcard.busy { opacity: .45; pointer-events: none; }
.attinfo .from { border: 0; background: none; padding: 0; text-align: left; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attinfo .from:hover { color: var(--accent); }
.attmore { text-align: center; padding: 16px; }
iframe.body.dark { background: transparent; }
iframe.body.pending { visibility: hidden; }

/* ---------- hromadná pošta, odhlášení ---------- */
.row .catbadge { font-size: 10px; color: var(--text-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; flex: none; }
.banner.bulk { background: var(--bg-soft); }
.banner.bulk .grow { flex: 1; }
.banner.bulk button { white-space: nowrap; }
.banner .done { display: inline-flex; align-items: center; gap: 4px; color: #16a34a; font-weight: 600; white-space: nowrap; }
.banner .done svg { width: 15px; height: 15px; }

/* ---------- správa složek ---------- */
.side h4.withbtn { display: flex; align-items: center; justify-content: space-between; }
.ibtn.tiny { width: 22px; height: 22px; font-size: 16px; line-height: 1; }
.side .folder .more { margin-left: 4px; border: 0; background: none; color: var(--text-3); padding: 0 4px; border-radius: 4px; visibility: hidden; font-size: 16px; line-height: 1; }
.side .folder:hover .more { visibility: visible; }
.side .folder .more:hover { background: var(--bg-hover); color: var(--text); }
.side .folder .n + .more { margin-left: 4px; }
.side .folder .label { flex: 1; }
.menu .danger { color: var(--danger); }
.menu .sepitem { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; }

/* ---------- responzivní rozvržení ---------- */
.back, .m-only, .menu-btn, .backdrop, .fab, .tabselect, .more-actions { display: none; }
.avatar-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; color: #fff; font-weight: 700; font-size: 14px; flex: none; }

/* --- dotyková zařízení: tablet i telefon (do 900 px) --- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(280px, 42%) 1fr; grid-template-rows: 52px 1fr; }
  .top { gap: 6px; padding: 0 8px; }
  .brand { width: auto; }
  .brand-logo { height: 30px; }
  .who, .search .hint, .d-only, .syncinfo:empty { display: none !important; }
  .m-only, .menu-btn { display: inline-grid; }
  .avatar-btn.m-only { display: grid; place-items: center; }
  /* složky jako vysouvací panel se ztmavením */
  .side { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 85vw); z-index: 60; box-shadow: var(--shadow);
    transform: translateX(-105%); transition: transform .22s ease; padding-top: 16px; display: block; }
  .shell.nav .side { transform: none; }
  .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .22s; }
  .shell.nav .backdrop { opacity: 1; pointer-events: auto; }
  .side .compose-btn { display: none; }
  /* plovoucí Napsat */
  .fab { display: inline-flex; align-items: center; gap: 8px; position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 45;
    border: 0; border-radius: 16px; padding: 14px 18px; background: var(--accent); color: #fff; font-weight: 600; font-size: 15px; box-shadow: var(--shadow); }
  .fab svg { width: 20px; height: 20px; }
  /* větší dotyková místa */
  .ibtn { width: 40px; height: 40px; }
  .ibtn svg { width: 20px; height: 20px; }
  .toolbar { padding: 6px 8px; gap: 0; }
  .chip { padding: 7px 14px; font-size: 14px; border-radius: 16px; }
  .filters:not(.cbar) { gap: 6px; padding: 8px 10px; }
  .folder { padding: 11px 12px; font-size: 15px; }
  .row .snip { font-size: 13.5px; }
  .filters { mask-image: linear-gradient(to right, #000 88%, transparent); -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); }
  .msg { padding: 16px; }
  .composer .ch .maxbtn { display: none; }
  .composer:not(.max) .ch { cursor: auto; }
  .composer, .composer.max, .composer.moved { inset: 0; width: auto; height: 100dvh; border-radius: 0; }
  /* formátovací lišta: jeden řádek s vodorovným posouváním (nezalamovat, ať nebere místo na psaní) */
  .etools { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px 6px; gap: 0; }
  .etools::-webkit-scrollbar { display: none; }
  .etools .ibtn { flex: none; width: 36px; height: 34px; }
  .etools .esep { flex: none; margin: 6px 3px; }
  .menu { max-width: calc(100vw - 16px); }
  .menu div { padding: 11px 14px; }
  .shell.attmode .reader { grid-column: 1 / -1; }
  /* hledání: jen ikona, po klepnutí přes celou lištu */
  .search { display: none; }
  .shell.searching .search { display: flex; align-items: center; position: absolute; inset: 0 0 auto 0; height: 52px; padding: 0 8px; gap: 4px; background: var(--bg); z-index: 5; max-width: none; }
  .shell.searching .search > svg { display: none; }
  .shell.searching .search input { padding-left: 14px; flex: 1; }
  .shell.searching .search .search-ac { left: 48px; right: 8px; top: 48px; }
  .top { position: relative; }
  /* stažení dolů pro obnovení: vlastní gesto místo obnovení celé stránky prohlížečem */
  .scroller, .crows, .shell.attmode .reader { overscroll-behavior-y: contain; }
}

/* indikátor obnovení stažením dolů (pozice a natočení nastavuje setupTouch) */
.ptr { position: fixed; z-index: 50; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); color: var(--accent); box-shadow: var(--shadow); pointer-events: none; opacity: 0;
  transition: transform .2s ease, opacity .2s ease; }
.ptr.pulling { transition: none; }
.ptr svg { width: 22px; height: 22px; opacity: .55; }
.ptr.ready svg, .ptr.spin svg { opacity: 1; }
.ptr.spin svg { animation: ptr-spin .8s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ptr.spin svg { animation: none; } }

/* --- telefon (do 600 px): jeden sloupec --- */
@media (max-width: 600px) {
  .shell { grid-template-columns: 1fr; }
  .reader { display: none; }
  .shell.reading .listpane { display: none; }
  .shell.reading .reader { display: block; }
  .shell.reading .fab { display: none; }
  .back { display: inline-grid; }
  /* lišta zprávy: hlavní akce + menu "⋯" */
  .toolbar .secondary { display: none; }
  .more-actions { display: inline-grid; font-size: 20px; }
  /* zpráva přes celou šířku: karty bez rámečku, datum pod jménem */
  .msg { padding: 12px 14px 90px; }
  .msg h1 { font-size: 19px; margin-bottom: 12px; }
  .card { border: 0; border-radius: 0; padding: 10px 0; margin: 0; border-bottom: 1px solid var(--line); }
  .card .hdr { flex-wrap: wrap; gap: 10px; }
  .card .hdr .avatar { width: 36px; height: 36px; font-size: 14px; }
  .card .hdr .dt { order: 3; width: 100%; padding-left: 46px; margin-top: -8px; font-size: 12px; }
  .card .hdr .dt .ibtn { display: none; }
  .hdr .rc { word-break: break-word; }
  .banner { flex-wrap: wrap; row-gap: 6px; }
  /* text zůstane vedle ikony; na další řádek jde jen tlačítko, zarovnané pod text */
  .banner .btext, .banner.bulk .grow { flex: 1 1 calc(100% - 40px); }
  .banner > svg ~ button, .banner > svg ~ .done, .banner > svg ~ .hint { margin-left: 28px; }
  iframe.body { border-radius: 0; }
  /* nastavení a dialogy přes celou obrazovku */
  .overlay { padding: 0; place-items: stretch; }
  .modal { max-width: none; border-radius: 0; max-height: none; height: 100dvh; padding: 16px; }
  .modal.wide { max-width: none; height: 100dvh; }
  .modal .row2 { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0 calc(6px + env(safe-area-inset-bottom)); margin-top: 16px; }
  .tabs { display: none; }
  .tabselect { display: block; position: relative; margin: 0 0 8px; }
  .tabselect select { display: block; width: 100%; padding: 11px 40px 11px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit; font-size: 15px; font-weight: 600; appearance: none; -webkit-appearance: none; }
  .tabselect svg { position: absolute; right: 12px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--text-2); pointer-events: none; }
  .condrow { flex-wrap: wrap; }
  .rulerow { flex-wrap: wrap; }
  /* psaní: lišta formátování nad textem zprávy (pod předmětem), jako na počítači */
  .composer .etools { order: 3; }
  .composer .upl { order: 6; }
  .composer .cfoot { order: 7; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .composer .editor { order: 4; }
  /* přílohy: dvě karty vedle sebe */
  .shell.attmode .reader { padding: 12px; }
  .attgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .attthumb { height: 90px; }
  .toasts { left: 12px; right: 12px; transform: none; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .toast { width: 100%; justify-content: space-between; }
}

/* přejetí prstem po řádku */
.row.swiping { transition: none; box-shadow: 0 0 0 1px var(--line); background: var(--bg); z-index: 2; }
.row { transition: transform .18s ease; }
.row.sw-left { background: color-mix(in srgb, var(--accent) 14%, var(--bg)); }
.row.sw-right { background: color-mix(in srgb, #16a34a 16%, var(--bg)); }

/* zavírací křížek dialogů */
.modal { position: relative; }
.modal-close { position: absolute; top: 12px; right: 12px; z-index: 2; }

/* dotyková zařízení bez myši: žádné nápovědy ke klávesám */
@media (hover: none) and (pointer: coarse) {
  .search .hint { display: none; }
}

/* dialog přesunu do složky */
.movelist { max-height: min(60vh, 520px); overflow-y: auto; margin: 4px -8px 12px; }
.movelist .folder { cursor: pointer; }
.movelist .folder.on { background: var(--bg-sel); color: var(--accent); font-weight: 600; }
.row2 .grow { flex: 1; }
@media (max-width: 600px) { .movelist { max-height: none; flex: 1; } }

/* verze v menu účtu */
.menu .ver { padding: 8px 12px 4px; font-size: 11px; color: var(--text-3); border-top: 1px solid var(--line); margin-top: 4px; cursor: default; }
.menu .ver:hover { background: none; }
.help-ver { margin: 18px 0 0; font-size: 12px; color: var(--text-3); text-align: right; }

/* ------------------------------------------------------------ třídění pošty */
@media (min-width: 601px) { .modal.wide { max-width: 860px; height: min(720px, calc(100vh - 32px)); } }
.triage .thead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 2px 0 10px; border-bottom: 1px solid var(--line); }
.thead .grow { flex: 1; }
.tsearch { flex: 0 1 260px; }
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--text-2); padding: 5px 12px; border-radius: 6px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--accent); color: var(--accent-text); }
.seg button:not(.on):hover { background: var(--bg-hover); color: var(--text); }
.tsec { padding: 12px 0 4px; }
.tsec-h { font-size: 12px; font-weight: 600; color: var(--text-3); padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tcheck { list-style: none; margin: 0; padding: 0; }
.tcheck li { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; font-size: 13px; border-bottom: 1px solid var(--line); }
.tcheck li svg { color: var(--accent); flex: none; margin-top: 2px; width: 14px; height: 14px; }
.trow { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; }
.trow .grow, .tline .grow { flex: 1; min-width: 0; }
.trow select { max-width: 260px; }
.tsec .hint { font-size: 12px; margin: 2px 0 6px; }
.tline { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.tline.undone { opacity: .55; }
.tname { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.triage .chip { font-size: 11px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 1px 8px; color: var(--text-2); white-space: nowrap; flex: none; }
.triage .chip.strong { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.keep { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); white-space: nowrap; flex: none; cursor: pointer; }
.tfoot { border-top: 1px solid var(--line); padding: 10px 0 4px; margin-top: 8px; font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.tfoot svg { width: 14px; height: 14px; flex: none; }
.tact { max-height: 60vh; overflow-y: auto; }
.row .catbadge.spam { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
@media (max-width: 600px) {
  .seg { width: 100%; overflow-x: auto; }
  .seg button { flex: 1; padding: 7px 8px; }
  .tsearch { width: 100%; }
  .tline { flex-wrap: wrap; row-gap: 4px; }
  .tline .grow { flex-basis: 100%; }
  .trow { flex-wrap: wrap; }
  .trow select { max-width: none; flex: 1; }
  .tfoot { font-size: 11px; }
}

/* editor podpisu v nastavení */
.sigbox { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sigbox .sigtools { border-bottom: 1px solid var(--line); padding: 2px 4px; display: flex; gap: 2px; background: var(--bg-soft); }
.sigbox .sigedit { min-height: 90px; max-height: 260px; overflow-y: auto; padding: 8px 10px; outline: none; font-size: 14px; }
.sigbox .sigedit img { max-width: 100%; height: auto; }
/* tmavý motiv: tmavý text podpisu (natvrdo černý z Roundcube, Gmailu, Wordu) – prvky označí markDarkInk() v app.js;
   jen zobrazení, atribut se před uložením i odesláním odstraní */
:is(.sigedit, .editor .sig) [data-wm-ink] { color: inherit !important; }

/* ------------------------------------------------------------ kontakty (standardní seznam + detail) */
.clist { display: none; }
.shell.abmode .listpane > .scroller, .shell.abmode .listpane > .filters:not(.cbar), .shell.abmode .listpane > .bulk { display: none; }
.shell.abmode .clist { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cbar { align-items: center; gap: 2px; overflow: visible; }
.crows { flex: 1; overflow-y: auto; min-height: 0; }
.crow { display: flex; align-items: center; gap: 10px; height: var(--row-h); padding: 8px 12px 8px 14px; border-bottom: 1px solid var(--line); cursor: default; user-select: none; }
.crow:hover { background: var(--bg-hover); }
.crow.sel { background: var(--bg-sel); }
.crow.cur { box-shadow: inset 3px 0 0 var(--accent); }
.crow .grow { flex: 1; min-width: 0; }
.crow .from { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow .snip { color: var(--text-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-density="compact"] .crow { padding-top: 4px; padding-bottom: 4px; }
.abav { border-radius: 50%; object-fit: cover; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; }
.tbtitle { font-weight: 600; margin-left: 6px; }
.toolbar a.ibtn { color: inherit; }
.abtop { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.abtop h1 { margin: 0 0 4px; }
.abs { font-size: 13px; color: var(--text-3); }
.abrows { display: grid; max-width: 760px; }
.abrow { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.abl { color: var(--text-3); font-size: 13px; }
.abv { overflow-wrap: anywhere; }
.abmap { font-size: 12px; }
.abnote { white-space: pre-wrap; }
.abform { max-width: 800px; }
.abphoto { display: flex; align-items: center; gap: 14px; }
.abphb { display: flex; gap: 6px; flex-wrap: wrap; }
.abgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.abgroup .btn { margin-top: 2px; }
.abline { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.form .abline select { width: 120px; flex: none; }
.abins { display: flex; gap: 6px; flex: 1; min-width: 0; }
.abins input { min-width: 0; flex: 1; }
.vipbtn.abbtn { margin-left: 4px; }

/* vyhledávací pole v panelech (přílohy, kontakty) – stejné jako hledání v poště */
.psearch { flex: 1; max-width: 420px; }
.cbar .psearch { max-width: none; }
.psearch input { height: 32px; }
.psearch svg { top: 7px; }
.shell .psearch { display: block !important; position: relative !important; inset: auto !important; height: auto !important; padding: 0 !important; background: none !important; }
.shell .psearch > svg { display: block !important; }
.shell .psearch input { padding-left: 36px !important; }

/* přílohy: hlavička jako u seznamu pošty */
.shell.attmode .reader { padding: 0; }
.listhead.atthead { gap: 12px; margin: 0; position: sticky; top: 0; z-index: 2; background: var(--bg); }
.listhead.atthead h2 { flex: none; }
.shell.attmode .filters { padding: 10px 24px 6px; border: 0; }
.attgrid { padding: 6px 24px 0; }
.attmore { padding: 12px 24px 24px; }
@media (max-width: 900px) {
  .abrow { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 600px) {
  .abgrid { grid-template-columns: 1fr; }
  .abline.multi { flex-wrap: wrap; }
  .abline.multi .abins { flex-basis: 100%; order: 3; flex-wrap: wrap; }
  .abline.multi .abins input { flex-basis: 45%; }
  .listhead.atthead { flex-wrap: wrap; }
  .listhead.atthead .psearch { max-width: none; flex-basis: 100%; }
  .shell.attmode .filters { padding: 8px 12px 4px; }
  .attgrid { padding: 6px 12px 0; }
  .attmore { padding: 12px; }
}

/* potvrzovací a vstupní dialogy (místo confirm/prompt prohlížeče) */
.modal.dlg { max-width: 440px; }
.modal.dlg h3 { padding-right: 32px; line-height: 1.35; }
.dlgtext { margin: -6px 0 6px; color: var(--text-2); line-height: 1.5; }
.dlgerr { margin: 6px 0 0; color: var(--danger); font-size: 13px; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn.danger:hover { filter: brightness(1.08); }
.swatches { display: grid; grid-template-columns: repeat(7, 36px); gap: 10px; margin: 4px 0 8px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; position: relative; }
.swatch:hover, .swatch:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch.custom { display: flex; align-items: center; justify-content: center; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); color: #fff; font-weight: 700; font-size: 18px; text-shadow: 0 0 3px #000; margin: 0; overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
@media (max-width: 600px) {
  .modal.dlg { height: auto; max-height: none; align-self: flex-end; border-radius: 16px 16px 0 0; }
  .swatches { grid-template-columns: repeat(auto-fill, 40px); }
}

/* telefon: kratší popisky tlačítek v patičce psaní ("Uložit" místo "Uložit koncept") */
@media (max-width: 600px) { .d-word { display: none; } }

/* nabídka instalace jako aplikace (mobil) */
.pwa-banner { position: fixed; left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 46; display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); max-width: 520px; margin: 0 auto; }
.pwa-banner img { flex: none; border-radius: 9px; }
.pwa-banner .pwa-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 1.35; }
.pwa-banner .pwa-text span { color: var(--text-2); }
.pwa-banner .btn { flex: none; }
.pwa-steps { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 12px; }
.pwa-steps div { display: flex; gap: 10px; align-items: baseline; }
.pwa-steps b { flex: none; width: 18px; color: var(--accent); }

/* spinner (např. tlačítko Načíst další) */
.spinner { display: inline-block; width: 14px; height: 14px; margin-right: 6px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
/* příloha se připravuje (stahuje z IMAPu) – spinner na odkazu */
a[data-att] { position: relative; }
a.attloading { opacity: .75; cursor: progress; }
.attspin { margin: 0 0 0 6px; flex: none; }
.attthumb .attspin { position: absolute; top: 50%; left: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; }
/* nastavení: skupiny, oprávnění oznámení, VIP, třídění */
.modal h4.setgrp { margin: 22px 0 2px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.modal h4.setgrp:first-child { margin-top: 4px; }
.modal .hint.ok { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.modal .hint.ok svg { width: 14px; height: 14px; color: var(--accent); }
.permline:empty { display: none; }
.permline { margin-top: 8px; }
.banner.warn { background: color-mix(in srgb, #f59e0b 12%, var(--bg)); border-color: color-mix(in srgb, #f59e0b 45%, var(--line)); color: var(--text); }
.fwrow .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.vipcnt { display: block; font-size: 12px; color: var(--text-3); }
.tintro { margin: 0 0 12px; }
.tintro .hint { margin-top: 0; }
/* hustota „Bez náhledu textu“: řádek bez třetí řádky (náhled), jinak jako normální */
:root[data-density="nosnip"] { --row-h: 54px; }
:root[data-density="nosnip"] .row .snip { display: none; }
/* seznam zpráv dostává fokus programově (Enter/šipka z hledání) – rámeček fokusu je zbytečný, pozici ukazuje zvýrazněný řádek */
.scroller:focus, .scroller:focus-visible { outline: none; }
/* nabídka instalace na počítači: vlevo dole (vpravo bývá okno nové zprávy) */
@media (min-width: 901px) { .pwa-banner { left: 16px; right: auto; bottom: 16px; width: 440px; margin: 0; } }
/* atribut hidden musí platit i u prvků s vlastním display (např. .ibtn) */
[hidden] { display: none !important; }
/* filtry nad seznamem: „⋯ ▾“ s tím, co se nevejde (počítač) */
.filters .chip.more { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.filters .chip.more svg { width: 14px; height: 14px; }
.filters .chip { flex: none; }
.menu .mi-sp { display: inline-block; width: 16px; flex: none; }

/* AI asistent */
.aisum { margin: 0 0 14px; padding: 10px 14px 12px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 6%, var(--bg)); font-size: 14px; }
.aisum .aihead { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; color: var(--accent); }
.aisum .aihead svg { width: 16px; height: 16px; }
.aisum .aihead b { font-size: 13px; }
.aisum .aihead .grow { flex: 1; }
.aisum .aihead .ibtn { width: 26px; height: 26px; color: var(--text-3); }
.aisum .aitext { white-space: pre-wrap; line-height: 1.55; color: var(--text); }
.aisum.busy .aitext { color: var(--text-3); }
.composer.aibusy .editor { opacity: .55; }
/* návrh odpovědi, jak ho AI píše (v editoru, do vložení hotového textu) */
.composer.aibusy .editor:has(.ailive) { opacity: 1; }
.ailive { color: var(--text); }
.ailive.wait { color: var(--accent); font-style: italic; animation: aipulse 1.4s ease-in-out infinite; }
.aicaret { display: inline-block; width: 2px; height: 1.05em; margin-left: 1px; vertical-align: -2px; background: var(--accent); animation: aiblink 1s steps(1) infinite; }
@keyframes aiblink { 50% { opacity: 0; } }
@keyframes aipulse { 50% { opacity: .5; } }
.etools .aibtn svg { color: var(--accent); }
.chip .chipi { width: 12px; height: 12px; vertical-align: -2px; margin-right: 3px; }
/* Nastavení → Integrace (podle LTweb Mail) */
.integ .fsec, .aic-body .fsec { margin-bottom: 22px; }
.fsec h4 { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--text); }
.fgroup { background: var(--bg-soft); border-radius: 12px; padding: 0 16px; }
.frow { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 46px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.frow:last-child { border-bottom: 0; }
.fl { font-size: 14px; min-width: 0; }
.fl.prov { display: flex; align-items: center; gap: 10px; }
.fl.prov svg.i { width: 24px; height: 24px; color: var(--text-2); flex: none; }
.fc { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; flex: none; max-width: 65%; }
.fc .btn.small .i { width: 14px; height: 14px; }
.fhint { color: var(--text-3); font-size: 12.5px; margin-top: 2px; line-height: 1.4; }
.fhint.pad { padding: 8px 0 10px; border-bottom: 1px solid var(--line); }
.fhint code, .mcpurl { font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.mcpurl { color: var(--text); }
.integ .muted, .aic .muted, .aia .muted { color: var(--text-2); }
.integ .small, .aia .small { font-size: 12.5px; }
.integ > p.small { margin: 0 0 6px; }
/* ostatní záložky nastavení ve stejném vzhledu: nadpis + šedý box s řádky */
.tabbody .fsec { margin-bottom: 22px; }
.tabbody .muted { color: var(--text-2); }
.tabbody > p.small { font-size: 12.5px; margin: 0 0 14px; }
.tabbody > .fsec + p.small { margin-top: -10px; }
.modal .tabbody .frow input.inp:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=search]):not([type=color]) { width: 260px; }
.tabbody .fgroup select.inp { width: 260px; }
.fc.ok svg { width: 16px; height: 16px; color: var(--accent); }
.fc.warn { color: var(--danger); }
.flist { border-bottom: 1px solid var(--line); }
.fgroup > .flist:last-child { border-bottom: 0; }
.fblock { padding: 2px 0 14px; border-bottom: 1px solid var(--line); }
.fblock:last-child { border-bottom: 0; }
.fblock > .fhint { margin-top: 8px; }
.fblock > .sigbox { margin-top: 12px; background: var(--bg); }
.tintro .fgroup { margin-top: 8px; }
.tsec { padding: 12px 0 0; }
.tsec .fgroup > .tline:last-child, .tcheck li:last-child { border-bottom: 0; }
.tsec .fgroup > .hint:first-child, .tsec .fgroup > .banner:first-child { margin-top: 10px; }
@media (max-width: 600px) {
  .modal .tabbody .frow input.inp:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=search]):not([type=color]), .tabbody .fgroup select.inp { width: 100%; }
}
.inp { height: 32px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; background: var(--bg); color: var(--text); font-size: 14px; outline: none; min-width: 0; width: auto; margin: 0; }
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.inp.num { width: 100px; text-align: right; }
.model-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.inline { display: inline-flex; align-items: center; gap: 8px; }
.sw { appearance: none; width: 38px; height: 22px; border-radius: 11px; background: var(--bg-hover); position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; border: 1px solid var(--line); }
.sw::before { content: ""; position: absolute; top: 1px; left: 1px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.sw:checked { background: var(--accent); border-color: var(--accent); }
.sw:checked::before { transform: translateX(16px); }
.modal.aic { width: min(620px, 96vw); }
.modal input.inp:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=search]):not([type=color]) { width: auto; height: 32px; padding: 0 10px; border-radius: 7px; }
.modal select.inp { width: auto; height: 32px; padding: 0 10px; border-radius: 7px; } /* výběr poskytovatele / aplikace (obecné .modal select má větší odsazení) */
.modal input.inp.num:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=search]):not([type=color]) { width: 100px; }
.modal .aic-body .fgroup input.inp:not(.num):not([type=checkbox]):not([type=radio]):not([type=file]):not([type=search]):not([type=color]) { width: 260px; }
.modal.aic { max-width: 620px; }
.modal.aia-modal { max-width: 820px; }
.modal .aic-body .fgroup select.inp, .integ .fgroup select.inp { width: 260px; }
@media (max-width: 600px) { .modal .aic-body .fgroup select.inp, .integ .fgroup select.inp { width: 100%; } }
@media (max-width: 600px) { .modal .aic-body .fgroup input.inp:not(.num):not([type=checkbox]):not([type=radio]):not([type=file]):not([type=search]):not([type=color]) { width: 100%; } }
.aic h2 { font-size: 22px; font-weight: 600; margin: 0 0 12px; }
.aic-body { font-size: 15px; line-height: 1.45; color: var(--text-2); }
.aic-body p { margin: 0 0 12px; }
.aic-body .fgroup { margin-top: 8px; }
.aic-body .fgroup .inp { width: 260px; }
.aic-body .fgroup .inp.num { width: 100px; }
.opt-list { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 14px; }
.opt { display: flex; align-items: flex-start; gap: 16px; width: 100%; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); text-align: left; color: inherit; font: inherit; cursor: pointer; }
.opt:hover { border-color: color-mix(in srgb, var(--line) 50%, var(--text-3)); }
.opt.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.opt .opt-ic { width: 28px; height: 28px; color: var(--text-2); stroke-width: 1.4; margin-top: 2px; flex: none; }
.opt-b { flex: 1; min-width: 0; }
.opt-t { font-size: 17px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 10px; }
.opt-d { color: var(--text-2); font-size: 14.5px; margin-top: 3px; line-height: 1.4; }
.inuse { color: #16a34a; font-size: 13px; font-weight: 600; }
.radio { width: 21px; height: 21px; border-radius: 50%; border: 1.5px solid var(--text-3); flex: none; margin-top: 3px; position: relative; }
.opt.on .radio { border-color: var(--accent); background: var(--accent); }
.opt.on .radio::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.aic-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); margin-top: 4px; }
.modal.aia-modal { width: min(820px, 96vw); }
.aia .dlg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.aia .dlg-head h3 { margin: 0; font-size: 17px; }
.aia .dlg-head .i { width: 20px; height: 20px; color: var(--accent); }
.aia-body .pad { padding: 4px 2px; }
.aia-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 4px 0 8px; }
.aia-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg); }
.aia-cl { font-size: 12.5px; color: var(--text-3); }
.aia-cv { font-size: 22px; font-weight: 600; margin: 2px 0 4px; }
.aia-cs { font-size: 12px; color: var(--text-3); }
.aia-h { margin: 14px 0 6px; font-size: 14px; }
.aia-runs { display: flex; flex-direction: column; gap: 4px; }
.aia-item { border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.aia-run { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none; text-align: left; color: inherit; font: inherit; cursor: pointer; border-radius: 10px; }
.aia-run:hover { background: var(--bg-hover); }
.aia-run .chev { width: 12px; height: 12px; color: var(--text-3); transition: transform .12s; flex: none; }
.aia-run.open .chev { transform: rotate(90deg); }
.aia-main { flex: 1; min-width: 0; }
.aia-top { display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; }
.aia-top .muted { font-size: 12px; }
.aia-sub { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aia-errt, .aia-run.err .aia-top b { color: var(--danger); }
.aia-right { text-align: right; flex: none; }
.aia-cost { font-weight: 600; font-size: 13.5px; }
.aia-det { padding: 0 12px 10px 34px; }
@media (max-width: 600px) {
  .frow { flex-wrap: wrap; }
  .fc { max-width: 100%; flex-wrap: wrap; }
  .aia-sum { grid-template-columns: 1fr; }
  .aic-body .fgroup .inp { width: 100%; }
}
