/* Формы → Таблицы. Токены */
:root {
  --bg: #FBFBF9;
  --ink: #1C1B1A;
  --muted: #6D6A64;
  --line: #E4E2DC;
  --accent: #E8590C;
  --accent-deep: #B23A00;
  --accent-soft: #FDEEE3;
  --ok: #2F7D4F;
  --err: #C4372B;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Golos Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.86em;
  background: var(--accent-soft);
  color: var(--accent-deep);
  padding: 1px 5px;
  border-radius: 4px;
  word-break: break-all;
}

/* Шапка */
.top { border-bottom: 2px solid var(--ink); background: var(--bg); }
.top-inner { display: flex; align-items: baseline; justify-content: space-between; padding-top: 18px; padding-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 26px; height: 12px; background: var(--accent); display: inline-block; border-radius: 2px; position: relative; }
.brand-mark::after { content: ""; position: absolute; right: -7px; top: 1px; border: 5px solid transparent; border-left-color: var(--accent); }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.chip { background: var(--accent-soft); color: var(--accent-deep); border-radius: 999px; padding: 1px 9px; font-weight: 500; }

/* Панель создания */
.panel { margin: 34px 0 44px; padding: 24px 26px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 14px; }
.hint { margin: 0 0 20px; color: var(--muted); font-size: 14px; max-width: 64ch; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 500; margin-bottom: 5px; font-size: 14px; }
.field .opt { color: var(--muted); font-weight: 400; }
.field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  background: var(--bg);
  color: var(--ink);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.two { display: flex; gap: 14px; }
.two .grow { flex: 1; }
.two .field:last-child { width: 220px; }

.actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
button { font: inherit; cursor: pointer; border-radius: var(--radius); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 18px;
  font-weight: 500;
}
.btn-primary:hover { background: var(--accent-deep); }
.btn-primary:disabled { background: var(--line); color: var(--muted); cursor: wait; }
.btn-ghost { background: none; border: 1px solid var(--line); padding: 10px 16px; color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-deep); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-msg { min-height: 1.4em; margin: 10px 0 0; font-size: 14px; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--err); }

/* Список связок */
.links-section { margin-bottom: 70px; }
.empty { color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px; }

.link { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 16px 20px 14px; margin-bottom: 14px; }
.link-head { display: flex; align-items: center; gap: 10px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.dot.paused { background: var(--muted); }
.dot.error { background: var(--err); }
.link-title { font-weight: 700; }
.link-total { margin-left: auto; color: var(--muted); font-size: 13px; }

.route { display: flex; align-items: center; gap: 10px; margin: 10px 0 8px; }
.route-end {
  color: var(--accent-deep);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46%;
}
.route-end:hover { border-bottom-color: var(--accent); }
.route-line { flex: 1; height: 2px; background: var(--accent); position: relative; min-width: 40px; }
.route-line::after { content: ""; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left-color: var(--accent); }

.link-status { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.link-status .error-text { color: var(--err); }

.link-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-small { background: none; border: 1px solid var(--line); padding: 5px 12px; font-size: 13px; color: var(--ink); }
.btn-small:hover { border-color: var(--accent); color: var(--accent-deep); }
.btn-danger:hover { border-color: var(--err); color: var(--err); }

@media (max-width: 640px) {
  .two { flex-direction: column; gap: 0; }
  .two .field:last-child { width: 100%; }
  .route-end { max-width: 40%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
