/* ====== Science Publications · Design System v2 ====== */
:root {
  /* Палитра */
  --bg: #fafbfc;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --border: #e6e8eb;
  --border-strong: #d3d7dc;
  --text: #1a1d21;
  --text-muted: #5b6470;
  --text-soft: #8a939f;

  --brand: #2d5bff;
  --brand-hover: #1e44cc;
  --brand-soft: #eaf0ff;

  --green: #15a36b;
  --green-soft: #e4f6ed;
  --amber: #d98e1c;
  --amber-soft: #fdf3df;
  --red: #d93b3b;
  --red-soft: #fbe5e5;
  --slate: #6b7785;
  --slate-soft: #eef0f3;
  --purple: #7950d8;
  --purple-soft: #efe9fd;

  /* Геометрия */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --sb-w: 240px;
  --shadow-1: 0 1px 2px rgba(20, 28, 40, 0.04);
  --shadow-2: 0 4px 16px rgba(20, 28, 40, 0.06);

  /* Шрифты */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-serif: 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
  /* Постоянное место под вертикальный scrollbar — страницы не «дёргаются» при переходах */
  scrollbar-gutter: stable;
}

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0 0 .75rem;
}
h1 { font-size: 1.75rem; line-height: 1.2; }
h2 { font-size: 1.3rem; line-height: 1.3; }
h3 { font-size: 1.05rem; line-height: 1.4; }
.serif, .article-body { font-family: var(--font-serif); }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }

/* ====== Боковая панель ====== */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sb-w);
  background: #ffffff;
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 14px;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar .brand:hover { color: var(--text); }
.brand-mark {
  width: 28px; height: 28px;
  background: var(--brand);
  color: #fff;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.sidebar .quick {
  background: var(--brand);
  color: #fff !important;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-1);
  transition: background .15s;
}
.sidebar .quick:hover { background: var(--brand-hover); }
.sidebar .quick svg { width: 16px; height: 16px; }

.sidebar .nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13.5px;
  transition: all .12s;
}
.sidebar .nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar .nav-link:hover { background: var(--surface-2); color: var(--text); }
.sidebar .nav-link.is-active {
  background: var(--brand-soft);
  color: var(--brand);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--purple-soft); color: var(--purple);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.user-text { display: flex; flex-direction: column; min-width: 0; }
.user-name {
  font-size: 12.5px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-logout { font-size: 11.5px; color: var(--text-soft); }
.user-logout:hover { color: var(--red); }

/* ====== Main ====== */
.app-main { margin-left: var(--sb-w); min-height: 100vh; }
.content {
  padding: 28px 40px;
  max-width: 2200px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
html, body { max-width: 100%; overflow-x: hidden; }
.app-main { max-width: 100%; min-width: 0; }
/* таблицы и широкий контент не должны распирать страницу */
.content table { max-width: 100%; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > table { margin: 0; }

@media (max-width: 900px) {
  :root { --sb-w: 0; }
  .sidebar { transform: translateX(-100%); }
  .app-main { margin-left: 0; }
  .content { padding: 20px 16px; }
}

/* ====== Auth ====== */
.auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #fafbfc, #eef1f6);
}
.auth-shell .card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: 32px;
  width: 100%;
  max-width: 380px;
}

/* ====== Flash ====== */
.flash {
  position: relative;
  padding: 10px 36px 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 13.5px;
  border: 1px solid transparent;
}
.flash-success { background: var(--green-soft); color: #0d6c47; border-color: rgba(21,163,107,.2); }
.flash-danger, .flash-error  { background: var(--red-soft); color: #8a1d1d; border-color: rgba(217,59,59,.2); }
.flash-warning { background: var(--amber-soft); color: #7a5210; border-color: rgba(217,142,28,.2); }
.flash-info { background: var(--brand-soft); color: #1e3da3; border-color: rgba(45,91,255,.15); }
.flash-close {
  position: absolute; right: 8px; top: 6px;
  background: transparent; border: 0; font-size: 18px; line-height: 1;
  color: inherit; opacity: .55; cursor: pointer;
}
.flash-close:hover { opacity: 1; }

/* ====== Cards ====== */
.card, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.panel-pad { padding: 18px 20px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2, .panel-head h3 { margin: 0; }
.panel-body { padding: 18px 20px; }

/* ====== Buttons ====== */
.btn, .btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  transition: all .12s;
  text-decoration: none;
}
.btn svg, .btn-primary svg, .btn-secondary svg, .btn-ghost svg, .btn-danger svg { width: 14px; height: 14px; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b62a2a; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 18px; font-size: 14px; }

/* Bootstrap-style fallback */
.btn-success { background: var(--green); color: #fff; border: 0; }
.btn-success:hover { background: #0e8254; color: #fff; }

/* ====== Inputs ====== */
.form-control, .form-select, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="url"], input[type="tel"], input[type="date"], input[type="datetime-local"], input:not([type]), textarea, select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
.form-control:focus, .form-select:focus, input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(45, 91, 255, .15);
}
label, .form-label {
  display: block;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.form-text { font-size: 12px; color: var(--text-soft); margin-top: 4px; }

/* ====== Tables ====== */
table.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table thead th {
  background: var(--surface-2);
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-soft);
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table tbody td {
  padding: 11px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table-compact tbody td { padding: 7px 12px; }

/* ====== Badges / pills ====== */
.badge, .pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1.5;
}
.pill-green { background: var(--green-soft); color: #0d6c47; }
.pill-amber { background: var(--amber-soft); color: #7a5210; }
.pill-red   { background: var(--red-soft); color: #8a1d1d; }
.pill-slate { background: var(--slate-soft); color: var(--slate); }
.pill-brand { background: var(--brand-soft); color: var(--brand); }
.pill-purple { background: var(--purple-soft); color: var(--purple); }
.pill-outline { background: #fff; border-color: var(--border-strong); color: var(--text-muted); }

/* ====== Stage chips for kanban ====== */
.stage-chip { font-weight: 600; font-size: 11px; padding: 3px 8px; }
.stage-idea            { background: var(--slate-soft); color: var(--slate); }
.stage-journal_selection { background: var(--purple-soft); color: var(--purple); }
.stage-drafting        { background: var(--amber-soft); color: #7a5210; }
.stage-qa              { background: var(--brand-soft); color: var(--brand); }
.stage-submitted       { background: #e7f3ff; color: #1056b8; }
.stage-under_review    { background: #fff3e0; color: #b76a00; }
.stage-revision_required { background: #fde6cf; color: #9a4a07; }
.stage-accepted        { background: var(--green-soft); color: #0d6c47; }
.stage-published       { background: #d6f3e3; color: #08593a; }
.stage-rejected        { background: var(--red-soft); color: #8a1d1d; }

/* ====== Stats ====== */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-1);
}
.stat-label { font-size: 11.5px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat-num { font-size: 1.6rem; font-weight: 700; color: var(--text); margin-top: 4px; }
.stat-hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ====== Kanban ====== */
.kanban {
  display: flex;
  gap: 10px;
  padding-bottom: 10px;
  align-items: flex-start;
}
.kanban-col {
  flex: 1 1 0;
  min-width: 0;            /* позволяет колонкам сжиматься и вписываться без горизонтального скролла */
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 8px;
  min-height: 160px;
  max-height: calc(100vh - 230px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
/* подсветка колонки-цели при перетаскивании */
.kanban-col.drag-over {
  outline: 2px dashed var(--brand);
  outline-offset: -2px;
  background: var(--brand-soft);
}
.kanban-card.dragging { opacity: .45; }
.kanban-card { cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-col-body { flex: 1; overflow-y: auto; }
.kanban-col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px 10px;
}
.kanban-col-title { font-size: 12.5px; font-weight: 600; color: var(--text); }
.kanban-col-count { font-size: 11.5px; color: var(--text-soft); background: var(--surface); border-radius: 999px; padding: 1px 8px; }
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-1);
  transition: box-shadow .12s, transform .12s;
  display: block;
  color: var(--text);
}
.kanban-card:hover { box-shadow: var(--shadow-2); color: var(--text); transform: translateY(-1px); }
.kanban-card-title { font-size: 12.5px; font-weight: 600; line-height: 1.35; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kanban-card-meta { font-size: 11.5px; color: var(--text-soft); display: flex; gap: 8px; flex-wrap: wrap; }

/* ====== Tabs ====== */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
}
.tab svg { width: 15px; height: 15px; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }

/* ====== Page header ====== */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head .page-title { margin: 0; }
.page-head .page-sub { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ====== Mail Gmail-style ====== */
.mail-shell {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: calc(100vh - 100px);
}
.mail-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  max-height: calc(100vh - 100px);
}
.mail-list-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: block;
  color: inherit;
}
.mail-list-row:hover { background: var(--surface-2); color: inherit; }
.mail-list-row.is-active { background: var(--brand-soft); }
.mail-list-row.is-unread .mail-from, .mail-list-row.is-unread .mail-subj { font-weight: 600; color: var(--text); }
.mail-from { font-size: 13px; color: var(--text-muted); display: flex; justify-content: space-between; }
.mail-subj { font-size: 13px; color: var(--text); margin-top: 2px; }
.mail-snippet { font-size: 12px; color: var(--text-soft); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-thread { padding: 20px 28px; overflow-y: auto; max-height: calc(100vh - 100px); }
.mail-msg {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  background: #fff;
}
.mail-msg-head { display: flex; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.mail-msg-from { font-weight: 600; font-size: 13px; }
.mail-msg-date { font-size: 12px; color: var(--text-soft); }
.mail-msg-body { font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; }
.mail-msg-body blockquote { border-left: 3px solid var(--border-strong); padding-left: 12px; color: var(--text-muted); margin: 8px 0; }

/* ====== Misc ====== */
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
code, kbd { font-family: var(--font-mono); font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.text-muted { color: var(--text-muted) !important; }
.text-soft { color: var(--text-soft) !important; }
.muted-link { color: var(--text-muted); }
.muted-link:hover { color: var(--brand); }

/* Bootstrap overrides */
.alert { border-radius: var(--radius); border: 1px solid transparent; padding: 10px 14px; }
.alert-success { background: var(--green-soft); color: #0d6c47; border-color: rgba(21,163,107,.2); }
.alert-danger  { background: var(--red-soft); color: #8a1d1d; border-color: rgba(217,59,59,.2); }
.alert-warning { background: var(--amber-soft); color: #7a5210; border-color: rgba(217,142,28,.2); }
.alert-info    { background: var(--brand-soft); color: #1e3da3; border-color: rgba(45,91,255,.15); }
.btn-outline-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--text); }

/* ====== Mail v2 — 3 panel Gmail layout ====== */
.mail-layout {
  display: grid;
  grid-template-columns: 220px 360px 1fr;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: calc(100vh - 100px);
}
.mail-side { border-right: 1px solid var(--border); padding: 14px 10px; display:flex; flex-direction:column; gap:10px; background: var(--surface); }
.mail-search input { width:100%; padding:8px 10px; border:1px solid var(--border); border-radius: 6px; font-size:13px; }
.mail-compose-btn { justify-content:center; padding: 9px 0; }
.mail-compose-btn svg { width:15px; height:15px; }
.mail-tabs { display:flex; flex-direction:column; gap:2px; margin-top:6px; }
.mail-tab {
  display:flex; align-items:center; gap:9px;
  padding: 8px 10px; border-radius: 6px; color: var(--text);
  font-size: 13.5px; text-decoration:none;
}
.mail-tab svg { width: 16px; height:16px; opacity:.7; }
.mail-tab:hover { background: var(--surface-2); color: var(--text); }
.mail-tab.active { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.mail-tab.active svg { opacity: 1; }
.mail-tab .count { margin-left:auto; font-size: 11.5px; color: var(--text-soft); background: transparent; padding: 1px 6px; border-radius: 10px; }
.mail-tab.active .count { color: var(--brand); }
.mail-sync { margin-top:auto; padding-top:8px; border-top:1px solid var(--border); }

/* Список тредов */
.mail-list { border-right: 1px solid var(--border); overflow-y:auto; background: var(--surface); }
.thread-row {
  display:flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border);
  cursor:pointer; color: inherit; text-decoration:none;
}
.thread-row:hover { background: var(--surface-2); color: inherit; }
.thread-row.active { background: var(--brand-soft); }
.thread-row.unread .thread-from, .thread-row.unread .thread-subj { font-weight: 600; color: var(--text); }
.thread-avatar {
  width: 36px; height:36px; border-radius:50%; flex-shrink:0;
  background: var(--brand-soft); color: var(--brand);
  display:flex; align-items:center; justify-content:center;
  font-weight:600; font-size:13px;
}
.thread-body { flex:1; min-width:0; }
.thread-head { display:flex; align-items:baseline; gap:6px; }
.thread-from { font-size:13px; color: var(--text); flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.thread-cnt { font-size:11px; background: var(--surface-2); color: var(--text-muted); padding: 1px 6px; border-radius:8px; }
.thread-date { font-size:11.5px; color: var(--text-soft); }
.thread-subj { font-size:13px; color: var(--text-muted); margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.thread-preview { font-size: 12px; color: var(--text-soft); margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.thread-meta { display:flex; gap:6px; margin-top:6px; align-items:center; }
.thread-meta .ico-sm { width:13px; height:13px; opacity:.6; }
.badge {
  font-size:10.5px; padding: 1px 7px; border-radius:10px; font-weight:500;
  background: var(--surface-2); color: var(--text-muted);
}
.badge-art { background: rgba(45,91,255,.1); color: var(--brand); }
.badge-jrn { background: rgba(21,163,107,.1); color: #0d6c47; }

/* Reader */
.mail-reader { overflow-y:auto; padding: 22px 28px; background: #fff; }
.empty { display:flex; flex-direction:column; align-items:center; justify-content:center; height:100%; color: var(--text-soft); gap:8px; }
.empty svg { width: 48px; height: 48px; opacity: .3; }
.reader-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.reader-subj { font-size: 20px; font-weight: 600; margin:0; line-height:1.3; }
.reader-actions { display:flex; gap:6px; flex-wrap:wrap; }
.reader-link { display:flex; gap:8px; align-items:center; flex-wrap:wrap; background: var(--amber-soft); padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.reader-link select { padding: 5px 8px; border:1px solid var(--border-strong); border-radius:5px; font-size:13px; max-width:260px; }
.reader-link .chk { display:flex; align-items:center; gap:4px; font-size:12.5px; }

.thread-msgs { display:flex; flex-direction:column; gap: 8px; }
.msg { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.msg-head { display:flex; gap:12px; align-items:center; padding: 12px 16px; cursor:pointer; }
.msg.collapsed .msg-body { display:none; }
.msg.collapsed .msg-head { padding: 10px 16px; }
.msg-avatar { width:32px; height:32px; border-radius:50%; background: var(--brand-soft); color: var(--brand); display:flex; align-items:center; justify-content:center; font-weight:600; font-size:12px; flex-shrink:0; }
.msg-meta { flex:1; min-width:0; }
.msg-from { font-size:13.5px; }
.msg-from .muted { color: var(--text-soft); font-weight:normal; font-size:12px; }
.msg-to { font-size: 12px; margin-top:2px; }
.msg-date { font-size: 12px; color: var(--text-soft); white-space:nowrap; }
.msg-out { background: #f7faff; }
.msg-body { padding: 4px 16px 16px; }
.msg-html { font-size: 14px; line-height: 1.6; }
.msg-html img { max-width: 100%; }
.msg-text { font-family: var(--font-mono); font-size: 13px; line-height:1.55; white-space: pre-wrap; word-wrap:break-word; background: transparent; padding: 0; border: 0; }
.msg-atts { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); display:flex; flex-wrap:wrap; gap:8px; }
.att { display:inline-flex; align-items:center; gap:6px; padding: 5px 10px; background: var(--surface-2); border-radius: 6px; font-size: 12.5px; color: var(--text); text-decoration:none; border: 1px solid var(--border); }
.att:hover { background: var(--brand-soft); color: var(--brand); }
.att svg { width:13px; height:13px; }

.reply-form { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface-2); }
.reply-head { display:flex; align-items:center; gap:8px; margin-bottom: 10px; font-size: 13px; }
.reply-head svg { width:16px; height:16px; color: var(--brand); }
.reply-form textarea { width:100%; min-height: 130px; padding: 10px 12px; border:1px solid var(--border-strong); border-radius:6px; font-family: inherit; font-size: 14px; line-height: 1.6; }
.reply-actions { display:flex; gap:10px; align-items:center; margin-top:10px; }
.reply-actions input[type=file] { font-size: 12px; flex:1; }

/* ===== Конвейер этапов статьи (stage pipeline) ===== */
.stage-pipeline { display:flex; flex-wrap:wrap; gap:0; margin:10px 0 4px; }
.stage-step {
  position:relative; display:flex; align-items:center; gap:6px;
  padding:6px 14px 6px 18px; font-size:12px; font-weight:500;
  background:var(--surface-2); color:var(--text-soft);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
  margin-right:2px;
}
.stage-step:first-child { padding-left:12px; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.stage-step.done   { background:#e4f6ed; color:#0d6c47; }
.stage-step.current{ background:var(--brand); color:#fff; font-weight:700; box-shadow:0 1px 4px rgba(0,0,0,.12); }
.stage-step.done i, .stage-step.current i { width:14px;height:14px; }
.stage-step .num { font-size:10px; opacity:.65; }
/* Блок "Куда отправляется" */
.dest-card { border:1px solid var(--border-strong); border-radius:8px; padding:14px 16px; background:var(--surface); }
.dest-card .dest-row { display:flex; align-items:center; gap:8px; padding:5px 0; font-size:13.5px; }
.dest-card .dest-row i { width:16px;height:16px; color:var(--text-soft); flex:none; }
.dest-card .dest-label { color:var(--text-soft); min-width:96px; }
.dest-card code { background:var(--surface-2); padding:1px 6px; border-radius:4px; }
.dest-empty { color:var(--text-soft); font-style:italic; padding:8px 0; }

.hidden { display: none !important; }

/* === DRAFT INDICATORS === */
.draft-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #dc2626;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 0 2px rgba(220,38,38,0.18);
  flex-shrink: 0;
}
.nav-link .nav-badge {
  display: inline-block;
  margin-left: auto;
  background: #dc2626;
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  min-width: 18px;
  padding: 3px 6px;
  border-radius: 10px;
  text-align: center;
}
.nav-link { display: flex; align-items: center; gap: 8px; }
.nav-link > span:not(.nav-badge) { flex: 1; }

