:root {
  --bg: #f5f6f8;
  --card: #fff;
  --text: #1d2330;
  --muted: #6b7385;
  --border: #e1e4ea;
  --accent: #6d4aff;
  --accent-hover: #5935f0;
  --grad: linear-gradient(120deg, #7c5cff, #22d3ee);
  --ok: #1f8a4c;
  --warn: #b7791f;
  --bad: #c53030;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { font-family: "Unbounded", system-ui, sans-serif; letter-spacing: -.02em; font-weight: 600; }
h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 8px; font: 700 18px "Unbounded", system-ui, sans-serif; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 24px; margin-bottom: 20px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.card.empty { text-align: center; padding: 40px; }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.heading h1 { margin: 0; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form .wide { grid-column: 1 / -1; }
@media (max-width: 640px) { .form.grid { grid-template-columns: 1fr; } }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.card.narrow.wide-form { max-width: 520px; }
.grid-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.grid-inner[hidden] { display: none; }
@media (max-width: 640px) { .grid-inner { grid-template-columns: 1fr; } }
fieldset.mode { border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px 14px; margin: 0; display: grid; gap: 10px; }
fieldset.mode legend { font-weight: 600; padding: 0 6px; }
label.radio { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
label.radio input { margin-top: 4px; }
.lead-text { max-width: 820px; margin: -4px 0 20px; }
.alert.warn-alert { background: #fdf3e1; border-color: #f3d9a4; color: #7a5212; }
.center { text-align: center; }
.big-icon { font-size: 48px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.prose { max-width: 820px; margin: 0 auto; }
.prose h2 { margin-top: 24px; }
.prose ul { padding-left: 20px; }
textarea { padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; font: inherit; width: 100%; resize: vertical; }
input[type=text], input[type=email], input[type=password], input[type=number], input:not([type]) {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; font: inherit; width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.hint { font-weight: 400; font-size: 13px; color: var(--muted); }

button, .button { display: inline-block; padding: 8px 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--text); font: inherit; cursor: pointer; }
button:hover, .button:hover { background: var(--bg); text-decoration: none; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-hover); }
.danger { color: var(--bad); border-color: var(--bad); }
button.small { padding: 4px 10px; font-size: 13px; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; }
form.inline { display: inline; }

.alert { background: #fdecec; border: 1px solid #f5c2c2; color: var(--bad); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.card .table-wrap { border: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 500; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.up { color: var(--bad); }
td.down { color: var(--ok); }
td.actions { text-align: right; }
table.bulletins th { white-space: normal; }
td.title-cell { min-width: 220px; }
.nowrap { white-space: nowrap; }

.badge, .status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--bg); color: var(--muted); }
.badge.ok, .status.ok { background: #e6f4ec; color: var(--ok); }
.badge.bad, .status.error, .status.no_subscription, .status.verification { background: #fdecec; color: var(--bad); }
.status.limit { background: #fdf3e1; color: var(--warn); }
.status.wrap { white-space: normal; border-radius: 8px; max-width: 240px; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.plan { margin-bottom: 0; }
.plan .price { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
button:disabled { opacity: .6; cursor: not-allowed; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .small-value { font-size: 15px; margin: 6px 0 2px; }

.steps-list { padding-left: 20px; display: grid; gap: 6px; margin: 12px 0 18px; }

/* окно входа FarPost */
.remote { display: grid; gap: 10px; }
.remote-msg { padding: 12px 14px; border-radius: 8px; background: var(--card); border: 1px solid var(--border); }
.remote-screen { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; touch-action: manipulation; background: #fff; }
.remote-input { display: flex; gap: 8px; }
.remote-input input { flex: 1; min-width: 0; }
.remote-keys { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.connect-alt summary { cursor: pointer; font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters input { flex: 1; min-width: 200px; width: auto; }
.pager { display: flex; gap: 16px; align-items: center; justify-content: center; }
