:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f3f4f6; --surface-3: #e9ebef; --border: #e3e5e9; --border-2: #d1d5db;
  --text: #111827; --text-2: #374151; --muted: #6b7280; --faint: #9ca3af;
  --accent: #2563eb; --primary: var(--accent); --primary-2: color-mix(in srgb, var(--accent) 82%, #000);
  --primary-50: color-mix(in srgb, var(--accent) 9%, #fff); --primary-100: color-mix(in srgb, var(--accent) 17%, #fff);
  --red: #dc2626; --green: #16a34a; --amber: #d97706; --star: #f59e0b;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.06); --shadow-lg: 0 12px 48px rgba(0,0,0,.22);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a20; --surface-2: #1f232b; --surface-3: #2a2f39; --border: #2a2f38; --border-2: #3a404b;
  --text: #e8eaee; --text-2: #c7cbd3; --muted: #959cab; --faint: #6b7280;
  --primary: color-mix(in srgb, var(--accent) 78%, #fff); --primary-2: color-mix(in srgb, var(--accent) 62%, #fff);
  --primary-50: color-mix(in srgb, var(--accent) 16%, #171a20); --primary-100: color-mix(in srgb, var(--accent) 28%, #171a20);
  --red: #f87171; --green: #4ade80; --amber: #fbbf24;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3); --shadow-lg: 0 12px 48px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; }
code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
kbd { font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 2px 5px; border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--muted); }
.ico { width: 18px; height: 18px; flex: none; }
.ico.rot90 { transform: rotate(90deg); }
.ico.spin, .spinning .ico { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.grow { flex: 1; }
.muted { color: var(--muted); } .small { font-size: 12px; } .t-red { color: var(--red); } .t-green { color: var(--green); }
.pad { padding: 6px 12px; }
.mobile-only, .mobile-back { display: none !important; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface); cursor: pointer; font-weight: 550; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.94); background: var(--red); }
.btn .ico { width: 16px; height: 16px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 26px; height: 26px; } .icon-btn.sm .ico { width: 15px; height: 15px; }
.icon-btn.star.on, .row-star.on { color: var(--star); } .icon-btn.star.on .ico, .row-star.on .ico { fill: var(--star); }
.link { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; }
.link:hover { text-decoration: underline; }
input:not([type=checkbox]):not([type=radio]), select, textarea { height: 34px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: 8px; background: var(--surface); outline: none; width: 100%; }
input:focus, select:focus, textarea:focus, .sig-edit:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 4px 7px; cursor: pointer; color: var(--muted); display: grid; }
.seg button.on { background: var(--primary-50); color: var(--primary); }
.seg .ico { width: 16px; height: 16px; }
.spinner { display: inline-block; width: 22px; height: 22px; border: 2.5px solid var(--border-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; vertical-align: -2px; }
.loading { display: grid; place-items: center; padding: 40px; } .loading.sm { padding: 10px; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 60px 20px; color: var(--muted); text-align: center; }
.empty .ico { width: 40px; height: 40px; stroke-width: 1.4; opacity: .55; }
.empty p { margin: 4px 0 0; font-size: 15px; }
.alert { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 8px; background: #fef3c7; color: #92400e; margin: 10px 0; }
[data-theme=dark] .alert { background: #3a2a08; color: #fcd34d; }
.hint { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--primary-50); color: var(--text-2); font-size: 13px; margin: 4px 0 10px; }
.hint .ico { width: 16px; height: 16px; margin-top: 1px; color: var(--primary); }

/* ---------- layout ---------- */
#app { display: grid; height: 100vh; height: 100dvh; position: relative; overflow: clip; /* nothing may widen the page on a phone (the layout viewport would grow and the lists stop scrolling) */ --sbw: var(--w-side); transition: grid-template-columns .2s ease; }
#app.side-collapsed { --sbw: 68px; }
#app.lay-cols { grid-template-columns: var(--sbw) 1px var(--w-list) 1px minmax(0, 1fr); grid-template-areas: "side s1 list s2 view"; }
#app.lay-rows { grid-template-columns: var(--sbw) 1px minmax(0, 1fr); grid-template-rows: var(--h-list) 1px minmax(0, 1fr); grid-template-areas: "side s1 list" "side s1 s2" "side s1 view"; }
.side { grid-area: side; } .list { grid-area: list; } .view { grid-area: view; }
[data-split="side"] { grid-area: s1; } [data-split="list"] { grid-area: s2; }
.split { background: var(--border); position: relative; z-index: 2; }
.split::after { content: ""; position: absolute; inset: 0 -4px; cursor: col-resize; touch-action: none; }
.lay-rows [data-split="list"]::after { inset: -4px 0; cursor: row-resize; }
.split:hover, .split.dragging { background: var(--primary); }

/* ---------- sidebar ---------- */
.side { display: flex; flex-direction: column; background: var(--surface-2); min-height: 0; }
[data-theme=dark] .side { background: #13161b; }
.brand { display: flex; align-items: center; gap: 4px; padding: 14px 8px 10px 16px; font-size: 16px; }
.brand-logo { margin-right: 5px; }
.brand b { flex: 1; letter-spacing: -.01em; }
.brand-logo { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: #fff; }
.brand-logo .ico { width: 16px; height: 16px; }
.btn-compose { margin: 2px 12px 10px; height: 40px; justify-content: flex-start; font-size: 14px; border-radius: 10px; box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn-compose kbd { margin-left: auto; background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.3); color: #fff; }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 12px; }
.nav-sec { display: flex; flex-direction: column; gap: 1px; padding-bottom: 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text-2); text-align: left; min-width: 0; }
.nav-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item b { font-size: 12px; font-weight: 650; color: var(--text); }
.nav-item .ico { width: 17px; height: 17px; color: var(--muted); }
.nav-item:hover { background: var(--surface-3); }
.nav-item.active { background: var(--primary-100); color: var(--primary); font-weight: 600; }
.nav-item.active .ico, .nav-item.active b { color: var(--primary); }
.nav-item.sub { padding: 5px 10px 5px calc(16px + var(--ind, 0px)); font-size: 13.5px; }
.nav-item.drop { background: var(--primary); color: #fff; } .nav-item.drop .ico { color: #fff; }
.acc { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 4px; }
.acc-head { display: flex; align-items: center; gap: 6px; padding: 6px 6px; cursor: pointer; border-radius: 6px; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; user-select: none; }
.acc-head:hover { color: var(--text); }
.acc-head > .ico { width: 13px; height: 13px; transition: transform .15s; }
.acc-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-head .cnt { font-size: 11px; color: var(--text); text-transform: none; }
.acc-head .ico.spin { width: 13px; height: 13px; }
.acc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; vertical-align: 1px; }
.acc-dot.lg { width: 12px; height: 12px; }
.nav-empty { padding: 16px 10px; color: var(--muted); font-size: 13px; }
.side-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 10px 8px; border-top: 1px solid var(--border); }
.side-foot .backup-btn { margin-left: auto; }
/* "Aktualizováno …" on its own line above the buttons – next to them it was squeezed to a few letters */
.side-status { order: -1; flex: 1 0 100%; padding: 0 4px 4px; text-align: left; font-size: 11px; color: var(--faint); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---------- message list ---------- */
.list { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); }
.list-head { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 9px; border-bottom: 1px solid var(--border); }
.list-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.list-title-row h2 { font-size: 18px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { position: relative; display: flex; align-items: center; }
.search > .ico { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search input { padding-left: 34px !important; background: var(--surface-2) !important; border-color: transparent !important; }
.search input:focus { background: var(--surface) !important; border-color: var(--primary) !important; }
.search .icon-btn { position: absolute; right: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--border); background: none; cursor: pointer; font-size: 12px; color: var(--muted); }
.chips button .ico { width: 13px; height: 13px; }
.chips button:hover { border-color: var(--border-2); color: var(--text); }
.chips button.on { background: var(--primary-50); border-color: var(--primary); color: var(--primary); }
.bulk { display: flex; align-items: center; gap: 4px; padding: 6px 10px 6px 14px; background: var(--primary-50); border-bottom: 1px solid var(--border); font-size: 13px; }
.bulk b { margin: 0 3px 0 8px; }
.rows { flex: 1; overflow-y: auto; min-height: 0; outline: none; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.row-group { position: sticky; top: 0; z-index: 1; padding: 6px 16px 4px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--border); }
.row { position: relative; display: flex; gap: 10px; padding: 10px 12px 10px 8px; border-bottom: 1px solid var(--border); cursor: default; user-select: none; }
.row:hover { background: var(--surface-2); }
.row.cursor { box-shadow: inset 2px 0 0 var(--border-2); }
.row.open { background: var(--primary-50); box-shadow: inset 3px 0 0 var(--primary); }
.row.selected { background: var(--primary-100); }
.row-check { display: grid; place-items: center; width: 18px; flex: none; opacity: 0; cursor: pointer; }
.row:hover .row-check, .row.selected .row-check, .bulk .row-check { opacity: 1; }
.row.unread::before { content: ""; position: absolute; left: 13px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.row.unread:hover::before, .row.unread.selected::before { display: none; }
.row-av { padding-top: 1px; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; font-size: 13px; font-weight: 650; flex: none; letter-spacing: .02em; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.row-main { flex: 1; min-width: 0; }
.row-top { display: flex; align-items: baseline; gap: 6px; }
.row-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.row-from .acc-dot { margin-right: 6px; }
.row time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.row-thread { font-size: 11px; color: var(--muted); border: 1px solid var(--border-2); border-radius: 8px; padding: 0 5px; line-height: 15px; }
.row-subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); margin-top: 1px; }
.row-ans .ico { width: 13px; height: 13px; color: var(--muted); vertical-align: -2px; margin-right: 4px; }
.row-snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; margin-top: 1px; min-height: 1.3em; }
.row.unread .row-from, .row.unread .row-subj { color: var(--text); font-weight: 650; }
.row.unread time { color: var(--primary); font-weight: 600; }
.row-icons { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 4px; padding-top: 20px; color: var(--muted); }
.row-icons .ico { width: 14px; height: 14px; }
.row-star { border: 0; background: none; padding: 0; cursor: pointer; color: var(--border-2); display: grid; }
.row:not(:hover) .row-star:not(.on) { visibility: hidden; }
.row-star:hover { color: var(--star); }
.row-hover { position: absolute; right: 6px; top: 6px; display: none; gap: 1px; background: inherit; border-radius: 8px; padding: 1px 2px 1px 0; }
.row-hover::before { content: ""; position: absolute; right: 100%; top: 0; bottom: 0; width: 28px; background: inherit; -webkit-mask-image: linear-gradient(to right, transparent, #000); mask-image: linear-gradient(to right, transparent, #000); }
.row:hover .row-hover { display: flex; }
.row-hover button { display: grid; place-items: center; width: 28px; height: 26px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--muted); }
.row-hover button:hover { background: var(--surface-2); color: var(--text); }
.row-hover .ico { width: 15px; height: 15px; }
.row-more { display: grid; place-items: center; padding: 16px; }
.draft-row { cursor: pointer; padding-left: 14px; }
.drag-ghost { position: fixed; top: -100px; left: -100px; padding: 6px 12px; border-radius: 8px; background: var(--primary); color: #fff; font-weight: 600; font-size: 13px; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- message view ---------- */
.view { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.view-empty { height: 100%; }
.v-bar { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.v-actions { display: flex; gap: 6px; }
/* too many buttons for a narrow screen: the bar scrolls sideways instead of widening the page */
.v-bar { min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; } .v-bar::-webkit-scrollbar { display: none; } .v-bar > :not(.grow), .v-actions > * { flex: none; }
.v-scroll { flex: 1; overflow-y: auto; padding: 18px 24px 30px; }
.v-subject { font-size: 21px; line-height: 1.3; letter-spacing: -.015em; overflow-wrap: anywhere; }
.v-meta { display: flex; align-items: center; gap: 5px; margin: 6px 0 16px; flex-wrap: wrap; }
.v-meta .ico { width: 14px; height: 14px; }
.thread { display: flex; flex-direction: column; gap: 10px; }
.msg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.msg-head { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; cursor: pointer; }
.msg-who { flex: 1; min-width: 0; }
.msg-who b { font-weight: 650; }
.msg-to, .msg-snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.expanded .msg-snip, .msg.collapsed .msg-to { display: none; }
.msg-date { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.msg-date .ico { width: 14px; height: 14px; }
.msg.collapsed .msg-body { display: none; }
.msg.collapsed:hover { border-color: var(--border-2); }
.msg-body { padding: 0 16px 16px 62px; }
.msg-details { display: grid; gap: 2px; padding: 8px 12px; margin-bottom: 10px; background: var(--surface-2); border-radius: 8px; color: var(--text-2); overflow-wrap: anywhere; }
.msg-details span { color: var(--muted); display: inline-block; min-width: 92px; }
.frame-wrap { background: #fff; border-radius: 8px; }
[data-theme=dark] .frame-wrap { padding: 12px; }
.mail-frame { width: 100%; border: 0; display: block; min-height: 40px; background: #fff; border-radius: 6px; }
.img-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 7px 12px; margin-bottom: 10px; border-radius: 8px; background: var(--surface-2); font-size: 12.5px; color: var(--text-2); }
.img-bar .ico { width: 15px; height: 15px; color: var(--muted); }
.img-bar span { flex: 1; min-width: 160px; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.att { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 6px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); max-width: 280px; min-width: 200px; }
.att-ext, .att-thumb { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 6px; background: var(--surface-3); font-size: 10px; font-weight: 700; color: var(--muted); flex: none; overflow: hidden; }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 550; }
.att-acts { display: flex; }
.v-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-left: 2px; }

/* ---------- compose ---------- */
.compose { position: fixed; right: calc(20px + var(--stack, 0) * 24px); bottom: 0; z-index: 50; width: 620px; max-width: calc(100vw - 16px); height: min(640px, calc(100vh - 40px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-2); border-bottom: 0; border-radius: 12px 12px 0 0; box-shadow: var(--shadow-lg); }
.compose.min { height: auto; width: 320px; }
.compose.min > :not(.c-head) { display: none !important; }
/* narrow screens: minimised = just the title bar at the bottom (not a blank full-height panel over the menu) */
@media (max-width: 900px) { .compose.min { top: auto; left: 0; right: 0; width: auto; height: auto; } }
/* drafts can be thrown away on phones too (the other row buttons are hover-only and hidden there) */
@media (max-width: 900px) { .row-hover.draft-del { display: flex !important; } }
.compose.max { inset: 4vh 8vw; width: auto; height: auto; border-radius: 12px; border-bottom: 1px solid var(--border-2); }
.c-head { display: flex; align-items: center; gap: 2px; padding: 8px 8px 8px 16px; background: var(--surface-2); border-radius: 12px 12px 0 0; cursor: default; user-select: none; }
.c-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.c-body { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.c-row { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid var(--border); min-height: 40px; position: relative; }
.c-lbl { color: var(--muted); font-size: 13px; width: 48px; flex: none; }
.c-row select { border: 0; padding: 0; height: 38px; box-shadow: none !important; background: none; }
.c-subj { border: 0 !important; padding: 0 !important; height: 40px !important; box-shadow: none !important; font-weight: 550; background: none !important; }
.rcp { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 5px 0; min-width: 0; position: relative; }
.rcp-chips { display: contents; }
.rcp input { flex: 1; min-width: 120px; border: 0 !important; height: 28px !important; padding: 0 !important; box-shadow: none !important; background: none !important; }
.chip { display: inline-flex; align-items: center; gap: 3px; height: 26px; padding: 0 4px 0 10px; border-radius: 13px; background: var(--surface-3); font-size: 13px; max-width: 260px; }
.chip.bad { background: #fee2e2; color: #991b1b; }
.chip button { display: grid; place-items: center; border: 0; background: none; width: 18px; height: 18px; border-radius: 50%; cursor: pointer; color: var(--muted); padding: 0; }
.chip button:hover { background: var(--border-2); }
.chip .ico { width: 12px; height: 12px; }
.rcp-sug { position: absolute; top: 100%; left: 0; z-index: 5; min-width: 280px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; }
.sug { display: flex; flex-direction: column; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.sug small { color: var(--muted); }
.sug.on, .sug:hover { background: var(--primary-50); }
.c-tools { display: flex; align-items: center; gap: 1px; padding: 4px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.c-tools button { display: grid; place-items: center; width: 30px; height: 28px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--muted); }
.c-tools button:hover { background: var(--surface-2); color: var(--text); }
.c-tools .ico { width: 16px; height: 16px; }
.c-tools select { width: auto; height: 28px; border: 0; background: none; color: var(--muted); font-size: 12px; padding: 0 4px; }
.c-tools .sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.c-color { position: relative; }
.c-colors { position: absolute; top: 100%; left: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 22px); gap: 4px; padding: 6px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px; box-shadow: var(--shadow); }
.c-colors button { width: 22px; height: 22px; border-radius: 4px; cursor: pointer; border: 0; padding: 0; }
.c-editor { flex: 1; overflow-y: auto; padding: 14px 16px; outline: none; line-height: 1.55; overflow-wrap: anywhere; }
.c-editor blockquote { border-left: 3px solid var(--border-2); margin: 0 0 0 4px; padding-left: 12px; color: var(--muted); }
.c-editor img { max-width: 100%; }
.c-editor .quote-head { color: var(--muted); font-size: 13px; margin: 6px 0; }
[data-theme=dark] .c-editor [style*="color"] { filter: brightness(1.6); }
.c-atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px; max-height: 96px; overflow-y: auto; }
.c-atts:not(:empty) { padding: 8px 14px; border-top: 1px solid var(--border); }
.c-att { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; max-width: 260px; cursor: default; }
.c-att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-att small { color: var(--muted); white-space: nowrap; }
.c-att.off { opacity: .5; text-decoration: line-through; }
.c-att.busy { opacity: .7; }
.c-att .ico { width: 14px; height: 14px; color: var(--muted); }
.c-att button { display: grid; place-items: center; border: 0; background: none; cursor: pointer; width: 22px; height: 22px; border-radius: 5px; color: var(--muted); }
.c-att button:hover { background: var(--surface-3); }
.c-foot { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); }
.c-drop { display: none; position: absolute; inset: 44px 8px 8px; border: 2px dashed var(--primary); border-radius: 10px; background: color-mix(in srgb, var(--primary-50) 92%, transparent); color: var(--primary); font-weight: 600; place-items: center; z-index: 6; pointer-events: none; }
.compose.dragging .c-drop { display: grid; }

/* ---------- modal, popmenu, toasts ---------- */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(15,17,21,.45); display: grid; grid-template-rows: minmax(0, 1fr); place-items: center; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 520px; max-width: 100%; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); }
.modal.sm { width: 400px; } .modal.lg { width: 760px; }
.modal > header { display: flex; align-items: center; padding: 14px 14px 10px 20px; }
.modal > header h3 { flex: 1; font-size: 17px; }
.modal-body { padding: 4px 20px 18px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.modal-body p { margin: 4px 0 10px; }
.modal > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }
.popmenu { position: fixed; z-index: 200; min-width: 200px; max-width: 340px; max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; }
.popmenu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 12px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.popmenu button span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popmenu button:hover { background: var(--primary-50); }
.popmenu button.danger { color: var(--red); }
.popmenu .ico { width: 16px; height: 16px; color: var(--muted); }
.popmenu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.pm-head { padding: 6px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; }
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 10px; background: #1f2937; color: #f9fafb; box-shadow: var(--shadow-lg); font-size: 13.5px; pointer-events: auto; animation: up .18s ease-out; max-width: min(560px, calc(100vw - 32px)); }
[data-theme=dark] .toast { background: #e8eaee; color: #111827; }
.toast.error { background: var(--red); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .2s; }
.toast-act { border: 0; background: none; color: #93c5fd; font-weight: 700; cursor: pointer; padding: 0; }
[data-theme=dark] .toast-act { color: var(--primary-2); filter: brightness(.7); }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }
.keys { width: 100%; border-collapse: collapse; }
.keys td { padding: 6px 4px; border-bottom: 1px solid var(--border); }
.keys td:first-child { white-space: nowrap; width: 1%; padding-right: 16px; }

/* ---------- settings ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 0; background: none; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 550; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .ico { width: 16px; height: 16px; }
.acc-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.acc-card .grow { min-width: 180px; }
.acc-card .ico { width: 14px; height: 14px; vertical-align: -2px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form h3 { font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 550; color: var(--text-2); }
.field small { font-weight: 400; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 90px auto; gap: 10px 12px; align-items: end; margin: 10px 0; }
.grid3 .check { height: 34px; }
details { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
details summary { cursor: pointer; font-weight: 550; font-size: 13px; }
details[open] { display: flex; flex-direction: column; gap: 10px; }
.sig-edit { min-height: 70px; padding: 8px 10px; border: 1px solid var(--border-2); border-radius: 8px; font-weight: 400; color: var(--text); outline: none; overflow-wrap: anywhere; }
.colors { display: flex; gap: 8px; }
.colors label { cursor: pointer; }
.colors input { display: none; }
.colors i { display: block; width: 24px; height: 24px; border-radius: 50%; border: 3px solid transparent; }
.colors input:checked + i { border-color: var(--surface); box-shadow: 0 0 0 2px var(--text); }
.form-foot { display: flex; gap: 8px; align-items: center; padding-top: 4px; }
.test-out:empty { display: none; }
.test-out div { display: flex; gap: 6px; align-items: center; }
.test-out .ico { width: 15px; height: 15px; }
.folder-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }


/* ---------- sidebar colour styles (Nastavení → Vzhled) ---------- */
:root[data-side="tint"] .side { background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
:root[data-side="tint"][data-theme="dark"] .side { background: color-mix(in srgb, var(--accent) 14%, #13161b); }
:root[data-side="solid"] .side, :root[data-side="dark"] .side {
  --text: #fff; --text-2: rgba(255,255,255,.9); --muted: rgba(255,255,255,.68); --faint: rgba(255,255,255,.5);
  --surface-3: rgba(255,255,255,.12); --border: rgba(255,255,255,.14); --border-2: rgba(255,255,255,.3); --surface-2: rgba(255,255,255,.1);
  color: var(--text);
}
:root[data-side="solid"] .side { background: color-mix(in srgb, var(--accent) 86%, #000); --primary: #fff; --primary-100: rgba(255,255,255,.2); }
:root[data-side="solid"] .side .btn-compose { background: #fff; border-color: #fff; color: color-mix(in srgb, var(--accent) 86%, #000); }
:root[data-side="solid"] .side .btn-compose kbd { background: color-mix(in srgb, var(--accent) 12%, #fff); border-color: transparent; color: inherit; }
:root[data-side="solid"] .side .brand-logo { background: #fff; color: color-mix(in srgb, var(--accent) 86%, #000); }
:root[data-side="dark"] .side { background: #111318; --primary-100: color-mix(in srgb, var(--accent) 34%, #111318); --primary: color-mix(in srgb, var(--accent) 60%, #fff); }
:root[data-side="solid"] .side .nav-item.drop, :root[data-side="dark"] .side .nav-item.drop { background: #fff; color: #111; }

/* ---------- appearance settings ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-2); cursor: pointer; padding: 0; }
.swatches button.on { box-shadow: 0 0 0 2px var(--text); }
.swatches label.custom { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; margin-left: 4px; }
.swatches input[type=color] { width: 34px; height: 30px; padding: 0 2px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface); cursor: pointer; }
.side-styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.side-style { display: flex; flex-direction: column; gap: 6px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: none; cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.side-style.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-100); color: var(--primary); font-weight: 600; }
.side-style .mini { display: flex; width: 100%; height: 54px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.side-style .mini i { width: 34%; } .side-style .mini b { flex: 1; background: var(--surface); }
.side-style .mini i::before { content: ""; display: block; margin: 8px 5px; height: 6px; border-radius: 3px; background: var(--accent); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets button { height: 30px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.presets button:hover { background: var(--surface-2); }
.presets button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.preview-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px; border: 1px dashed var(--border-2); border-radius: 10px; }
.preview-row .chip-on { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 13px; background: var(--primary-50); color: var(--primary); border: 1px solid var(--primary); font-size: 12px; }
.preview-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }

/* ---------- small screens: one pane at a time ---------- */
@media (max-width: 900px) {
  #app, #app.lay-cols, #app.lay-rows { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "main"; }
  .split { display: none; }
  .list, .view { grid-area: main; }
  .view { display: none; }
  #app.has-view .view { display: flex; } #app.has-view .list { display: none; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  #app.side-open .side { transform: none; }
  .side-back { position: fixed; inset: 0; z-index: 59; background: rgba(15,17,21,.4); }
  #app.side-open .side-back { display: block; }
  .side-styles { grid-template-columns: repeat(2, 1fr); }
  .mobile-only, .mobile-back { display: inline-grid !important; }
  #laySeg { display: none; }
  .v-actions .btn span { display: none; }
  .v-bar { flex-wrap: nowrap; gap: 0; padding: 6px 6px; } .v-actions { gap: 4px; } .v-bar .icon-btn { width: 30px; }
  .v-scroll { padding: 14px 14px 30px; }
  .msg-body { padding: 0 12px 12px; }
  .row-hover { display: none !important; }
  .compose, .compose.max { inset: 0; width: auto; height: auto; max-width: none; border-radius: 0; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* ================= v2: rail, edge tab, layouts, density, colour labels, polish ================= */
.side-back { display: none; }
.btn-ghost { border-color: transparent; background: none; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.count-pill { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.count-pill:empty { display: none; }
.list-badge { width: 12px; height: 12px; border-radius: 4px; flex: none; }

/* edge tab – always visible on the border between the menu and the mail */
.side-tab { position: absolute; left: calc(var(--sbw) + 1px); top: 50%; transform: translateY(-50%); z-index: 45; width: 16px; height: 58px; padding: 0;
  border: 1px solid var(--border-2); border-left: 0; border-radius: 0 12px 12px 0; background: var(--surface-2); color: var(--muted);
  display: grid; place-items: center; cursor: pointer; box-shadow: 3px 0 10px rgba(0,0,0,.08); transition: left .2s ease, width .12s, background .12s, color .12s; }
[data-theme=dark] .side-tab { background: #13161b; }
.side-tab:hover { width: 22px; background: var(--primary); border-color: var(--primary); color: #fff; }
.side-tab .ico { width: 14px; height: 14px; transition: transform .2s; }
.side-tab.flip .ico { transform: rotate(180deg); }
:root[data-side="tint"] .side-tab { background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
:root[data-side="solid"] .side-tab { background: color-mix(in srgb, var(--accent) 86%, #000); border-color: transparent; color: rgba(255,255,255,.85); }
:root[data-side="dark"] .side-tab { background: #111318; border-color: transparent; color: rgba(255,255,255,.75); }

/* collapsed menu = icon rail */
@media (min-width: 901px) {
  #app.side-collapsed [data-split="side"] { pointer-events: none; }
  .side-collapsed .brand { justify-content: center; padding: 14px 0 10px; }
  .side-collapsed .brand b, .side-collapsed #syncAll, .side-collapsed .side-status, .side-collapsed .nav-empty p { display: none; }
  .side-collapsed .brand-logo { margin: 0; }
  .side-collapsed .btn-compose { align-self: center; width: 44px; padding: 0; justify-content: center; margin: 2px 0 10px; }
  .side-collapsed .btn-compose span, .side-collapsed .btn-compose kbd { display: none; }
  .side-collapsed .side-scroll { padding: 0 8px 12px; }
  .side-collapsed .nav-item { justify-content: center; padding: 8px 0 !important; position: relative; }
  .side-collapsed .nav-item > span:not(.f-ico), .side-collapsed .nav-more { display: none !important; }
  .side-collapsed .nav-item b { position: absolute; top: 1px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: 10px; line-height: 16px; text-align: center; background: var(--primary); color: #fff; }
  .side-collapsed .nav-item b:empty { display: none; }
  .side-collapsed .acc-head { justify-content: center; padding: 8px 0; }
  .side-collapsed .acc-head > :not(.acc-dot) { display: none; }
  .side-collapsed .acc-dot { width: 10px; height: 10px; }
  .side-collapsed .nav-title { font-size: 0; height: 1px; padding: 0; margin: 6px; background: var(--border); }
  .side-collapsed .side-foot { flex-direction: column; gap: 4px; padding: 8px 0; }
  :root[data-side="solid"] .side-collapsed .nav-item b { background: #fff; color: color-mix(in srgb, var(--accent) 86%, #000); }
}

/* sidebar polish: labels, coloured folders */
.nav-title { padding: 10px 6px 4px; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.nav-sec.labels { border-top: 1px solid var(--border); padding-top: 2px; }
.lab-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--lc); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--lc) 25%, transparent); margin: 0 3px; }
.nav-item.lab.active { background: color-mix(in srgb, var(--lc) 22%, transparent); color: var(--text); }
.nav-item.lab.active b { color: var(--text); }
.nav-item > .f-ico { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; flex: none; margin: -2px -2px; overflow: visible; }
.f-ico .ico { width: 16px; height: 16px; }
.nav-item.fcol .f-ico { background: var(--fc); box-shadow: 0 1px 3px color-mix(in srgb, var(--fc) 45%, transparent); }
.nav-item.fcol .f-ico .ico { color: #fff !important; width: 14px; height: 14px; }
.nav-item.fcol.active { background: color-mix(in srgb, var(--fc) 20%, transparent); color: var(--text); }
.nav-item.fcol.active b { color: var(--text); }
.nav-more { display: none; place-items: center; width: 20px; height: 20px; border-radius: 5px; margin: -2px -4px -2px 0; color: var(--muted); }
.nav-more .ico { width: 14px; height: 14px; }
.nav-item:hover .nav-more { display: grid; }
.nav-item:hover .nav-more + * , .nav-more:hover { background: var(--surface-3); }
.nav-item.active { box-shadow: inset 3px 0 0 var(--primary); }
.nav-item.fcol.active { box-shadow: inset 3px 0 0 var(--fc); }
.nav-item.lab.active { box-shadow: inset 3px 0 0 var(--lc); }
.v-folder { display: inline-flex; align-items: center; gap: 5px; }
.v-folder[style] { color: var(--fc); font-weight: 600; }

/* list rows as rounded cards */
.rows { padding: 2px 8px 14px; }
.row-group { margin: 0 -8px; padding: 10px 18px 5px; border-bottom: 0; background: var(--surface); }
.row { border-bottom: 0; border-radius: 10px; margin: 2px 0; transition: background .1s; }
.row::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -2px; border-bottom: 1px solid var(--border); }
.row:has(+ .row-group)::after, .row:last-child::after, .row.colored::after, .row:has(+ .row.colored)::after { display: none; }
.row.unread::before { left: 12px; }
.row.cursor { box-shadow: inset 0 0 0 1px var(--border-2); }
.row.open { background: var(--primary-50); box-shadow: inset 0 0 0 2px var(--primary); }
.row.selected { background: var(--primary-100); }

/* colour labels on rows */
.lbl { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; margin-right: 7px; border-radius: 6px; font-size: 11px; font-weight: 650; letter-spacing: .01em; vertical-align: 1px;
  background: color-mix(in srgb, var(--lc) 88%, #000); color: #fff; white-space: nowrap; }
.lbl.lg { height: 22px; font-size: 12px; padding: 0 9px; margin: 0; }
.colors-strong .row.colored { background: color-mix(in srgb, var(--lc) 17%, var(--surface)); box-shadow: inset 5px 0 0 var(--lc); }
.colors-strong .row.colored:hover { background: color-mix(in srgb, var(--lc) 24%, var(--surface)); }
.colors-strong .row.colored .row-from, .colors-strong .row.colored .row-subj { color: var(--text); }
.colors-soft .row.colored { background: color-mix(in srgb, var(--lc) 6%, var(--surface)); box-shadow: inset 3px 0 0 var(--lc); }
.colors-soft .row.colored:hover { background: color-mix(in srgb, var(--lc) 10%, var(--surface)); }
.colors-soft .lbl { background: color-mix(in srgb, var(--lc) 18%, var(--surface)); color: color-mix(in srgb, var(--lc) 60%, var(--text)); }
.row.colored.open { box-shadow: inset 5px 0 0 var(--lc), inset 0 0 0 2px var(--primary); }
.row.colored.selected { box-shadow: inset 5px 0 0 var(--lc), inset 0 0 0 2px var(--primary-100); }
.row.colored + .row.colored { margin-top: 3px; }
.view.colored { background: color-mix(in srgb, var(--lc) 6%, var(--bg)); }
.view.colored .v-bar { box-shadow: inset 0 -3px 0 var(--lc); }
.v-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pm-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 2px dashed var(--border-2); }
.pm-dot[style] { border: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.popmenu .pm-check { width: 14px; height: 14px; color: var(--primary); }
.popmenu button.on { background: var(--primary-50); font-weight: 600; }

/* row content: inline snippet only in the one-line density */
.row-snip-inline { display: none; }
.subj-t { overflow: hidden; text-overflow: ellipsis; }
.no-snip .row-snip, .no-snip .row-snip-inline { display: none !important; }
.no-av .row-av { display: none; }
.dens-compact .row { padding-top: 6px; padding-bottom: 6px; gap: 8px; }
.dens-compact .row-snip { display: none; }
.dens-compact .avatar { width: 28px; height: 28px; font-size: 11px; }
.dens-compact .row-icons { padding-top: 4px; flex-direction: row; align-items: center; }
.dens-compact .row.unread::before { top: 14px; }
.dens-line .row { align-items: center; padding-top: 6px; padding-bottom: 6px; gap: 8px; }
.dens-line .row-av, .dens-line .row-snip, .dens-line .row-thread { display: none; }
.dens-line .row-main { display: grid; grid-template-columns: minmax(120px, 30%) minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.dens-line .row-top { display: contents; }
.dens-line .row-from { grid-column: 1; grid-row: 1; }
.dens-line .row-subj { grid-column: 2; grid-row: 1; margin: 0; display: flex; align-items: center; min-width: 0; }
.dens-line .row-main time { grid-column: 3; grid-row: 1; }
.dens-line .row-snip-inline { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-weight: 400; margin-left: 8px; }
.dens-line .subj-t { flex: none; max-width: 70%; white-space: nowrap; }
.dens-line .row-icons { padding-top: 0; flex-direction: row; align-items: center; }
.dens-line .row.unread::before { top: 50%; margin-top: -4px; }
.dens-line .row-hover { top: 50%; transform: translateY(-50%); }
.row:hover .row-top time, .row:hover .row-thread { visibility: hidden; }

/* layout "Jen seznam": the message replaces the list */
#app.lay-full { grid-template-columns: var(--sbw) 1px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "side s1 list"; }
#app.lay-full > .view { grid-area: list; display: none; }
#app.lay-full.has-view > .view { display: flex; }
#app.lay-full.has-view > .list, #app.lay-full > [data-split="list"] { display: none; }
#app.lay-full .mobile-back { display: inline-grid !important; }
#app.lay-full .v-scroll > * { max-width: 960px; margin-left: auto; margin-right: auto; }

/* view menu */
.view-menu { width: 340px; max-width: calc(100vw - 16px); padding: 6px 10px 10px; }
.view-menu .pm-head { padding: 10px 2px 6px; }
.vm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.vm-grid.two { grid-template-columns: 1fr 1fr; }
.view-menu .vm-opt { flex-direction: column; align-items: center; gap: 5px; padding: 8px 4px 7px; border: 1px solid var(--border); border-radius: 10px; text-align: center; }
.view-menu .vm-opt b { font-size: 12px; font-weight: 600; }
.view-menu .vm-opt:hover { border-color: var(--border-2); background: var(--surface-2); }
.view-menu .vm-opt.on { border-color: var(--primary); background: var(--primary-50); color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.vm-ico { display: grid; place-items: center; }
.art { width: 54px; height: 36px; display: block; }
.art .a-bg { fill: var(--surface); stroke: var(--border-2); }
.art .a-side { fill: var(--surface-3); }
.art .a-line { stroke: var(--faint); stroke-width: 2.2; stroke-linecap: round; fill: none; }
.art .a-acc { fill: var(--primary); opacity: .8; }
.vm-sw { display: block; width: 54px; height: 24px; border-radius: 6px; }
.vm-sw.strong { background: color-mix(in srgb, #ef4444 18%, var(--surface)); box-shadow: inset 5px 0 0 #ef4444; }
.vm-sw.soft { background: color-mix(in srgb, #ef4444 6%, var(--surface)); box-shadow: inset 3px 0 0 #ef4444; }
.vm-checks { display: flex; flex-direction: column; gap: 9px; padding: 12px 4px 2px; border-top: 1px solid var(--border); margin-top: 10px; }

/* settings: labels and rules */
.sep-line { border: 0; border-top: 1px solid var(--border); margin: 4px 0; width: 100%; }
.label-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.lab-row { display: flex; align-items: center; gap: 8px; }
.lab-row input { height: 32px !important; border-left: 4px solid var(--lc) !important; }
.lab-row kbd { width: 20px; text-align: center; }
.rules { display: flex; flex-direction: column; gap: 6px; }
.rule { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--lc) 10%, var(--surface)); box-shadow: inset 4px 0 0 var(--lc); font-size: 13px; }

/* general polish */
.list-head { padding: 14px 14px 10px; }
.list-title-row h2 { font-size: 19px; }
.v-bar { padding: 8px 14px; }
.msg { border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.03); }
.brand-logo { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent)); box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primary { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 92%, #fff), var(--primary)); }
.chips button.on { font-weight: 600; }
@media (max-width: 900px) { .rows { padding: 2px 4px 14px; } .row-group { margin: 0 -4px; } .label-edit { grid-template-columns: 1fr; } #viewBtn span { display: none; } #viewBtn { padding: 0 8px; } }
.rows { overflow-x: hidden; }

/* ================= v3: polish ================= */
mark { background: color-mix(in srgb, #facc15 55%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
[data-theme=dark] mark { background: color-mix(in srgb, #facc15 35%, transparent); }
.row-hover button { width: 30px; height: 28px; }
.row-hover button:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
/* message opening: a gentle fade */
.v-scroll { animation: viewIn .16s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } }
.view-empty .ico { width: 34px; height: 34px; padding: 18px; box-sizing: content-box; border-radius: 50%; background: var(--primary-50); color: var(--primary); opacity: 1; stroke-width: 1.6; margin-bottom: 6px; }
.view-empty small kbd { margin: 0 1px; }
/* toasts with an undo button */
.toast { border-radius: 12px; padding: 11px 14px 11px 18px; }
.toast-act { padding: 4px 10px; border-radius: 7px; background: rgba(255,255,255,.12); color: #fff; }
.toast-act:hover { background: rgba(255,255,255,.22); }
[data-theme=dark] .toast-act { background: rgba(0,0,0,.08); color: var(--primary); filter: none; }
.toast.ok::before { content: "✓"; font-weight: 700; color: #4ade80; margin-right: -6px; }
/* popup menus */
.popmenu { border-radius: 12px; padding: 5px; box-shadow: 0 10px 40px rgba(0,0,0,.18), 0 1px 3px rgba(0,0,0,.08); animation: pmIn .1s ease-out; }
@keyframes pmIn { from { opacity: 0; transform: scale(.97); } }
.popmenu button { border-radius: 7px; padding: 7px 10px; font-size: 13.5px; }
.popmenu button kbd { margin-left: auto; }
.popmenu button.danger .ico { color: var(--red); }
.popmenu button.danger:hover { background: color-mix(in srgb, var(--red) 12%, transparent); }
/* compose window */
.compose { border-radius: 14px 14px 0 0; overflow: hidden; }
.c-head { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border-bottom: 1px solid var(--border); padding: 9px 8px 9px 16px; }
.compose.min .c-head { border-bottom: 0; cursor: pointer; }
.compose.min { box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.c-row:focus-within { box-shadow: inset 0 -2px 0 var(--primary); }
.c-foot { background: var(--surface); }
.c-foot .btn-primary { height: 36px; padding: 0 18px; border-radius: 9px; }
.c-editor { font-size: 14.5px; }
/* settings modal */
.modal { border-radius: 16px; }
.modal > header h3 { font-size: 18px; }
.acc-card { transition: border-color .12s, box-shadow .12s; }
.acc-card:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
/* list header & scrollbars */
.rows::-webkit-scrollbar, .v-scroll::-webkit-scrollbar, .side-scroll::-webkit-scrollbar { width: 10px; }
.rows::-webkit-scrollbar-thumb, .v-scroll::-webkit-scrollbar-thumb, .side-scroll::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 18%, transparent); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
.rows::-webkit-scrollbar-thumb:hover, .v-scroll::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--text) 30%, transparent); }
.search input { border-radius: 10px !important; height: 36px !important; }
.v-quick .btn { border-radius: 10px; }
.msg-head:hover .msg-who b { text-decoration: underline; text-decoration-color: var(--border-2); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* pictures of a quoted mail are not loaded while writing (they would report that you opened it); they go out with the e-mail */
.c-editor img[data-msrc] { min-width: 48px; min-height: 28px; background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3-3L6 21'/%3E%3C/svg%3E") center / 18px no-repeat; border-radius: 6px; outline: 1px dashed var(--border-2); }

/* ---------- narrow window: menu as a drawer, the edge tab stays visible (like Adima) ---------- */
@media (max-width: 900px) {
  #app, #app.lay-cols, #app.lay-rows, #app.lay-full, #app.side-collapsed { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "main"; --sbw: 0px; }
  #app.lay-full > .view, #app.lay-full > .list { grid-area: main; }
  .side-tab { position: fixed; left: 0; z-index: 61; height: 64px; width: 18px; transition: left .2s ease, width .12s, background .12s; }
  #app.side-open .side-tab { left: 280px; }
  .list-head { padding-left: 24px; }
  .v-bar { padding-left: 22px; }
}

/* the edge tab in the accent colour – always easy to find */
.side-tab, [data-theme=dark] .side-tab, :root[data-side="tint"] .side-tab { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 3px 0 12px color-mix(in srgb, var(--primary) 35%, transparent); }
.side-tab:hover { background: var(--primary-2); border-color: var(--primary-2); width: 22px; }
[data-theme=dark] .side-tab { color: #0f1115; }

/* ---------- v4 ---------- */
.skeleton { padding: 6px 4px; }
.sk-row { display: flex; gap: 12px; padding: 12px 10px 12px 30px; }
.sk-av { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.sk-row div { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.sk-row b { height: 10px; border-radius: 5px; width: 40%; } .sk-row b:nth-child(2) { width: 75%; } .sk-row b:nth-child(3) { width: 60%; }
.sk-av, .sk-row b { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty small { max-width: 280px; line-height: 1.45; }
.me-badge { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 5px; background: var(--primary-50); color: var(--primary); font-size: 11px; font-weight: 650; line-height: 17px; vertical-align: 1px; }
.msg.mine { border-left: 3px solid var(--primary); }
.welcome { display: flex; gap: 14px; align-items: center; padding: 4px 0 6px; }
.welcome .brand-logo { width: 44px; height: 44px; border-radius: 12px; flex: none; }
.welcome .brand-logo .ico { width: 22px; height: 22px; }
.welcome h3 { font-size: 19px; }
.welcome p { margin: 2px 0 0 !important; }

/* ---------- v5: accessibility ---------- */
/* light-mode muted text a touch darker (4.5:1 on the grey sidebar) */
:root:not([data-theme=dark]) { --muted: #5f6672; }
.side-status { color: var(--muted); }
/* label pills: white text on a darkened shade passes 4.5:1 for every colour, yellow included */
.lbl { background: color-mix(in srgb, var(--lc) 62%, #000); }
.colors-soft .lbl { color: color-mix(in srgb, var(--lc) 45%, #000); }
[data-theme=dark] .colors-soft .lbl { color: color-mix(in srgb, var(--lc) 55%, #fff); }
[data-theme=dark] .toast.error { background: #b91c1c; color: #fff; }
/* account header is a real button now */
button.acc-head { width: 100%; border: 0; background: none; font: inherit; font-size: 12px; text-align: left; }
/* folder row = folder button + its own "⋯" button */
.nav-row { position: relative; }
.nav-row > .nav-more { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: none; place-items: center; width: 24px; height: 24px; margin: 0; border: 0; border-radius: 6px; background: var(--surface-3); cursor: pointer; color: var(--muted); }
.nav-row:hover > .nav-more, .nav-row:focus-within > .nav-more { display: grid; }
.nav-row:hover > .nav-item b, .nav-row:focus-within > .nav-item b { visibility: hidden; }
@media (min-width: 901px) { .side-collapsed .nav-row > .nav-more { display: none !important; } .side-collapsed .nav-row > .nav-item b { visibility: visible; } }
/* list: the keyboard cursor is visible when the list has focus, row tools appear for the focused row */
#rows:focus-visible { outline: none; }
#rows:focus-visible .row.cursor { box-shadow: inset 0 0 0 2px var(--primary); }
.row:focus-within .row-hover { display: flex; } .row:focus-within .row-check { opacity: 1; } .row:focus-within .row-star { visibility: visible; }
.msg-head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 12px; }
.acc-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 6px 6px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--red) 12%, var(--surface)); color: var(--text); font-size: 12px; line-height: 1.35; }
.acc-alert .ico { width: 15px; height: 15px; color: var(--red); }
.acc-alert span { flex: 1; min-width: 120px; }
@media (min-width: 901px) { .side-collapsed .acc-alert { display: none; } }

/* ================= v6: attachment database, library, scheduled, templates ================= */
.nav-sec.files { border-top: 1px solid var(--border); padding-top: 2px; }
.files-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 6px 10px; margin: 0 -8px 4px; padding-left: 14px; padding-right: 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.files-bar .chips button small { margin-left: 3px; color: var(--muted); font-weight: 600; }
.files-bar .chips button.on small { color: var(--primary); }
.files-note { width: 100%; display: flex; align-items: center; gap: 6px; margin: 0; }
.files-note .ico { width: 13px; height: 13px; }
.seg-text button { padding: 4px 10px; font-size: 12px; font-weight: 550; }
.ficon { display: grid; place-items: center; width: 40px; height: 48px; flex: none; border-radius: 6px; font-size: 10px; font-weight: 800; letter-spacing: .02em; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--kc) 85%, #fff), var(--kc)); box-shadow: 0 1px 2px rgba(0,0,0,.12); clip-path: polygon(0 0, 72% 0, 100% 22%, 100% 100%, 0 100%); }
.att-grid { display: flex; flex-direction: column; gap: 4px; }
.att-card { position: relative; display: flex; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 12px; cursor: pointer; outline-offset: -2px; }
.att-card:hover { background: var(--surface-2); }
.att-card.open { background: var(--primary-50); box-shadow: inset 0 0 0 2px var(--primary); }
.att-thumb-lg { width: 56px; height: 56px; flex: none; display: grid; place-items: center; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.att-thumb-lg img { width: 100%; height: 100%; object-fit: cover; }
.att-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.att-fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.att-line { display: flex; align-items: center; gap: 5px; min-width: 0; }
.att-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-line .ico { width: 12px; height: 12px; flex: none; }
.att-tools { display: none; gap: 2px; align-items: center; }
.att-card:hover .att-tools, .att-card:focus-within .att-tools, .lib-row:hover .att-tools, .lib-row:focus-within .att-tools, .sched-row .att-tools { display: flex; }
.att-tools button, .att-tools a { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.att-tools button:hover, .att-tools a:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.att-tools .ico { width: 16px; height: 16px; }
.lib-list { display: flex; flex-direction: column; gap: 4px; }
.lib-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; }
.lib-row:hover { background: var(--surface-2); }
.lib-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lib-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-note { color: var(--text-2); background: var(--surface-2); border-radius: 6px; padding: 1px 6px; align-self: flex-start; margin-top: 2px; }
.lib-drop { margin: 8px 6px; padding: 26px; border: 2px dashed var(--primary); border-radius: 12px; text-align: center; color: var(--primary); font-weight: 600; background: var(--primary-50); }
.sched-row { align-items: center; }
.sched-when { width: 92px; flex: none; display: flex; flex-direction: column; padding-left: 8px; }
.sched-when b { font-size: 13px; }
.sched-row.failed { background: color-mix(in srgb, var(--red) 8%, var(--surface)); }
.pick-list { max-height: 52vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.pick-row { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 10px; cursor: pointer; }
.pick-row:hover { background: var(--surface-2); }
.pick-row .ficon { width: 32px; height: 38px; font-size: 9px; }
.pick-meta { display: flex; flex-direction: column; min-width: 0; }
.pick-meta b, .pick-meta small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-btn { display: inline-flex; }
.split-btn > .btn:first-child { border-radius: 9px 0 0 9px; }
.split-btn .split-more { border-radius: 0 9px 9px 0; padding: 0 8px; margin-left: 1px; height: 36px; }
.c-att.library { background: color-mix(in srgb, var(--primary) 8%, var(--surface-2)); border-color: color-mix(in srgb, var(--primary) 25%, var(--border)); }
.unsub-btn { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); border-radius: 8px; padding: 3px 9px; font-size: 12px; font-weight: 550; cursor: pointer; }
.unsub-btn:hover { border-color: var(--red); color: var(--red); }
.unsub-btn .ico { width: 14px; height: 14px; }
.v-meta { flex-wrap: wrap; }
.tpl-edit { min-height: 160px; }
.tpl-snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
@media (max-width: 900px) { .att-tools { display: flex; } .att-tools button, .att-tools a { width: 28px; } .sched-when { width: 72px; } }

/* ================= v7: folders, rules, contacts, backups ================= */
.nav-item.add-folder { color: var(--muted); font-size: 12.5px; opacity: .8; }
.nav-item.add-folder:hover { opacity: 1; color: var(--primary); }
.nav-item.add-folder .ico { width: 14px; height: 14px; }
@media (min-width: 901px) { .side-collapsed .nav-item.add-folder { display: none; } }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 10px; background: var(--border-2); transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--primary); outline-offset: 2px; }
.acc-card.off { opacity: .6; }
.rule-box { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
.rule-box legend { font-weight: 650; font-size: 13px; padding: 0 6px; color: var(--text-2); }
.contact-row .avatar { width: 40px; height: 40px; font-size: 14px; }
.backups { display: flex; flex-direction: column; gap: 4px; font-weight: 400; }
.backup-row { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.backup-row .ico { width: 14px; height: 14px; color: var(--muted); }
.backup-row span { flex: 1; }
.backup-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.backup-foot small { overflow-wrap: anywhere; }

/* ---------- calendar invitation card ---------- */
.invite { display: flex; gap: 14px; padding: 14px; margin-bottom: 12px; border-radius: 12px; background: color-mix(in srgb, var(--primary) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); }
.invite.cancelled { background: color-mix(in srgb, var(--red) 6%, var(--surface)); border-color: color-mix(in srgb, var(--red) 25%, var(--border)); }
.invite.cancelled .inv-title { text-decoration: line-through; }
.inv-date { width: 56px; height: 60px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.08); overflow: hidden; }
.inv-date b { font-size: 22px; line-height: 1; }
.inv-date small { text-transform: uppercase; font-size: 11px; font-weight: 700; color: var(--red); margin-top: 3px; }
.inv-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.inv-body > span { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.inv-body .ico { width: 14px; height: 14px; color: var(--muted); flex: none; }
.inv-title { font-size: 15px; }
.inv-acts { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
@media (max-width: 900px) { .rows { padding-left: 20px; } .files-bar { padding-left: 24px; } }

/* ---------- iPhone app (home screen): content clear of the notch, status bar and home indicator ---------- */
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#app { height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
@media (max-width: 900px) {
  .side { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .compose, .compose.max { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
  #toasts { bottom: calc(20px + env(safe-area-inset-bottom)); }
  .modal-back { grid-template-columns: minmax(0, 1fr); padding: max(10px, env(safe-area-inset-top)) 8px max(10px, env(safe-area-inset-bottom)); }
  .modal { justify-self: center; max-height: 100%; }
  .modal-back > .modal.lg { width: 100%; height: 100%; }
  .tabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; } .tabs button { flex: none; }
  /* 16px inputs: Safari on iPhone does not zoom in when a field gets focus */
  input, select, textarea, .c-editor { font-size: 16px; }
}

/* ---------- touch screens (iPhone / iPad): what desktop shows on hover is always there, comfortable tap sizes ---------- */
@media (hover: none) {
  .nav-row > .nav-more { display: grid; background: none; }
  .nav-row > .nav-item b { visibility: visible !important; margin-right: 26px; }
  .row, .nav-item { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .att-tools { display: flex; }
}
@media (max-width: 900px) {
  .c-tools select { font-size: 16px; }                 /* below 16 px iOS zooms the page on focus */
  .compose, .compose.max { z-index: 70; }               /* above the menu tab and the drawer */
  .side-tab { width: 24px; height: 76px; left: env(safe-area-inset-left, 0px); }
  #app.side-open .side-tab { left: calc(280px + env(safe-area-inset-left, 0px)); }
  .v-bar .icon-btn { width: 40px; height: 40px; }
  .icon-btn { min-width: 36px; min-height: 36px; }
  .att-tools button, .att-tools a { width: 36px; height: 36px; }
}

/* ---------- backup button (sidebar foot): green / orange / red by days since the last download ---------- */
.backup-btn { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; margin-left: 4px; border-radius: 14px; border: 0; cursor: pointer; font-size: 12px; font-weight: 650; color: #fff; flex: none; transition: filter .12s; }
.backup-btn .ico { width: 14px; height: 14px; }
.backup-btn:hover { filter: brightness(1.08); }
.backup-btn.ok { background: #16a34a; }
.backup-btn.warn { background: #ea580c; }
.backup-btn.bad { background: #dc2626; animation: backupPulse 2.4s ease-in-out infinite; }
@keyframes backupPulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, #dc2626 25%, transparent); } }
@media (min-width: 901px) { .side-collapsed .backup-btn { padding: 0; width: 32px; justify-content: center; margin: 0; } .side-collapsed .backup-btn span { display: none; } }
.backup-row.ok .ico { color: #16a34a; } .backup-row.warn .ico { color: #ea580c; } .backup-row.bad .ico { color: #dc2626; }
.backup-row.bad span { color: #dc2626; font-weight: 600; }
.acc-alert.need-pw { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.acc-alert.need-pw .ico { color: var(--primary); }

/* ================= iPhone: the look of iOS Mail (html.phone = touch phone, see js/swipe.js) ================= */
.ph-bar, .ph-tool { display: none; }
html.phone { --ios-sep: color-mix(in srgb, var(--text) 13%, transparent); --ios-fill: rgba(118,118,128,.12); }
html.phone body { font-size: 17px; background: var(--surface); }
html.phone .ph-link { display: inline-flex; align-items: center; gap: 2px; height: 44px; padding: 0 6px; border: 0; background: none; color: var(--primary); font-size: 17px; cursor: pointer; }
html.phone .ph-link .ico { width: 22px; height: 22px; stroke-width: 2.2; }
html.phone .ph-link[aria-pressed="true"] { color: #fff; }
html.phone .ph-link[aria-pressed="true"] .ico { background: var(--primary); border-radius: 50%; }
html.phone .side-tab { display: none !important; }

/* list: navigation bar, large title, search */
html.phone .list-head { padding: 0 16px 8px; gap: 8px; border-bottom: 0; background: var(--surface); }
html.phone .ph-bar { display: flex; align-items: center; margin: 0 -10px; }
html.phone .list-title-row { padding: 0; }
html.phone #listTitle { font-size: 32px; font-weight: 700; letter-spacing: .2px; line-height: 1.15; }
html.phone #listBadge, html.phone #listCount, html.phone #viewBtn, html.phone .chips { display: none !important; }
html.phone .search { height: 36px; border: 0; border-radius: 10px; background: var(--ios-fill); padding: 0 8px; }
html.phone .search input { font-size: 17px; background: none; }

/* rows: blue dot for unread, bold sender, date with ›, two lines of text */
html.phone .rows { padding: 0; }
html.phone .row-group { margin: 0; padding: 14px 16px 6px; font-size: 13px; background: var(--surface); }
html.phone .row { gap: 0; margin: 0; border-radius: 0; padding: 11px 16px 11px 30px; background: var(--surface); box-shadow: none !important; overflow: hidden; }
html.phone .row::after { left: 30px; right: 0; bottom: 0; border-bottom: .5px solid var(--ios-sep); display: block !important; }
html.phone .row.unread::before { display: block; left: 10px; top: 19px; width: 11px; height: 11px; background: var(--primary); }
html.phone .row.open, html.phone .row:active { background: var(--surface-2); }
html.phone .row.selected { background: var(--primary-100); }
html.phone .row.colored { box-shadow: inset 4px 0 0 var(--lc) !important; }
html.phone .row-check, html.phone .row-av, html.phone .row-hover, html.phone .row-star:not(.on) { display: none !important; }
html.phone .row-top { align-items: baseline; }
html.phone .row-from { font-size: 17px; font-weight: 600; color: var(--text); }
html.phone .row-top time { font-size: 15px; color: var(--muted); font-weight: 400; visibility: visible !important; }
html.phone .row-top time::after { content: "›"; margin-left: 6px; font-size: 19px; line-height: 0; color: var(--faint); }
html.phone .row-subj { font-size: 15px; color: var(--text); font-weight: 400 !important; margin-top: 1px; }
html.phone .row-snip { font-size: 15px; line-height: 1.33; color: var(--muted); white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.66em; }
html.phone .row-icons { position: absolute; right: 16px; top: 36px; flex-direction: row; padding: 0; gap: 6px; }
html.phone .row-star.on { color: var(--star); visibility: visible; }

/* bottom toolbar: filter · status · new mail */
html.phone .ph-tool { display: flex; align-items: center; height: 46px; padding: 0 10px; border-top: .5px solid var(--ios-sep); background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
html.phone .ph-status { flex: 1; text-align: center; font-size: 12px; color: var(--text-2); }

/* swipe actions (js/swipe.js): the row slides, the buttons are revealed underneath */
html.phone .row > :not(.sw-layer), html.phone .row::before { transform: translateX(var(--sx, 0px)); }
html.phone .row.sw-anim > :not(.sw-layer), html.phone .row.sw-anim::before { transition: transform .22s cubic-bezier(.2,.8,.2,1); }
html.phone .row.sw-on { background: var(--surface); }
.sw-layer { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.sw-side { position: absolute; top: 0; bottom: 0; display: none; width: var(--sw, 0px); pointer-events: auto; overflow: hidden; }
.sw-left { left: 0; } .sw-right { right: 0; }
.sw-layer.show-left .sw-left, .sw-layer.show-right .sw-right { display: flex; }
.sw-side button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; color: #fff; font-size: 13px; font-weight: 500; cursor: pointer; transition: flex-grow .18s; }
.sw-side button .ico { width: 22px; height: 22px; }
.sw-side button span { white-space: nowrap; }
.sw-blue { background: #007aff; } .sw-orange { background: #ff9500; } .sw-gray { background: #8e8e93; } .sw-red { background: #ff3b30; } .sw-purple { background: #af52de; }
/* long swipe: the main action takes the whole width */
.sw-layer.full .sw-right button:not(:last-child) { flex-grow: 0; flex-basis: 0; padding: 0; overflow: hidden; }
.sw-layer.full .sw-right button:last-child { flex-grow: 1; align-items: flex-start; padding-left: 24px; }
.sw-layer.full .sw-left button { align-items: flex-end; padding-right: 24px; }

/* message: "‹ Zpět" at the top, the actions in a toolbar at the bottom */
html.phone .view { position: relative; background: var(--surface); }
html.phone .view .v-scroll { order: 1; padding: 52px 16px 24px; }
/* no backdrop-filter here: it would make the bar the containing block of the absolutely placed "‹ Zpět" */
html.phone .view .v-bar { order: 2; justify-content: space-around; gap: 0; padding: 0 6px; height: 46px; border-top: .5px solid var(--ios-sep); border-bottom: 0; background: var(--surface); }
html.phone .view::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 44px; z-index: 2; background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-bottom: .5px solid var(--ios-sep); }
html.phone .view .mobile-back { position: absolute; top: 0; left: 4px; z-index: 3; width: auto !important; height: 44px; padding: 0 8px; color: var(--primary); }
html.phone .view .mobile-back::after { content: "Zpět"; font-size: 17px; margin-left: 2px; }
html.phone .view .mobile-back .ico { width: 22px; height: 22px; stroke-width: 2.4; }
html.phone .v-bar > .grow, html.phone #vReplyAll, html.phone #vFwd, html.phone #vUnread, html.phone #vColor, html.phone #vSpam, html.phone #vArchive { display: none !important; }
html.phone .v-actions { order: 4; }
html.phone .v-bar #vFlag { order: 1; } html.phone .v-bar #vMove { order: 2; } html.phone .v-bar #vDelete { order: 3; } html.phone .v-bar #vMore { order: 5; }
html.phone .v-bar .icon-btn, html.phone #vReply { width: 44px; height: 44px; min-width: 44px; padding: 0; border: 0; background: none; color: var(--primary); justify-content: center; }
html.phone .v-bar .icon-btn .ico, html.phone #vReply .ico { width: 24px; height: 24px; }
html.phone .v-bar #vFlag.on { color: var(--star); }
html.phone .v-subject { font-size: 22px; line-height: 1.25; }
html.phone #app:not(.side-open) .side { box-shadow: none; }
html.phone .view .mobile-back { display: inline-flex !important; align-items: center; }
html.phone #toasts { bottom: calc(58px + env(safe-area-inset-bottom)); }

/* iPhone: "Schránky" = a full screen like in iOS Mail; "Hotovo" (or a swipe to the left) closes it */
.ph-side-title, .ph-done { display: none; }
html.phone .side { width: 100%; box-shadow: none; transition: transform .3s cubic-bezier(.2,.8,.2,1); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
html.phone .side-back { display: none !important; }
html.phone .brand { height: 44px; padding: 0 6px; }
html.phone .brand-logo, html.phone .brand > b { display: none; }
html.phone #syncAll { width: 44px; height: 44px; margin-right: auto; color: var(--primary); }
html.phone #syncAll .ico { width: 22px; height: 22px; }
html.phone #sideClose { width: auto; height: 44px; padding: 0 10px; color: var(--primary); font-size: 17px; font-weight: 600; }
html.phone #sideClose .ico { display: none; }
html.phone #sideClose .ph-done { display: inline; }
html.phone .ph-side-title { display: block; margin: 0; padding: 2px 16px 10px; font-size: 32px; font-weight: 700; letter-spacing: .2px; }
html.phone .btn-compose { margin: 0 16px 8px; height: 44px; font-size: 17px; border-radius: 12px; }
html.phone .btn-compose kbd { display: none; }
html.phone .side .nav-item { min-height: 44px; font-size: 17px; }
html.phone .side .nav-item .ico { width: 22px; height: 22px; }
html.phone #keysBtn { display: none; }
/* iPhone: the minimised compose bar sits above the bottom toolbar (list and message), not over it */
html.phone .compose.min { bottom: calc(46px + env(safe-area-inset-bottom)); padding: 0; border-radius: 12px 12px 0 0; }
/* iPhone: a long subject stops before the paperclip / star on the right instead of running under them */
html.phone .row:has(.row-icons > span, .row-star.on) .row-subj { padding-right: 40px; }
