:root {
  --bg0: #0f1419;
  --bg1: #1a222c;
  --bg2: #243040;
  --line: #3a4654;
  --text: #e8eef4;
  --muted: #9aa8b5;
  --accent: #3d8bfd;
  --accent-soft: #1e3a5f;
  --ok: #3d9a6a;
  --font: "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 10% -10%, #1e3a5f 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1a3d32 0%, transparent 50%),
    var(--bg0);
  color: var(--text);
  font-family: var(--font);
}

.page {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 1rem;
  min-height: 0;
}

.hero {
  flex: 0 0 auto;
  margin-bottom: 1rem;
}

.hero__lede-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.25rem;
}

.hero__doc-link {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 0.98rem;
  line-height: 1.5;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  white-space: nowrap;
}

.hero__doc-link:hover {
  color: var(--text);
}

@media (max-width: 640px) {
  .hero__lede-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}

h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-weight: 650;
  letter-spacing: -0.02em;
}

.hero__title {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  flex-wrap: wrap;
  line-height: 1;
}

.hero__beta {
  font-size: 0.55em;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  line-height: 1;
  /* Cap-height of the title sits slightly below the line box; nudge BETA down. */
  margin-top: 0.12em;
}

.lede {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.98rem;
}

.lede code {
  color: #c5d4e3;
  font-size: 0.9em;
}

.panel--hint {
  flex: 0 0 auto;
  margin-bottom: 1rem;
}

.panel--hint p {
  margin: 0;
  padding: 0.85rem 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.panel--controls .mode-switch--locale {
  flex: 0 0 auto;
  padding: 0.08rem;
}

.panel--controls .mode-switch--locale .mode-switch__opt {
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.2;
}

.mode-switch {
  display: inline-flex;
  align-items: stretch;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--bg1);
}

.mode-switch__opt {
  margin: 0;
  padding: 0.45rem 0.85rem;
  border: 0;
  border-radius: 0.28rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 560;
  cursor: default;
}

.mode-switch__opt:hover {
  color: var(--text);
}

.mode-switch__opt--on {
  background: var(--bg2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, var(--line));
}

body.editor-open {
  overflow: hidden;
}

/* Прозрачный fullscreen iframe — диалог/окно редактора внутри docs-app. */
.editor-shell {
  position: fixed;
  inset: 0;
  z-index: 2500;
  background: transparent;
  pointer-events: none;
}

.editor-shell[hidden] {
  display: none;
}

.editor-shell__frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  pointer-events: auto;
  color-scheme: normal;
}

.panel {
  background: color-mix(in srgb, var(--bg1) 92%, #000);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 18px 40px rgb(0 0 0 / 28%);
}

.panel--context {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.panel--controls {
  flex: 0 0 auto;
  width: 23.5rem;
  display: flex;
  flex-direction: column;
}

.panel--overlay {
  flex: 0 0 auto;
  width: 16.5rem;
  display: flex;
  flex-direction: column;
}

.host-row {
  --host-row-pad-x: 1.1rem;
  --host-row-pad-bottom: 1rem;
  --host-control-h: 2.4rem;
  display: flex;
  flex: 0 0 auto;
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.host-row .panel {
  margin: 0;
}

.context-fields {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 0.9rem 1rem;
  align-items: end;
  margin-top: auto;
  padding: 0.85rem var(--host-row-pad-x) var(--host-row-pad-bottom);
}

.context-field--user {
  max-width: 9.5rem;
}

.controls-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: auto;
  padding: 0.85rem var(--host-row-pad-x) var(--host-row-pad-bottom);
}

.controls-body .mode-switch {
  width: 100%;
  height: var(--host-control-h);
  box-sizing: border-box;
}

.controls-body .mode-switch__opt {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.45rem;
  font-size: 0.8rem;
  text-align: center;
}

.overlay-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: auto;
  padding: 0.85rem var(--host-row-pad-x) var(--host-row-pad-bottom);
}

.overlay-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  min-height: 1.5rem;
}

.overlay-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.overlay-field > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.overlay-field--color {
  flex: 0 0 auto;
}

.overlay-color-swatch {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 2.25rem;
  height: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  overflow: hidden;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #bbb 25%, transparent 25%),
    linear-gradient(-45deg, #bbb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #bbb 75%),
    linear-gradient(-45deg, transparent 75%, #bbb 75%);
  background-size: 0.55rem 0.55rem;
  background-position:
    0 0,
    0 0.275rem,
    0.275rem -0.275rem,
    -0.275rem 0;
}

.overlay-color-swatch::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--overlay-swatch-fill, #000);
  pointer-events: none;
}

.overlay-color-swatch input[type='color'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.overlay-field--opacity,
.overlay-field--range {
  flex: 1 1 auto;
}

.overlay-lead-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 2.25rem;
  height: 1.5rem;
  color: var(--muted);
}

.overlay-lead-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.overlay-field__range {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 1.5rem;
}

.overlay-field__range input[type='range'] {
  flex: 1 1 auto;
  min-width: 0;
  accent-color: var(--accent);
}

.overlay-field__range output {
  flex: 0 0 2.25rem;
  color: var(--text);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

@media (max-width: 800px) {
  .host-row {
    flex-direction: column;
  }

  .panel--controls,
  .panel--overlay {
    width: auto;
  }

  .context-fields {
    grid-template-columns: 1fr;
  }

  .context-field--user {
    max-width: none;
  }
}

.context-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.context-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.context-field input {
  width: 100%;
  height: var(--host-control-h, 2.4rem);
  box-sizing: border-box;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  background: var(--bg0);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}

.context-field input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-sizing: border-box;
  flex: 0 0 2.5rem;
  height: 2.5rem;
  min-height: 2.5rem;
  padding: 0 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
}

.panel__head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
}

.panel--staff .panel__head {
  justify-content: flex-start;
  gap: 0.7rem;
  position: relative;
  z-index: 3;
}

.staff-tool,
.staff-menu {
  position: relative;
  display: flex;
  align-items: stretch;
  align-self: stretch;
  margin-left: 0.15rem;
  padding-left: 0.55rem;
  border-left: 1px solid var(--line);
}

.staff-menu__btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.5rem;
  border: none;
  border-radius: 0.25rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 560;
  cursor: default;
}

.staff-menu__btn:hover,
.staff-menu--open .staff-menu__btn {
  background: rgb(255 255 255 / 8%);
  color: var(--text);
}

.staff-menu__btn svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.staff-menu__list {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 4;
  width: max-content;
  min-width: 12rem;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--bg2);
  box-shadow: 0 12px 28px rgb(0 0 0 / 35%);
}

.staff-menu__list[hidden] {
  display: none;
}

.staff-menu__group {
  position: relative;
}

.staff-menu__item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.45rem 0.7rem;
  border: none;
  border-radius: 0.28rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  white-space: nowrap;
  cursor: default;
}

.staff-menu__group > .staff-menu__item::after {
  content: "›";
  margin-left: auto;
  padding-left: 0.75rem;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
}

.staff-menu__item:hover,
.staff-menu__group:hover > .staff-menu__item {
  background: var(--accent-soft);
}

.staff-menu__sub {
  display: none;
  position: absolute;
  top: -0.3rem;
  left: calc(100% - 0.15rem);
  z-index: 5;
  width: max-content;
  min-width: 12rem;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--bg2);
  box-shadow: 0 12px 28px rgb(0 0 0 / 35%);
}

.staff-menu__group:hover > .staff-menu__sub,
.staff-menu__group:focus-within > .staff-menu__sub {
  display: block;
}

.panel--staff:has(.staff-menu--open) {
  overflow: visible;
}

.panel--staff {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel__foot {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  flex: 0 0 2.5rem;
  height: 2.5rem;
  min-height: 2.5rem;
  padding: 0 1.1rem;
  border-top: 1px solid var(--line);
  background: var(--bg2);
}

.panel__foot p {
  margin: 0;
  font-size: 0.85rem;
}

.table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 0.65rem 1rem;
  text-align: left;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  position: sticky;
  top: 0;
  background: #1f2a36;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:nth-child(even) {
  background: rgb(255 255 255 / 2%);
}

tbody tr.is-selected,
tbody tr.is-selected:nth-child(even) {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
}

.col-n {
  width: 3.5rem;
  color: var(--muted);
}

.col-fio {
  width: 32%;
}

.col-post {
  width: 34%;
}

.fio {
  font-weight: 560;
}

.muted {
  color: var(--muted);
}
