/* ===================================================================
   Панель мониторинга — мягкий и дружелюбный дизайн
   Две темы (светлая/тёмная), индиго-акцент, скругления, графики.
   =================================================================== */

:root {
  color-scheme: dark;

  --bg: #131419;
  --surface: #1a1c22;
  --surface-2: #22252d;
  --surface-3: #2b2f39;

  --line: #2b2f3a;
  --line-soft: #22252d;

  --text: #eef0f5;
  --muted: #9ba1ad;
  --faint: #707682;

  --accent: #8b93ff;
  --accent-rgb: 139, 147, 255;
  --accent-soft: rgba(139, 147, 255, .15);

  --chart-ram: #5bc4b1;
  --chart-tx: #f2967e;

  --ok: #5ac58b;
  --warn: #e7b45c;
  --crit: #ee6f60;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 16px 40px rgba(8, 10, 18, .35);
}

html[data-theme="light"] {
  color-scheme: light;

  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #f1f2f6;
  --surface-3: #e8eaef;

  --line: #e4e6ec;
  --line-soft: #eef0f4;

  --text: #1c1e24;
  --muted: #70767f;
  --faint: #9ba1ab;

  --accent: #5560d8;
  --accent-rgb: 85, 96, 216;
  --accent-soft: rgba(85, 96, 216, .10);

  --chart-ram: #29a18c;
  --chart-tx: #dd6f56;

  --ok: #2aa05f;
  --warn: #b07d14;
  --crit: #d5544a;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 16px 36px rgba(24, 27, 38, .10);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
        "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--surface-3); border-radius: 999px;
  border: 3px solid transparent; background-clip: content-box;
}

/* ------------------------------ Шапка ------------------------------ */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: stretch; gap: 24px; flex-wrap: wrap;
  min-height: 58px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); flex: none;
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: dot-pulse 2.4s ease-in-out infinite;
}
.brand-name { font-size: 14px; font-weight: 650; }
.chip {
  font: 500 11.5px/1 ui-monospace, "Cascadia Code", Consolas, monospace;
  color: var(--muted); background: var(--surface-2);
  border-radius: 999px; padding: 5px 9px;
}

.tabs { display: flex; gap: 6px; align-self: center; margin: 8px 0; }
.tab {
  display: flex; align-items: center;
  border: 0; border-radius: 999px; background: transparent;
  padding: 7px 16px;
  color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 550;
  cursor: pointer; transition: color .15s, background .15s;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.is-active { color: var(--text); background: var(--accent-soft); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.chip.uptime { font-variant-numeric: tabular-nums; white-space: nowrap; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 550; color: var(--muted);
  background: var(--surface-2); border-radius: 999px;
  padding: 6px 11px; white-space: nowrap;
}
.pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; opacity: .6;
}
.pill.ok { color: var(--ok); }
.pill.err { color: var(--crit); }
.pill.ok::before { animation: dot-pulse 2.4s ease-in-out infinite; }

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

/* ------------------------------ Кнопки и поля ------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 550;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, filter .15s;
}
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .45; cursor: default; }

.icon-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px; flex: none;
  border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--muted); font: inherit; font-size: 14px; line-height: 1;
  cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }

.input {
  height: 34px; padding: 0 11px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--faint); }
.input:hover { background: var(--surface-3); }
.input:focus {
  background: var(--surface-2); border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select.input { cursor: pointer; padding-right: 6px; }
.input.sm { height: 30px; font-size: 12.5px; }

/* ------------------------------ Каркас ------------------------------ */

main { max-width: 1180px; margin: 0 auto; padding: 20px 20px 60px; }

.panel { display: none; }
.panel.is-active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

h2 {
  margin: 0 0 14px;
  font-size: 13px; font-weight: 600;
  color: var(--muted);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.card-head h2 { margin: 0; }
.head-tools { display: flex; gap: 8px; flex-wrap: wrap; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.ta-right { text-align: right; }

.card-foot {
  margin-top: 12px; font-size: 12.5px; color: var(--muted);
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.card-foot .grow { min-width: 0; flex: 1; }

/* ------------------------------ Сводка ------------------------------ */

.hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding: 16px 20px; margin-bottom: 14px;
}
.hero-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dot {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  background: var(--faint);
}
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); }
.hero-title { font-size: 15px; font-weight: 650; line-height: 1.3; }
.hero-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.hero-side { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ------------------------------ Метрики с графиками ------------------------------ */

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }

.stat { min-width: 0; padding: 16px 18px 14px; }
.stat-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-value {
  font-size: 27px; font-weight: 650; letter-spacing: -.02em;
  line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.stat-value.warn { color: var(--warn); }
.stat-value.crit { color: var(--crit); }

.spark { height: 52px; }
.spark svg { display: block; width: 100%; height: 100%; }
.spark.cpu  { --spark-1: var(--accent); }
.spark.ram  { --spark-1: var(--chart-ram); }
.spark.net  { --spark-1: var(--accent); }
.spark-area { fill: var(--spark-1); opacity: .16; }
.spark-line { fill: none; stroke: var(--spark-1); stroke-width: 2; stroke-linecap: round; }
.spark-line.tx { stroke: var(--chart-tx); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.span2 { grid-column: span 2; }

/* ------------------------------ Диски ------------------------------ */

.disk { margin-bottom: 15px; }
.disk:last-of-type { margin-bottom: 0; }
.disk-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 7px; font-size: 13.5px;
}
.disk-mount { font-weight: 600; }
.disk-detail { color: var(--muted); font-size: 12.5px; min-width: 0; }
.disk-pct {
  margin-left: auto; color: var(--muted);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.disk-pct.warn { color: var(--warn); }
.disk-pct.crit { color: var(--crit); }

.bar { height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.fill {
  height: 100%; width: 0; border-radius: 999px;
  background: var(--accent);
  transition: width .5s ease, background .3s;
}
.fill.warn { background: var(--warn); }
.fill.crit { background: var(--crit); }

/* ------------------------------ Датчики ------------------------------ */

.sensors { display: flex; flex-wrap: wrap; gap: 8px; }
.sensor {
  display: inline-flex; align-items: baseline; gap: 7px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 12.5px;
}
.sensor-name { color: var(--muted); font-weight: 500; }
.sensor-val { font-variant-numeric: tabular-nums; }
.sensor-val.warn { color: var(--warn); }
.sensor-val.crit { color: var(--crit); }

/* ------------------------------ Температуры CPU/GPU ------------------------------ */

.temps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.temp-tile {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.temp-name { color: var(--muted); font-size: 12px; }
.temp-val {
  font-size: 22px; font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.temp-val.warn { color: var(--warn); }
.temp-val.crit { color: var(--crit); }
.temp-val.muted { font-size: 14px; font-weight: 500; color: var(--faint); }

/* ------------------------------ Ядра: мини-колонки ------------------------------ */

.core-bars {
  display: flex; align-items: flex-end; gap: 2px;
  height: 30px; margin-top: 10px;
}
.core-bar {
  flex: 1 1 0; min-width: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--surface-3);
  height: 3%;
  transition: height .35s, background .35s;
}

/* вариант внутри stat-head: между «Процессор» и значением % */
.head-bars {
  flex: 1; height: 16px; margin-top: 0;
  align-self: center; min-width: 0;
}

/* ------------------------------ Minecraft ------------------------------ */

.mc-card .mc-form { display: flex; gap: 8px; margin-top: 10px; }
.mc-card .mc-form .input { flex: 1; min-width: 0; }
.mc-out {
  margin: 10px 0 0; padding: 10px 12px;
  max-height: 220px; overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}

.hint-title { font-weight: 650; margin-bottom: 6px; }
.hint-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.hint-list b { font-weight: 650; }

.au-form { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.au-form .input { flex: 1; min-width: 180px; }
.au-cmd { max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-state { font-size: 12.5px; font-weight: 600; }
.au-state.ok { color: var(--ok); }
.au-state.off { color: var(--muted); }
.au-note { margin-top: 10px; }

/* ------------------------------ Таблицы ------------------------------ */

.table-wrap { overflow: auto; max-height: 520px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; white-space: nowrap; }
th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface);
  color: var(--faint); font-size: 12px; font-weight: 600;
}
td { border-bottom: 1px solid var(--line-soft); }
th { border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
td.num { font-variant-numeric: tabular-nums; }
td.muted { color: var(--muted); }

.kill {
  background: transparent; border: 0; color: var(--faint);
  border-radius: 7px; cursor: pointer; padding: 2px 8px; font-size: 12.5px;
  transition: background .15s, color .15s;
}
.kill:hover { background: color-mix(in srgb, var(--crit) 13%, transparent); color: var(--crit); }

/* ------------------------------ Файловый менеджер ------------------------------ */

.fs-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 13px 14px; margin-bottom: 8px;
}
.pathbar { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 320px; }
.crumbs {
  display: flex; align-items: center; gap: 1px; flex-wrap: wrap; min-width: 0;
  font: 12.5px/1.4 ui-monospace, "Cascadia Code", Consolas, monospace;
}
.crumb {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 4px 8px; border-radius: 8px; font: inherit;
  transition: background .15s, color .15s;
}
.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb.is-last { color: var(--text); font-weight: 600; }
.crumb-sep { color: var(--faint); }

.fs-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.searchbox { display: flex; gap: 4px; }
.searchbox .input { width: 220px; }

.fs-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 2px 2px 10px; flex-wrap: wrap;
}
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); }

.files-table { padding: 0; overflow: hidden; position: relative; }
.files-table th, .files-table td { padding: 10px 13px; }
.fs-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.fs-icon { width: 17px; text-align: center; flex: none; opacity: .5; }
.fs-label {
  border: 0; background: transparent; color: var(--text); font: inherit;
  cursor: pointer; padding: 0; text-align: left;
  overflow: hidden; text-overflow: ellipsis; max-width: 460px;
  transition: color .15s;
}
.fs-label:hover { color: var(--accent); }
.fs-label.is-dir { font-weight: 600; }
.fs-link { color: var(--faint); font-size: 11.5px; margin-left: 6px; }
.fs-actions-cell { display: flex; gap: 2px; justify-content: flex-end; }
.fs-act {
  border: 0; background: transparent; color: var(--faint);
  border-radius: 7px; cursor: pointer; padding: 4px 8px; font-size: 13px;
  transition: background .15s, color .15s;
}
.fs-act:hover { color: var(--text); background: var(--surface-2); }
.fs-act.danger:hover { color: var(--crit); background: color-mix(in srgb, var(--crit) 13%, transparent); }
.empty { padding: 30px; text-align: center; color: var(--muted); font-size: 13px; }

.drop-hint {
  margin-top: 10px; padding: 22px; border-radius: var(--radius);
  text-align: center; font-size: 13.5px;
  border: 1px dashed var(--accent); color: var(--accent);
  background: var(--accent-soft); display: none;
}
#panel-files.is-dragover .drop-hint { display: block; }

/* ------------------------------ Модалка ------------------------------ */

.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 11, 16, .55); backdrop-filter: blur(6px); padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
  display: flex; flex-direction: column; overflow: hidden;
  width: min(980px, 96vw); height: min(80vh, 760px);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 15px; border-bottom: 1px solid var(--line);
  font-size: 12.5px; overflow: hidden;
}
.modal-head .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
#editor-text {
  flex: 1; width: 100%; resize: none; border: 0; outline: none;
  padding: 16px 18px; background: var(--surface); color: var(--text);
  font: 13px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace;
  tab-size: 4;
}
.modal-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 15px; border-top: 1px solid var(--line);
}
.modal-foot > div { display: flex; gap: 8px; }

/* ------------------------------ Тосты ------------------------------ */

.toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  max-width: 380px; padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px; box-shadow: var(--shadow);
  font-size: 13px; animation: slide .18s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--crit); }
.toast.prog { border-left-color: var(--accent); min-width: 240px; }
@keyframes slide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------ Вход ------------------------------ */

.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg); padding: 20px;
}
.login-card {
  display: flex; flex-direction: column; gap: 13px;
  width: min(368px, 92vw); padding: 32px 28px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow);
}
.login-logo {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); margin: 0 auto 4px;
  box-shadow: 0 0 0 6px var(--accent-soft);
}
.login-card h1 { margin: 0; font-size: 18px; font-weight: 650; text-align: center; }
.login-card p { margin: 0 0 4px; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.55; }
.login-card input {
  height: 42px; padding: 0 13px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid transparent; border-radius: 12px;
  font: inherit; font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card button {
  height: 42px; border: 0; border-radius: 12px;
  background: var(--accent); color: #fff;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: filter .15s;
}
.login-card button:hover { filter: brightness(1.06); }
.error {
  padding: 10px 12px; border-radius: 10px; text-align: center; font-size: 12.5px;
  background: color-mix(in srgb, var(--crit) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--crit) 30%, transparent);
  color: var(--crit);
}

/* ------------------------------ Терминал ------------------------------ */

.term { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.term-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.term-title { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-title.hello-title { color: var(--ok); font-weight: 600; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.is-set { color: var(--accent); }

.term-out {
  height: min(52vh, 520px); overflow: auto; flex: 1;
  padding: 14px 16px;
  background: #14151a; color: #e6e9f0;
  border-radius: 0 0 var(--radius) var(--radius);
}
html[data-theme="light"] .term-out { border-top: 0; }

.line {
  font: 12.5px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace;
  white-space: pre-wrap; word-break: break-word; min-height: 20px;
}
.line.echo { color: #9aa0ac; }
.line.echo .cmd { color: #eef0f5; }

/* ответ команды — правее («с табуляцией»), команда — как есть */
.term-out .line:not(.echo) { padding-left: 26px; }

/* промпт выделяем цветом */
.line.echo .ps, .term-ps { color: var(--accent); font-weight: 600; }
.line.hello { color: #7fd89c; }
.line.waitline { color: #8b909c; }
.note { font-size: 12px; margin-top: 2px; }
.note.ok { color: #63c58a; }
.note.warn { color: #e6b45c; }
.note.err { color: #ee6f60; }
.note.muted { color: #8b909c; }

.seg { color: #e6e9f0; }
.seg.c0  { color: #666a75; }  .seg.c1  { color: #e5716b; }
.seg.c2  { color: #63c58a; }  .seg.c3  { color: #e2b95d; }
.seg.c4  { color: #7a92f5; }  .seg.c5  { color: #c58ce0; }
.seg.c6  { color: #5bc4b5; }  .seg.c7  { color: #dfe2ea; }
.seg.c8  { color: #8b909c; }  .seg.c9  { color: #f28b82; }
.seg.c10 { color: #7fd89c; }  .seg.c11 { color: #f3cd7e; }
.seg.c12 { color: #9db4ff; }  .seg.c13 { color: #d9a8ec; }
.seg.c14 { color: #8fdcd0; }  .seg.c15 { color: #f0f2f8; }
.seg.bg0  { background: #666a75; }  .seg.bg1  { background: #e5716b; }
.seg.bg2  { background: #63c58a; }  .seg.bg3  { background: #e2b95d; }
.seg.bg4  { background: #7a92f5; }  .seg.bg5  { background: #c58ce0; }
.seg.bg6  { background: #5bc4b5; }  .seg.bg7  { background: #dfe2ea; }
.seg.bg8  { background: #8b909c; }  .seg.bg9  { background: #f28b82; }
.seg.bg10 { background: #7fd89c; }  .seg.bg11 { background: #f3cd7e; }
.seg.bg12 { background: #9db4ff; }  .seg.bg13 { background: #d9a8ec; }
.seg.bg14 { background: #8fdcd0; }  .seg.bg15 { background: #f0f2f8; }
.seg.b { font-weight: 600; }
.seg.i { font-style: italic; }
.seg.u { text-decoration: underline; }

.term-form {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 6px 8px 6px 16px;
}
.term-ps {
  font: 12.5px/1.4 ui-monospace, "Cascadia Code", Consolas, monospace;
  color: var(--muted); max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  user-select: none;
}
.term-line {
  flex: 1; min-width: 0; height: 40px; padding: 0 10px;
  background: transparent; border: 0; outline: none;
  color: var(--text);
  font: 13.5px/1.4 ui-monospace, "Cascadia Code", Consolas, monospace;
}
.term-line::placeholder { color: var(--faint); }

.term-hints { margin-top: 10px; padding: 0 4px; }
.term-hints b { color: var(--muted); font-weight: 600; }

.modal-card.small { display: block; width: min(420px, 94vw); height: auto; }

/* редактор настроек автозапуска */
.au-edit-body{display:flex;flex-direction:column;gap:12px;padding:18px 20px 4px}
.au-edit-field{display:flex;flex-direction:column;gap:5px}
.au-edit-field > span{font-size:12px;color:var(--muted);font-weight:600}
.au-edit-check{display:flex;align-items:center;gap:8px;font-size:13px;user-select:none;cursor:pointer}
.au-edit-check input{width:16px;height:16px;accent-color:var(--accent)}
.sudo-body { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.sudo-body p { margin: 0; line-height: 1.55; }
.sudo-body .input { width: 100%; height: 40px; }
.sudo-body .modal-foot { margin: 4px -16px -16px; }

/* ------------------------------ Адаптив ------------------------------ */

@media (max-width: 1020px) {
  .grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .topbar { height: auto; gap: 8px; padding: 10px 14px; }
  .tabs { order: 3; width: 100%; margin: 2px 0; justify-content: flex-start; }
  .tab { padding: 6px 13px; }
  main { padding: 14px 14px 48px; }

  .cards { grid-template-columns: 1fr; }
  .stat { padding: 15px 17px 12px; }
  .stat-value { font-size: 24px; }

  .searchbox { flex: 1 1 100%; }
  .searchbox .input { width: 100%; }
  .fs-label { max-width: 190px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============================ Админ-панель сайта ============================ */

#panel-admin select#adm-type { flex: 0 0 auto; min-width: 150px; }
#panel-admin .au-form { align-items: center; }

.input.area {
  display: block; width: 100%;
  height: auto; min-height: 120px;
  padding: 9px 11px; margin-bottom: 10px;
  line-height: 1.5; resize: vertical;
  font-family: inherit;
}

.adm-foot { display: flex; gap: 8px; margin-top: 14px; }

.nowrap { white-space: nowrap; }
.adm-actions { display: inline-flex; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; }
#panel-admin #adm-body td { vertical-align: top; }
#panel-admin #adm-body td:first-child { min-width: 260px; }

.badge {
  display: inline-block; padding: 2px 9px;
  border: 1px solid var(--line); border-radius: 20px;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  white-space: nowrap;
}
.badge.t-news   { color: #7db4ff; border-color: #7db4ff55; }
.badge.t-update { color: var(--ok); border-color: #43d17a55; }
.badge.t-alert  { color: #ffc247; border-color: #ffc24755; }
.badge.t-warning{ color: var(--crit); border-color: #ff5d5d55; }
.badge.dim      { color: var(--faint); }
.badge.pin      { color: var(--accent); border-color: var(--accent-soft); }

/* --- фильтры и поиск во вкладке «Админ-панель» --- */
.adm-filters {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin: 2px 0 12px;
}
.adm-filters .input.sm:first-child { flex: 1 1 220px; }
.adm-filters select.input.sm { flex: 0 0 auto; }

/* --- варианты иконок-кнопок во вкладке «Админ-панель» --- */
.icon-btn.i-primary:hover { color: var(--accent); }
.icon-btn.i-danger:hover { color: var(--crit); }
.icon-btn svg { display: block; }

/* --- маркеры отзывов (список в админке) --- */
.q-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.q-dot {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.q-dot::after { content: "\201C"; }
.q-dot.c-orange { background: var(--accent); color: #2a1204; }
.q-dot.c-green  { background: #43d17a; color: #0d2214; }
.q-dot.c-blue   { background: var(--blue, #7db4ff); color: #10213a; }
.q-dot.c-amber  { background: var(--amber, #ffc247); color: #2a1c04; }
.q-dot.c-pink   { background: var(--pink, #ff8bb0); color: #2d0f1f; }
.q-dot.c-dark   { background: var(--muted, #888); color: #111; }
