[hidden] { display: none !important; }
/* Syntx Studio — стили. Тёмная тема по умолчанию, светлая — по prefers-color-scheme. */

:root {
  color-scheme: dark;
  --bg: #0f1113;
  --bg-2: #14171a;
  --card: #171a1e;
  --card-2: #1d2126;
  --line: #262b31;
  --text: #e7e9ea;
  --muted: #99a1a9;
  --accent: #6ea8fe;
  --accent-ink: #0b1020;
  --accent-soft: rgba(110, 168, 254, 0.14);
  --ok: #4ecb71;
  --warn: #e8c15a;
  --err: #f2685c;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f5f7;
    --bg-2: #eceef1;
    --card: #ffffff;
    --card-2: #f6f7f9;
    --line: #dfe3e7;
    --text: #1a1d20;
    --muted: #5f6873;
    --accent: #2f6fd0;
    --accent-ink: #ffffff;
    --accent-soft: rgba(47, 111, 208, 0.12);
    --ok: #2f9e57;
    --warn: #b58a12;
    --err: #d1483c;
    --shadow: 0 8px 24px rgba(20, 30, 40, 0.08);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

body.lb-open { overflow: hidden; }

h1 { font-size: 22px; margin: 0 0 12px; line-height: 1.25; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
p { margin: 8px 0; }
a { color: var(--accent); }
img { max-width: 100%; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.err { color: var(--err); }
.spacer { flex: 1 1 auto; }

/* ============================== Шапка ============================== */

.hdr {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 650;
  text-decoration: none;
  color: var(--text);
  letter-spacing: .2px;
  white-space: nowrap;
}
.brand-accent { color: var(--accent); margin-left: 5px; }

.nav { display: flex; gap: 4px; }
.nav a {
  padding: 6px 11px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
}
.nav a:hover { color: var(--text); background: var(--card-2); }
.nav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent); }

.health {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 0;
}
.health .provs { display: flex; gap: 14px; flex-wrap: wrap; }
.health .prov { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.health .prov b { color: var(--text); font-weight: 600; }
.health .dot { font-size: 10px; line-height: 1; }
.health .halt { color: var(--err); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.health .halt.warn { color: var(--warn); }
.health .tok-warn { color: var(--warn); font-weight: 700; }
.health .tok-bad { color: var(--err); font-weight: 700; }

.bell-wrap { position: relative; }
.bell {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  font-size: 17px;
  cursor: pointer;
  color: var(--text);
}
.bell:hover { border-color: var(--accent); }
.bell-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--err);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
}

.notif-panel {
  position: absolute;
  right: 0;
  top: 46px;
  width: min(360px, calc(100vw - 24px));
  max-height: 70vh;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 60;
}
.np-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.np-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.np-pad { padding: 12px; }
.np-item { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.np-item:last-child { border-bottom: 0; }
.np-item:hover { background: var(--card-2); }
.np-item.unread { box-shadow: inset 3px 0 0 var(--accent); }
.np-title { font-size: 14px; font-weight: 600; }
.np-body { font-size: 13px; color: var(--muted); margin: 2px 0 4px; }

/* ============================== Каркас ============================== */

.view { padding-bottom: 60px; }

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ============================== Формы и кнопки ============================== */

.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }

input[type="text"], input[type="search"], input[type="number"], input[type="password"],
textarea, select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); border-color: var(--err); background: transparent; }
.btn.small { padding: 7px 13px; font-size: 13px; }
.btn.tiny { padding: 4px 10px; font-size: 12px; }

.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.chk input { width: auto; }
.radios { display: flex; gap: 18px; flex-wrap: wrap; }
.radios label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.radios input { width: auto; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

/* ============================== Главная ============================== */

.drop {
  position: relative;
  margin: 12px 0;
  min-height: 150px;
  padding: 16px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.drop-hint { color: var(--muted); font-size: 14px; }
.preview { max-height: 46vh; max-width: 100%; border-radius: var(--radius-sm); object-fit: contain; }

.session-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.scard {
  display: flex;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card-2);
  text-decoration: none;
  color: var(--text);
}
.scard:hover { border-color: var(--accent); }
.scard.await { border-color: var(--warn); box-shadow: 0 0 0 1px rgba(232, 193, 90, 0.28); }
.scard.await .scard-meta { color: var(--warn); font-weight: 600; }
.thumb {
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.thumb.broken { visibility: hidden; }
.scard-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.scard-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard-meta { font-size: 13px; color: var(--accent); }

/* ============================== Сессия ============================== */

.session-page { display: grid; grid-template-columns: minmax(280px, 400px) 1fr; gap: 16px; align-items: start; }
.col-left, .col-right { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-left { position: sticky; top: 76px; }

.photo-link { display: block; }
.photo { width: 100%; border-radius: var(--radius-sm); display: block; background: var(--bg-2); }
.stitle { margin: 12px 0 4px; }
.brief { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 14.5px; }
.brief b { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.stepper { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.step { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: var(--radius-sm); color: var(--muted); }
.step .mark {
  width: 24px; height: 24px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 12px;
}
.step.done { color: var(--text); }
.step.done .mark { background: var(--ok); border-color: var(--ok); color: #08130b; }
.step.cur { color: var(--text); background: var(--card-2); font-weight: 600; }
.step.cur .mark { border-color: var(--accent); color: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.step.err { color: var(--err); font-weight: 600; }
.step.err .mark { background: var(--err); border-color: var(--err); color: #fff; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-soft); }
  70%  { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.errbox {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--err);
  border-radius: var(--radius-sm);
  color: var(--err);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.errtext { overflow-wrap: anywhere; }
.notice { margin-top: 10px; font-size: 13.5px; color: var(--accent); }
.workers { margin-top: 4px; font-size: 13px; color: var(--muted); }
.live { margin-top: 6px; font-size: 12.5px; color: var(--ok); }
#stream-note { margin-top: 6px; }

.feed { display: flex; flex-direction: column; gap: 10px; max-height: 62vh; overflow: auto; padding-right: 4px; }
.msg { max-width: 88%; display: flex; flex-direction: column; gap: 3px; }
.msg.right { align-self: flex-end; align-items: flex-end; }
.msg .who { font-size: 12px; color: var(--muted); }
.bubble {
  padding: 10px 13px;
  border-radius: 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
  font-size: 14.5px;
}
.msg.right .bubble { background: var(--accent-soft); border-color: transparent; }
.memline { font-size: 12.5px; color: var(--muted); padding: 1px 4px; overflow-wrap: anywhere; }

.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.rcell { margin: 0; cursor: zoom-in; }
.rcell .rimg {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.rcell img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .18s ease; }
.rcell:hover img { transform: scale(1.03); }
.rcell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rcell figcaption { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.star { color: var(--warn); }

.reviews { margin-top: 14px; }
.review { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.review .score { color: var(--accent); font-size: 13px; }
.rblock p { font-size: 14.5px; }

.costs { list-style: none; margin: 0; padding: 0; display: flex; gap: 16px; flex-wrap: wrap; font-size: 14.5px; }

/* ---------- Лайтбокс ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 8, 10, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
}
.lb-fig {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.lb-fig img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 6px; }
.lb-fig figcaption { color: #cfd4d8; font-size: 13px; margin-top: 8px; }
.lb-nav {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  width: 46px;
  height: 64px;
  border-radius: 10px;
  cursor: pointer;
}
.lb-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 15px;
}
.lb-nav:hover, .lb-close:hover { background: rgba(255, 255, 255, 0.2); }
.lb-bar { position: absolute; left: 0; right: 0; bottom: 18px; display: flex; justify-content: center; gap: 10px; }

/* ============================== Память ============================== */

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters input[type="search"] { flex: 1 1 220px; width: auto; }
.filters select { flex: 0 0 auto; width: auto; }

.mem-list { display: flex; flex-direction: column; gap: 12px; }
.mem-card .mem-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 8px; font-size: 14.5px; }
.mem-edit { margin: 10px 0; }
.mem-actions { margin-top: 12px; }
.mem-imgs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mem-imgs img { width: 92px; height: 92px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }

/* ============================== Настройки ============================== */

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.tbl tr:last-child td { border-bottom: 0; }
.cfg-ov { display: flex; gap: 8px; flex-wrap: wrap; min-width: 260px; }
.cfg-ov select { width: auto; flex: 0 0 auto; }
.cfg-ov input { flex: 1 1 160px; width: auto; }

/* ============================== Оверлеи ============================== */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 10, 12, 0.72);
  display: grid;
  place-items: center;
  padding: 16px;
}
.login-card { width: min(380px, 100%); box-shadow: var(--shadow); }

.toasts {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100vw - 24px));
}
.toast {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow);
  font-size: 14px;
  transition: opacity .3s ease, transform .3s ease;
}
.toast.err { border-left-color: var(--err); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ============================== Страница входа ============================== */

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent),
    var(--bg);
}
.login-wrap { width: min(380px, 100%); }
.login-logo {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .3px;
  margin-bottom: 6px;
}
.login-card { box-shadow: var(--shadow); }
.logout-btn { flex: 0 0 auto; }

/* ============================== Карточки действий автора ============================== */

.action-card { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.action-card.question { border-color: var(--warn); box-shadow: 0 0 0 1px rgba(232, 193, 90, 0.16); }
.warn-badge { background: rgba(232, 193, 90, 0.16); color: var(--warn); }
.q-text { font-size: 15px; margin: 8px 0 4px; overflow-wrap: anywhere; }

.plan-block { margin: 10px 0; }
.plan-block h3 { margin: 0 0 4px; }
.plan-block p { margin: 4px 0; font-size: 14.5px; }
.plan-edits { margin: 4px 0; padding-left: 20px; font-size: 14.5px; }
.plan-edits li { margin: 2px 0; }
details.plan-block summary {
  cursor: pointer;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
details.plan-block[open] summary { color: var(--accent); }
.prompt-en { white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

.rt-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.rt-item { align-items: flex-start; gap: 9px; font-size: 14px; color: var(--text); }
.rt-item input { margin-top: 3px; }
.rt-text { display: block; }

.appr-controls { align-items: flex-end; gap: 16px; }
.inline-field { margin: 0; max-width: 260px; }
.estimate { font-size: 14px; color: var(--accent); font-weight: 600; }
.appr-comment { flex: 1 1 200px; width: auto; }

/* ============================== Мобильная вёрстка ============================== */

@media (max-width: 900px) {
  .session-page { grid-template-columns: 1fr; }
  .col-left { position: static; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .hdr { gap: 8px; padding: 8px 12px; }
  .brand { font-size: 15px; }
  .nav a { padding: 5px 9px; font-size: 13px; }
  .health { order: 3; width: 100%; margin-left: 0; font-size: 11.5px; }
  .health .provs { gap: 10px; }
  .bell-wrap { margin-left: auto; }
  .hide-narrow { display: none; }
  .page { padding: 12px; gap: 12px; }
  .card { padding: 13px; border-radius: 12px; }
  .grid2 { grid-template-columns: 1fr; }
  .session-list { grid-template-columns: 1fr; }
  .feed { max-height: none; overflow: visible; }
  .rgrid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .lightbox { padding: 10px; gap: 6px; }
  .lb-fig img { max-height: 68vh; }
  .lb-close { width: 34px; height: 34px; top: 8px; right: 8px; }
  .lb-nav { width: 36px; height: 54px; font-size: 24px; }
  .lb-bar { bottom: 12px; }
  .cfg-ov { min-width: 0; }
  .appr-controls { align-items: stretch; }
  .inline-field { max-width: none; }
  .appr-comment { flex: 1 1 100%; }
  .action-card .row .btn { flex: 1 1 auto; }
  /* колонку «Провайдер и модель» не прячем: на узком экране таблица скроллится
     по горизонтали внутри .tbl-wrap */
}

@media (max-width: 380px) {
  .nav a { padding: 4px 7px; font-size: 12px; }
  .thumb { width: 60px; height: 60px; }
  .rgrid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  /* баланс прячется последним; срок токена Syntx не прячется никогда */
  .hide-tiny { display: none; }
}
