:root {
  --ink: #1d2430; --muted: #6b7380; --line: #dde1e7; --bg: #f5f6f8; --card: #fff;
  --accent: #1f5f99; --ok: #1d7a46; --warn: #a15c00; --err: #b3261e; --live: #c4161c;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
h3 { font-size: 14px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
h2.day { margin-top: 22px; }
code { background: #eef0f3; padding: 0 3px; border-radius: 3px; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.warn { color: var(--warn); }
.err { color: var(--err); }

.top { display: flex; align-items: center; gap: 24px; background: #17202c; color: #fff; padding: 0 20px; height: 48px; }
.brand { font-weight: 700; letter-spacing: .06em; }
.brand span { font-weight: 400; opacity: .7; }
.brand.big { font-size: 22px; margin-bottom: 16px; color: var(--ink); }
.tabs { display: flex; gap: 2px; height: 100%; }
.tabs a { color: #c9d2de; padding: 0 14px; display: flex; align-items: center; border-bottom: 3px solid transparent; }
.tabs a.on { color: #fff; border-bottom-color: #5fa8e8; }
.tabs a:hover { text-decoration: none; color: #fff; }
.logout { margin-left: auto; }
.logout .link { color: #c9d2de; }

.statusbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 8px 20px; background: #fff; border-bottom: 1px solid var(--line); font-size: 13px; }
.statusbar .clock { font-variant-numeric: tabular-nums; font-weight: 600; }
.right { margin-left: auto; }
.pill { padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.pill.live { background: var(--live); color: #fff; }
.pill.safe { background: #e5f3eb; color: var(--ok); }
.pill.paused { background: #fde7c6; color: #7a4100; }
.pill.warn { background: #fff4d6; color: #7a5600; }
.pill.overdue { background: #fde7c6; color: #7a4100; }
.pill.failed { background: #fbe1df; color: var(--err); }

main { padding: 18px 20px 60px; max-width: 1500px; }
.flash { padding: 8px 12px; border-radius: 6px; margin-bottom: 10px; background: #e5f3eb; color: #134d2c; }
.flash.warn { background: #fff4d6; color: #6b4a00; }
.flash.error { background: #fbe1df; color: #7d1a14; }

.bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.bar h1 { margin: 0; }
.actions { display: flex; gap: 8px; margin-left: auto; }
.filters { display: flex; gap: 6px; }
.inline { display: inline; }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.card.empty { text-align: center; padding: 40px; }
.live-card { border-color: #f0b4b6; }
.danger-zone { border-style: dashed; }

.form label { display: block; margin-bottom: 10px; font-weight: 600; font-size: 12px; color: #39414d; }
.form label.chk, label.chk { display: inline-flex; gap: 5px; align-items: center; font-weight: 400; font-size: 13px; margin-right: 10px; }
input, select, textarea { font: inherit; border: 1px solid #c8ced6; border-radius: 5px; padding: 5px 7px; background: #fff; }
.form input:not([type=checkbox]):not([type=radio]):not([type=file]), .form select, .form textarea { display: block; width: 100%; margin-top: 3px; font-weight: 400; }
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; width: 100%; }
input.narrow, .form input.narrow { width: 70px; display: inline-block; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > label, .row > fieldset { flex: 1 1 200px; }
.row .grow { flex: 3; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 10px; padding: 6px 10px; }
legend { font-size: 12px; font-weight: 600; color: #39414d; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }
.addr { display: flex; align-items: center; gap: 2px; }
.addr span { color: var(--muted); white-space: nowrap; }
.form .addr input { margin-top: 0 !important; }
.rowform { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rowform .count { width: 30px; text-align: right; color: var(--muted); }
input.placeholder { color: var(--warn); }

.btn { display: inline-block; font: inherit; font-weight: 600; border: 1px solid #b9c1cc; background: #fff; color: var(--ink); padding: 6px 12px; border-radius: 5px; cursor: pointer; }
.btn:hover { background: #f0f3f6; text-decoration: none; }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: var(--live); border-color: var(--live); color: #fff; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.link { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0 4px; }

table.list { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
table.list th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.list td { padding: 6px 8px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
tr.st-sent td, tr.st-cancelled td { color: var(--muted); }
tr.st-cancelled td a { color: var(--muted); text-decoration: line-through; }
.bulkbar { display: flex; gap: 8px; align-items: center; position: sticky; top: 0; background: var(--bg); padding: 6px 0; z-index: 2; }
.bulkbar .sep { width: 12px; }

.status { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 1px 7px; border-radius: 9px; background: #eceff3; color: #4b5563; }
.status.scheduled, .status.active { background: #e3eefa; color: #1f5f99; }
.status.sending, .status.pending { background: #efe6fb; color: #5b2a9c; }
.status.sent, .status.done, .status.dry { background: #e5f3eb; color: var(--ok); }
.status.partial, .status.overdue, .status.paused { background: #fde7c6; color: #7a4100; }
.status.failed { background: #fbe1df; color: var(--err); }
.status.cancelled { background: #f1f1f1; color: #888; }

details { border-top: 1px solid var(--line); padding: 8px 0; }
summary { cursor: pointer; font-weight: 600; }
dl.hdrs { display: grid; grid-template-columns: 80px 1fr; gap: 2px 8px; font-size: 12px; margin: 8px 0; }
dl.hdrs dt { color: var(--muted); }
dl.hdrs dd { margin: 0; word-break: break-word; }
iframe.mail { width: 100%; height: 340px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
iframe.mail.tall { height: 600px; }
ul.atts { padding-left: 18px; margin: 0 0 8px; }
.old { color: var(--err); }
.new { color: var(--ok); }
pre.domain { white-space: pre-wrap; background: #f3f4f6; padding: 8px; border-radius: 5px; overflow-x: auto; }

body.login { display: grid; place-items: center; min-height: 100vh; }
.loginbox { width: 320px; }
.loginbox label { display: block; margin-bottom: 12px; font-size: 12px; font-weight: 600; }
.loginbox input { display: block; width: 100%; margin-top: 4px; }
.loginbox .btn { width: 100%; }

.badge { background: #e8590c; color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.seg a { padding: 5px 12px; color: var(--ink); border-right: 1px solid var(--line); }
.seg a:last-child { border-right: none; }
.seg a.on { background: #17202c; color: #fff; }
.scroll { overflow-x: auto; }
table.matrix td.cell { text-align: center; font-size: 12px; min-width: 110px; }
table.matrix td.cell a { display: block; color: inherit; }
td.cell.replied { background: #e5f3eb; }
td.cell.late { background: #fff4d6; }
td.cell.missing { background: #fbe1df; }
td.cell.waiting { background: #eef4fb; }
tr.in-new td { font-weight: 600; }
tr.in-ignored td { color: var(--muted); }
pre.mailtext { white-space: pre-wrap; font: 14px/1.5 system-ui, sans-serif; margin: 10px 0; }
.replyblock { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.crit { display: flex; margin-bottom: 6px; }
.crit .wide { flex: 1; min-width: 200px; }
.scale { display: flex; gap: 4px; margin-top: 4px; }
