/* Каталог запчастей — стиль по макетам docs/design/ (Apple-подобный). */
:root {
  --bg: #F5F5F7;
  --card: #FFFFFF;
  --text: #1D1D1F;
  --text-2: #6E6E73;
  --text-3: #86868B;
  --accent: #0071E3;
  --accent-soft: #E8F1FC;
  --sel: #EEF4FD;
  --line: #E5E5EA;
  --fill: #F0F0F3;
  --fill-2: #E8E8ED;
  --warn: #B25000;
  --warn-soft: #FFF1E0;
  --ok: #1E7E34;
  --ok-soft: #E3F4E6;
  --danger: #D70015;
  --radius: 14px;
  --radius-s: 10px;
  --bar-h: 64px;
  --tap: 44px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 12px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
input { font: inherit; color: inherit; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.muted { color: var(--text-2); }
.hidden { display: none !important; }

/* ---------- Верхняя панель ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--bar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  background: rgba(245,245,247,.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 17px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: #1D1D1F; display: grid; place-items: center; }
.brand-mark i { width: 13px; height: 13px; border-radius: 3.5px; background: #FFE600; display: block; }
.searchbox { flex: 1; max-width: 760px; position: relative; }
.searchbox input {
  width: 100%; height: 38px; border: 0; border-radius: var(--radius-s);
  background: var(--fill-2); padding: 0 14px 0 38px; outline: none; font-size: 15px;
}
.searchbox input:focus { background: #fff; box-shadow: 0 0 0 3px rgba(0,113,227,.25); }
.searchbox svg { position: absolute; left: 12px; top: 10px; color: var(--text-2); }
.topbar .spacer { flex: 1; }

/* Сегментный переключатель */
.seg { display: inline-flex; background: var(--fill-2); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button {
  border: 0; background: transparent; min-height: 32px; padding: 0 14px; border-radius: 7px;
  font-size: 14px; font-weight: 500; cursor: pointer; color: var(--text);
}
.seg button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.seg.wide { display: flex; width: 100%; }
.seg.wide button { flex: 1; min-height: 36px; }

/* Кнопки-пилюли */
.pill {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  min-height: var(--tap); padding: 0 20px; border-radius: 999px; border: 0;
  background: var(--fill-2); color: var(--text); font-weight: 500; font-size: 15px; cursor: pointer; white-space: nowrap;
}
.pill:hover { background: #DEDEE3; text-decoration: none; }
.pill.primary { background: var(--accent); color: #fff; }
.pill.primary:hover { background: #0077ED; }
.pill.small { min-height: 34px; padding: 0 14px; font-size: 14px; }
.pill[disabled] { opacity: .45; cursor: default; }
.iconbtn {
  width: var(--tap); height: var(--tap); border: 0; border-radius: 12px; background: transparent;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--text);
}
.iconbtn:hover { background: var(--fill); }

/* ---------- Раскладка компьютера ---------- */
.layout {
  display: grid; gap: 24px; padding: 24px;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  align-items: start; max-width: 1920px; margin: 0 auto;
}
.layout.no-right { grid-template-columns: 300px minmax(0, 1fr); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.side { position: sticky; top: calc(var(--bar-h) + 24px); max-height: calc(100vh - var(--bar-h) - 48px); display: flex; flex-direction: column; }
.side .card { display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 20px 20px 12px; border-bottom: 1px solid var(--line); }
.label-caps { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); margin-bottom: 10px; }
.select {
  position: relative; display: block;
}
.select select {
  appearance: none; width: 100%; height: var(--tap); border: 0; border-radius: var(--radius-s);
  background: var(--fill); padding: 0 40px 0 16px; font: inherit; font-weight: 600; font-size: 16px; color: var(--text); cursor: pointer;
}
.select svg { position: absolute; right: 14px; top: 15px; pointer-events: none; color: var(--text-2); }
.tree { overflow: auto; padding: 8px 10px 14px; flex: 1; min-height: 0; }
.tree-row {
  display: flex; align-items: center; gap: 6px; min-height: 40px; border-radius: 10px;
  padding: 4px 10px 4px 0; cursor: pointer; color: var(--text); font-size: 15px; user-select: none;
}
.tree-row:hover { background: var(--fill); text-decoration: none; }
.tree-row.on { background: var(--sel); color: var(--accent); font-weight: 600; }
.tree-row .tw { width: 22px; height: 22px; flex: none; display: grid; place-items: center; color: var(--text-3); border-radius: 6px; }
.tree-row .tw svg { transition: transform .15s; }
.tree-row .tw.open svg { transform: rotate(90deg); }
.tree-row .pos { color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 28px; }
.tree-row.on .pos { color: var(--accent); opacity: .8; }
.tree-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tree-row .art { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.tree-more { padding: 6px 10px; font-size: 13px; color: var(--text-2); }

.main { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 15px; }
.crumbs .sep { color: var(--text-3); }
.crumbs span.last { color: var(--text-2); }
.page-head { display: flex; align-items: flex-end; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.page-head h1 { font-size: 34px; line-height: 1.12; letter-spacing: -.02em; margin: 6px 0 6px; font-weight: 700; }
.page-head .sub { color: var(--text-2); font-size: 16px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Схема ---------- */
.schema-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.schema-bar .tabs { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.chip {
  min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.chip.on { border-color: var(--text); box-shadow: 0 0 0 1px var(--text) inset; }
.chip:not(.on) { color: var(--text-2); font-weight: 500; }
.schema-view {
  position: relative; height: 520px; overflow: hidden; background: #fff; border-radius: 0 0 var(--radius) var(--radius);
  touch-action: none; cursor: grab;
}
.schema-view.drag { cursor: grabbing; }
.schema-view img { position: absolute; left: 0; top: 0; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; max-width: none; }
.schema-view .hint { position: absolute; right: 12px; bottom: 10px; font-size: 12px; color: var(--text-3); background: rgba(255,255,255,.85); padding: 3px 8px; border-radius: 6px; pointer-events: none; }
.schema-meta { position: absolute; left: 12px; bottom: 10px; font-size: 12px; color: var(--text-2); background: rgba(255,255,255,.85); padding: 3px 8px; border-radius: 6px; }
.schema-card:fullscreen { border-radius: 0; display: flex; flex-direction: column; }
.schema-card:fullscreen .schema-view { flex: 1; height: auto !important; border-radius: 0; }
.schema-card.fs-fallback { position: fixed; inset: 0; z-index: 100; border-radius: 0; display: flex; flex-direction: column; }
.schema-card.fs-fallback .schema-view { flex: 1; height: auto; }
.loading-ph { display: grid; place-items: center; height: 100%; color: var(--text-3); }

.notice { display: flex; gap: 16px; align-items: center; padding: 18px 20px; }
.notice .ic { width: 44px; height: 44px; border-radius: 10px; background: var(--fill); display: grid; place-items: center; color: var(--text-2); flex: none; }
.notice b { display: block; font-size: 16px; }
.notice .muted { font-size: 15px; }
.notice.warn .ic { background: var(--warn-soft); color: var(--warn); }
.notice.ok .ic { background: var(--ok-soft); color: var(--ok); }

/* Шторка: схема сверху, таблица снизу, общая высота — до низа окна */
.split { display: flex; flex-direction: column; min-height: 480px; }
.split-schema { flex: none; min-height: 0; }
.schema-card.fill { height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.schema-card.fill .schema-view { flex: 1; height: auto; min-height: 0; }
.schema-card.fill .schema-bar { flex: none; }
.split-handle {
  flex: none; height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 8px 0 20px; margin: 4px 0;
  cursor: row-resize; touch-action: none; user-select: none; border-radius: 12px;
}
.split-handle:hover, .split-handle:focus-visible { background: rgba(0,0,0,.04); }
.split-handle:focus-visible { outline: 3px solid rgba(0,113,227,.35); }
.split-handle h2 { margin: 0; font-size: 18px; font-weight: 700; }
.split-handle .cnt { font-size: 13px; white-space: nowrap; }
.split-handle .grip { flex: 1; display: flex; justify-content: center; }
.split-handle .grip::before { content: ""; width: 44px; height: 5px; border-radius: 3px; background: #C7C7CC; }
.split-handle:hover .grip::before { background: #AEAEB2; }
.split-handle .filter { width: 260px; max-width: 30%; cursor: auto; }
.split-table { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.split-table .tbl-wrap { flex: 1; max-height: none; }
.split table.parts td { padding: 5px 8px; line-height: 1.35; }
.split table.parts th { padding: 9px 8px; }
/* Над шторкой — компактный заголовок, чтобы таблице досталось больше места */
.main:has(.split) { gap: 12px; }
.main:has(.split) .page-head h1 { font-size: 28px; margin: 2px 0 2px; }
.main:has(.split) .page-head .sub { font-size: 15px; }
.split table.parts .dn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }

/* ---------- Таблица деталей ---------- */
.tbl-head { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.tbl-head h2 { margin: 0; font-size: 20px; font-weight: 700; flex: 1; }
.filter { position: relative; width: 340px; max-width: 50%; }
.filter input { width: 100%; height: 36px; border: 0; border-radius: var(--radius-s); background: var(--fill); padding: 0 12px 0 34px; outline: none; }
.filter input:focus { box-shadow: 0 0 0 3px rgba(0,113,227,.25); background: #fff; }
.filter svg { position: absolute; left: 11px; top: 10px; color: var(--text-2); }
.tbl-wrap { overflow: auto; max-height: 70vh; }
table.parts { width: 100%; border-collapse: collapse; font-size: 15px; }
table.parts th {
  position: sticky; top: 0; z-index: 1; background: #fff; text-align: left; font-weight: 500; color: var(--text-2);
  font-size: 14px; padding: 12px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.parts td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.parts tr:last-child td { border-bottom: 0; }
table.parts th:first-child, table.parts td:first-child { padding-left: 20px; }
table.parts th:last-child, table.parts td:last-child { padding-right: 20px; }
table.parts tbody tr { cursor: pointer; }
table.parts tbody tr:hover td { background: #FAFAFC; }
table.parts tbody tr.sel td { background: var(--sel); }
table.parts .c-pos { color: var(--text-2); width: 56px; font-variant-numeric: tabular-nums; }
table.parts .c-sbn { width: 52px; }
table.parts .c-art { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.parts .c-qty { text-align: right; width: 64px; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.parts th.c-qty { text-align: right; }
table.parts .c-txt { color: var(--text-2); }
table.parts .c-txt .ell { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.parts .c-rem { color: var(--text-2); white-space: nowrap; }
table.parts .c-num { color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.parts .c-desc { min-width: 180px; }
table.parts tr.ns .c-desc, table.parts tr.ns .c-art { color: var(--text-2); }
table.parts .sub-link { font-weight: 500; }
.tbl-foot { padding: 14px 20px; color: var(--text-2); font-size: 14px; border-top: 1px solid var(--line); }
.sbn { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: 14px; }
.badge-ns { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: var(--fill-2); color: var(--text-2); font-size: 13px; font-weight: 600; }
.repl { display: block; font-size: 13px; color: var(--warn); margin-top: 2px; }
.repl a { color: var(--accent); }
.folder { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Карточка детали справа ---------- */
.right { position: sticky; top: calc(var(--bar-h) + 24px); display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - var(--bar-h) - 48px); overflow: auto; }
.pc { padding: 22px; }
.pc .kicker { font-size: 13px; color: var(--text-2); }
.pc h3 { font-size: 26px; line-height: 1.15; margin: 6px 0 8px; font-weight: 700; letter-spacing: -.01em; }
.pc .art { font-size: 18px; font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.tile { background: var(--fill); border-radius: 12px; padding: 12px 14px; min-height: 72px; }
.tile .k { font-size: 13px; color: var(--text-2); }
.tile .v { font-size: 17px; font-weight: 600; margin-top: 4px; overflow-wrap: anywhere; }
.list { padding: 0; margin: 0; list-style: none; }
.list > li > a, .list > li > .li, .list > li > button {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 20px; color: var(--text);
  border: 0; background: none; width: 100%; text-align: left; cursor: pointer; font-size: 16px;
}
.list > li + li { border-top: 1px solid var(--line); }
.list > li > a:hover { background: #FAFAFC; text-decoration: none; }
.list .grow { flex: 1; min-width: 0; }
.list .val { color: var(--text-2); font-size: 15px; white-space: nowrap; }
.list .chev { color: var(--text-3); flex: none; }
.list .t2 { display: block; color: var(--text-2); font-size: 14px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.list .lead { color: var(--text-2); width: 40px; flex: none; font-variant-numeric: tabular-nums; }
.empty-pc { padding: 28px 22px; color: var(--text-2); text-align: center; }

/* ---------- Страницы-списки (главная, поиск, деталь, инструменты) ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; display: flex; flex-direction: column; gap: 20px; }
.page h1 { font-size: 34px; letter-spacing: -.02em; margin: 0; }
.page h2 { font-size: 22px; margin: 8px 0 0; }
.section-title { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); margin: 10px 4px -6px; }
.grid-div { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.div-card { display: flex; flex-direction: column; gap: 6px; padding: 22px; color: var(--text); min-height: 132px; transition: transform .12s, box-shadow .12s; }
.div-card:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.div-card .ic { width: 44px; height: 44px; border-radius: 12px; background: #1D1D1F; display: grid; place-items: center; margin-bottom: 8px; }
.div-card .ic i { width: 18px; height: 18px; border-radius: 5px; background: #FFE600; }
.div-card .ic.tool { background: var(--accent-soft); color: var(--accent); }
.div-card b { font-size: 19px; }
.div-card span { color: var(--text-2); }
.variants { padding: 0 20px 14px 72px; display: flex; flex-wrap: wrap; gap: 8px; }
.variants a { font-size: 13px; padding: 6px 10px; background: var(--fill); border-radius: 8px; color: var(--text); font-variant-numeric: tabular-nums; }
.variants a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 16px 20px; }
.chain .node { padding: 6px 12px; border-radius: 10px; background: var(--fill); font-variant-numeric: tabular-nums; }
.chain .node.final { background: var(--accent-soft); }
.doc-row .tag { font-size: 12px; font-weight: 700; color: var(--text-2); background: var(--fill); border-radius: 6px; padding: 3px 7px; flex: none; min-width: 42px; text-align: center; }
.doc-hist { padding: 0 20px 12px 74px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.serial { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 20px; }
.serial input { height: var(--tap); border: 0; border-radius: var(--radius-s); background: var(--fill); padding: 0 14px; width: 220px; outline: none; font-variant-numeric: tabular-nums; }
.serial input:focus { box-shadow: 0 0 0 3px rgba(0,113,227,.25); background: #fff; }
.serial .lbl { font-weight: 600; margin-right: 4px; }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; font-size: 15px; flex-wrap: wrap; }
.banner.ok { background: var(--ok-soft); color: #145A24; }
.banner.warn { background: var(--warn-soft); color: #7A3700; }
.banner .grow { flex: 1; }
.err { padding: 40px; text-align: center; color: var(--text-2); }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--fill-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Нижнее меню и шторки (телефон) ---------- */
.tabbar { display: none; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 60; }
.sheet { position: fixed; z-index: 61; right: 0; top: 0; bottom: 0; width: min(400px, 100%); background: var(--bg); overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; box-shadow: -10px 0 40px rgba(0,0,0,.12); }
.m-back { display: none; }

/* Планшет: карточка детали — шторкой справа */
@media (max-width: 1279px) {
  .layout, .layout.no-right { grid-template-columns: 280px minmax(0, 1fr); }
  .layout > .right { display: none; }
}

/* Телефон */
@media (max-width: 819px) {
  body { font-size: 16px; }
  .topbar { display: none; }
  .layout, .layout.no-right { display: block; padding: 0 16px 100px; }
  .side { display: none; }
  .main { gap: 16px; }
  .crumbs { display: none; }
  .m-back { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding-top: env(safe-area-inset-top); }
  .m-back a { display: inline-flex; align-items: center; gap: 2px; font-size: 19px; min-height: var(--tap); }
  .page-head h1 { font-size: 32px; margin-top: 4px; }
  .page-head .actions { display: none; }
  .page { padding: 12px 16px 100px; }
  .page h1 { font-size: 32px; }
  .schema-bar { padding: 10px 12px; }
  .schema-view { height: 300px; }
  .schema-view .hint { display: none; }
  .tbl-head { display: none; }
  .tbl-wrap { max-height: none; }
  .filter { width: 100%; max-width: none; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(248,248,250,.85); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid rgba(0,0,0,.1); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; color: var(--text-2); min-height: 56px; }
  .tabbar a.on { color: var(--accent); }
  .tabbar a:hover { text-decoration: none; }
  .variants { padding-left: 20px; }
  .doc-hist { padding-left: 20px; }
  .serial input { flex: 1; width: auto; }
}
/* Строки iOS-списка вместо таблицы на телефоне */
.mrow { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 64px; color: var(--text); cursor: pointer; }
.mrow:hover { text-decoration: none; background: #FAFAFC; }
.mrow + .mrow { border-top: 1px solid var(--line); }
.mrow .lead { width: 34px; color: var(--text-2); flex: none; font-variant-numeric: tabular-nums; }
.mrow .grow { flex: 1; min-width: 0; }
.mrow .t1 { font-size: 17px; }
.mrow .t2 { color: var(--text-2); font-size: 15px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.mrow.ns .t1 { color: var(--text-2); }

/* ---------- Этап 5а: вход, «+», списки, окна, админка ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pill.wide { width: 100%; }
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 24px 16px 48px; }
.auth-top { width: 100%; max-width: 460px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.auth-card { width: 100%; max-width: 460px; padding: 32px 28px; }
.auth-card h1 { font-size: 30px; letter-spacing: -.02em; margin: 0 0 6px; }
.auth-card > p { margin: 0 0 18px; }
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-2); }
.field input, .modal textarea {
  height: var(--tap); border: 0; border-radius: var(--radius-s); background: var(--fill); padding: 0 14px; font-size: 16px;
  color: var(--text); outline: none;
}
.modal textarea { height: auto; padding: 12px 14px; resize: vertical; width: 100%; font: inherit; }
.field input:focus, .modal textarea:focus { background: #fff; box-shadow: 0 0 0 3px rgba(0,113,227,.25); }
.field small { font-size: 13px; }
.auth-links { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; }
.auth-links a { min-height: 36px; display: flex; align-items: center; }

.listbtn { white-space: nowrap; }
.avatar-wrap { position: relative; }
.avatar { width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: var(--fill-2); font-weight: 600; cursor: pointer; }
.avatar:hover { background: #DEDEE3; }
.sheet-bg.clear { background: transparent; }
.menu { position: absolute; right: 0; top: 52px; z-index: 62; min-width: 260px; padding: 8px; display: flex; flex-direction: column; }
.menu-head { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu a, .menu button { min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 10px; color: var(--text);
  background: none; border: 0; text-align: left; cursor: pointer; font-size: 15px; }
.menu a:hover, .menu button:hover { background: var(--fill); text-decoration: none; }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 90; display: flex; flex-direction: column; gap: 8px;
  width: min(560px, calc(100% - 32px)); pointer-events: none; }
.toast { background: rgba(29,29,31,.92); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 15px; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.toast.warn { background: #7A3700; }
.toast.err { background: var(--danger); }
.modal { position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 32px));
  max-height: calc(100vh - 64px); overflow: auto; padding: 22px; }
.modal h3 { margin: 0 0 6px; font-size: 21px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* «+» в строках (макеты 112 и «Телефон») */
table.parts .c-add { width: 56px; text-align: right; }
.addbtn { width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: var(--accent-soft); color: var(--accent);
  display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.addbtn:hover { background: #D6E7FA; }
.addbtn:active { transform: scale(.94); }
.addbtn.off { background: var(--fill); color: #C7C7CC; cursor: default; }
.split table.parts .addbtn { width: 36px; height: 36px; }
.split table.parts .c-add { padding-top: 2px; padding-bottom: 2px; }

/* Списки подбора */
.lists-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
.lists-side .list a.on { background: var(--sel); color: var(--accent); }
.lists-main { display: flex; flex-direction: column; gap: 14px; }
.lists-main .page-head h1 { font-size: 30px; }
.hint-line { font-size: 14px; }
.tag-cur { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
.plus-ic { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.pick-row { gap: 12px; }
.stepper { display: inline-flex; align-items: center; background: var(--fill); border-radius: 12px; }
.stepper input { width: 64px; height: 36px; border: 0; background: #fff; border-radius: 8px; text-align: center; font-variant-numeric: tabular-nums; font-size: 16px; }
.stepper .iconbtn { width: 40px; height: 40px; }
.list-foot { display: flex; gap: 10px; }
.list button.on { background: var(--sel); }

/* Админка */
.admin-page { max-width: 1400px; }
table.adm td { vertical-align: top; }
table.adm .ell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-row { flex-wrap: wrap; }
.adm-act { white-space: nowrap; }
.adm-act .pill { margin: 2px; }
select.mini { height: 34px; border: 0; border-radius: 8px; background: var(--fill); padding: 0 8px; font: inherit; font-size: 14px; }
.badge-ns.warnb { background: var(--warn-soft); color: var(--warn); }
.report b { font-weight: 600; }

/* Нижнее меню: счётчик на «Списках» */
.tb-ic { position: relative; display: inline-block; }
.tb-ic .badge { position: absolute; top: -6px; right: -12px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }

@media (max-width: 1279px) { .listbtn { padding: 0 12px; } }
@media (max-width: 819px) {
  .lists-grid { display: block; }
  .lists-main .page-head .actions { display: flex !important; }
  .pick-row { flex-wrap: wrap; }
  .auth-card { padding: 24px 20px; }
  .toasts { bottom: 84px; }
  .mrow .addbtn { margin-left: 4px; }
}
/* «+» всегда виден: колонка закреплена у правого края таблицы, даже когда таблица шире карточки */
table.parts th.c-add, table.parts td.c-add { position: sticky; right: 0; background: #fff; box-shadow: -10px 0 10px -10px rgba(0,0,0,.12); }
table.parts tbody tr:hover td.c-add { background: #FAFAFC; }
table.parts tbody tr.sel td.c-add { background: var(--sel); }

/* ---------- Офлайн (этап 5б) ---------- */
.offline-bar {
  position: sticky; top: var(--bar-h); z-index: 29;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 7px 16px; font-size: 14px; font-weight: 500; text-align: center;
  background: #3A3A3C; color: #fff;
}
.offline-bar.sync { background: var(--accent-soft); color: var(--accent); }
.offline-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px; }
.offline-box .grow { flex: 1; min-width: 220px; }
.offline-box .t2 { display: block; color: var(--text-2); font-size: 14px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.offline-box progress { flex: 1 1 100%; height: 6px; accent-color: var(--accent); }
.pill.on { background: var(--ok-soft); color: #145A24; }
@media (max-width: 819px) {
  .offline-bar { top: 0; padding: calc(6px + env(safe-area-inset-top)) 16px 6px; font-size: 13px; }
}
