/* Плоский вид: без теней нигде (правило UI, docs/UI.md), действия — кнопками. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #dfe3e8;
  --text: #1f2328;
  --muted: #6b7280;
  --accent: #2f6feb;
  --accent-text: #ffffff;
  --ok-bg: #e6f4ea; --ok-text: #1e6b34;
  --warn-bg: #fff4e0; --warn-text: #8a5300;
  --bad-bg: #fde8e8; --bad-text: #9b1c1c;
  --idle-bg: #eef0f3; --idle-text: #4b5563;
  --danger: #c62828;
}
* { box-sizing: border-box; box-shadow: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.bar { display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.bar h1 { font-size: 18px; margin: 0; font-weight: 600; }
.spacer { flex: 1; }
.muted { color: var(--muted); }

button {
  font: inherit; padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
button:hover { border-color: #b8c0cc; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button:disabled { opacity: .6; cursor: default; }
button.icon { padding: 2px 8px; line-height: 1.2; }

.servers { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; padding: 16px 20px 0; }
.server { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.server h2 { font-size: 15px; margin: 0 0 2px; display: flex; gap: 8px; align-items: baseline; }
.server .host { color: var(--muted); font-weight: 400; font-size: 13px; }
.server .row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.server ul { list-style: none; margin: 8px 0 0; padding: 0; }
.server li { padding: 4px 0; border-top: 1px solid var(--border); }
.server li:first-child { border-top: 0; }
.server .warn { color: var(--warn-text); font-size: 13px; }
.server .err { color: var(--bad-text); font-size: 13px; white-space: pre-wrap; }

.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
/* В ячейке таблицы чип не наследует высоту строки AG Grid. */
.ag-cell .chip { line-height: 18px; vertical-align: middle; }
.chip.ok { background: var(--ok-bg); color: var(--ok-text); }
.chip.warn { background: var(--warn-bg); color: var(--warn-text); }
.chip.bad { background: var(--bad-bg); color: var(--bad-text); }
.chip.idle { background: var(--idle-bg); color: var(--idle-text); }

.clients { padding: 16px 20px 20px; }
.grid { height: calc(100vh - 290px); min-height: 360px; }

.modal { border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; width: min(440px, 92vw); }
.modal.wide { width: min(760px, 94vw); }
.modal::backdrop { background: rgba(20, 24, 31, .35); }
.modal h2 { margin: 0 0 12px; font-size: 16px; }
.modal label { display: block; margin: 10px 0; color: var(--muted); font-size: 13px; }
.modal select, .modal input, .modal textarea {
  display: block; width: 100%; margin-top: 4px; font: inherit; color: var(--text);
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
}
.modal textarea { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 12px; resize: vertical; word-break: break-all; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.actions.left { justify-content: flex-start; }
.notice { background: var(--warn-bg); color: var(--warn-text); padding: 8px 10px; border-radius: 6px; margin: 0 0 12px; }
.error { color: var(--bad-text); }
.result { display: flex; gap: 16px; align-items: flex-start; }
.qr { width: 260px; height: 260px; border: 1px solid var(--border); border-radius: 6px; flex: none; }
.qr img { width: 100%; height: 100%; image-rendering: pixelated; }
.result-text { flex: 1; min-width: 0; }
@media (max-width: 640px) { .result { flex-direction: column; } .qr { width: 100%; height: auto; aspect-ratio: 1; } }
/* Колонка действия: кнопка целиком, без многоточия. */
.ag-cell.action-cell { padding: 0 10px; text-overflow: clip; display: flex; align-items: center; }

/* Таблица клиентов — своя, без библиотеки (22.09.2026). */
.clients-bar { display: flex; align-items: center; gap: .75rem; margin: 0 0 .5rem; }
.clients-bar input { flex: 0 1 22rem; padding: .35rem .5rem; border: 1px solid #dfe3e8; border-radius: 6px; font: inherit; }
.grid { overflow: auto; }
table.clients { width: 100%; border-collapse: collapse; font-size: 13px; }
table.clients th, table.clients td { padding: .35rem .5rem; border-bottom: 1px solid #eceff2; text-align: left; white-space: nowrap; }
table.clients th { position: sticky; top: 0; background: #f6f7f9; font-weight: 600; cursor: pointer; user-select: none; z-index: 1; }
table.clients th.num, table.clients td.num { text-align: right; }
table.clients tbody tr:hover { background: #fafbfc; }
table.clients td.action-cell, table.clients th.action-cell { width: 2.5rem; text-align: center; cursor: default; }

/* Окно выдачи: выбор устройства и шаги (22.09.2026). */
.howto { margin: .5rem 0 1rem; padding-left: 1.2rem; line-height: 1.5; }
.howto li { margin: .45rem 0; }
.platforms { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .2rem; }
.platform { padding: .35rem .7rem; border: 1px solid #dfe3e8; border-radius: 999px; background: #fff; cursor: pointer; font: inherit; }
.platform.active { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.result-text .muted { margin: .4rem 0 0; font-size: 12px; }
.hint { margin: .4rem 0 .8rem; color: #555; font-size: 13px; line-height: 1.45; }
.note-cell { border: 0; background: none; font: inherit; color: #333; cursor: pointer; padding: 0; text-align: left; max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-cell:hover { text-decoration: underline; }
