:root {
  --bg: #fff;
  --fg: #1d1d1d;
  --muted: #666;
  --accent: #1d6fa5;
  --border: #e5e5e5;
  --max-width: 50rem;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

/* Header layout: site name vlevo, auth UI vpravo */
.site-header {
  background: var(--accent);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.site-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #fff;
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.2;
}
.site-brand:hover { text-decoration: none; opacity: 0.92; }
.site-logo {
  display: block;
  height: 2.5rem;
  width: 2.5rem;
  /* SVG/PNG už má vlastní kruhový tvar (bílý kruh + obvod). Žádný extra
     border-radius/background by ho jen zdeformoval. */
}
.site-name {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

/* Auth UI v hlavičce.
   Layout: [user-name] | [Spravovat] [Odhlásit]
   user-name je plain text, Spravovat/Odhlásit jsou jednotně-stylované pill buttony.
   Mezi user-name a buttony je vertikální oddělovač. */
.site-auth {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}
.site-auth .user-name {
  color: rgba(255, 255, 255, 0.92);
  padding-right: 0.75rem;
  border-right: 1px solid rgba(255, 255, 255, 0.3);
  text-decoration: none;
}
.site-auth a.user-name:hover { color: #fff; text-decoration: underline; }
.auth-link {
  color: #fff;
  text-decoration: none;
  opacity: 0.92;
}
.auth-link:hover {
  opacity: 1;
  text-decoration: underline;
}
/* Společný styl pro Spravovat (link) i Odhlásit (button form) — vizuálně identické. */
.auth-admin,
.auth-button {
  display: inline-block;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  padding: 0.3rem 0.75rem;
  border-radius: 3px;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
}
.auth-admin:hover,
.auth-button:hover {
  background: rgba(255, 255, 255, 0.15);
  text-decoration: none;
}
.auth-form {
  margin: 0;
  display: inline;
}

.site-main {
  max-width: var(--max-width);
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  padding: 2rem 1rem;
}
a { color: var(--accent); }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; }
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
blockquote {
  border-left: 3px solid var(--border);
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  color: var(--muted);
}
code {
  background: #f4f4f4;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.95em;
}
/* Card grid pro výpis článků (home page) */
.article-grid {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.article-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}
.article-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}
.article-card-link:hover { text-decoration: none; }
.article-card .cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #f0f0f0;
}
.article-card .no-cover {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #e8eef5, #d4dde8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 2.5rem;
}
.article-card .card-meta {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.article-card time {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.article-card .card-title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
  color: var(--accent);
}
.article-card .card-excerpt {
  color: var(--fg);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0;
  flex: 1;
}
.article-header time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  margin: 2rem 0;
}
.gallery a { display: block; }
.gallery figure.gallery-thumb { margin: 0; display: block; }
.gallery img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  border-radius: 4px;
  background: #f0f0f0;
}
.article-body img { max-width: 100%; height: auto; }

/* PDF příloha s preview obrázkem v textu článku. Markdown link
   `[alt](pozvanka.pdf)` MarkdownRenderer vyrenderuje jako klikatelný
   thumbnail, pokud vedle PDF leží sourozenec pozvanka.{jpg|png|webp}. */
.pdf-preview-link {
  display: inline-block;
  margin: 0.5rem 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
}
.pdf-preview-link:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}
.pdf-preview {
  display: block;
  max-width: 280px;
  height: auto;
}

.back { margin-top: 2rem; }
.empty { color: var(--muted); }

/* Admin sekce.
   inline-flex (ne inline-block), aby šly dovnitř buttonu vložit ikonky a
   text + SVG byly perfektně vertikálně vystředěné. Pro varianty bez ikonky
   se chová identicky jako inline-block. */
.btn-primary, .btn-danger, .btn-cancel, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  border: none;
}
/* Inline SVG ikonky uvnitř buttonů. fill:none + stroke:currentColor =
   ikona zdědí barvu textu buttonu (modrá u secondary, červená u danger). */
.btn-primary .icon,
.btn-secondary .icon,
.btn-danger .icon,
.btn-cancel .icon {
  width: 0.95em;
  height: 0.95em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.9; text-decoration: none; }
.btn-secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
  margin-right: 0.25rem;
}
.btn-secondary:hover { background: var(--accent); color: #fff; text-decoration: none; }
.btn-danger {
  background: #fff;
  color: #c33;
  border: 1px solid #c33;
}
.btn-danger:hover { background: #c33; color: #fff; }
.btn-cancel {
  background: #f0f0f0;
  color: #333;
  border: 1px solid var(--border);
}
.btn-cancel:hover { background: #e8e8e8; text-decoration: none; }

/* Existující fotky v edit form */
.existing-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Admin-form PDF sekce. */
.pdf-field {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}
.pdf-field legend.field-label {
  padding: 0 0.4rem;
}

/* Admin-form routes-kalkulačky sekce. */
.routes-field {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}
.routes-field legend.field-label { padding: 0 0.4rem; }
.routes-checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.3rem 0.8rem;
  margin-top: 0.4rem;
}
.route-check {
  display: flex; gap: 0.45rem; align-items: center;
  padding: 0.25rem 0.4rem;
  border-radius: 3px;
}
.route-check:hover { background: #f6f8fb; }
.route-check input[type=checkbox] { margin: 0; }
.existing-pdf {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: #f8f9fa;
  border-radius: 4px;
}
.existing-pdf .pdf-preview {
  max-width: 120px;
  max-height: 160px;
  height: auto;
  display: block;
}
.existing-pdf-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.existing-pdf:has(input[type="checkbox"]:checked) {
  background: #fee;
  outline: 1px solid #c33;
}
.photo-item {
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}
.photo-item.is-cover { border-color: var(--accent); border-width: 2px; }
.photo-item:has(input[type="checkbox"]:checked) {
  background: #fee;
  border-color: #c33;
}
.photo-item img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 3px;
  background: #f0f0f0;
}
.photo-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  gap: 0.3rem;
}
.cover-radio,
.delete-check {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  cursor: pointer;
}
.cover-radio input[type="radio"] { display: none; }
.cover-radio span {
  font-size: 1.3rem;
  color: #ccc;
  line-height: 1;
}
.cover-radio input[type="radio"]:checked + span,
.photo-item.is-cover .cover-radio span { color: gold; }
.cover-radio:hover span { color: #ddd; }

.delete-check { color: var(--muted); }
.delete-check:hover { color: #c33; }
.photo-name {
  color: var(--muted);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  flex: 1;
  text-align: center;
}

.admin-list {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}
.admin-list th,
.admin-list td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.admin-list th { background: #fafafa; font-weight: 600; }
.admin-list time { font-variant-numeric: tabular-nums; color: var(--muted); }
.admin-list .slug-info { font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }
/* Akce: tlačítka vedle sebe vpravo, gap mezi nimi.
   Padding je v admin-list menší než u "samostatných" buttonů na stránce, aby se vešly
   do úzkého sloupce a vizuálně neutekly nad text řádku. */
.admin-list .actions {
  text-align: right;
  white-space: nowrap;
}
.admin-list .actions .btn-secondary,
.admin-list .actions .btn-danger {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}
.admin-list .actions .btn-danger { margin-left: 0.25rem; }
.admin-list form { display: inline; margin: 0; }

.alert {
  background: #fee;
  border-left: 3px solid #c33;
  color: #800;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin: 1rem 0;
}

/* ==========================================================================
   Mail (read-only INBOX MVP)
   --------------------------------------------------------------------------
   2-pane layout: vlevo seznam účtů, vpravo zprávy nebo detail. Šířku sidebaru
   držíme úzkou (16rem), na malých displejích se zalamuje pod sebe.
   ========================================================================== */
/* Mail UI vyžaduje víc horizontálního místa než zbytek webu (50rem max-width).
   Přes :has() override-ujeme kontejner jen na mail stránkách — bez nutnosti
   přidávat třídu do base.php. */
.site-main:has(.mail-app) { max-width: 80rem; }
.mail-app {
  display: grid;
  grid-template-columns: 16rem 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}
@media (max-width: 700px) {
  .mail-app { grid-template-columns: 1fr; }
}
.mail-sidebar {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fafafa;
  padding: 0.75rem;
  height: fit-content;
}
.mail-sidebar-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.mail-account-list { list-style: none; padding: 0; margin: 0; }
.mail-account-list > li { margin: 0 0 0.4rem; }
.mail-account-list .mail-account {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 4px;
  text-decoration: none;
  color: var(--fg);
  font-size: 0.95rem;
  line-height: 1.3;
  font-weight: 600;
}
.mail-account-list .mail-account:hover { background: rgba(0,0,0,0.04); text-decoration: none; }
.mail-account-list > li.is-selected > .mail-account {
  background: rgba(29, 111, 165, 0.12);
  color: var(--accent);
}

/* Folder tree pro vybraný účet. Indent přes CSS variable --depth (set inline style). */
.mail-folder-list {
  list-style: none;
  padding: 0;
  margin: 0.15rem 0 0.5rem;
  font-size: 0.9rem;
}
.mail-folder { margin: 0; }
.mail-folder > a,
.mail-folder > .mail-folder-label {
  display: block;
  padding: 0.32rem 0.6rem 0.32rem calc(0.85rem + var(--depth, 0) * 0.85rem);
  border-radius: 3px;
  text-decoration: none;
  color: var(--fg);
  line-height: 1.25;
}
.mail-folder > a:hover { background: rgba(0,0,0,0.04); text-decoration: none; }
.mail-folder > .mail-folder-label {
  color: var(--muted);
  cursor: default;
}
.mail-folder.is-current > a {
  background: var(--accent);
  color: #fff;
}
/* Special folder ikonky přes CSS pseudo-element. SVG inline jako data URI,
   stroke je currentColor — zděděné z parent <a>, takže bíle na modrém pozadí
   u .is-current a tmavě jinde. */
.mail-folder > a::before,
.mail-folder > .mail-folder-label::before {
  content: '';
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.4em;
  vertical-align: -0.15em;
  background-color: currentColor;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-size: contain;
          mask-size: contain;
  opacity: 0.85;
}
/* Inbox = inbox tray icon */
.mail-folder-inbox > a::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M2 9V3h12v6'/><path d='M2 9h3l1 2h4l1-2h3v4H2z'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M2 9V3h12v6'/><path d='M2 9h3l1 2h4l1-2h3v4H2z'/></svg>");
}
/* Sent = paper plane */
.mail-folder-sent > a::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M14 2L2 7l5 2 2 5z'/><path d='M14 2L7 9'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M14 2L2 7l5 2 2 5z'/><path d='M14 2L7 9'/></svg>");
}
/* Drafts = pencil */
.mail-folder-drafts > a::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M11 1.5L14.5 5L5 14.5H1.5V11L11 1.5Z'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M11 1.5L14.5 5L5 14.5H1.5V11L11 1.5Z'/></svg>");
}
/* Trash = bin */
.mail-folder-trash > a::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M2 4H14'/><path d='M12.5 4L12 14H4L3.5 4'/><path d='M6 4V2H10V4'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M2 4H14'/><path d='M12.5 4L12 14H4L3.5 4'/><path d='M6 4V2H10V4'/></svg>");
}
/* Junk = stop sign */
.mail-folder-junk > a::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='8' cy='8' r='6'/><path d='M5 8h6'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='8' cy='8' r='6'/><path d='M5 8h6'/></svg>");
}
/* Archive = box */
.mail-folder-archive > a::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M2 4h12v3H2z'/><path d='M3 7v6h10V7'/><path d='M6 10h4'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M2 4h12v3H2z'/><path d='M3 7v6h10V7'/><path d='M6 10h4'/></svg>");
}
/* User folder (default) = simple folder */
.mail-folder-user > a::before,
.mail-folder-all > a::before,
.mail-folder-important > a::before,
.mail-folder-flagged > a::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M2 4h4l2 2h6v7H2z'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M2 4h4l2 2h6v7H2z'/></svg>");
}

.mail-main { min-width: 0; }   /* min-width:0 dovolí grid child se zalomit */
.mail-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}
.mail-toolbar h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  color: var(--accent);
}
.mail-count { color: var(--muted); font-size: 0.85rem; }

.mail-message-list { list-style: none; padding: 0; margin: 0; }
.mail-message-list li {
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.mail-message-list a {
  display: grid;
  /* From užší (8rem fixní), subject "vyhrává" zbytek místa.
     min-width:0 v gridu a ellipsis v dětech zaručí, že se nic nepřekrývá. */
  grid-template-columns: 8rem 1fr 4.5rem;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.6rem 0.5rem;
  text-decoration: none;
  color: var(--fg);
  font-size: 0.92rem;
}
.mail-message-list a:hover { background: rgba(0,0,0,0.03); text-decoration: none; }
.mail-message-list .mail-from {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-message-list .mail-subject {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
}
.mail-message-list time {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.mail-message-list li.is-unseen .mail-from,
.mail-message-list li.is-unseen .mail-subject { font-weight: 600; }
@media (max-width: 700px) {
  .mail-message-list a {
    grid-template-columns: 1fr 4rem;
    grid-template-areas: "from time" "subj subj";
  }
  .mail-message-list .mail-from { grid-area: from; }
  .mail-message-list .mail-subject { grid-area: subj; }
  .mail-message-list time { grid-area: time; }
}

.mail-message {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 1.25rem;
}
.mail-message-header h1 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  line-height: 1.3;
}
.mail-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0;
}
.mail-meta dt { font-weight: 600; }
.mail-meta dd { margin: 0; color: var(--fg); }
.mail-message-body { margin-top: 1rem; }
.mail-message-body pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  background: none;
  padding: 0;
  border-radius: 0;
}

/* HTML body iframe (sandboxed). Pevná výška + interní scroll. Bez allow-scripts
   nemůžeme měřit content height a auto-resize, takže pevná dimenze je trade-off. */
.mail-body-frame {
  width: 100%;
  height: 70vh;
  min-height: 25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  margin-top: 1rem;
  display: block;
}
.mail-images-toggle {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.6rem 0.9rem;
  background: #fff7e6;
  border: 1px solid #d99e3a;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #8a5a00;
}
.mail-images-toggle .btn-secondary {
  margin-left: auto;
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}

.article-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.field-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.field-row .field { flex: 1; min-width: 12rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field-label { font-weight: 600; font-size: 0.9rem; }
.field input,
.field textarea {
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}
.field textarea { font-family: "SF Mono", Menlo, Consolas, monospace; resize: vertical; }
.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.field .hint { color: var(--muted); font-size: 0.85rem; }
.form-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

/* /me profile card. Generický blok — používá CSS proměnné z :root,
   takže každý theme to obarví podle své --accent. */
.profile-card {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  padding: 1.5rem;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 1rem 0 0.5rem;
}
.profile-avatar {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.profile-summary { min-width: 0; flex: 1; }
.profile-name { margin: 0 0 0.15rem; font-size: 1.4rem; word-break: break-word; }
.profile-email { margin: 0 0 0.6rem; color: var(--muted); word-break: break-all; font-size: 0.95rem; }

.profile-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.profile-tag {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.profile-tag-super { background: var(--accent); border-color: var(--accent); color: #fff; }

.profile-meta-line { margin: 0 0 1.5rem; color: var(--muted); font-size: 0.9rem; }

.profile-section { margin: 1.75rem 0; }
.profile-section h2 { margin-bottom: 0.4rem; font-size: 1.15rem; }
.profile-section p { margin: 0.5rem 0; }
.profile-form { margin-top: 0.75rem; }

/* User menu (avatar trigger + dropdown). Generický blok — používá CSS
   proměnné, takže se v každém tématu naplní svojí --accent / --border. */
.user-menu { position: relative; display: inline-block; }
.user-menu-trigger {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 50%;
  line-height: 0;
}
.user-menu-trigger:focus { outline: none; }
.user-menu-trigger:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.user-menu-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-sizing: border-box;
}
.user-menu-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 14rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  padding: 0.4rem 0;
  z-index: 100;
  font-size: 0.9rem;
  color: var(--fg);
}
.user-menu-dropdown[hidden] { display: none; }

.user-menu-header {
  padding: 0.5rem 1rem 0.4rem;
}
.user-menu-name {
  font-weight: 600;
  word-break: break-word;
}
.user-menu-email {
  color: var(--muted);
  font-size: 0.8rem;
  word-break: break-all;
}
.user-menu-dropdown hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0.3rem 0;
}
.user-menu-dropdown a,
.user-menu-dropdown button {
  display: block;
  width: 100%;
  padding: 0.45rem 1rem;
  color: var(--fg);
  text-decoration: none;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}
.user-menu-dropdown a:hover,
.user-menu-dropdown button:hover {
  background: rgba(0, 0, 0, 0.05);
  text-decoration: none;
}
.user-menu-dropdown form { margin: 0; padding: 0; }

/* /me page wrapper — když na stránce je .profile-card, daj .site-main
   karta-styl (bílý box s shadow), aby vypadala jako auth /me. */
.site-main:has(.profile-card) {
  max-width: 46rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Mail message toolbar — back link vlevo, akce (Přečtené/Archivovat/Smazat) vpravo. */
.mail-message-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}
.mail-message-toolbar .back {
  margin: 0;
  text-decoration: none;
  color: var(--accent);
  font-size: 0.95rem;
}
.mail-message-toolbar .back:hover { text-decoration: underline; }
.mail-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.mail-actions form { margin: 0; display: inline; }
.mail-actions .btn-secondary,
.mail-actions .btn-danger {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  line-height: 1.2;
}

/* Mail pagination — pod listem zpráv. */
.mail-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}
.mail-pagination .btn-secondary {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}
.mail-pagination .btn-secondary.is-disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}
.mail-page-status {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ==========================================================================
   Mail compose — formulář pro novou zprávu (/mail/compose).
   ========================================================================== */

/* "Napsat" tlačítko v sidebaru — výrazné, prominent action. */
.mail-compose-btn {
  display: block;
  text-align: center;
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.8rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.95rem;
}
.mail-compose-btn:hover { background: var(--accent-hover, var(--accent)); filter: brightness(1.08); text-decoration: none; }

.mail-compose-title { margin: 0 0 1rem; font-size: 1.5rem; font-weight: 700; }

.mail-compose-error {
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  background: #fff4f4;
  border: 1px solid #f0c2c2;
  border-radius: 4px;
  color: #8a1f1f;
}

.mail-compose-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-width: 50rem;
}
.mail-compose-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  align-items: center;
  gap: 0.6rem;
}
.mail-compose-row > span {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}
.mail-compose-row input[type="text"],
.mail-compose-row select {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: inherit;
  width: 100%;
  background: #fff;
}
.mail-compose-row input[type="text"]:focus,
.mail-compose-row select:focus,
.mail-compose-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 100, 200, 0.15);
}

.mail-compose-row-body { grid-template-columns: 1fr; }
.mail-compose-row textarea {
  width: 100%;
  min-height: 16rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  background: #fff;
}

/* Kopie / skrytá kopie — collapsible <details>. */
.mail-compose-cc-toggle {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.mail-compose-cc-toggle > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  padding-left: 6.1rem;   /* zarovnání s labels nahoře */
  user-select: none;
  list-style: revert;
}
.mail-compose-cc-toggle[open] > summary { margin-bottom: 0.2rem; }

.mail-compose-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.5rem;
  padding-left: 6.1rem;
}

/* Compose layout — tightit max-width pro lepší čtení. */
.site-main:has(.mail-app-compose) { max-width: 70rem; }

/* Visually hidden helper pro screen readery. */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Mail attachments — seznam příloh v message detail.
   ========================================================================== */
.mail-attachments {
  margin: 1rem 0 1.25rem;
  padding: 0.75rem 1rem;
  background: #f8f8f8;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.mail-attachments h2 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.mail-attachments ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.mail-attachments li { display: flex; }
.mail-attachments a {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  text-decoration: none;
  color: var(--fg);
  flex: 1;
}
.mail-attachments a:hover {
  background: rgba(0,0,0,0.04);
  text-decoration: none;
}
.mail-attach-name { font-weight: 500; color: var(--accent); }
.mail-attach-meta { font-size: 0.8rem; color: var(--muted); }
.mail-attach-icon {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.85em;
  opacity: 0.7;
  vertical-align: baseline;
}

/* Mail compose — file input pro přílohy. */
.mail-compose-row-files input[type="file"] {
  font-size: 0.9rem;
  font-family: inherit;
}

.mail-compose-row-forward-att .mail-compose-forward-att-label {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.95rem;
  color: var(--fg);
  cursor: pointer;
}
/* User menu — sekce "Přepnout na" v dropdownu (multi-tenant switcher). */
.user-menu-section-title {
  padding: 0.55rem 0.9rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.user-menu-dropdown a.user-menu-tenant-link {
  font-size: 0.95rem;
  color: var(--accent);
}

/* Externí link icon v user-menu (Související sekce). */
.user-menu-ext-icon {
  font-size: 0.85em;
  opacity: 0.6;
  margin-left: 0.2rem;
}

/* ==========================================================================
   Kalkulačka dopravy (/kalkulacka)
   ========================================================================== */

.tripcalc-form { max-width: 48rem; }
.tripcalc-section {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.tripcalc-section legend {
  padding: 0 0.5rem;
  font-weight: 600;
}
.tripcalc-section .field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.5rem 0;
}
.tripcalc-section .field input[type="number"],
.tripcalc-section .field input[type="text"],
.tripcalc-section .field select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  max-width: 24rem;
}
.tripcalc-section .hint { color: var(--muted); font-size: 0.85rem; }

.tripcalc-people {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}
.tripcalc-people th,
.tripcalc-people td {
  padding: 0.4rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tripcalc-people th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.tripcalc-people input[type="text"],
.tripcalc-people select {
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
}
.tripcalc-role-cell { width: 5rem; white-space: nowrap; }
.tripcalc-row-driver { background: rgba(0, 0, 0, 0.04); }

.tripcalc-rounding {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.tripcalc-rounding-row {
  display: flex;
  gap: 0.5rem;
}
.tripcalc-rounding-row select { flex: 1; }
@media (max-width: 540px) {
  .tripcalc-rounding { grid-template-columns: 1fr; }
}

.tripcalc-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  padding: 0.5rem 0;
}
.tripcalc-checkbox input[type="checkbox"] {
  margin-top: 0.2rem;
  transform: scale(1.2);
  cursor: pointer;
}
.tripcalc-checkbox small {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.85rem;
}
.tripcalc-fullpay {
  border-left: 3px solid var(--accent);
  background: rgba(0, 0, 0, 0.03);
  padding: 0.5rem 0.75rem;
  margin: 0.5rem 0;
}

/* Výsledková sekce — vizuálně oddělená barvou. */
.tripcalc-result {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  background: #fafbfc;
}
.tripcalc-result h2 { margin-top: 0; }
.tripcalc-result h3 { margin-top: 1.5rem; margin-bottom: 0.5rem; font-size: 1.05rem; }
.tripcalc-outcomes,
.tripcalc-summary {
  width: 100%;
  border-collapse: collapse;
}
.tripcalc-outcomes th,
.tripcalc-outcomes td,
.tripcalc-summary th,
.tripcalc-summary td {
  padding: 0.4rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.tripcalc-outcomes .num,
.tripcalc-summary .num { text-align: right; font-variant-numeric: tabular-nums; }
.tripcalc-summary th { font-weight: 400; }
.tripcalc-net th { font-weight: 600; border-top: 2px solid var(--border); }
.tripcalc-net td { border-top: 2px solid var(--border); }
.tripcalc-formula { margin-top: 1rem; }
.tripcalc-formula summary { cursor: pointer; }
