:root {
  --bg: #f4f4f6; --panel: #ffffff; --text: #17171b; --muted: #6c6c78; --line: #e2e2e8;
  --accent: #e8445a; --accent-text: #fff; --ok: #1f9d55; --bad: #c0392b; --field: #f7f7f9; --chip: #fde8eb;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111114; --panel: #1b1b20; --text: #ececf1; --muted: #9a9aa8; --line: #2c2c34;
          --accent: #ef4d63; --field: #141418; --chip: #3a1d24; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
       -webkit-font-smoothing: antialiased; padding: 16px; }
[hidden] { display: none !important; }
a { color: var(--accent); }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; font-weight: 400; }
.grow { flex: 1; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
button, .btn { font: inherit; color: var(--text); background: var(--field); border: 1px solid var(--line); border-radius: 9px;
               padding: 6px 12px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { border-color: var(--muted); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
input, textarea, select { font: inherit; color: var(--text); background: var(--field); border: 1px solid var(--line);
                          border-radius: 8px; padding: 7px 9px; width: 100%; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
label { display: block; margin: 8px 0; color: var(--muted); font-size: 13px; }
label > input, label > textarea { margin-top: 4px; color: var(--text); font-size: 14px; }
label.sw { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--text); }
.num { width: 70px; display: inline-block; margin: 0 4px; }

/* вход */
.auth { min-height: 85vh; display: grid; place-items: center; }
.narrow { width: 100%; max-width: 420px; padding: 24px; }
.auth h1 { margin-bottom: 4px; }
.auth button.primary { width: 100%; padding: 10px; margin-top: 8px; }
.err { color: var(--bad); min-height: 1.4em; margin: 10px 0 0; }
.steps { padding-left: 18px; color: var(--muted); }
.steps li { margin: 6px 0; }
.secret { display: block; margin: 6px 0; padding: 8px; background: var(--field); border-radius: 8px; color: var(--text);
          font-size: 15px; letter-spacing: 1px; word-break: break-all; user-select: all; }

/* панель */
.top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--field); border: 1px solid var(--line); }
.pill.ok { color: var(--ok); }
.pill.bad { color: var(--bad); }
.bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bar details { width: 100%; }
.bar summary { cursor: pointer; color: var(--muted); }
.settings { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding-top: 10px; }
.settings label { margin: 0; color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-bottom: 14px; }
.grid .panel { margin: 0; min-width: 0; }
.card-head { display: flex; gap: 10px; align-items: flex-start; }
.name { font-weight: 600; font-size: 16px; background: transparent; border-color: transparent; padding: 2px 4px; }
.niche { width: 110px; font-size: 12px; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 2px 4px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); display: inline-block; }
.dot.on { background: var(--ok); }
.auto-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 8px; }
.runner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 4px 10px; font-size: 12.5px; }
.seg button.on { background: var(--accent); color: var(--accent-text); }
.applied { margin-top: 6px; min-height: 1.2em; }
.applied.ok { color: var(--ok); }
.applied.wait { color: var(--muted); }
.tabs { display: flex; gap: 4px; margin: 12px 0 6px; border-bottom: 1px solid var(--line); }
.tab { border: 0; border-radius: 0; background: transparent; padding: 6px 8px; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.pane { display: none; }
.pane.on { display: block; }
.status { font-size: 13px; padding: 6px 0; }
.status.on { color: var(--ok); }
.log { font-size: 12px; max-height: 260px; overflow: auto; }
.log div { display: flex; gap: 6px; padding: 3px 0; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; }
.log div > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.log .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip { background: var(--chip); border-radius: 6px; padding: 0 5px; }
.log a { text-decoration: none; }
.vhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.vhead input { flex: 1; min-width: 160px; width: auto; }
.vhead select { width: auto; }
.table-wrap { overflow-x: auto; }
table.videos { width: 100%; border-collapse: collapse; font-size: 13px; }
.videos th, .videos td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.videos th { color: var(--muted); font-weight: 500; border-top: 0; }
.videos td.t { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.videos td.title { max-width: 380px; }
.videos td.note input { min-width: 160px; padding: 4px 6px; }
.videos .del { padding: 2px 8px; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
         background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; transition: .2s; z-index: 10; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
@media (max-width: 600px) {
  body { padding: 10px; }
  .grid { grid-template-columns: 1fr; }
  .videos td.title { max-width: 200px; }
}
