@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/space-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/space-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@property --angle { syntax: '<angle>'; initial-value: 0deg; inherits: false; }

/* Tokeny z YAPPER webu */
:root {
  --ink: #0b0b0b;
  --ink-2: #111110;
  --ink-3: #181715;
  --ink-4: #22211e;
  --paper: #f5f5f3;
  --orange: #ff6700;
  --orange-hover: #ff7f26;
  --orange-glow: #ff670066;
  --line: #363430;
  --line-soft: #24221f;
  --muted: #bdb8af;
  --muted-2: #8a857c;
  --danger: #ff5a45;
  --ok: #7fd48a;
  --type: 'Space Grotesk', 'Segoe UI', sans-serif;
  --serif: Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 500px at -10% -20%, #ff670010, transparent 60%),
    radial-gradient(700px 500px at 110% 120%, #ff67000a, transparent 60%),
    var(--ink);
  color: var(--paper);
  font: 15px/1.5 var(--type);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.grain {
  position: fixed; inset: -50%; z-index: 100; pointer-events: none; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain { 0%,100% { transform: translate(0,0); } 20% { transform: translate(-3%,2%); } 40% { transform: translate(2%,-3%); } 60% { transform: translate(-2%,-1%); } 80% { transform: translate(3%,3%); } }

[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
::selection { background: var(--orange); color: var(--ink); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-4); border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--line); }
kbd { font-family: var(--mono); font-size: 10px; border: 1px solid var(--line); border-bottom-width: 2px; padding: 0 4px; color: var(--muted); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.eyebrow { margin: 0; font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.dim { color: var(--muted-2); }

.logo { display: inline-flex; align-items: baseline; font-weight: 700; font-size: 24px; letter-spacing: -0.06em; text-decoration: none; color: var(--paper); white-space: nowrap; }
.logo i { font-style: normal; color: var(--orange); text-shadow: 0 0 18px var(--orange-glow); }
.logo small { margin-left: 10px; font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ---------- Tlačítka ---------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: space-between; gap: 18px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 0; background: transparent;
  font-weight: 650; font-size: 14px; white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s var(--ease), box-shadow .25s var(--ease), transform .12s var(--ease);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn .arrow { font-size: 17px; transition: transform .25s var(--spring); }
.btn:hover .arrow { transform: translate(3px, -3px); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--ink); }
.btn.primary:hover { background: var(--orange-hover); border-color: var(--orange-hover); box-shadow: 0 10px 34px -10px var(--orange-glow), 0 0 0 1px #ff8a3d inset; }
.btn.ghost:hover { border-color: var(--muted-2); background: var(--ink-3); }
.btn.danger { color: #ffb3a8; }
.btn.danger:hover { border-color: var(--danger); background: #ff5a4514; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; gap: 10px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }
.shine::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, #ffffff70, transparent);
  transform: skewX(-20deg); transition: left .6s var(--ease); pointer-events: none;
}
.shine:hover::after { left: 130%; }
.btn.loading { color: transparent !important; }
.btn.loading::before { content: ''; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border: 2px solid var(--ink); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 38px; height: 38px; padding: 0;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  transition: color .15s, border-color .15s, background .15s, transform .12s;
}
.icon-btn:hover { color: var(--paper); border-color: var(--line); background: var(--ink-3); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.on { color: var(--orange); }
.icon-btn.on svg { fill: var(--orange); }
.icon-btn.active { color: var(--ink); background: var(--orange); border-color: var(--orange); }
.icon-btn.tiny { width: 26px; height: 26px; }
.icon-btn.tiny svg { width: 16px; height: 16px; }

/* Tooltipy */
[data-tip] { position: relative; }
[data-tip]:hover::before {
  content: attr(data-tip); position: absolute; z-index: 50; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  padding: 5px 8px; background: var(--paper); color: var(--ink);
  font: 600 11px/1.2 var(--type); white-space: nowrap; pointer-events: none;
  animation: tip .15s .35s var(--ease) both;
}
@keyframes tip { from { opacity: 0; transform: translate(-50%, -3px); } }

/* ---------- Boot ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot .logo { font-size: 44px; animation: pulse 1.1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .3; filter: blur(1px); } to { opacity: 1; filter: none; } }

/* ---------- Přihlášení ---------- */
.login { display: grid; grid-template-columns: 1.15fr 1fr; height: 100vh; height: 100dvh; overflow: auto; }
.login-brand {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
  padding: clamp(24px, 5vw, 72px);
  border-right: 1px solid var(--line);
  --mx: 70%; --my: 60%;
}
.spot { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(520px circle at var(--mx) var(--my), #ff670026, transparent 60%); }
.login-brand > * { position: relative; }
.login-hero h1 { margin: 18px 0 22px; font-family: var(--serif); font-weight: 400; font-size: clamp(52px, 7.6vw, 118px); line-height: .95; letter-spacing: -0.045em; }
.login-hero h1 > * { display: inline-block; animation: word .9s var(--ease) both; }
.login-hero h1 > :nth-child(2) { animation-delay: .08s; }
.login-hero h1 > :nth-child(3) { animation-delay: .16s; }
.login-hero h1 > :nth-child(4) { animation-delay: .24s; }
.login-hero h1 em { font-style: normal; color: var(--orange); text-shadow: 0 0 40px #ff670055; }
@keyframes word { from { opacity: 0; transform: translateY(30px) rotate(2deg); filter: blur(6px); } }
.login-lede { max-width: 38ch; margin: 0; font-size: 18px; color: var(--muted); animation: word .9s .35s var(--ease) both; }
.login-panel { display: grid; place-items: center; padding: clamp(20px, 5vw, 72px); background: #0e0e0d; }
.login-card {
  position: relative; width: min(420px, 100%); padding: 1px;
  background: conic-gradient(from var(--angle), var(--line) 0deg, var(--line) 250deg, var(--orange) 300deg, var(--line) 345deg);
  animation: border-spin 6s linear infinite, rise .6s var(--ease) both;
}
@keyframes border-spin { to { --angle: 360deg; } }
.login-card-inner { display: grid; gap: 20px; padding: 34px 30px 26px; background: var(--ink-2); }
.login-card h2 { margin: 0; font-size: 40px; letter-spacing: -0.055em; line-height: 1; }
.login-sub { margin: -8px 0 4px; color: var(--muted-2); font-size: 14px; }
.login-sub b { color: var(--paper); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.field { display: grid; gap: 8px; }
.field > span:first-child { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; height: 50px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 0; background: var(--ink);
  font-size: 16px; transition: border-color .15s, box-shadow .2s;
}
.field textarea { height: auto; min-height: 90px; padding: 12px 14px; resize: vertical; }
.field input:hover, .field select:hover { border-color: var(--muted-2); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px #ff670022; }
.pw { position: relative; display: block; }
.pw input { padding-right: 96px; }
.pw-toggle { position: absolute; right: 6px; top: 6px; bottom: 6px; padding: 0 12px; border: 0; background: transparent; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pw-toggle:hover { color: var(--paper); }
.caps { color: var(--orange); font-size: 12px; }
.form-error { margin: 0; padding: 10px 12px; border-left: 2px solid var(--danger); background: #ff5a4512; color: #ffb3a8; font-size: 14px; animation: shake .35s var(--ease); }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.secure-note { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; color: var(--muted-2); }
.secure-note svg { width: 14px; height: 14px; color: var(--ok); }

/* ---------- Aplikace ---------- */
.app {
  display: grid;
  grid-template-columns: 248px minmax(320px, 420px) 1fr;
  grid-template-rows: 64px 1fr;
  grid-template-areas: 'top top top' 'side list read';
  height: 100vh; height: 100dvh;
  animation: fade .4s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.topbar {
  position: relative; grid-area: top;
  display: flex; align-items: center; gap: 22px; padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line);
  background: #0b0b0bf2; backdrop-filter: blur(12px);
}
.topbar::after { content: ''; position: absolute; left: 0; bottom: -1px; height: 1px; width: 248px; background: linear-gradient(90deg, var(--orange), transparent); }
.menu-btn { display: none; }
.search {
  flex: 1; max-width: 620px;
  display: flex; align-items: center; gap: 10px;
  height: 40px; margin-left: 30px; padding: 0 12px;
  border: 1px solid var(--line); background: var(--ink-2); color: var(--muted-2);
  transition: border-color .15s, box-shadow .2s, background .2s;
}
.search:focus-within { border-color: var(--orange); color: var(--paper); background: var(--ink); box-shadow: 0 0 0 4px #ff67001a; }
.search-ico { display: inline-grid; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 14px; }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.me { display: flex; align-items: center; gap: 10px; margin-left: 8px; padding: 4px 4px 4px 12px; border: 1px solid transparent; background: none; text-align: right; transition: border-color .15s, background .15s; }
.me:hover, .me[aria-expanded='true'] { border-color: var(--line); background: var(--ink-3); }
.me-text { display: grid; line-height: 1.2; }
.me-text b { font-size: 13px; }
.me-text small { font-family: var(--mono); font-size: 11px; color: var(--muted-2); }
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px;
  background: var(--ink-4); border: 1px solid var(--line);
  font-weight: 700; font-size: 12px; letter-spacing: -0.02em; color: var(--paper);
}
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.accent { background: var(--orange); border-color: var(--orange); color: var(--ink); }
#me-avatar { background: var(--orange); border-color: var(--orange); color: var(--ink); box-shadow: 0 0 20px -4px var(--orange-glow); }

.sidebar { grid-area: side; display: flex; flex-direction: column; gap: 6px; padding: 18px 12px; border-right: 1px solid var(--line); overflow-y: auto; }
.compose-btn { margin-bottom: 14px; min-height: 48px; font-size: 15px; box-shadow: 0 12px 30px -16px var(--orange-glow); }
.folders { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.folders a {
  position: relative; display: flex; align-items: center; gap: 12px;
  height: 38px; padding: 0 10px 0 12px;
  text-decoration: none; color: var(--muted); font-weight: 500; font-size: 14px;
  transition: background .15s, color .15s, padding .2s var(--ease);
}
.folders a:hover { background: var(--ink-3); color: var(--paper); padding-left: 15px; }
.folders a[aria-current='page'] { background: linear-gradient(90deg, #ff670014, transparent 80%), var(--ink-3); color: var(--paper); font-weight: 650; }
.folders a::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; background: var(--orange); transform: scaleY(0); transition: transform .25s var(--spring); }
.folders a[aria-current='page']::before { transform: scaleY(1); box-shadow: 0 0 12px var(--orange); }
.folders a.drop { background: #ff670022; outline: 1px dashed var(--orange); }
.folders svg { width: 18px; height: 18px; }
.folders .count { margin-left: auto; min-width: 22px; padding: 0 6px; font-family: var(--mono); font-size: 11px; line-height: 20px; text-align: center; color: var(--muted-2); }
.folders .count.hot { background: var(--orange); color: var(--ink); font-weight: 700; }
.custom-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 2px; padding: 0 4px 0 12px; }
.shortcuts { margin-top: auto; padding: 14px 4px 0; font-size: 10px; line-height: 2.1; letter-spacing: .04em; text-transform: none; }
.scrim { display: none; }

/* ---------- Seznam ---------- */
.list-pane { grid-area: list; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.list-head, .bulk { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 14px 16px 10px; }
.list-head h1 { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 30px; letter-spacing: -0.06em; line-height: 1; }
.bulk { background: linear-gradient(90deg, #ff670018, transparent); animation: rise .2s var(--ease); }
.bulk b { font-size: 14px; white-space: nowrap; }
.bulk-actions { display: flex; margin-left: auto; }
.filters { display: flex; gap: 6px; padding: 0 16px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.chip {
  flex: none; height: 28px; padding: 0 11px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 600; transition: all .15s;
}
.chip:hover { color: var(--paper); border-color: var(--muted-2); }
.chip[aria-selected='true'] { background: var(--paper); border-color: var(--paper); color: var(--ink); }

.check { position: relative; display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; cursor: pointer; }
.check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.check span { width: 16px; height: 16px; border: 1.5px solid var(--muted-2); transition: all .15s var(--spring); }
.check:hover span { border-color: var(--paper); }
.check input:checked + span { background: var(--orange); border-color: var(--orange); box-shadow: 0 0 10px -2px var(--orange-glow); }
.check input:checked + span::after { content: ''; display: block; width: 4px; height: 8px; margin: 1px 0 0 4.5px; border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.check input:indeterminate + span { background: var(--orange); border-color: var(--orange); }
.check input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 2px; }

.msg-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.msg {
  position: relative;
  display: grid; grid-template-columns: 20px 1fr auto; gap: 1px 12px; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer; user-select: none;
  animation: row .35s var(--ease) both; animation-delay: calc(var(--i, 0) * 18ms);
  transition: background .12s;
}
@keyframes row { from { opacity: 0; transform: translateX(-6px); } }
.msg:hover { background: var(--ink-2); }
.msg.selected { background: var(--ink-3); }
.msg.checked { background: #ff670012; }
.msg::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--orange); transform: scaleY(0); transition: transform .25s var(--spring); }
.msg.selected::before { transform: scaleY(1); box-shadow: 0 0 14px var(--orange); }
.msg .check { grid-row: 1 / 3; }
.msg .who { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; color: var(--muted); font-size: 14px; }
.msg .who span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.msg .meta-r { display: flex; align-items: center; gap: 6px; color: var(--muted-2); }
.msg .meta-r svg { width: 14px; height: 14px; }
.msg .when { font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.msg .subj { grid-column: 2 / 4; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 14px; }
.msg.unread .who, .msg.unread .subj { color: var(--paper); font-weight: 650; }
.msg.unread .who::before { content: ''; flex: none; width: 7px; height: 7px; background: var(--orange); box-shadow: 0 0 10px var(--orange); animation: dot 2.4s ease-in-out infinite; }
@keyframes dot { 50% { box-shadow: 0 0 2px var(--orange); } }
.msg .star-on { color: var(--orange); }
.msg .star-on svg { fill: var(--orange); }
.list-empty { padding: 56px 24px; color: var(--muted-2); text-align: center; }
.list-empty b { display: block; margin-bottom: 4px; color: var(--paper); font-size: 20px; letter-spacing: -0.03em; }
.list-more { display: flex; justify-content: center; padding: 16px; }
.skeleton { height: 66px; border-bottom: 1px solid var(--line-soft); background: linear-gradient(90deg, transparent 20%, #ffffff09, transparent 80%) 0 0 / 200% 100%; animation: shimmer 1.1s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Čtečka ---------- */
.reader { grid-area: read; min-width: 0; min-height: 0; overflow-y: auto; }
.reader-empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted-2); text-align: center; }
.reader-empty p { margin: 0; color: var(--paper); font-size: 22px; letter-spacing: -0.04em; font-weight: 600; }
.big-dot { width: 16px; height: 16px; margin-bottom: 14px; background: var(--orange); box-shadow: 0 0 40px 6px #ff670044; animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); box-shadow: 0 0 60px 10px #ff670033; } }
.reader-msg { max-width: 980px; padding: 0 clamp(18px, 3.4vw, 48px) 64px; animation: rise .35s var(--ease) both; }
.toolbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 2px; padding: 12px 0; margin-bottom: 8px; border-bottom: 1px solid var(--line); background: #0b0b0bf0; backdrop-filter: blur(10px); }
.toolbar .spacer { flex: 1; }
.toolbar .sep { width: 1px; height: 20px; margin: 0 6px; background: var(--line); }
.back-btn { display: none !important; }
.reader-msg h2 { margin: 22px 0 18px; font-size: clamp(26px, 3.2vw, 42px); font-weight: 700; line-height: 1.04; letter-spacing: -0.055em; text-wrap: balance; overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border: 1px solid var(--line); font: 600 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.badge svg { width: 13px; height: 13px; }
.badge.ok { color: var(--ok); border-color: #7fd48a44; }
.badge.bad { color: var(--danger); border-color: #ff5a4566; }
.badge.warn { color: var(--orange); border-color: #ff670066; }
.meta { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 18px; }
.meta .from { display: grid; gap: 2px; line-height: 1.35; min-width: 0; flex: 1; }
.meta .from b { font-size: 15px; }
.meta .from .addr { font-family: var(--mono); font-size: 12px; color: var(--muted-2); overflow-wrap: anywhere; }
.meta .rcpt-line { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.meta .rcpt-line button { border: 0; background: none; padding: 0; margin-left: 4px; color: var(--muted-2); text-decoration: underline; text-underline-offset: 3px; font-size: 12px; }
.meta .details { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 8px 0 0; font-size: 12px; color: var(--muted-2); }
.meta .details dt { font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; font-size: 10px; padding-top: 2px; }
.meta .details dd { margin: 0; overflow-wrap: anywhere; color: var(--muted); }
.meta time { font-family: var(--mono); font-size: 12px; color: var(--muted-2); white-space: nowrap; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--line); background: var(--ink-2); font-size: 13px; color: var(--muted); animation: rise .3s var(--ease); }
.banner svg { width: 18px; height: 18px; color: var(--orange); }
.banner.danger { border-color: #ff5a4566; background: #ff5a4510; color: #ffc9c0; }
.banner.danger svg { color: var(--danger); }
.banner .grow { flex: 1; min-width: 180px; }
.banner button, .banner a { border: 0; background: none; padding: 0; color: var(--paper); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }
.sheet { position: relative; background: #fff; border: 1px solid var(--line); box-shadow: 0 30px 80px -40px #000; animation: sheet .5s var(--ease) both; }
@keyframes sheet { from { opacity: 0; transform: translateY(10px) scale(.995); } }
.sheet iframe { display: block; width: 100%; height: 160px; border: 0; background: #fff; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.att {
  display: inline-flex; align-items: center; gap: 10px; max-width: 280px; height: 46px; padding: 0 12px 0 8px;
  border: 1px solid var(--line); background: var(--ink-2); text-decoration: none; color: var(--paper); font-size: 13px;
  transition: border-color .15s, transform .15s var(--spring), background .15s;
}
a.att:hover { border-color: var(--orange); transform: translateY(-2px); background: var(--ink-3); }
.att .ext { display: grid; place-items: center; width: 30px; height: 30px; background: var(--orange); color: var(--ink); font: 700 9px/1 var(--mono); text-transform: uppercase; flex: none; }
.att .nm { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.25; }
.att small { display: block; color: var(--muted-2); font-family: var(--mono); font-size: 10px; }
.att button { margin-left: 4px; border: 0; background: none; color: var(--muted-2); padding: 4px; }
.att button:hover { color: var(--danger); }
.att button svg { width: 14px; height: 14px; }
.reply-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }

/* ---------- Menu / popover ---------- */
.menu {
  position: fixed; z-index: 80; min-width: 220px; max-width: 340px; max-height: 70vh; overflow-y: auto;
  padding: 6px; background: var(--ink-2); border: 1px solid var(--line);
  box-shadow: 0 24px 60px -20px #000, 0 0 0 1px #ffffff06 inset;
  animation: pop .18s var(--ease) both; transform-origin: top;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu > button, .menu > a { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; background: none; text-align: left; text-decoration: none; color: var(--paper); font-size: 13px; }
.menu > button:hover, .menu > a:hover { background: var(--ink-4); }
.menu > button svg { width: 16px; height: 16px; color: var(--muted); }
.menu .mh { padding: 8px 10px 4px; font: 600 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu .sw { width: 14px; height: 14px; flex: none; border: 1px solid #ffffff22; }
.menu small { margin-left: auto; color: var(--muted-2); font-size: 11px; }
.popform { display: grid; gap: 8px; padding: 8px; min-width: 280px; }
.popform label { display: grid; gap: 4px; font: 600 10px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); }
.popform input { height: 38px; padding: 0 10px; border: 1px solid var(--line); background: var(--ink); font: 400 14px var(--type); color: var(--paper); text-transform: none; letter-spacing: 0; }
.popform input:focus { outline: none; border-color: var(--orange); }
.popform .row { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Psaní ---------- */
.compose {
  position: fixed; right: 20px; bottom: 0; z-index: 40;
  width: min(820px, calc(100vw - 40px)); height: min(88vh, 900px);
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-bottom: 0;
  background: var(--ink-2);
  box-shadow: 0 -30px 90px -20px #000000d0, 0 0 0 1px #ff670010;
  animation: slideup .35s var(--ease) both;
}
.compose.max { inset: 20px; width: auto; height: auto; border-bottom: 1px solid var(--line); }
.compose.min { height: 52px; width: 340px; overflow: hidden; }
.compose.min .c-body { display: none; }
.compose.dragging::after { content: 'Pusť soubory sem'; position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: #0b0b0bd9; border: 2px dashed var(--orange); color: var(--orange); font-size: 22px; font-weight: 700; letter-spacing: -0.03em; pointer-events: none; }
@keyframes slideup { from { transform: translateY(30px); opacity: 0; } }
.c-head { display: flex; align-items: center; gap: 4px; min-height: 52px; padding: 0 8px 0 18px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, #ff670014, transparent 50%); }
.c-head h2 { flex: 1; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 16px; letter-spacing: -0.03em; cursor: pointer; }
.c-head .status { font-family: var(--mono); font-size: 11px; color: var(--muted-2); margin-right: 6px; white-space: nowrap; }
.c-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.c-line { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 3px 12px 3px 18px; border-bottom: 1px solid var(--line-soft); }
.c-line > .lbl { width: 84px; flex: none; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); }
.c-line:focus-within > .lbl { color: var(--orange); }
.c-line input.plain { flex: 1; min-width: 0; height: 36px; border: 0; background: none; outline: none; font-size: 15px; }
.c-line .from-addr { flex: 1; font-size: 14px; color: var(--muted); }
.c-line .toggles { display: flex; gap: 2px; flex: none; }
.c-line .toggles button { border: 0; background: none; padding: 4px 6px; font-size: 12px; color: var(--muted-2); font-weight: 600; }
.c-line .toggles button:hover { color: var(--orange); }
.rcpt { position: relative; flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 3px 0; }
.rcpt input { flex: 1; min-width: 120px; height: 30px; border: 0; background: none; outline: none; font-size: 15px; }
.rchip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 28px; padding: 0 4px 0 9px; background: var(--ink-4); border: 1px solid var(--line); font-size: 13px; animation: pop .15s var(--ease); }
.rchip.bad { border-color: var(--danger); color: #ffb3a8; }
.rchip span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rchip button { display: grid; place-items: center; width: 20px; height: 20px; border: 0; padding: 0; background: none; color: var(--muted-2); }
.rchip button:hover { color: var(--paper); }
.rchip button svg { width: 13px; height: 13px; }
.suggest { position: absolute; left: 0; top: 100%; z-index: 10; min-width: 280px; padding: 4px; background: var(--ink-3); border: 1px solid var(--line); box-shadow: 0 20px 40px -20px #000; animation: pop .15s var(--ease); }
.suggest button { display: grid; width: 100%; padding: 7px 10px; border: 0; background: none; text-align: left; line-height: 1.3; }
.suggest button b { font-size: 13px; }
.suggest button small { font-family: var(--mono); font-size: 11px; color: var(--muted-2); }
.suggest button.hl, .suggest button:hover { background: var(--ink-4); }

.tplbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 18px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; scrollbar-width: none; }
.seg { display: inline-flex; border: 1px solid var(--line); flex: none; }
.seg button { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border: 0; background: none; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; transition: background .15s, color .15s; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--paper); }
.seg button[aria-pressed='true'] { background: var(--paper); color: var(--ink); }
.sw { display: inline-block; width: 12px; height: 12px; border: 1px solid #ffffff30; flex: none; }
.sw.yapper { background: linear-gradient(180deg, #0b0b0b 45%, #ff6700 45% 58%, #fff 58%); }
.sw.noir { background: linear-gradient(180deg, #0b0b0b 45%, #ff6700 45% 58%, #1a1917 58%); }
.sw.plain { background: #fff; }
.tplbar .btn.small { min-height: 32px; flex: none; }
.tplbar .grow { flex: 1; }

.fmtbar { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; align-items: center; gap: 0; padding: 5px 8px; border-bottom: 1px solid var(--line-soft); background: var(--ink); }
.fmtbar .icon-btn { width: 31px; height: 32px; flex: none; }
.fmtbar .icon-btn svg { width: 17px; height: 17px; }
.fmtbar .sep { width: 1px; height: 18px; margin: 0 4px; background: var(--line); }
.fmtbar .txt { font: 700 15px/1 var(--type); }
.fmtbar .txt.i { font-style: italic; font-family: var(--serif); }
.fmtbar .txt.u { text-decoration: underline; }
.fmtbar .txt.s { text-decoration: line-through; }
.fmtbar select { height: 30px; margin-right: 4px; padding: 0 6px; border: 1px solid var(--line); background: var(--ink-2); font-size: 12px; }
.fmtbar .color-a { display: grid; justify-items: center; font: 700 14px/1 var(--type); }
.fmtbar .color-a i { display: block; width: 16px; height: 3px; margin-top: 2px; background: var(--orange); }
.palette { display: grid; grid-template-columns: repeat(6, 26px); gap: 4px; padding: 8px; }
.palette button { width: 26px; height: 26px; padding: 0; border: 1px solid #ffffff22; min-height: 0; transition: transform .12s var(--spring); }
.palette button:hover { transform: scale(1.15); outline: 1px solid var(--paper); }

/* Editor = WYSIWYG náhled šablony */
.c-scroll { flex: 1; min-height: 0; overflow-y: auto; background: radial-gradient(600px 300px at 50% 0, #ff67000c, transparent), #1a1917; }
.frame { max-width: 640px; margin: 22px auto; background: #fff; color: #1d1c1a; box-shadow: 0 20px 60px -30px #000; transition: background .3s, color .3s; }
.frame .f-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 30px; background: #0b0b0b; border-bottom: 3px solid var(--orange); }
.frame .f-head .logo { font-size: 24px; }
.frame .f-head small { font: 600 10px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted-2); }
.frame .f-sign { display: flex; flex-direction: column; margin: 0 30px 26px; padding-left: 12px; border-left: 3px solid var(--orange); font-size: 13px; line-height: 1.5; color: #6b665d; }
.frame .f-sign b { color: #0b0b0b; }
.frame .f-foot { padding: 18px 30px; background: #0b0b0b; font-size: 11px; line-height: 1.7; color: var(--muted); }
.frame .f-foot b { color: var(--paper); }
.frame .f-foot b i { font-style: normal; color: var(--orange); }
.frame .f-foot a { color: var(--orange); text-decoration: none; }
.frame.noir { background: #0b0b0b; color: #e6e2da; outline: 1px solid var(--line); }
.frame.noir .f-foot { background: #000; }
.frame.noir .f-sign b { color: var(--paper); }
.frame.noir .editor h1, .frame.noir .editor h2, .frame.noir .editor h3, .frame.noir .editor .y-lead { color: var(--paper); }
.frame.noir .editor .y-card { background: #161512; }
.frame.plain .f-head, .frame.plain .f-foot, .frame.plain .f-sign { display: none; }
.frame.plain { margin: 0 auto; max-width: none; min-height: 100%; box-shadow: none; }

.editor { min-height: 260px; padding: 32px 30px 18px; outline: none; font: 400 16px/1.65 var(--type); caret-color: var(--orange); overflow-wrap: anywhere; }
.editor p { margin: 0 0 14px; }
.editor h1 { margin: 0 0 16px; font-size: 34px; line-height: 1.05; letter-spacing: -0.04em; color: #0b0b0b; }
.editor h2 { margin: 0 0 16px; font-size: 28px; line-height: 1.08; letter-spacing: -0.035em; color: #0b0b0b; }
.editor h3 { margin: 0 0 10px; font-size: 19px; color: #0b0b0b; }
.editor .y-lead { font-size: 20px; line-height: 1.45; color: #0b0b0b; }
.editor blockquote { margin: 0 0 14px; padding: 4px 0 4px 16px; border-left: 3px solid var(--orange); color: #6b665d; }
.editor ul, .editor ol { margin: 0 0 14px; padding-left: 22px; }
.editor a { color: #d95700; }
.editor a.y-btn { display: inline-block; padding: 13px 22px; background: var(--orange); color: #0b0b0b; font-weight: 700; font-size: 15px; text-decoration: none; }
.editor .y-card { margin: 0 0 16px; padding: 16px 18px; background: #f5f3ee; border-left: 3px solid var(--orange); }
.editor .y-card p:last-child { margin: 0; }
.editor .y-quote { margin-top: 18px; padding-left: 14px; border-left: 2px solid #d8d3ca; color: #6b665d; font-size: 14px; }
.editor .y-quote blockquote { border-left-color: #d8d3ca; }
.editor .y-sig { margin-top: 18px; color: #6b665d; font-size: 14px; }
.editor hr { border: 0; border-top: 1px solid #e2ded6; margin: 22px 0; }
.editor img { max-width: 100%; }

.c-atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px 0; }
.c-atts:empty { display: none; }
.c-atts .att { height: 40px; }
.c-foot { display: flex; align-items: center; gap: 8px; padding: 12px 14px 14px 18px; border-top: 1px solid var(--line); }
.c-foot .grow { flex: 1; }
.c-foot .hint { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; color: var(--muted-2); }
.prio-high { color: var(--orange) !important; }

/* ---------- Modály ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: #000000a8; backdrop-filter: blur(6px); animation: fade .2s var(--ease); }
.modal { position: relative; display: flex; flex-direction: column; width: min(720px, 100%); max-height: calc(100vh - 40px); background: var(--ink-2); border: 1px solid var(--line); box-shadow: 0 40px 120px -30px #000; animation: modal .3s var(--spring) both; }
.modal.wide { width: min(980px, 100%); height: calc(100vh - 40px); }
@keyframes modal { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; margin: 0; font-size: 22px; letter-spacing: -0.045em; }
.modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 24px 26px; }
.modal-body.flush { padding: 0; background: #1a1917; display: flex; justify-content: center; }
.modal-body.flush iframe { width: 100%; height: 100%; border: 0; background: #fff; transition: width .35s var(--ease); }
.modal-body.flush.mobile iframe { width: 390px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); }
.settings { display: grid; gap: 30px; }
.settings section { display: grid; gap: 14px; }
.settings h3 { margin: 0; font-size: 12px; font-family: var(--mono); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--orange); }
.settings p.note { margin: -6px 0 0; color: var(--muted-2); font-size: 13px; }
.sig-editor { min-height: 90px; padding: 12px 14px; border: 1px solid var(--line); background: #fff; color: #1d1c1a; outline: none; font: 400 14px/1.6 var(--type); }
.sig-editor:focus { border-color: var(--orange); box-shadow: 0 0 0 4px #ff670022; }
.tpl-list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.tpl-list > div { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--ink-2); font-size: 14px; }
.tpl-list > div span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-list .empty { color: var(--muted-2); font-size: 13px; }
.keys { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 22px; font-size: 13px; color: var(--muted); }
.keys div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line-soft); padding-bottom: 6px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-row label { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line); cursor: pointer; font-size: 13px; transition: all .15s; }
.radio-row input { accent-color: var(--orange); }
.radio-row label:has(input:checked) { border-color: var(--orange); background: #ff670012; }

/* ---------- Toasty ---------- */
.toasts { position: fixed; left: 24px; bottom: 24px; z-index: 90; display: grid; gap: 8px; justify-items: start; pointer-events: none; max-width: calc(100vw - 48px); }
.toast { display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: var(--paper); color: var(--ink); font-weight: 600; font-size: 14px; pointer-events: auto; box-shadow: 0 18px 40px -16px #000; animation: toast .35s var(--spring) both; }
.toast.out { animation: toastout .25s var(--ease) forwards; }
@keyframes toast { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toastout { to { opacity: 0; transform: translateY(8px); } }
.toast button { border: 0; background: none; padding: 0; font-weight: 700; color: #c24d00; text-decoration: underline; text-underline-offset: 3px; }
.toast.err { background: var(--danger); color: #1a0500; }

/* ---------- Responzivita ---------- */
@media (max-width: 1180px) {
  .app { grid-template-columns: 220px 1fr; grid-template-areas: 'top top' 'side list'; }
  .topbar::after { width: 220px; }
  .reader { grid-area: list; position: relative; z-index: 3; background: var(--ink); }
  .app:not(.reading) .reader { display: none; }
  .back-btn { display: inline-grid !important; }
  .me-text { display: none; }
}
@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 56px 1fr; grid-template-areas: 'top' 'list'; }
  .topbar { gap: 6px; padding: 0 6px 0 4px; }
  .topbar::after { display: none; }
  .menu-btn { display: inline-grid; }
  .logo { font-size: 21px; }
  .topbar .logo small, .search kbd, #refresh-btn, #settings-btn { display: none; }
  .search { margin-left: 4px; height: 38px; }
  .me { margin-left: 2px; padding: 2px; }
  .sidebar { position: fixed; z-index: 45; top: 0; bottom: 0; left: 0; width: min(290px, 84vw); background: var(--ink); transform: translateX(-100%); transition: transform .3s var(--ease); }
  .app.nav-open .sidebar { transform: none; box-shadow: 30px 0 80px #000; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 44; background: #000a; backdrop-filter: blur(2px); }
  .shortcuts { display: none; }
  .list-head h1 { font-size: 26px; }
  .reader-msg { padding: 0 14px 48px; }
  .meta { flex-wrap: wrap; }
  .meta time { width: 100%; padding-left: 58px; }
  .compose, .compose.max { inset: 0; width: auto; height: auto; border: 0; }
  .compose .max-btn, .compose .min-btn { display: none; }
  .frame { margin: 0; }
  .editor { padding: 22px 18px 12px; }
  .frame .f-head, .frame .f-foot { padding-left: 18px; padding-right: 18px; }
  .frame .f-sign { margin-left: 18px; }
  .c-foot .hint, .c-foot .opt-label { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-brand { gap: 28px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-brand > .eyebrow:last-child { display: none; }
  .login-hero h1 { font-size: clamp(46px, 14vw, 66px); }
  .login-lede { font-size: 16px; }
  .keys { grid-template-columns: 1fr; }
  .modal-wrap { padding: 0; }
  .modal, .modal.wide { width: 100%; height: 100%; max-height: none; }
  [data-tip]:hover::before { display: none; }
  .toasts { left: 12px; right: 12px; bottom: 12px; justify-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
