/* Poctletter – barvy vycházejí z vizuálu kampaní Poctailor (tmavě modrá + červený akcent). */
:root {
  --navy: #0C2340;
  --navy-2: #163A64;
  --ink: #1A2536;
  --muted: #5E7188;
  --line: #DDE4EE;
  --paper: #F4F6FA;
  --white: #FFFFFF;
  --accent: #D1371F;
  --accent-hover: #B52E19;
  --ok: #1F8A5B;
  --info: #1E4D82;
  --warn: #A86F0E;
  --err: #B8321F;
  --radius: 6px;
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); }
a { color: var(--info); }
a:hover { color: var(--navy); }
:focus-visible { outline: 3px solid #7FA7D9; outline-offset: 2px; }
h1, h2 { line-height: 1.2; margin: 0; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.3px; }
h2 { font-size: 18px; font-weight: 700; margin: 28px 0 10px; }
code { font-size: 13px; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* layout */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--navy) 220px, var(--paper) 220px); }
.side { background: var(--navy); color: #fff; padding: 22px 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 21px; letter-spacing: -0.4px; color: #fff; text-decoration: none; padding: 0 22px 22px; display: block; }
.side ul { list-style: none; margin: 0; padding: 0; flex: 1; }
.side li a, .side li.soon { display: block; padding: 9px 22px; color: rgba(255,255,255,.78); text-decoration: none; border-left: 3px solid transparent; }
.side li a:hover { color: #fff; background: rgba(255,255,255,.06); }
.side li a[aria-current="page"] { color: #fff; border-left-color: var(--accent); background: rgba(255,255,255,.08); font-weight: 500; }
.side li.soon { color: rgba(255,255,255,.38); }
.side li.soon small { font-size: 11px; margin-left: 4px; }
.side li.sep { margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.12); }
.me { padding: 16px 22px 0; border-top: 1px solid rgba(255,255,255,.12); font-size: 13px; color: rgba(255,255,255,.7); display: flex; flex-direction: column; gap: 4px; }
.me .link { color: #fff; align-self: flex-start; }
.main { padding: 32px 40px 64px; max-width: 1180px; width: 100%; }
.head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.head h1 { margin-right: auto; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.count { color: var(--muted); font-weight: 400; font-size: 20px; margin-left: 4px; }
.lead { max-width: 68ch; color: var(--muted); margin: 0 0 18px; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 500; font-size: 14px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--white); color: var(--ink); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: #B9C6D6; color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-danger { color: var(--err); border-color: #E7C2BB; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--info); cursor: pointer; text-decoration: underline; }

/* messages */
.messages { margin-bottom: 16px; }
.msg { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--white); margin: 0 0 8px; }
.msg ul { margin: 6px 0; padding-left: 20px; }
.msg-success { border-left: 4px solid var(--ok); }
.msg-info { border-left: 4px solid var(--info); }
.msg-warning { border-left: 4px solid var(--warn); background: #FFF8EA; }
.msg-error { border-left: 4px solid var(--err); background: #FDF1EE; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #FAFBFD; }
td { padding: 9px 12px; border-bottom: 1px solid #EDF1F6; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FAFBFD; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.chk { width: 36px; }
.empty { text-align: center; color: var(--muted); padding: 36px 12px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; margin: 1px 4px 1px 0; border-radius: 10px; background: #E8EEF6; color: var(--navy-2); white-space: nowrap; }
.change { display: inline-block; font-size: 12px; margin-right: 8px; color: var(--muted); }
.status { font-size: 13px; white-space: nowrap; }
.status::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--ok); }
.status-unsubscribed::before { background: #8A99AB; }
.status-bounced::before { background: var(--warn); }
.status-complained::before { background: var(--err); }
.row-error td:first-child { box-shadow: inset 3px 0 0 var(--err); }
.row-blocked td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* filters & bulk */
.filters, .inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { flex: 1 1 280px; }
.bulkbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 12px; background: #E8EEF6; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; font-size: 14px; }
.bulkbar + .table-wrap { border-radius: 0 0 var(--radius) var(--radius); }
#selcount { margin-right: auto; color: var(--navy-2); }
.pager { display: flex; gap: 16px; align-items: center; justify-content: center; margin: 16px 0; font-size: 14px; }

/* forms */
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=datetime-local], input[type=file], select, textarea {
  font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid #C9D3DF; border-radius: var(--radius); background: var(--white); color: var(--ink); max-width: 100%;
}
input:focus, select:focus { border-color: var(--info); }
input:disabled, select:disabled { background: var(--paper); color: var(--muted); }
.form { max-width: 720px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.field { margin-bottom: 16px; }
fieldset.plain { border: 0; padding: 0; margin: 0; }
fieldset.plain legend { font-weight: 500; font-size: 14px; margin-bottom: 4px; }
.has-error input, .has-error select { border-color: var(--err); }
.form label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 4px; }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=date], .form select { width: 100%; }
fieldset { border: 0; border-top: 1px solid var(--line); padding: 16px 0 0; margin: 0 0 8px; }
fieldset:first-of-type { border-top: 0; padding-top: 0; }
legend { font-weight: 700; font-size: 15px; padding: 0 8px 0 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row2 > .field { margin-bottom: 16px; }
.helptext { font-size: 13px; color: var(--muted); margin-top: 4px; max-width: 64ch; }
.errorlist { list-style: none; padding: 0; margin: 4px 0; color: var(--err); font-size: 13px; }
.field-error { color: var(--err); font-size: 13px; width: 100%; margin: 0; }
.checks > div, .form .field div:has(> div > label > input[type=checkbox]), .form ul:not(.errorlist) { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 4px 0; }
.form ul:not(.errorlist) label, .checks label { font-weight: 400; display: inline-flex; gap: 6px; align-items: center; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 6px; }
.danger { max-width: 720px; margin-top: 28px; }
.danger form { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.danger .muted { font-size: 13px; flex: 1 1 300px; }

/* import */
.template-note { display: flex; gap: 24px; justify-content: space-between; align-items: center; background: var(--navy); color: #fff; border-radius: var(--radius); padding: 20px 24px; margin-bottom: 20px; max-width: 900px; }
.template-note h2 { margin: 0 0 6px; color: #fff; }
.template-note p { margin: 0 0 8px; color: rgba(255,255,255,.78); max-width: 60ch; }
.template-note .cols { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.template-note code { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
.confirm { display: flex; gap: 10px; align-items: center; margin: 4px 0 8px; }

/* Výsledek importu: jeden pruh, jehož šířky odpovídají počtům řádků. */
.outcome { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.outcome .bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; margin-bottom: 14px; }
.seg { display: block; min-width: 6px; }
.seg-create { background: var(--ok); }
.seg-update { background: var(--info); }
.seg-skip { background: #B7C3D1; }
.seg-blocked { background: #D59A2A; }
.seg-errors { background: var(--err); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 0; }
.legend div { display: flex; flex-direction: column; }
.legend dt { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.legend dd { margin: 0; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--navy); padding: 20px; }
.login-card { background: var(--white); border-radius: 10px; padding: 32px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 6px; }
.login-card .brand { color: var(--navy); padding: 0; font-size: 26px; }
.login-card p.muted { margin: 0 0 14px; }
.login-card label { font-weight: 500; font-size: 14px; margin-top: 8px; }
.login-card .btn { margin-top: 16px; justify-content: center; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: var(--paper); }
  .side li.soon { display: none; }
  .side { position: static; height: auto; padding: 14px 0; }
  .side ul { display: flex; flex-wrap: wrap; }
  .side li a, .side li.soon { padding: 6px 14px; border-left: 0; border-bottom: 2px solid transparent; }
  .side li a[aria-current="page"] { border-bottom-color: var(--accent); }
  .side li.sep { margin: 0; padding: 0; border: 0; }
  .me { flex-direction: row; justify-content: space-between; padding-top: 10px; margin-top: 8px; }
  .main { padding: 20px 16px 48px; }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .template-note { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- kampaně ---------- */
.small { font-size: 12px; }
form.inline { display: inline; margin-left: 12px; }
textarea { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid #C9D3DF; border-radius: var(--radius); width: 100%; }
textarea.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.45; white-space: pre; tab-size: 2; }

/* Průvodce: skutečná posloupnost kroků, proto čísla. */
.wizard { list-style: none; display: flex; flex-wrap: wrap; gap: 0; padding: 0; margin: 0 0 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); overflow: hidden; }
.wizard li { flex: 1 1 0; min-width: 120px; }
.wizard li + li { border-left: 1px solid var(--line); }
.wizard a, .wizard span { display: flex; gap: 8px; align-items: center; padding: 11px 14px; font-size: 14px; color: var(--muted); text-decoration: none; }
.wizard a:hover { background: #FAFBFD; color: var(--ink); }
.wizard b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid #C9D3DF; font-size: 12px; font-weight: 500; flex: none; }
.wizard .is-done b { background: var(--ok); border-color: var(--ok); color: #fff; }
.wizard .is-current span { color: var(--ink); font-weight: 500; box-shadow: inset 0 -3px 0 var(--accent); }
.wizard .is-current b { border-color: var(--navy); background: var(--navy); color: #fff; }

.sender { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--paper); border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.content-grid .form { max-width: none; }
.checks-list { margin: 20px 0; }
.checks-list ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.check { padding: 9px 12px 9px 14px; border-radius: var(--radius); background: var(--white); border: 1px solid var(--line); border-left-width: 4px; font-size: 14px; }
.check-error { border-left-color: var(--err); background: #FDF1EE; }
.check-warning { border-left-color: #D59A2A; background: #FFF8EA; }
.check-info { border-left-color: var(--info); }
.images { margin-top: 8px; }
.image-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.image-list li { display: flex; gap: 10px; align-items: center; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; }
.image-list img { width: 56px; height: 40px; object-fit: cover; border-radius: 4px; background: var(--paper); }
.image-list div { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.image-list input { width: 100%; font-size: 12px; padding: 4px 6px; }

/* Náhled: e-mail se ukazuje „na stole“ – tmavé pozadí jako u poštovního programu. */
.preview { position: sticky; top: 16px; }
.preview-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 14px; }
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.toggle button { font: inherit; font-size: 13px; padding: 6px 14px; border: 0; background: none; cursor: pointer; color: var(--muted); }
.toggle button + button { border-left: 1px solid var(--line); }
.toggle button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.device { background: #DCE3EC; border-radius: var(--radius); padding: 16px; display: flex; justify-content: center; overflow: hidden; }
.frame-box { position: relative; overflow: hidden; border-radius: 4px; box-shadow: 0 1px 3px rgba(12,35,64,.18); background: #fff; }
.device iframe { position: absolute; top: 0; left: 0; width: 700px; max-width: none; height: 900px; border: 0; background: #fff; transform-origin: 0 0; }
.empty-preview { background: #DCE3EC; border-radius: var(--radius); padding: 60px 24px; text-align: center; color: var(--muted); margin: 0; }

.recipient-count { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.recipient-count .big { font-size: 40px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0 0 18px; max-width: 900px; }
.summary div { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.summary dt { font-size: 13px; color: var(--muted); }
.summary dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.form-q { margin-top: 0; }
.later { max-width: 680px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.later h2 { margin-top: 0; }

@media (max-width: 1100px) {
  .content-grid { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; }
}

/* ---------- odesílání a statistiky ---------- */
.err { color: var(--err); }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.send-summary { font-size: 16px; margin: 0 0 16px; }
.progress { height: 12px; background: #E8EEF6; border-radius: 6px; overflow: hidden; margin: 12px 0; }
.progress span { display: block; height: 100%; background: var(--ok); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 10px; }
.kpis div { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.kpis dt { font-size: 13px; color: var(--muted); }
.kpis dd { margin: 2px 0; font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
/* Prokliky jsou nejspolehlivější metrika – proto jediný zvýrazněný údaj. */
.kpis .kpi-main { background: var(--navy); border-color: var(--navy); color: #fff; }
.kpis .kpi-main dt, .kpis .kpi-main .muted { color: rgba(255,255,255,.7); }
.timeline { display: flex; align-items: flex-end; gap: 2px; height: 140px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.tl-col { flex: 1; height: 100%; display: flex; align-items: flex-end; gap: 1px; }
.tl-col span { flex: 1; min-height: 0; border-radius: 2px 2px 0 0; }
.tl-open { background: #9DB4D3; }
.tl-click { background: var(--navy); }
.tl-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding: 4px 10px 0; }
.legend-inline { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.legend-inline .dot { margin-left: 8px; }
td.url { max-width: 520px; overflow-wrap: anywhere; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); font-size: 14px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a span { color: var(--ink); font-variant-numeric: tabular-nums; margin-left: 4px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
@media (max-width: 1100px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
