:root {
  --blue: #2d6cdf;
  --blue-dark: #1f56bd;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1c2330;
  --muted: #6b7484;
  --border: #e3e7ef;
  --ok: #1a8f4e;
  --warn: #c23b3b;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  padding-top: max(12px, env(safe-area-inset-top));
}
.brand { font-weight: 700; font-size: 18px; text-decoration: none; color: var(--text); }
.topbar nav { display: flex; align-items: center; gap: 16px; }
.topbar nav a { text-decoration: none; color: var(--muted); font-size: 15px; }
.topbar nav a:hover { color: var(--blue); }

.container { max-width: 820px; margin: 0 auto; padding: 18px; padding-bottom: 64px; }

h1 { font-size: 24px; margin: 12px 0; }
h2 { font-size: 18px; margin: 0 0 12px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin: 14px 0;
}
.card.narrow { max-width: 420px; margin: 40px auto; }
.card.tip { border-color: #cfe0ff; background: #eef4ff; }

label { display: block; margin: 12px 0; font-weight: 600; font-size: 14px; }
input, select, textarea {
  width: 100%; margin-top: 6px; padding: 11px 12px; font-size: 16px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  font-family: inherit; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 540px) { .grid2 { grid-template-columns: 1fr; } }

button, .btn {
  display: inline-block; cursor: pointer; font-size: 15px; font-weight: 600;
  padding: 11px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; color: var(--text); text-decoration: none; font-family: inherit;
}
button:hover, .btn:hover { background: #f0f3fa; }
.primary, button.primary {
  background: var(--blue); color: #fff; border-color: var(--blue);
}
.primary:hover, button.primary:hover { background: var(--blue-dark); }
.btn.small, button.small { padding: 7px 11px; font-size: 13px; }
.danger { color: var(--warn); border-color: #f0c9c9; }
.danger:hover { background: #fdeeee; }
.warning, .btn.warning { color: #9a5b00; border-color: #f0dcb8; background: #fff7e8; }
.link { background: none; border: none; color: var(--muted); padding: 0; font-size: 15px; }
.link:hover { color: var(--blue); background: none; }
.inline { display: inline; margin: 0; }

.row { display: flex; }
.row.between { justify-content: space-between; }
.row.center { align-items: center; }
.row.gap { gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.actions { margin: 14px 0; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center-text { text-align: center; }
code {
  background: #eef1f7; padding: 1px 6px; border-radius: 5px;
  font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.alert { padding: 11px 14px; border-radius: 10px; margin: 12px 0; font-size: 14px; }
.alert.error { background: #fdeeee; color: var(--warn); border: 1px solid #f0c9c9; }
.alert.ok { background: #eaf7ef; color: var(--ok); border: 1px solid #c2e6d0; }

.list { display: flex; flex-direction: column; gap: 10px; }
.listitem {
  display: flex; align-items: center; justify-content: space-between;
  text-decoration: none; color: inherit; margin: 0;
}
.listitem-title { font-weight: 600; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: #eef1f7; color: var(--muted);
}
.status-sending { background: #fff2d6; color: #9a5b00; }
.status-done, .status-sent { background: #eaf7ef; color: var(--ok); }
.status-failed { background: #fdeeee; color: var(--warn); }
.status-paused { background: #eceff5; color: var(--muted); }
.status-draft, .status-pending { background: #eef1f7; color: var(--muted); }
.status-skipped { background: #f3eefe; color: #6a4fbf; }
.status-scheduled { background: #e6f0ff; color: #1f56bd; }

.sep { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.schedule-box { border-color: #cfe0ff; background: #f3f8ff; }

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.stat {
  flex: 1 1 90px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; text-align: center; font-size: 13px; color: var(--muted);
}
.stat .num { display: block; font-size: 22px; font-weight: 700; color: var(--text); }
.stat.ok .num { color: var(--ok); }
.stat.warn .num { color: var(--warn); }

.sig-details { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.sig-details summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--blue); }
.sig-form { margin-top: 10px; }
.sig-preview {
  max-width: 240px; height: auto; border: 1px solid var(--border);
  border-radius: 8px; padding: 6px; background: #fff; display: block; margin: 6px 0;
}
.checkline { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.checkline input { width: auto; margin: 0; }
.sig-rendered {
  border: 1px solid var(--border); border-radius: 8px; padding: 14px;
  background: #fff; margin: 6px 0 12px; overflow-x: auto;
}

.preview {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  background: #fff; margin-top: 8px; overflow-wrap: break-word;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }

.sitefoot {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 20px; border-top: 1px solid var(--border);
}
