/* RelayHelper demo — темна тема в стилі основного застосунку */
:root {
  --bg: #101318; --panel: #171c24; --panel2: #1d232e; --line: #2a3140;
  --ink: #e7eaf0; --muted: #8f98a8; --dim: #6b7383;
  --accent: #3d7bfd; --accent-h: #5a8ffd; --good: #2ea86b; --warn: #d9a13c;
  --danger: #e05252; --wave-bg: #0b0e13;
  --ph-a: #ffd600; --ph-b: #00c853; --ph-c: #ff1744; --ph-n: #2979ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent-h); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── шапка ── */
.nav {
  display: flex; align-items: center; gap: 22px;
  padding: 0 28px; height: 56px;
  background: #12161d; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; color: var(--ink); letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand .mark { color: var(--accent-h); }
.brand .demo {
  font-size: 11px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--line); border-radius: 20px;
  padding: 2px 9px; margin-left: 9px; vertical-align: 2px;
}
.nav .links { display: flex; gap: 4px; }
.nav .links a {
  color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 500;
}
.nav .links a:hover { color: var(--ink); background: var(--panel2); text-decoration: none; }
.nav .links a.on { color: var(--ink); background: var(--panel2); }
.nav .spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.plan {
  font-size: 10.5px; font-weight: 700; letter-spacing: .6px;
  padding: 2px 8px; border-radius: 20px; text-transform: uppercase;
  background: #23304a; color: #8fb2ff;
}
.plan.free { background: #262c38; color: var(--muted); }
.plan.lifetime { background: #2a3a2e; color: #7fd6a0; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 28px 60px; }
.page-head { display: flex; align-items: baseline; gap: 14px; margin: 6px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 14px; }
.page-head .grow { flex: 1; }

.flash {
  background: #17251c; border: 1px solid #2c4a36; color: #9ad8b0;
  padding: 10px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px;
}

/* ── кнопки і форми ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent); color: #fff; border: 0; border-radius: 9px;
  padding: 9px 16px; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent-h); text-decoration: none; }
.btn.ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: var(--panel2); }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.btn.danger { background: transparent; border: 1px solid #513037; color: #e08585; }
.btn.danger:hover { background: #2a1c20; }
input, select, textarea {
  background: var(--panel2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 11px; font: inherit; font-size: 14px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 1.5px solid var(--accent); border-color: var(--accent); }
textarea { min-height: 96px; resize: vertical; }
label.f { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.field { margin-bottom: 14px; }

/* ── фільтри ── */
.filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; margin-bottom: 18px;
}
.filters .wide { grid-column: span 2; }
.filters .actions { display: flex; gap: 8px; align-items: end; }

/* ── таблиця ── */
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.tbl th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--dim); padding: 11px 14px; border-bottom: 1px solid var(--line);
  background: #141922;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid #1e2430; vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #1a202b; }
.tbl .t { font-weight: 600; }
.tbl .m { color: var(--muted); font-size: 13px; }

/* ── чипи тегів ── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line); color: var(--muted);
  background: var(--panel2); border-radius: 20px; padding: 2px 10px;
  white-space: nowrap;
}
.chip.kv { color: #ffca7a; border-color: #4a3c26; background: #241e14; }
.chip.ansi { color: #8fb2ff; border-color: #2c3b5e; background: #161d2c; }
.chip.dmg { color: #ff9d9d; border-color: #4e2c31; background: #241619; }
.chip.obj { color: #93d7a9; border-color: #2d4636; background: #141f18; }

/* ── картки ── */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px 20px; margin-bottom: 16px;
}
.card h2 { font-size: 16px; margin: 0 0 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.kv-list { display: grid; grid-template-columns: 160px 1fr; gap: 7px 14px; font-size: 14px; }
.kv-list .k { color: var(--muted); }
.filelist { list-style: none; margin: 0; padding: 0; }
.filelist li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid #1e2430; font-size: 14px;
}
.filelist li:last-child { border-bottom: 0; }
.filelist .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.filelist .size { color: var(--dim); font-size: 12.5px; }
.badge-role {
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; background: #1c2c45; color: #7fa7f5;
}
.badge-role.additional { background: #262c38; color: var(--muted); }

/* ── статистика ── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.tile .n { font-size: 26px; font-weight: 700; letter-spacing: .3px; }
.tile .c { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ── осцилограми ── */
.scope { background: var(--wave-bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.lane { display: flex; border-bottom: 1px solid #161b23; }
.lane:last-child { border-bottom: 0; }
.lane .tag {
  width: 130px; flex: 0 0 130px; padding: 10px 12px;
  border-right: 1px solid #161b23; font-size: 12.5px;
}
.lane .tag .nm { font-weight: 700; }
.lane .tag .u { color: var(--dim); font-size: 11.5px; }
.lane svg { display: block; width: 100%; height: 90px; }
.digital-states { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
.dstate { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 6px;
  background: #161c26; color: var(--dim); border: 1px solid var(--line); }
.dstate.hot { background: #2b1a1e; color: #ff8f8f; border-color: #55333a; }

/* ── коментарі, історія ── */
.comment { padding: 10px 0; border-bottom: 1px solid #1e2430; font-size: 14px; }
.comment:last-child { border-bottom: 0; }
.comment .who { font-weight: 600; }
.comment .when { color: var(--dim); font-size: 12px; margin-left: 8px; }
.hist { font-size: 13px; color: var(--muted); }
.hist td { padding: 5px 10px 5px 0; border-bottom: 1px dashed #1e2430; }

/* ── вхід ── */
.login-hero {
  min-height: calc(100vh - 56px); display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(700px 340px at 75% 12%, rgba(61, 123, 253, .13), transparent 60%),
    radial-gradient(560px 300px at 18% 85%, rgba(255, 214, 0, .05), transparent 60%);
}
.login-card {
  width: 430px; max-width: calc(100vw - 40px);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 34px 34px 28px;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.role-btn {
  display: flex; align-items: center; gap: 13px; width: 100%;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 11px;
  padding: 13px 15px; margin-bottom: 10px; cursor: pointer; font: inherit;
  color: var(--ink); text-align: left;
}
.role-btn:hover { border-color: var(--accent); background: #1d2635; }
.role-btn .ava {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 38px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff;
}
.role-btn .who { font-weight: 600; }
.role-btn .what { color: var(--muted); font-size: 12.5px; }
.login-note { color: var(--dim); font-size: 12.5px; margin-top: 14px; line-height: 1.55; }

/* ── меню File у переглядачі ── */
.filebar {
  display: flex; align-items: center; gap: 2px;
  background: #141922; border: 1px solid var(--line); border-bottom: 0;
  border-radius: 12px 12px 0 0; padding: 4px 8px; font-size: 13.5px;
}
.filebar .fm { position: relative; }
.filebar .fm > button {
  background: none; border: 0; color: var(--ink); font: inherit;
  padding: 6px 12px; border-radius: 7px; cursor: pointer;
}
.filebar .fm > button:hover, .filebar .fm.open > button { background: var(--panel2); }
.filebar .dd {
  display: none; position: absolute; left: 0; top: 100%; z-index: 20; min-width: 250px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.filebar .fm.open .dd { display: block; }
.filebar .dd a, .filebar .dd button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  color: var(--ink); font: inherit; font-size: 13.5px;
  padding: 8px 11px; border-radius: 7px; cursor: pointer;
}
.filebar .dd a:hover, .filebar .dd button:hover { background: #263045; text-decoration: none; }
.filebar .dd .sep { border-top: 1px solid var(--line); margin: 5px 4px; }
.filebar .dd .dis { color: var(--dim); cursor: default; }
.filebar .dd .dis:hover { background: none; }
.filebar .crumbs { margin-left: auto; color: var(--dim); font-size: 12.5px; padding-right: 8px; }

/* ── різне ── */
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.right { text-align: right; }
.mt0 { margin-top: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pair-row { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 8px; margin-bottom: 8px; }
.iconbtn {
  background: none; border: 1px solid var(--line); color: var(--muted);
  border-radius: 7px; cursor: pointer; font-size: 14px; padding: 0 9px;
}
.iconbtn:hover { color: var(--danger); border-color: #513037; }
.help { color: var(--dim); font-size: 12.5px; margin-top: 5px; }
.empty {
  text-align: center; color: var(--muted); padding: 46px 20px;
  background: var(--panel); border: 1px dashed var(--line); border-radius: 12px;
}
.preview-tbl { font-size: 12.5px; }
.preview-tbl th { white-space: nowrap; }
.map-chip { font-size: 11px; color: #7fa7f5; display: block; margin-top: 3px; font-weight: 400; text-transform: none; letter-spacing: 0; }
