/* brstrim panel — integration layer over the purchased "Neon" theme.
   Theme css (bootstrap/fonts/style) is loaded first; this file maps our
   app classes (.card, .row, .ablock, ...) onto the Neon look and keeps
   structural rules the panel JS relies on. */

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  background-color: #212325;
  background-image:
    radial-gradient(37.53% 147.33% at 5.39% 8.57%, rgba(255,255,255,.07) 0%, rgba(255,255,255,0) 100%),
    linear-gradient(180deg, #26282a 0%, #212325 100%);
}

/* ---- top bar ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 28px;
  border-bottom: 1px solid transparent;
  background-image:
    linear-gradient(135deg, #3A3E41 0%, #2A2D30 49%, #242628 100%),
    linear-gradient(139deg, #434B54 1%, #2A2C2F 45%, #191B1E 75%);
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  box-shadow: 0 18px 30px rgba(21,22,24,.25);
}
.app-header .brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: #d7e1ec;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .04em;
  margin: 0;
}
.app-header .brand .accent { color: #78c5d6; }
.app-header .spacer { flex: 1; }
.app-header #who { font-size: 14px; }

/* ---- tabs (theme's nav-line look: accent underline on active) ---- */
.ptabs {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  align-items: baseline;
  border-bottom: 1px solid rgba(215,225,236,.08);
  margin: 0 0 16px;
}
.ptabs .ptab {
  position: relative;
  padding: 10px 0 12px;
  border: 0;
  background: none;
  box-shadow: none;
  color: #a0a1ac;
  font-size: 15px;
  line-height: 1.4;
  cursor: pointer;
}
.ptabs .ptab:hover { color: #d7e1ec; }
.ptabs .ptab.active { color: #d7e1ec; }
.ptabs .ptab.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 3px;
  border-radius: 2px;
  background: #78c5d6;
}
.tabpane { display: none; }
.tabpane.active { display: grid; gap: 22px; }

/* ---- mobile nav: burger + drawer ---- */
#navBurger {
  display: none;
  border: 0;
  background: none;
  box-shadow: none;
  color: #d7e1ec;
  font-size: 20px;
  line-height: 1;
  min-width: 0; /* base button has min-width:140px */
  padding: 4px 6px;
  margin-right: 6px;
}
#navBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,11,13,.55);
  z-index: 190;
}
#navDrawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 260px;
  max-width: 82vw;
  background: #1e2023;
  z-index: 200;
  padding: 14px 0;
  box-shadow: 8px 0 30px rgba(0,0,0,.5);
  overflow-y: auto;
}
#navDrawer .drawer-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px 12px;
  border-bottom: 1px solid rgba(215,225,236,.08);
  margin-bottom: 8px;
}
#navDrawer .dbrand { font-size: 18px; font-weight: 600; color: #d7e1ec; }
#navDrawer .dbrand .accent { color: #78c5d6; }
#navClose {
  border: 0;
  background: none;
  box-shadow: none;
  color: #a0a1ac;
  font-size: 18px;
  padding: 4px;
}
#navDrawer .dtab {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  box-shadow: none;
  color: #a0a1ac;
  font-size: 15px;
  padding: 12px 18px;
}
#navDrawer .dtab:hover { color: #d7e1ec; }
#navDrawer .dtab.active {
  color: #d7e1ec;
  background: rgba(120,197,214,.08);
  border-left: 3px solid #78c5d6;
}

@media (max-width: 768px) {
  .ptabs { display: none; }
  #navBurger { display: inline-block; }
  .app-header { gap: 10px; padding: 12px 12px; }
  .app-header .brand { font-size: 19px; }
  .app-header #who {
    font-size: 12px; max-width: 38vw;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  main { padding: 0 10px; }
  /* stacked table: each row is a mini-card, actions land under the data */
  table { display: block; overflow-x: auto; }
  table thead { display: none; }
  table tbody { display: block; }
  table tbody tr {
    display: block;
    border: 1px solid rgba(67,70,78,.5);
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 8px 12px;
  }
  table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 6px 0;
    border: 0;
  }
  /* column label on the left, value pushed to the right edge */
  table td::before {
    content: attr(data-th);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #78c5d6;
    flex-shrink: 0;
  }
  table td[data-th=""]::before,
  table td[data-th="действия"]::before { content: none; }
  td[data-th="действия"] { justify-content: center; flex-wrap: wrap; gap: 8px; }
  td[data-th="действия"] > button { flex: 1 1 calc(50% - 8px); }
  td select { max-width: 60%; }
  td > button {
    margin: 0;
    min-width: 0;
    padding: 8px 12px;
    font-size: 13px;
    flex: 1 1 auto;
    max-width: 48%;
  }
  /* stream-tab controls fit narrow rows */
  .row > select { min-width: 0; max-width: 100%; }
  .row > button { min-width: 0; }
  .row > label { flex-shrink: 1; min-width: 0; }
  #novncFrame { height: calc(100vh - 140px); min-height: 320px; }
}

/* ---- layout: always single column, full width ---- */
main {
  margin: 24px 0 60px;
  padding: 0 24px;
  display: grid;
  gap: 22px;
  grid-template-columns: 1fr;
  align-items: start;
}

/* ---- cards: same gradient panel as the theme modal ---- */
.card {
  border: 1px solid transparent;
  border-radius: 20px;
  background-image:
    linear-gradient(135deg, #3A3E41 0%, #2A2D30 49%, #242628 100%),
    linear-gradient(139deg, #434B54 1%, #2A2C2F 45%, #191B1E 75%);
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  box-shadow: 14px 18px 26px rgba(21,22,24,.28), -4px -4px 15px rgba(195,200,205,.04);
  padding: 26px 28px;
  overflow-x: auto;
}
.card h2 {
  color: #d7e1ec;
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(120,197,214,.18);
}

/* ---- login ---- */
#loginBox {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 16px;
}
#loginBox .login-card {
  width: 100%;
  max-width: 430px;
  text-align: center;
  border: 1px solid transparent;
  border-radius: 20px;
  background-image:
    linear-gradient(135deg, #3A3E41 0%, #2A2D30 49%, #242628 100%),
    linear-gradient(139deg, #434B54 1%, #2A2C2F 45%, #191B1E 75%);
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  box-shadow: 30px 25px 40px rgba(21,22,24,.4), -4px -4px 15px rgba(195,200,205,.04);
  padding: 44px 40px 36px;
}
#loginBox .login-card h2 { color: #d7e1ec; font-size: 1.7rem; margin: 0 0 8px; }
#loginBox .login-card .muted { display: block; margin-bottom: 24px; }
#loginBox input { width: 100%; text-align: center; font-size: 15px; }
#loginBox button { width: 100%; margin-top: 18px; }
#loginBox .login-logo {
  display: inline-block;
  width: 54px; height: 54px;
  border-radius: 16px;
  margin-bottom: 18px;
  font-size: 26px;
  line-height: 54px;
  color: #212325;
  font-weight: 700;
  background: linear-gradient(166deg, #78c5d6 0%, #4e97a8 100%);
  box-shadow: 6px 6px 16px rgba(21,22,24,.4), inset 1px 1px 2px rgba(255,255,255,.35);
}

/* ---- controls: Neon .btn look applied to every button ---- */
button:not(:where(#tc-widget-root *)) {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0.125rem solid transparent;
  border-left-width: 0.1875rem;
  border-radius: 10px;
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1.53;
  min-width: 140px;
  padding: 11px 34px;
  cursor: pointer;
  color: #b4c0ce;
  background-image:
    linear-gradient(166deg, transparent 0% 50%, #2D3135 50%, #3E4248 100%),
    linear-gradient(166deg, #3E4248 0%, #2A2E32 50%, #3E4248 50%, #313437 100%);
  background-position: 0% 0%, 100% 100%;
  background-size: 200% 200%;
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  box-shadow: 8px 8px 22px rgba(21,22,24,.38), -4px -2px 16px rgba(195,200,205,.08);
  transition: .45s ease-in-out;
}
button:not(:where(#tc-widget-root *)):hover {
  background-position: 100% 100%, 0% 0%;
  color: #d7e1ec;
  box-shadow: 8px 8px 22px rgba(21,22,24,.38), -4px -2px 16px rgba(195,200,205,.08),
    inset -2px -2px 4px rgba(54,54,57,.16), inset 2px 2px 4px rgba(30,30,32,.18);
}
button:not(:where(#tc-widget-root *)):disabled { opacity: .4; cursor: default; }
button:not(:where(#tc-widget-root *)):disabled:hover { background-position: 0% 0%, 100% 100%; color: #b4c0ce; }
button.danger {
  background-image:
    linear-gradient(166deg, transparent 0% 50%, #4d2621 50%, #6b352c 100%),
    linear-gradient(166deg, #6b352c 0%, #40211c 50%, #6b352c 50%, #4a2823 100%);
  color: #f2c7bd;
}
button.danger:hover { color: #ffd9d0; }
button.primary {
  background-image:
    linear-gradient(166deg, transparent 0% 50%, #3a6b76 50%, #4e97a8 100%),
    linear-gradient(166deg, #4e97a8 0%, #2f5a64 50%, #4e97a8 50%, #38707c 100%);
  color: #e8f6f9;
}
button.primary:hover { color: #fff; }

/* ---- inputs: Neon .form-control look ---- */
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select {
  width: auto;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 14px;
  color: #d7e1ec;
  background-image:
    linear-gradient(166deg, #2c2d2f 0% 100%),
    linear-gradient(166deg, #525A63 0%, #2E353C 50%, #616972 50%, #3E464F 100%);
  background-size: auto auto, 200% 200%;
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  box-shadow: inset 2px 2px 8px rgba(4,4,5,.6);
  transition: .5s ease-in-out;
}
input:focus, select:focus, textarea:focus {
  outline: 0;
  background-position: 0% 0%, 100% 100%;
}
textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 15px;
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #d7e1ec;
  resize: vertical;
  background-image:
    linear-gradient(166deg, #2c2d2f 0% 100%),
    linear-gradient(166deg, #525A63 0%, #2E353C 50%, #616972 50%, #3E464F 100%);
  background-size: auto auto, 200% 200%;
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  box-shadow: inset 2px 2px 8px rgba(4,4,5,.6);
  transition: .5s ease-in-out;
}
textarea::placeholder { color: #a0a1ac; }
/* пустое обязательное поле — оранжевая рамка «введите сюда» */
/* !important: базовый input:not([type=...]) перебивает обычный класс спецификой */
input.need { border-color: #ff8c68 !important; }
input::placeholder { color: #a0a1ac; }
input[type=text] { flex: 1; min-width: 220px; }
/* file input: inset field + Neon-style selector button */
input[type=file] {
  font-size: 13px;
  color: #a0a1ac;
  max-width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 4px 10px 4px 4px;
  background-image:
    linear-gradient(166deg, #2c2d2f 0% 100%),
    linear-gradient(166deg, #525A63 0%, #2E353C 50%, #616972 50%, #3E464F 100%);
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  box-shadow: inset 2px 2px 8px rgba(4,4,5,.6);
}
input[type=file]::file-selector-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-left-width: 3px;
  border-radius: 8px;
  margin-right: 12px;
  padding: 7px 18px;
  font: inherit;
  font-weight: 500;
  color: #b4c0ce;
  cursor: pointer;
  background-image:
    linear-gradient(166deg, transparent 0% 50%, #2D3135 50%, #3E4248 100%),
    linear-gradient(166deg, #3E4248 0%, #2A2E32 50%, #3E4248 50%, #313437 100%);
  background-position: 0% 0%, 100% 100%;
  background-size: 200% 200%;
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  box-shadow: 4px 4px 12px rgba(21,22,24,.38), -2px -1px 8px rgba(195,200,205,.08);
  transition: .45s ease-in-out;
}
input[type=file]::file-selector-button:hover {
  background-position: 100% 100%, 0% 0%;
  color: #d7e1ec;
}
select option { background: #2c2d2f; color: #d7e1ec; }
input[type=range] { accent-color: #78c5d6; }
input[type=checkbox] { accent-color: #78c5d6; width: 16px; height: 16px; }

/* ---- helpers ---- */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
/* bootstrap's .row>* forces width:100% + gutter padding — undo it for our toolbar rows */
.row > * { width: auto; max-width: none; padding: 0; margin-top: 0; flex-shrink: 0; }
/* the padding reset above also wiped control paddings — restore them explicitly */
.row > button { padding: 11px 34px; }
.row > select { padding: 10px 15px; align-self: stretch; }
.row > input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]) { padding: 12px 15px; }
.row > input[type=file] { padding: 4px 10px 4px 4px; }
.row > input[type=text], .row > input[type=password] { flex: 1 1 220px; }
.muted { color: #a0a1ac; font-size: 13px; }

/* setup hint: snackbar из темы Neon — заметное уведомление, h6-размер 20px,
   тёмный текст, т.к. фон snackbar-* пастельный */
.setup-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: #2a2d30;
}
.setup-hint .snackbar-icon { flex-shrink: 0; font-size: 26px; margin-right: 0; }
.setup-hint.snackbar-warning .snackbar-icon { color: #f0a500; }

/* tts: youtube-стиль контроль швидкості — ±, слайдер, пресет-пігулки */
.tts-speedrow { gap: 8px; }
.tts-speedrow .dur { font-size: 12px; color: #a0a1ac; }
.tts-speedrow input[type=range] { width: 150px; padding: 0; }
.tts-spdbtn { border-radius: 50%; }
.row > .tts-spdbtn, .row > .tts-chip {
  padding: 7px 0; min-width: 0; font-size: 12px; line-height: 1;
  width: 34px;
}
.row > .tts-chip { width: auto; padding: 8px 13px; border-radius: 999px; }
.tts-chip.on {
  background: linear-gradient(135deg, #78c5d6, #5faab9); color: #101418;
}
#ttsSpdVal {
  min-width: 46px; font-size: 13px; color: #a0a1ac;
  font-variant-numeric: tabular-nums;
}
.warn { color: #ff8c68; font-size: 13px; }
.err { color: #ff8c68; font-size: 13px; min-height: 18px; }
.field-err { display: block; min-height: 0; margin-top: 4px; }
.ok { color: #7fd68a; font-size: 13px; }
.hidden { display: none !important; }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; vertical-align: top; color: #c7cdd8; }
thead th {
  color: #78c5d6;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .08em;
  border-bottom: 1px solid rgba(120,197,214,.25);
}
tbody tr { border-bottom: 1px solid rgba(67,70,78,.5); }
tbody tr:hover { background: rgba(255,255,255,.02); }
/* action buttons in ДЕЙСТВИЯ cells: append order, gap between siblings */
td > button { margin: 2px 8px 2px 0; }
td > button:last-child { margin-right: 0; }
#usersTable td:last-child { white-space: normal; }
#usersTable td:last-child > button { margin-bottom: 6px; }
#usersTable button:not(:where(#tc-widget-root *)) {
  min-width: 140px;
  padding: 5px 10px;
}
/* access switch: neon glow when ON, plain when OFF */
#usersTable .switch-toggle-modern.active .guide {
  border-color: rgba(120,197,214,.55);
  box-shadow: inset 2px 2px 8px rgba(4,4,5,.6),
    0 0 8px rgba(120,197,214,.75), 0 0 20px rgba(120,197,214,.4);
}
#usersTable .switch-toggle-modern.active .slider {
  box-shadow: inset 0 -1px 1px #181A1D, 0 0 8px rgba(120,197,214,.6);
}
#usersTable .sub-note { font-size: 12px; color: #a0a1ac; margin-right: 8px; }

/* ---- misc ---- */
#novncFrame {
  width: 100%;
  height: 560px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: #191b1e;
  background-image: linear-gradient(166deg, #525A63 0%, #2E353C 50%, #616972 50%, #3E464F 100%);
  background-clip: border-box;
}
pre {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  max-height: 240px;
  overflow: auto;
  font-size: 12px;
  white-space: pre-wrap;
  color: #a0a1ac;
  background-image:
    linear-gradient(166deg, #242628 0% 100%),
    linear-gradient(166deg, #3E464F 0%, #2E353C 50%, #434B54 50%, #353c44 100%);
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  box-shadow: inset 2px 2px 8px rgba(4,4,5,.6);
}
#sessionInfo { font-size: 13px; margin: 10px 0; color: #a0a1ac; }
#sessionInfo b { color: #78c5d6; }

/* ---- audio blocks ---- */
.ablock {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 14px;
  margin: 12px 0;
  background-image:
    linear-gradient(135deg, #33373a 0%, #2a2d30 60%, #242628 100%),
    linear-gradient(139deg, #434B54 1%, #2A2C2F 45%, #191B1E 75%);
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
}
.ablock .ahead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.ablock .atitle { font-weight: 600; min-width: 220px; color: #d7e1ec; }
.ablock input[type=range] { width: 120px; padding: 0; }
.ablock input[type=number] { width: 64px; }
/* pause input sits next to the mode select — pin both to one height */
.ablock .ahead select, .ablock .ahead input[type=number] {
  height: 40px; box-sizing: border-box;
}
/* the "тиша" label wraps text + input — as a plain inline element the input
   rides the text baseline and the pair drifts off the row's flex center */
.ablock .ahead > label {
  display: inline-flex; align-items: center; gap: 6px; margin: 0;
}
.ablock .vol { width: 40px; display: inline-block; color: #a0a1ac; }
.atracks { margin-top: 8px; font-size: 12px; }
.atracks .atr { padding: 4px 0; border-top: 1px solid rgba(67,70,78,.5); }
/* line 1: number + name + meta */
.atracks .atr-top { display: flex; align-items: center; gap: 8px; }
.atracks .atr .aname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c7cdd8; }
.atracks .atr .ameta { color: #a0a1ac; white-space: nowrap; }
.atracks .atr.failed .aname { color: #ff8c68; }
/* uploading / queued / processing rows — warm yellow in the site palette */
.atracks .atr.pending .aname, .atracks .atr.pending .ameta { color: #e6c76a; }
.atracks .atr .aname.noname { color: #ff8c68; }
/* line 2: player stretches, ✕ stays a compact square at its right */
.atracks .atr-bottom { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.atracks audio { height: 28px; flex: 1 1 0; min-width: 0; }
.atracks button { min-width: 0; padding: 3px 10px; font-size: 12px; }
.bgthumb { display: block; max-width: 240px; max-height: 120px; border-radius: 8px; margin: 6px 0 2px; }
/* custom eye toggle: the native ::-ms-reveal eye vanishes on blur and is
   not scriptable — our button stays until the key is saved */
input[type=password]::-ms-reveal, input[type=password]::-ms-clear { display: none; }
.pwrow { display: flex; align-items: stretch; gap: 8px; flex: 1 1 220px; }
.pwrow input[type=password], .pwrow input[type=text],
.pwrow input[type=datetime-local] { flex: 1 1 auto; min-width: 0; }
.pwrow .eye { align-self: stretch; display: flex; align-items: center; padding: 0 14px; }
/* native picker glyphs render black on the dark theme — the ghost button
   in .pwrow opens the picker via showPicker(), so all of them are hidden.
   color-scheme makes any glyph a browser still draws (Firefox has no
   hideable pseudo-element) render light instead of black */
input[type=datetime-local] { color-scheme: dark; }
input[type=datetime-local]::-webkit-calendar-picker-indicator,
input[type=datetime-local]::-webkit-inner-spin-button,
input[type=datetime-local]::-webkit-clear-button { display: none; }
/* inside the vertical .form label flex-basis means HEIGHT (giant gaps) —
   there the row takes the full label width instead */
.form .pwrow { flex: none; width: 100%; }
.ablock .aupload { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; }
.ablock .aupload input[type=file] { font-size: 12px; max-width: 260px; }
#audioIntervals label { display: flex; flex-direction: column; font-size: 12px; color: #a0a1ac; gap: 5px; }
#audioIntervals input { width: 92px; }

/* ---- button variants: icon + ghost + small ---- */
.btn-ico { font-size: 1.25em; line-height: 1; margin-right: .5em; }
button.ghost {
  background-image:
    linear-gradient(166deg, transparent 0% 50%, #2D3135 50%, #3E4248 100%),
    linear-gradient(166deg, #3E4248 0%, #2A2E32 50%, #3E4248 50%, #313437 100%);
  color: #b4c0ce;
}
button.sm { min-width: 0; padding: 7px 18px; font-size: .9rem; border-radius: 8px; }
.dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #a0a1ac;
  display: inline-block;
  box-shadow: 0 0 12px currentColor;
}
.big-btn { font-size: 20px; padding: 16px 52px; border-radius: 14px; }
.row .dur {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--muted, #8b93a7);
}
.dur input { width: 110px; text-align: center; }
.muted.small { font-size: 12px; margin-top: 10px; }

/* ---- studio hero: status on the left, controls on the right ---- */
.hero { padding: 36px 40px; overflow: visible; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(0, 1.6fr);
  gap: 36px 48px;
  align-items: center;
}
.hero-status {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 6px;
  padding: 10px 0;
}
.status-ring {
  position: relative;
  width: 128px; height: 128px;
  margin-bottom: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(136deg, #2D3135 7%, #3E4248 50%, #2D3135 93%);
  box-shadow: inset -2px -2px 2px rgba(83,86,102,.14), inset 2px 2px 5px rgba(0,0,0,.38),
    10px 10px 28px rgba(21,22,24,.45), -6px -4px 18px rgba(195,200,205,.06);
}
.status-ring::before {
  content: "";
  position: absolute; inset: 14px;
  border-radius: 50%;
  background: linear-gradient(-32deg, #1A1D21 3%, #393D42 44% 56%, #1A1D21 97%);
  box-shadow: 4px 4px 18px rgba(0,0,0,.4), -4px -2px 16px rgba(195,200,205,.08);
}
.status-ring-icon {
  position: relative;
  font-size: 44px;
  color: #8b93a3;
  text-shadow: 0 0 18px rgba(0,0,0,.4);
  transition: color .4s ease, text-shadow .4s ease;
}
.status-ring .dot {
  position: absolute; top: 12px; right: 12px;
  width: 16px; height: 16px;
  border: 2px solid #26282a;
  box-shadow: 0 0 14px currentColor;
  z-index: 2;
}
.status-ring-pulse {
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 2px solid transparent;
  opacity: 0;
}
.hero[data-phase="live"] .status-ring-icon { color: #5fd38a; text-shadow: 0 0 24px rgba(34,197,94,.55); }
.hero[data-phase="live"] .status-ring-pulse {
  border-color: rgba(34,197,94,.55);
  animation: ring-pulse 2.2s ease-out infinite;
}
.hero[data-phase="busy"] .status-ring-icon,
.hero[data-phase="finale"] .status-ring-icon,
.hero[data-phase="awaiting_login"] .status-ring-icon,
.hero[data-phase="stopping"] .status-ring-icon { color: #fbbf24; text-shadow: 0 0 22px rgba(251,191,36,.45); }
.hero[data-phase="busy"] .status-ring-pulse,
.hero[data-phase="awaiting_login"] .status-ring-pulse,
.hero[data-phase="stopping"] .status-ring-pulse {
  border-color: rgba(251,191,36,.5);
  animation: ring-pulse 1.4s ease-out infinite;
}
.hero[data-phase="error"] .status-ring-icon { color: #f87171; text-shadow: 0 0 22px rgba(248,113,113,.45); }
@keyframes ring-pulse {
  0%   { transform: scale(.92); opacity: .9; }
  100% { transform: scale(1.22); opacity: 0; }
}
.status-title { font-size: 22px; font-weight: 600; color: #d7e1ec; line-height: 1.3; }
.status-auth { font-size: 13px; }
.status-timer:empty { display: none; }
.status-timer {
  min-height: 22px; margin-top: 8px;
  font-size: 15px; font-variant-numeric: tabular-nums;
  color: #78c5d6;
}
.hero[data-phase="live"] .status-timer { color: #7fd68a; }

/* theme .countdown rings, animated via stroke-dashoffset */
.air-clock { margin: 14px 0 0; justify-content: center; }
.air-clock .countdown-block { margin: 0 9px; }
.air-clock .countdown-block-seconds { display: block; }
.air-clock .countdown-circle { width: 92px; max-width: 92px; transform: rotate(-90deg); }
.air-clock .countdown-circle .bg,
.air-clock .countdown-circle .fg { fill: transparent; stroke-width: 6px; }
.air-clock .countdown-circle .fg {
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 339.292;
  transition: stroke-dashoffset .55s linear;
}
.air-clock .countdown-block-hours .fg { stroke: #78c5d6; }
.air-clock .countdown-block-minutes .fg { stroke: #66c8a4; }
.air-clock .countdown-block-seconds .fg { stroke: #EC72B4; }
.air-clock .countdown-counter { font-size: 20px; font-variant-numeric: tabular-nums; }
.air-clock .countdown-title { font-size: 11px; color: #a0a1ac; letter-spacing: .04em; }
/* in countdown mode the arc is what is LEFT; it naturally shrinks via the same paintRing() */

.hero-controls { display: grid; gap: 22px; min-width: 0; }
.ctl { display: grid; gap: 10px; min-width: 0; }
.ctl-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: #78c5d6;
}
.ctl-label [class*="mdi-"] { font-size: 16px; }
.ctl .muted.small { margin: 0; }

/* theme .nav-boxed as a segmented control made of <button>s */
#expertPick.nav-boxed {
  display: flex; justify-content: flex-start; gap: 2px;
  max-width: 100%;
  padding: 3px;
  border-radius: 12px;
  overflow: visible;
}
#expertPick .nav-link {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 18px;
  border: 0; border-radius: 10px;
  background-image: none; background-color: transparent;
  box-shadow: none;
  color: #a0a1ac;
  font-size: 14px; font-weight: 500; line-height: 1.4;
  transition: color .2s ease-in-out;
}
#expertPick .nav-link:hover { color: #d7e1ec; background-position: 0 0; }
#expertPick .nav-link.active { color: #d7e1ec; }
#expertPick .nav-link:disabled { opacity: .55; }
#expertPick .nav-link:disabled:hover { color: #a0a1ac; }
#expertPick .nav-link:disabled:hover::before { opacity: 0; }
#expertPick .nav-link.active:disabled { opacity: 1; }
#expertPick .nav-link.active:disabled:hover::before { opacity: 1; }

/* timer: theme switch + compact minutes field */
.ctl-timer { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.switch-toggle-group { display: flex; align-items: center; gap: 10px; }
.ctl-timer .switch-toggle-group { display: inline-flex; align-items: center; gap: 12px; font-size: 14px; }
.ctl-timer .switch-toggle-label { color: #c7cdd8; }
.switch-toggle:focus-visible { outline: 0; }
.switch-toggle:focus-visible .guide { box-shadow: inset 2px 2px 8px rgba(4,4,5,.6), 0 0 0 3px rgba(120,197,214,.35); }
.switch-toggle.disabled { opacity: .4; cursor: default; }
.ctl-timer .dur { display: inline-flex; align-items: center; gap: 10px; margin: 0; color: #a0a1ac; font-size: 13px; }
.ctl-timer .dur input { width: 96px; text-align: center; font-size: 15px; font-weight: 600; }
.ctl-timer .dur-unit { color: #a0a1ac; }

.ctl-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.ctl-actions .big-btn { font-size: 18px; padding: 14px 42px; }
.ctl-actions .ghost { min-width: 0; padding: 11px 24px; font-size: .95rem; }
#studioErr { margin: 0; }

@media (max-width: 900px) {
  .hero { padding: 28px 22px; }
  .hero-grid { grid-template-columns: 1fr; gap: 26px; }
  .status-ring { width: 108px; height: 108px; margin-bottom: 12px; }
  .status-ring-icon { font-size: 38px; }
  .ctl-actions .big-btn { width: 100%; }
  .ctl-actions .ghost { width: 100%; }
  #expertPick.nav-boxed { overflow-x: auto; }
  #expertPick .nav-link { flex: 0 0 auto; }
}
.form { display: grid; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: #a0a1ac; }
.lbl-row { display: flex; align-items: center; }
/* theme .list-marked-check glyph (\f222) in the secondary orange */
.check-mark::before {
  display: inline-block;
  content: '\f222';
  margin-right: .56em;
  font-size: 1.2em;
  font-family: 'Material Design Icons';
  line-height: 1;
  color: #ff8c68;
}

@media (max-width: 640px) {
  .card { padding: 20px 16px; }
  /* audio upload row: let it wrap, show/hide goes on its own full-width line */
  .ablock .aupload { flex-wrap: wrap; }
  .ablock .aupload .atog { order: 5; width: 100%; }
  .ablock .aupload input[type=file] { width: 100%; flex-basis: 100%; max-width: none; }
  /* block header: title line, then a full-width volume line, then тиша+select */
  .ablock .atitle { min-width: 0; }
  .ablock .ahead input[type=range] { flex: 1 1 calc(100% - 52px); width: auto; min-width: 0; }
  .ablock .ahead .vol { flex: none; }
  .ablock .ahead select { flex: 1 1 auto; min-width: 0; }
  /* expert bg upload button — full width */
  #bgExpertBtn { width: 100%; }
  /* action buttons full-width, one per line — same as the «Показать» toggle */
  #saveBtn, #scheduleSaveBtn, #profileSaveBtn, #profilePayBtn,
  #audioSaveBtn, #audioRefreshBtn, #stGo, #ttsGo {
    width: 100%; flex-basis: 100%;
  }
  /* свой голос: имя над аудио, каждый инпут — своя строка,
     чекбокс на всю ширину, цена + «Создать» строкой ниже */
  #genVoicePane .row { flex-wrap: wrap; }
  #genVoicePane .row > label { flex-basis: 100% !important; }
  #genVoicePane .vc-name { order: -1; }
  #genVoicePane .vc-name input { width: 100% !important; }
  /* track rows already stack name-over-player on every screen — no mobile rules needed */
  #loginBox .login-card { padding: 32px 22px 28px; }
  .big-btn { width: 100%; padding: 16px 20px; }
  .hero-actions .big-btn { width: auto; }
  /* inline min-width:26em on #tokenValue overflows narrow screens */
  #tokenValue { min-width: 0 !important; }
  .row > button { padding: 10px 20px; }
  .row > input[type=text], .row > input[type=password],
  .row > input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]) {
    flex-basis: 160px;
    min-width: 0;
  }
}

/* ---- expert tabs (studio cabinet) — same look as admin .ptabs ---- */
.tabs {
  position: relative;
  display: flex; align-items: baseline; gap: 28px; flex-wrap: wrap;
  border-bottom: 1px solid rgba(215,225,236,.08);
  margin: 0 0 16px;
}
.tablist { display: flex; gap: 28px; flex-wrap: wrap; align-items: baseline; }
.tab {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 0; margin-top: 0; padding: 10px 0 12px;  /* theme's '* + .tab' adds 1.875rem top margin */
  border: 0; background: none; box-shadow: none; border-radius: 0;
  color: #a0a1ac; font-size: 15px; line-height: 1.4; cursor: pointer;
}
.tab:hover { color: #d7e1ec; }
.tab.active { color: #d7e1ec; }
.tab.active::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 3px; border-radius: 2px; background: #78c5d6;
}
.tab .tdot { width: 8px; height: 8px; border-radius: 50%; background: #8b93a3; flex: none; }
.tab .tdot { box-shadow: 0 0 8px currentColor; }

/* mobile: tabs hug the header — must come AFTER the rules above or they lose */
@media (max-width: 768px) {
  main { margin: 4px 0 40px; gap: 14px; padding: 0 4px; }
  /* top tab bar is replaced by the burger drawer on phones */
  .tabs { display: none; }
  .tab { padding: 2px 0 6px; font-size: 14px; }
}
/* expert status dot inside drawer items */
#navDrawer .dtab { display: flex; align-items: center; gap: 10px;
  justify-content: flex-start; margin-left: 0; margin-right: 0; text-align: left; }
#navDrawer .dtab .tdot { width: 8px; height: 8px; border-radius: 50%;
  background: #8b93a3; flex: none; box-shadow: 0 0 8px currentColor; }
/* one fixed icon slot for every drawer/tab item: text starts at the same x */
.dico { width: 20px; flex: none; display: inline-flex; justify-content: center;
  align-items: center; font-size: 18px; line-height: 1; }
#navDrawer .dtab { border-left: 3px solid transparent; padding-left: 15px; }
body.profile-open #drawerTabList .dtab.active {
  color: #a0a1ac; background: none; border-left-color: transparent; }
body.profile-open .tab.active { color: #a0a1ac; }
body.profile-open .tab.active::after { display: none; }
/* studio drawer-top: brand left, ✕ pinned right (admin keeps close-left) */
#navDrawer .drawer-top:has(.dbrand:first-child) #navClose { margin-left: auto; }
/* collapsible «Настройки эфира» group in the studio drawer */
#navDrawer .dtab-group .dlabel { flex: 1; }
#navDrawer .dtab-group .darrow {
  font-size: 16px; color: #8b93a3; flex: none;
  transition: transform .15s ease;
}
#navDrawer .dtab-group.open .darrow { transform: rotate(90deg); }
#navDrawer .dgroup .dtab { padding-left: 38px; font-size: 14px; }
/* round expert avatar right after the name, capital-letter size */
#navDrawer .dtab .dtab-img {
    flex: none;
    display: block;
    height: .72em;
    height: 3cap;
    border-radius: 20%;
    object-fit: cover;
    margin: 5px 6px;
}

/* ---- dashboard counters ---- */
.stat-grid {
  display: grid; gap: 14px; margin-top: 6px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.stat {
  position: relative; padding: 18px 14px 14px; text-align: center;
  border: 1px solid rgba(255,255,255,.08); border-radius: 10px;
  background: rgba(255,255,255,.03);
}
.stat::before {
  content: ""; position: absolute; left: 14px; right: 14px; top: 0;
  height: 3px; border-radius: 0 0 3px 3px; background: currentColor;
}
.stat-val { font-size: 30px; font-weight: 700; line-height: 1.1; color: currentColor; }
.stat-title { margin-top: 6px; font-size: 12px; letter-spacing: .04em;
  text-transform: uppercase; color: #a0a1ac; }
.stat-teal   { color: #78c5d6; }
.stat-blue   { color: #6ea8fe; }
.stat-green  { color: #5fd38a; }
.stat-red    { color: #f2c7bd; }
.stat-violet { color: #b58cf2; }

/* ---- GRAM payments (TON Connect) ---- */
#loginBox { flex-wrap: wrap; gap: 24px; }
#loginBox .partner-card { border: 1px solid rgba(120,197,214,.25); }
#loginBox .partner-card h2 { font-size: 1.3rem; }
.pay-card, .profile-card { display: none; }
#app.pay-mode > *:not(#payCard):not(#expertTabs) { display: none !important; }
#app.pay-mode > #payCard { display: block !important; }
#app.profile-mode > *:not(#profileCard):not(#expertTabs) { display: none !important; }
#app.profile-mode > #profileCard { display: block !important; }
.profile-table { width: 100%; margin-bottom: 8px; }
.pay-go { margin: 0 0 18px; }
.profile-table td { padding: 6px 10px 6px 0; vertical-align: top; }
.profile-table td:first-child { color: #a0a1ac; white-space: nowrap; width: 1%; }
.profile-table .ok { color: #66c8a4; }
.profile-table .bad { color: #e5736f; }
.profile-table td a { word-break: break-all; }
/* Neonexa link block separated from the profile rows, emphasized title */
.profile-card .form { border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 20px; margin-top: 14px; }
.profile-card .field-title { font-size: 15px; font-weight: 600;
  letter-spacing: .03em; color: #78c5d6; }
/* expert name in the «Подготовка» heading — dash stays light, name is neon */
#audioExpert { font-size: 1.15em; font-weight: 600; color: #eef4f8; }
#audioExpert .exp-name { color: #78c5d6; letter-spacing: .03em; }
/* expert portraits: avatar in the «Эксперт в эфире» picker + prep page photo */
.epick-img { height: 1.3em; width: 1.3em; object-fit: cover;
  border-radius: 50%; vertical-align: -0.25em; margin-right: .35em; }
.expert-photo { display: block; width: 100%; border-radius: 12px;
  margin: 6px 0 12px; box-shadow: 0 0 18px rgba(120,197,214,.25); }
@media (max-width: 768px) {
  #profileNavBtn { display: none !important; }
  .profile-table { display: block; }
  .profile-table tbody { display: block; }
  .profile-table tbody tr { display: flex; justify-content: space-between; align-items: baseline;
    gap: 14px; margin-bottom: 8px; padding: 10px 12px; }
  .profile-table td { display: block; padding: 0; width: auto; }
  .profile-table td::before { content: none; }
  .profile-table td:first-child { flex: none; white-space: nowrap; }
  .profile-table td > button.copy-ico { flex: none; width: 40px; min-width: 40px; height: 36px;
    padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
  .profile-table td:last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; }
}
.pay-box { text-align: left; margin: 14px 0; padding: 14px 16px; border-radius: 10px;
  background: rgba(120,197,214,.06); border: 1px solid rgba(120,197,214,.2); }
.pay-amount { font-size: 1.5rem; color: #d7e1ec; font-weight: 600; }
.pay-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.pay-actions button { flex: 1 0 140px; min-width: 0; }
#cabPay > button { min-width: 260px; max-width: 100%; }
#loginBox .pay-actions button { width: auto; flex: 1 0 140px; margin-top: 0; }
#loginBox .pay-manual-copy { width: auto; }
.pay-st-paid { color: #7fd68a; }
.pay-st-pending { color: #fbbf24; }
.pay-st-cancelled, .pay-st-expired { color: #8b93a3; }
.pay-manual { margin: 10px 0 4px; padding-top: 8px; border-top: 1px dashed rgba(120,197,214,.25); }
.pay-manual-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; flex-wrap: wrap; }
.pay-manual-label { color: #8b93a3; font-size: 12px; flex: none; }
.pay-manual-value { font-size: 12px; color: #c7cdd8; word-break: break-all;
  flex: 1 0 100%; order: 3; }
.pay-manual-copy { padding: 2px 8px; min-width: 0; font-size: 12px; flex: none;
  order: 2; margin-left: auto; }
.pay-qr { margin: 10px 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pay-qr img { width: 160px; height: 160px; border-radius: 10px; background: #fff; padding: 6px; }

/* ---- SuperTTS окно генерации (gen.js) ---- */
.gmodal { position: fixed; inset: 0; z-index: 300; display: flex;
  align-items: center; justify-content: center; }
.gmodal-back { position: absolute; inset: 0; background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px); }
.gmodal-card { position: relative; width: 100%; height: 100%;
  max-height: none; display: flex; flex-direction: column;
  background: #171a21; border: none; border-radius: 0;
  padding: 16px 18px; overflow: hidden; }
.gmodal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.gmodal-head h3 { margin: 0; flex: 1; font-size: 1.05rem; }
.gmodal-body { overflow-y: auto; padding-right: 4px; }
.gmodal-body label { display: block; margin: 8px 0; font-size: 13px;
  color: #a0a1ac; }
.gmodal-body textarea, .gmodal-body input[type=text],
.gmodal-body input[type=number], .gmodal-body select {
  width: 100%; margin-top: 4px; box-sizing: border-box; }
.gmodal-body h4 { margin: 14px 0 6px; font-size: .95rem; color: #d7e1ec; }
.gmodal-body details { margin: 10px 0; }
.gmodal-body details summary { cursor: pointer; color: #78c5d6; font-size: 13px; }
.grow { padding: 7px 0; border-top: 1px solid rgba(67,70,78,.5); }
.grow-head { display: flex; align-items: center; gap: 8px; }
.gname { flex: 1; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: #c7cdd8; }
.grow-bottom { display: flex; align-items: center; gap: 8px; margin-top: 5px;
  flex-wrap: wrap; }
.grow-bottom audio { height: 28px; flex: 1 1 0; min-width: 0; }
.gst { font-size: 11px; padding: 1px 8px; border-radius: 8px;
  white-space: nowrap; }
.gst-queued, .gst-submitting, .gst-running { color: #e6c76a;
  background: rgba(230,199,106,.12); }
.gst-ready { color: #7fd68a; background: rgba(127,214,138,.12); }
.gst-failed { color: #ff8c68; background: rgba(255,140,104,.12); }
.gst-cancelled, .gst-replaced { color: #8b93a3; background: rgba(139,147,163,.12); }
.agen { font-size: 12px; padding: 4px 12px; min-width: 0; }
button.sm { min-width: 0; padding: 4px 12px; font-size: 12px; border-radius: 8px; }
/* табы внутри фулскрин-попапа: глобальный media<=768px прячет .tabs —
   для модалки они должны оставаться видимыми */
.gmodal .tabs { display: flex; margin: 4px 0 10px; }
.gmodal .tabs .tab { padding: 6px 0 8px; font-size: 14px; }

/* невалидное поле — красный неон */
input.bad, textarea.bad, select.bad {
  border-color: #ff4d4d !important;
  box-shadow: 0 0 0 1px #ff4d4d, 0 0 8px #ff4d4d99, 0 0 16px #ff4d4d55 !important;
}

/* история генераций — мобильная разметка ПОСЛЕ базовых .grow-bottom
   правил (иначе проигрывает им по порядку): плеер на всю ширину,
   кнопки делят строку под ним */
@media (max-width: 640px) {
  .grow-bottom { flex-wrap: wrap; }
  .grow-bottom audio { flex-basis: 100%; }
  .grow-bottom button { flex: 1 1 auto; }
}
