/* Design system of the marks web UI — a dark operations console.
   Layered near-black surfaces (page < sidebar < cards < raised), hairline
   borders instead of shadows, one blue accent, and status color that always
   encodes a row outcome: green = new marks, blue = amendments/propagation,
   amber = not found / attention, red = problem rows. Text and layout tokens
   live in :root; every component below reads them, never a raw hex. */

/* --- Fonts: self-hosted Golos Text (latin + cyrillic subsets, weights
       400/500/600). A cyrillic-first grotesque built for Russian UI text;
       the fallback stack keeps every page readable before the font loads. */

@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/static/fonts/golos-text-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("/static/fonts/golos-text-cyrillic-400.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url("/static/fonts/golos-text-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url("/static/fonts/golos-text-cyrillic-500.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("/static/fonts/golos-text-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url("/static/fonts/golos-text-cyrillic-600.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* --- Tokens ------------------------------------------------------------- */

:root {
  /* surfaces, light to raised */
  --bg-0: #0a0c10; /* page */
  --bg-1: #10141a; /* sidebar */
  --bg-2: #161b23; /* cards, inputs */
  --bg-3: #1d242e; /* hover, raised */
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);

  /* text */
  --text-1: #eef1f6;
  --text-2: #97a1b0;
  --text-3: #5f6b7a;

  /* the one accent (saturated for fills, lighter for text on dark) */
  --accent: #4c7dff;
  --accent-hover: #6991ff;
  --accent-text: #8aa8ff;
  --accent-wash: rgba(76, 125, 255, 0.12);

  /* row-outcome statuses (text-safe shades; base tones for dots) */
  --ok: #4fce75;
  --ok-text: #5fdb83;
  --warn: #e2a23c;
  --warn-text: #e7b05b;
  --err: #e06552;
  --err-text: #ee8875;

  --radius-card: 12px;
  --radius-control: 10px;
  --radius-chip: 8px;

  --font:
    "Golos Text", -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --font-mono:
    ui-monospace, "Cascadia Mono", Consolas, "JetBrains Mono", monospace;
}

/* --- Base ---------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg-0);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-0);
  color: var(--text-1);
  font: 400 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  /* The parse title ends in the uploaded file name — one long token that must
     not push a narrow viewport sideways. */
  overflow-wrap: anywhere;
}

h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

p {
  margin: 0 0 12px;
}

a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: #a5bcff;
}

code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #c8d2e0;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 2px 6px;
}

::selection {
  background: rgba(76, 125, 255, 0.35);
}

:focus-visible {
  outline: 2px solid #6e9bff;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

/* --- App shell: sidebar + content ---------------------------------------- */

body:not(.is-bare) {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 20px 14px 16px;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px;
}

.brand-mark {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

/* Both marks (this one and .login-mark below) are the plate + emblem pair:
   the accent square comes from the mark itself, the white emblem from the
   pud-logo.svg image, whose viewBox is already squared to the emblem — so
   filling the plate is the correct scale. */
.brand-mark img,
.login-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-1);
}

.side-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-label {
  padding: 14px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.side-label:first-child {
  padding-top: 0;
}

.side-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 14px;
  border-radius: var(--radius-control);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

a.side-item:hover {
  background: var(--bg-2);
  color: var(--text-1);
}

.side-item.is-active {
  background: var(--bg-2);
  color: var(--text-1);
}

/* The active marker of the reference design: a short light bar on the
   item's left edge. */
.side-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: #fff;
}

.side-item svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--text-3);
}

.side-item.is-active svg {
  color: var(--text-1);
}

/* A section that is planned but not built yet: readable, inert, quiet. */
.side-item.is-soon {
  color: var(--text-3);
  cursor: default;
}

.side-soon {
  margin-left: auto;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

.side-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.side-user {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-foot form {
  margin: 0;
}

/* --- Content column ------------------------------------------------------- */

.content {
  padding: 38px 40px 72px;
}

.page {
  max-width: 1080px;
}

/* Table-first pages (the journal): the 1080 reading measure starves the one
   column that carries a full file name, so these pages take a wider stage —
   at desktop widths the longest real name then sits on a single line. */
.page-wide {
  max-width: 1500px;
}

.page-sub {
  margin: 0 0 26px;
  max-width: 62ch;
  color: var(--text-2);
}

/* --- Alerts / flash -------------------------------------------------------- */

.alert,
.flash {
  margin: 0 0 20px;
  padding: 10px 14px;
  border-radius: var(--radius-control);
  font-size: 13.5px;
}

.alert {
  border: 1px solid rgba(224, 101, 82, 0.3);
  background: rgba(224, 101, 82, 0.09);
  color: var(--err-text);
}

.alert code {
  color: inherit;
  background: rgba(255, 255, 255, 0.09);
}

.flash {
  border: 1px solid rgba(79, 206, 117, 0.3);
  background: rgba(79, 206, 117, 0.09);
  color: var(--ok-text);
}

/* --- Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font: 500 14px/1.2 var(--font);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text-1);
}

.btn-ghost:hover {
  background: var(--bg-3);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 11px 22px;
  font-size: 14.5px;
}

.btn-block {
  width: 100%;
}

/* --- Forms ------------------------------------------------------------------- */

.field {
  margin: 0 0 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--bg-2);
  color: var(--text-1);
  font: 400 14px var(--font);
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="search"]:hover,
textarea:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-3);
}

/* A disabled text input must LOOK disabled. The base rule above sets an
   explicit color and background, which overrides the browser's own greyed-out
   rendering — without this block a locked field is indistinguishable from an
   editable one (the manual-run form locks both dates under «кумулятивный»).
   Dashed border + flat page background + dimmed value; the hover/focus
   affordances are switched off, and the field's label dims with it. */
input[type="text"]:disabled,
input[type="password"]:disabled,
textarea:disabled {
  border-style: dashed;
  border-color: var(--line-strong);
  background: var(--bg-0);
  color: var(--text-3);
  -webkit-text-fill-color: var(--text-3); /* Safari ignores `color` on disabled inputs */
  opacity: 1; /* the dimming is the tokens above, not a UA-specific fade */
  cursor: not-allowed;
}

input[type="text"]:disabled:hover,
input[type="password"]:disabled:hover,
textarea:disabled:hover {
  border-color: var(--line-strong);
}

/* :has() degrades gracefully: without it only the input itself dims. */
.field:has(> input:disabled) > label,
.field:has(> textarea:disabled) > label {
  color: var(--text-3);
}

textarea {
  display: block;
  resize: vertical;
  line-height: 1.45;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-3);
}

/* The file picker as a dashed landing zone: the affordance says "drop a
   registry here" while staying the plain native input (no JS to fake it). */
input[type="file"] {
  width: 100%;
  padding: 26px 18px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-card);
  background: var(--bg-2);
  color: var(--text-2);
  font: 400 13.5px var(--font);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

input[type="file"]:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: var(--bg-3);
}

input[type="file"]:focus {
  outline: none;
  border-color: var(--accent);
  border-style: solid;
}

input[type="file"]::file-selector-button {
  margin-right: 14px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--bg-3);
  color: var(--text-1);
  font: 500 13px var(--font);
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  border-color: rgba(255, 255, 255, 0.24);
}

/* The picked file as a card (static/upload.js builds it once a file is chosen
   and hides the native zone): the xlsx icon, the name ellipsized to the card's
   width (the full name rides the title attribute), the size, and the
   «Заменить»/«Убрать» pair. Same surface family as the zone it replaces. */
.file-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  background: var(--bg-2);
}

/* Canonical size; upload.js pins the same 28px as svg attrs — the no-CSS floor */
.file-card-icon {
  flex: none;
  width: 28px;
  height: 28px;
  color: var(--accent-text);
}

.file-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0; /* lets the name ellipsize instead of pushing the buttons out */
  flex: 1;
}

.file-card-name {
  font: 500 14px var(--font);
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card-size {
  font: 400 12.5px var(--font);
  color: var(--text-3);
}

.file-card-x {
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-2);
  font: 400 18px/1 var(--font);
  cursor: pointer;
}

.file-card-x:hover {
  border-color: var(--line-strong);
  background: var(--bg-3);
  color: var(--text-1);
}

/* A busy submit button (static/upload.js): disabled, dimmed, and carrying the
   spinner the label swap leaves room for. */
.btn.is-busy {
  opacity: 0.75;
  cursor: progress;
}

.btn.is-busy::before {
  content: "";
  width: 14px;
  height: 14px;
  flex: none;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-busy-spin 0.8s linear infinite;
}

@keyframes btn-busy-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn.is-busy::before {
    animation: none;
  }
}

/* Every <select> in the app used to render in the OS's own chrome — the one
   control text/file inputs got styled and this one didn't. A single-value
   select gets the same field shell as a text input plus a themed chevron
   (appearance: none drops the native arrow so the background-image one is
   the only one drawn); a multi-select drops the arrow (nothing to point at)
   and grows tall enough to show more than one row without a resize. */
select {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background:
    url("/static/chevron-down.svg")
      no-repeat right 12px center,
    var(--bg-2);
  color: var(--text-1);
  font: 400 14px var(--font);
  appearance: none;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

select:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

select:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--bg-3);
}

select:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

select option {
  background: var(--bg-2);
  color: var(--text-1);
}

select[multiple] {
  padding: 6px;
  background-image: none;
  min-height: 96px;
}

select[multiple] option {
  padding: 6px 8px;
  border-radius: var(--radius-chip);
}

.hint {
  margin: 10px 0 18px;
  font-size: 13px;
  color: var(--text-3);
}

/* The «Ручной запуск» type-specific block (2026-09-09 follow-up): a plain
   fieldset groups the active type's parameters under one caption instead of
   the fields just running on from the type picker — no border box, just the
   legend and a rule under it so the group reads without a per-type <h2>. */
.field-group {
  margin: 0 0 16px;
  padding: 0;
  border: none;
}

.field-group legend {
  padding: 0 0 10px;
  width: 100%;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-group .field:first-of-type {
  margin-top: 16px;
}

/* --- Inline control rows ----------------------------------------------------
   Related controls read as ONE line — the jobs filter bar and the schedules
   preset row (user walkthrough 2026-09-08) — and wrap to further lines on
   narrow screens instead of stacking full-width blocks. Fields take a
   compact share of the line (not the block default of the full width);
   the row's trailing buttons sit on the same baseline as the controls,
   which is why they carry the same bottom margin the fields do. */

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  column-gap: 16px;
}

.form-row .field {
  flex: 1 1 150px;
  max-width: 230px;
}

.form-row .btn {
  margin-bottom: 16px;
}

/* --- Stepper: the real sequence of the pipeline ------------------------------- */

.stepper {
  display: flex;
  align-items: center;
  margin: 0 0 26px;
}

.step {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.step-dot {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-2);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.step.is-active {
  color: var(--text-1);
}

.step.is-active .step-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.step.is-done .step-dot {
  border-color: rgba(79, 206, 117, 0.55);
  font-size: 0;
}

.step.is-done .step-dot::before {
  content: "\2713";
  font-size: 12px;
  color: var(--ok-text);
}

/* A dashed connector: the flow line of the pipeline, not a decoration. */
.step-line {
  flex: 1;
  min-width: 24px;
  margin: 0 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.16);
}

/* --- Cards / panels ------------------------------------------------------------ */

.card {
  max-width: 620px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--bg-2);
}

.panel {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--bg-2);
}

.panel-head {
  padding: 16px 20px 12px;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 13px;
}

.panel-body {
  padding: 4px 20px 18px;
}

.actions {
  margin-top: 26px;
}

/* Section title with an outcome dot: the dot repeats the color the tiles
   and the journal use for the same outcome. */
.sec-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.sec-title::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--text-3);
}

.sec-ok::before {
  background: var(--ok);
}

.sec-info::before {
  background: var(--accent);
}

.sec-warn::before {
  background: var(--warn);
}

.sec-err::before {
  background: var(--err);
}

/* --- Stat tiles (the parse summary) ---------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 14px 0 0;
  padding: 0;
}

.stat {
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--bg-2);
}

.stat dd {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--stat, var(--text-1));
}

.stat dt {
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--text-2);
}

.stat-ok {
  --stat: var(--ok-text);
}

.stat-info {
  --stat: var(--accent-text);
}

.stat-warn {
  --stat: var(--warn-text);
}

.stat-err {
  --stat: var(--err-text);
}

/* --- Tables ------------------------------------------------------------------------ */

.table-scroll {
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

th.num,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.num {
  font-weight: 500;
}

/* A zero stays quiet; a non-zero count speaks in its outcome color. */
td.pos-ok {
  color: var(--ok-text);
}

td.pos-info {
  color: var(--accent-text);
}

td.pos-warn {
  color: var(--warn-text);
}

td.pos-err {
  color: var(--err-text);
}

/* The journal's identity column: the registry file name with who uploaded it
   and when as a quiet second line. The name may be one long unbroken token, so
   it wraps anywhere instead of stretching the column. */
td.filename {
  overflow-wrap: anywhere;
  font-weight: 500;
}

.file-meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
  white-space: nowrap;
}

/* The /users actions column: an edit link plus several one-button forms.
   Without this they glue into one pile — forms are block boxes with no
   margins, and the global input rule (width: 100%) stretches the password
   field across the cell and wraps its button. Each form keeps its input
   and button on one row; the entries stack with a small gap. */
td.row-actions > * + * {
  margin-top: 6px;
}

td.row-actions form {
  display: flex;
  align-items: center;
  gap: 6px;
}

td.row-actions input[type="password"] {
  width: 150px;
}

.table-scroll::-webkit-scrollbar {
  height: 8px;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: 4px;
}

.table-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* --- Conflict decisions: the last column of the discrepancies table ---------------------- */

/* The two answers stack inside the decision cell, so a long brand list in a
   neighboring column never squeezes the radios. */
.choices {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.choices .choice {
  margin: 0;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 6px 10px 0 0;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  color: var(--text-2);
  font-size: 13.5px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.choice:hover {
  background: var(--bg-3);
  color: var(--text-1);
}

.choice input {
  accent-color: var(--accent);
  margin: 0;
}

/* :has() degrades to a plain native radio in browsers without it — the
   control stays fully usable, just less styled. */
.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--text-1);
}

/* A locked checkbox/radio (the form's JS disables «по регионам» once a region
   is chosen): the whole chip reads as unavailable, not just the tiny box. */
.choice:has(input:disabled) {
  border-style: dashed;
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text-3);
  cursor: not-allowed;
}

/* --- Warnings callout --------------------------------------------------------------------- */

.callout-warn ul {
  margin: 0;
  padding: 2px 0 2px 18px;
}

.callout-warn li {
  margin: 5px 0;
  color: var(--text-2);
  font-size: 13.5px;
}

.callout-warn {
  padding: 14px 18px;
  border-left: 3px solid var(--warn);
  background: rgba(226, 162, 60, 0.07);
  border-radius: 4px var(--radius-control) var(--radius-control) 4px;
}

/* --- Empty state / pagination --------------------------------------------------------------- */

.empty {
  margin-top: 22px;
  padding: 40px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-card);
  text-align: center;
  color: var(--text-3);
}

.pager {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.pager-info {
  font-size: 13px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* --- Home tiles -------------------------------------------------------------------------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.tile {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--bg-2);
  color: var(--text-1);
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.tile:hover {
  background: var(--bg-3);
  border-color: var(--line-strong);
  color: var(--text-1);
}

.tile svg {
  width: 18px;
  height: 18px;
  color: var(--accent-text);
}

.tile-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 15px;
  font-weight: 600;
}

.tile-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
}

/* --- Bare shell: login and pre-auth pages -------------------------------------------------------- */

body.is-bare {
  display: block;
  background:
    radial-gradient(
      880px 460px at 50% -12%,
      rgba(76, 125, 255, 0.16),
      transparent 62%
    ),
    var(--bg-0);
}

body.is-bare .content {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 384px;
  padding: 30px 30px 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-2);
}

.login-mark {
  width: 44px;
  height: 44px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  font-weight: 600;
}

.login-card h1 {
  margin-bottom: 4px;
  font-size: 17px;
  text-align: center;
}

.login-sub {
  margin-bottom: 22px;
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
}

/* The form's submit button and the block link that follows the form
   (Войти → «Забыли пароль?», «Отправить запрос» → «Вернуться ко входу»)
   otherwise touch: the card spaces its titled children, not forms. */
.login-card form {
  margin-bottom: 16px;
}

/* --- Narrow screens: the sidebar folds into a top bar ---------------------------------------------- */

@media (max-width: 760px) {
  body:not(.is-bare) {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 12px;
    padding: 14px 14px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  /* The row wraps instead of scrolling: at phone widths the items plus the
     "скоро" pill do not fit one line, and a clipped pill behind an invisible
     scroll reads as a broken layout. A second row is honest at any width. */
  .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }

  .side-label {
    display: none;
  }

  .side-item {
    padding: 8px 12px;
    white-space: nowrap;
  }

  .side-item.is-active::before {
    display: none;
  }

  .side-foot {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
  }

  /* The logout button is btn-block for the desktop column; beside the user
     name in a row it must size to its label, not fight for 100% of it. */
  .side-foot .btn {
    width: auto;
  }

  .content {
    padding: 24px 16px 56px;
  }

  .step {
    font-size: 0;
    gap: 0;
  }

  .step-line {
    margin: 0 8px;
  }
}

/* The invite link's copy row (feature rnp-ai-bot): the code is the copy
   target itself (click/Enter copies), the ghost button gives the visible
   affordance with the icon. */
.invite-copy-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.invite-copy-text {
  cursor: copy;
}

.invite-copy-text:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.invite-copy-row .is-copied {
  color: #1a7f37;
}

/* --- Tabs (feature acb-monthly-plan-form): the /journal page's two
       surfaces — the uploads journal and the «Планы АКБ» ledger. The same
       underline vocabulary the side nav uses, horizontal: the active tab
       carries the accent, the rest stay quiet until hovered. */
.tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--line-strong);
}

.tab {
  padding: 10px 14px 12px;
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text-1);
}

.tab.is-active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}

/* --- The plan form's region table (feature acb-monthly-plan-form). The
       group row is a full-width caption: manager (full name where known)
       and territory; the value input is a narrow numeric field that stops
       the plan column from claiming the table's width; the (i) mark is the
       «неполный месяц» hint of the previous-month АКБ column (title carries
       the tooltip — no script under the CSP). */
.plan-group td {
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
  background: var(--bg-1);
  border-top: 1px solid var(--line-strong);
}

.plan-value {
  width: 9rem;
  text-align: right;
}

.ref-info {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0 0.3rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text-3);
  font-size: 0.7rem;
  line-height: 1.1;
  cursor: help;
  vertical-align: middle;
}

/* The listing's action cell: the «...» menu without the page-level
   .actions spread. */
.actions-cell {
  white-space: nowrap;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Collapsible manager groups (progressive enhancement): the group row is the
   toggle, plans.js collapses the region rows that follow it — without the
   script every group simply stays expanded. */
.plan-group {
  cursor: pointer;
  user-select: none;
}

.plan-group .chev {
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  color: var(--text-3);
  transition: transform 0.15s ease;
}

.plan-group.is-collapsed .chev {
  transform: rotate(-90deg);
}

tr[hidden] {
  display: none;
}

/* A region with neither a value nor «снят» this month: the warning wash of
   the callout palette, never a danger tint — an empty plan is a prompt to
   fill, not an error. */
.plan-row-empty td {
  background: rgba(226, 162, 60, 0.07);
}

/* The save-confirm checkbox (plan form and clear page share it): a plain
   checkbox, not the boxed .choice chip — a single confirmation is a
   statement, not one option among many. */
.confirm-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  border-radius: 0;
  color: var(--text-1);
  font-size: 14px;
  cursor: pointer;
}

.confirm-check input {
  accent-color: var(--accent);
  margin: 0;
}

/* A little more air between the confirmation and the action buttons. */
.confirm-field {
  margin: 0 0 10px;
}

/* The «Показать регионы» busy state: the region-table load takes seconds
   while the reference columns compute — the submit button becomes an
   overlay spinner (plans.js adds the class on submit). Its OWN class, never
   the upload flow's is-busy pair at the top of this file (opacity + inline
   currentColor spinner + the data-busy-label swap): one .btn.is-busy defined
   twice silently restyled /upload's buttons, label included. */
.btn.is-loading {
  position: relative;
  pointer-events: none;
  color: transparent;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn.is-loading::after {
    animation: none;
  }
}

/* The «...» row menu: native <details> — no script, keyboard-open, closes
   on navigation; the panel drops below-right of its cell. */
.row-menu {
  position: relative;
}

.row-menu summary {
  list-style: none;
  cursor: pointer;
}

.row-menu summary::-webkit-details-marker {
  display: none;
}

.row-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5;
  min-width: 10rem;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--bg-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.row-menu-panel a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-1);
  font-size: 13.5px;
  text-decoration: none;
}

.row-menu-panel a:hover {
  background: var(--bg-3);
}

.row-menu-panel a.is-danger {
  color: var(--err-text);
}

/* --- Оргструктура (2026-10-13 redesign) -----------------------------------
   The /orgstructure pages pilot Verdana — the user's pinned proposal —
   scoped to the page's own class until the face is promoted app-wide.
   Verdana's wide, high-x-height grotesque reads dense Cyrillic tables
   better at a notch smaller size than Golos, so the page re-sets its
   scale; every component below reads the incumbent tokens only. */

.org-page {
  --font: Verdana, "Segoe UI", Tahoma, "DejaVu Sans", Arial, sans-serif;
  font-family: var(--font);
  font-size: 13px;
}

.org-page h1 {
  font-size: 20px;
  letter-spacing: 0;
}

.org-page h2 {
  font-size: 14px;
}

.org-page table {
  font-size: 12px;
}

.org-page th {
  font-size: 10px;
  letter-spacing: 0.07em;
}

.org-page .btn {
  font-size: 13px;
}

.org-page input[type="text"],
.org-page input[type="number"],
.org-page input[type="search"],
.org-page select {
  font-size: 13px;
}

/* The identity anchor of the section: the territory id, always the same
   badge whether it heads a distribution group or rides a picker row. */
.org-id {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--bg-3);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
}

/* Pills: subjects, divisions, a manager's territories. One shape for
   every categorical value — colour stays reserved for outcomes. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: nowrap;
}

.org-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}


/* --- The overview tab: division sections -----------------------------------
   Collapsible cards on the page's dark background; the sections group
   SUBJECTS by their binding's division (a territory spanning both — the
   050 anomaly the form now heals — renders in both, its subjects split
   by their own). */
.dist-title {
  margin: 26px 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}

.dist-search { margin: 0 0 14px; }
.dist-search input { width: 100%; max-width: 420px; }
.dist-search input::placeholder { color: var(--text-2); opacity: 1; }
.dist-search-note { margin: 8px 0 0; font-size: 12.5px; color: var(--text-2); }

.dist-sec { margin-top: 28px; }
.dist-sec:first-of-type { margin-top: 0; }

.dist-box {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.dist-box-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.dist-box-head::-webkit-details-marker { display: none; }
.dist-box-head:hover { background: var(--bg-3); }
details.dist-box[open] > .dist-box-head { border-bottom: 1px solid var(--line); }

/* the focus ring sits inside so it repeats the card's rounding */
.dist-box-head:focus-visible {
  outline: 2px solid #6e9bff;
  outline-offset: -2px;
}

/* the collapse chevron: CSS borders, no image (CSP default-src 'self') */
.dist-chevron {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 1.6px solid var(--text-2);
  border-bottom: 1.6px solid var(--text-2);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex: none;
}

/* the free section's collapsed head carries the «привязать» shortcut;
   when it hides on open, the auto margin returns to the chevron */
.dist-box-head.is-free .dist-chevron { margin-left: 0; }
details.dist-box[open] > .dist-box-head.is-free .dist-chevron { margin-left: auto; }
details.dist-box:not([open]) .dist-chevron { transform: rotate(-135deg); }
.dist-box-head.is-free { color: var(--warn-text); }

.dist-head-cta {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent-text);
}

.dist-head-cta:hover { color: var(--link-hover); }
details.dist-box[open] > .dist-box-head .dist-head-cta { display: none; }
.dist-foot { padding: 10px 16px 12px; border-top: 1px solid var(--line); }

/* the territory row: the heading of its subject list, on its own ground */
.dist-terr {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-1);
  text-align: left;
}

.dist-terr:first-child { border-top: 0; }

.dist-list { margin: 0; padding: 0 0 2px; list-style: none; }

.dist-subj {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 5px 16px 5px 58px;
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: 12.5px;
}

.dist-subj::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--line-strong);
  flex: none;
}

.dist-subj.is-free { color: var(--warn-text); }
.dist-subj.is-free::before { background: var(--warn); }
.dist-subj.is-stale { color: var(--text-3); }

.org-count {
  font-size: 11.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.org-owner {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
  white-space: nowrap;
}

.org-owner:hover {
  color: var(--accent-text);
}

.org-owner-vacant {
  color: var(--warn-text);
}

.org-owner-vacant:hover {
  filter: brightness(1.2);
}

.org-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--ok);
}

.org-dot-idle {
  background: var(--text-3);
}

/* --- The division segment ---------------------------------------------------
   The binding's division is ONE value per territory (the mockup's «один
   сегмент на территорию» — saving it over a mixed territory normalizes
   the anomaly). A two-option radio pair styled as a segmented control:
   the native input stays focusable and announced but paints nothing; the
   span beside it is the visible control. */
.org-seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  overflow: hidden;
}

.org-seg label {
  display: inline-flex;
}

.org-seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.org-seg span {
  padding: 6px 20px;
  font-size: 12.5px;
  color: var(--text-2);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.org-seg label + label span {
  border-left: 1px solid var(--line-strong);
}

.org-seg input:checked + span {
  background: var(--accent-wash);
  color: var(--text-1);
  font-weight: 600;
}

/* keyboard focus paints the segment's option, not the hidden input */
.org-seg input:focus-visible + span {
  outline: 2px solid #6e9bff;
  outline-offset: -2px;
}

/* --- The subject checklist --------------------------------------------------
   The territory form's subject pick: a flat checkbox list with a sticky
   search field (orgstructure.js filters rows and toggles .is-checked —
   without the script every row stays listed and the control stays fully
   usable). */
.org-checklist {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--bg-1);
  max-height: 340px;
  overflow-y: auto;
}

/* the create form's shorter variant (the mockup caps it at 220px) */
.org-checklist.is-compact {
  max-height: 220px;
}

.org-checklist-search {
  position: sticky;
  top: 0;
  padding: 8px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-control) var(--radius-control) 0 0;
}

.org-checklist-search input {
  width: 100%;
  box-sizing: border-box;
}

.org-checklist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.org-checklist-row:first-of-type {
  border-top: 0;
}

.org-checklist-row:hover {
  background: var(--bg-3);
}

/* The author display:flex above beats the UA's [hidden] rule — without
   this the checklist search's row.hidden would hide nothing. */
.org-checklist-row[hidden] {
  display: none;
}

.org-checklist-row input[type="checkbox"] {
  flex: none;
}

.org-checklist-name {
  flex: 1;
  font-size: 12.5px;
  color: var(--text-2);
}

.org-checklist-row.is-checked .org-checklist-name {
  color: var(--text-1);
}

/* the row's whereabouts mark: «в территории» / «свободен» */
.org-checklist-row .org-here {
  font-size: 10.5px;
  color: var(--text-3);
}

/* --- The territory row's inline assign form (mockup v3) ---------------------
   Id, caption and the current holder on the left; the manager select with
   its buttons on the right — one row until the viewport says otherwise.
   The owner drops the overview's margin-left:auto it carries there. */
.assign-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.assign-row .org-owner {
  margin-left: 0;
}

.assign-row select {
  width: auto;
}

.assign-caption {
  color: var(--text-2);
}

/* The inline territory checkbox chips (mockup v3): the transfer row's one
   line pick and the same control in the create/edit forms — a wrapped
   row, no picker. */
.transfer-set {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.transfer-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-chip);
  cursor: pointer;
  white-space: nowrap;
}

.transfer-check:hover {
  background: var(--bg-3);
}

.transfer-check input {
  margin: 0;
  accent-color: var(--accent);
}

.transfer-check .org-checklist-name {
  color: var(--text-1);
  font-weight: 500;
}

/* The transfer submit rides enabled in the markup (no-JS submits to the
   route's own refusal); JS disables it until the form is ready. */
.assign-row button[type="submit"]:disabled {
  opacity: 0.45;
}

/* The new-position fold takes its own full row inside the horizontal
   manager form. */
.m-create > .org-inline-add {
  flex: 1 1 100%;
}

.assign-spacer {
  flex: 1;
}

/* --- The managers list (mockup v3) ----------------------------------------- */

/* the list's toolbar: search + the status segment + the summary */
.list-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.list-toolbar input[type="search"] {
  width: 260px;
}

.list-toolbar .org-seg {
  flex: none;
}

.list-summary {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-3);
}

/* the identity column: avatar initials, the name, the role under it */
.m-id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}

.m-avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.m-name {
  display: block;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.25;
}

.m-role {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* the status pill */
.m-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  white-space: nowrap;
}

.m-status .org-dot {
  display: inline-block;
}

.m-status.is-active {
  border-color: rgba(79, 206, 117, 0.35);
  color: var(--ok-text);
  background: rgba(79, 206, 117, 0.08);
}

/* a deactivated manager's whole row reads retired — never deleted */
tr.m-inactive td {
  opacity: 0.55;
}

tr.m-inactive .m-avatar {
  border-style: dashed;
}

/* the add-manager form: horizontal fields, one row on wide screens */
.m-create {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.m-create .field {
  flex: 1 1 200px;
  margin: 0;
}

.m-create .field.m-narrow {
  flex: 0 0 160px;
}

.m-create .check {
  flex: none;
  align-self: center;
}

.m-create .btn {
  align-self: center;
}

/* --- The org tables ---------------------------------------------------------
   The org-structure tables carry class="org-table": cells center
   vertically (the standing table requirement) and the action column reads
   as ONE horizontal row — the global td.row-actions stacks vertically for
   /users, and its margin-top tilts a horizontal row off-center. */
.org-page table.org-table th,
.org-page table.org-table td {
  vertical-align: middle;
}

.org-page table.org-table td.m-num,
.org-page table.org-table th.m-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.org-page table.org-table td.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.org-page table.org-table td.row-actions > * + * {
  margin-top: 0;
}

/* --- Collapsed create panels ------------------------------------------------
   Rare, quarterly forms: native <details>, keyboard-open, opening on
   their own refusal (the template adds `open` when this form's submitted
   values are on the re-render). */

.org-add {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--bg-2);
}

.org-add > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border-radius: var(--radius-card);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  transition: color 0.15s ease;
}

.org-add > summary::-webkit-details-marker {
  display: none;
}

.org-add > summary:hover {
  color: var(--text-1);
}

.org-add > summary svg {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--accent-text);
}

.org-add[open] > summary {
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  color: var(--text-1);
}

.org-add > .panel-body {
  padding-top: 16px;
}

/* The «add a position» fold inside the manager form: one concept (the
   position), one extension point — not a second always-open field. */
.org-inline-add {
  margin: 0 0 14px;
}

.org-inline-add > summary {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent-text);
  font-size: 12.5px;
  cursor: pointer;
  list-style: none;
}

.org-inline-add > summary::-webkit-details-marker {
  display: none;
}

.org-inline-add > summary svg {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  margin-right: 5px;
}

.org-inline-add > summary:hover {
  color: #a5bcff;
}

/* The registry's two add forms side by side on wide screens, stacked on
   narrow ones. */
.org-inline-form {
  flex: 1 1 280px;
  max-width: 420px;
}
