:root {
  --navy: #1f3b5c;
  --navy-2: #2b4f78;
  --accent: #b8742a;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #dde3ea;
  --text: #1d2733;
  --muted: #6b7785;
  --red: #c0392b;
  --red-bg: #fdecea;
  --amber: #a86400;
  --amber-bg: #fff4e0;
  --green: #2e7d4f;
  --green-bg: #e7f5ec;
  --blue-bg: #e8f0fa;
  --radius: 8px;
}
* { box-sizing: border-box; }
/* Атрибут hidden важнее display из правил ниже (плашка КП, счётчик). */
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 14px/1.45 "Segoe UI", Calibri, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; color: var(--navy); }
h2 { font-size: 15px; margin: 0 0 10px; color: var(--navy); text-transform: uppercase; letter-spacing: .03em; }

/* шапка */
.top {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  height: 52px;
}
.brand { font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.brand span { color: #e0a868; }
.top nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.top nav a {
  color: #cfdbe8;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
}
.top nav a:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.top nav a.on { background: #fff; color: var(--navy); font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; color: #cfdbe8; white-space: nowrap; }
.who a { color: #cfdbe8; }
.who form { margin: 0; }
.who button { background: none; border: 1px solid #4d6a8c; color: #cfdbe8; padding: 4px 10px; }

main { max-width: 1280px; margin: 0 auto; padding: 20px; }

/* карточки и сетка */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 2fr 1fr; }
.g2e { grid-template-columns: 1fr 1fr; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: block; color: var(--text); }
.kpi:hover { text-decoration: none; border-color: var(--navy-2); }
.kpi .n { font-size: 30px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.kpi .l { color: var(--muted); }
.kpi.bad .n { color: var(--red); }
.kpi.good .n { color: var(--green); }
@media (max-width: 900px) {
  .g2, .g2e { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .top { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  /* Узкое окно: пункты меню переносятся на вторую строку, а не прячутся за прокруткой. */
  .top nav { order: 3; flex: 1 1 100%; flex-wrap: wrap; overflow: visible; }
  .who { margin-left: auto; }
}

/* таблицы */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.done td { color: var(--muted); }
tr.done td a { color: var(--muted); }

/* метки */
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--blue-bg); color: var(--navy); white-space: nowrap; }
.st-open { background: var(--blue-bg); color: var(--navy); }
.st-in_progress { background: var(--amber-bg); color: var(--amber); }
.st-waiting { background: #eee8f6; color: #5b3b8c; }
.st-done { background: var(--green-bg); color: var(--green); }
.st-cancelled { background: #eceff2; color: var(--muted); }
.pr-high, .pr-urgent { background: var(--red-bg); color: var(--red); }
.late { color: var(--red); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* формы */
input, select, textarea, button {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}
textarea { width: 100%; min-height: 70px; resize: vertical; }
button, .btn {
  padding: 7px 14px;
  border: 1px solid var(--navy);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.3;
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  cursor: pointer;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--navy-2); text-decoration: none; }
button.light, .btn.light { background: #fff; color: var(--navy); border-color: var(--line); }
button.light:hover { background: var(--bg); }
button.green { background: var(--green); border-color: var(--green); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 1 auto; }
.grow { flex: 1 1 200px !important; }
.form-grid { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; align-items: center; }
.form-grid label { color: var(--muted); }
.form-grid input, .form-grid select { width: 100%; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pills { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.pills a { padding: 5px 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line); color: var(--text); }
.pills a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.pills a:hover { text-decoration: none; border-color: var(--navy-2); }
.msg { padding: 10px 14px; border-radius: 6px; background: var(--green-bg); color: var(--green); margin-bottom: 12px; }
.msg.err { background: var(--red-bg); color: var(--red); }
details > summary { cursor: pointer; color: var(--navy-2); }
details[open] > summary { margin-bottom: 10px; }

/* лента */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: none; }
.feed .meta { color: var(--muted); font-size: 12px; }
.feed .body { white-space: pre-wrap; margin-top: 2px; }
.result { background: var(--green-bg); border-radius: 6px; padding: 10px 12px; white-space: pre-wrap; }
.pre { white-space: pre-wrap; }

/* вход */
.login { max-width: 360px; margin: 12vh auto; }
.login input { width: 100%; margin-bottom: 10px; }
.login button { width: 100%; padding: 10px; }
.empty { color: var(--muted); padding: 12px 0; }

/* фото товара */
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos img { max-width: 100%; max-height: 220px; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.photos > :first-child img { max-height: 280px; }
.ph-item { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.ph-actions { display: flex; gap: 6px; align-items: center; }
.thumb { object-fit: contain; border-radius: 4px; border: 1px solid var(--line); background: #fff; vertical-align: middle; }

/* ---------- каталог: разделы ---------- */
.sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.section { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; color: var(--text); transition: box-shadow .15s, transform .15s;
  border-top: 4px solid var(--sec, var(--navy)); }
.section:hover { text-decoration: none; box-shadow: 0 6px 22px rgba(31,59,92,.12); transform: translateY(-1px); }
.sec-cover { height: 150px; background: #f7f8fa; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.sec-cover .cover { width: 100%; height: 100%; object-fit: cover; }
.sec-cover .mono { font-size: 64px; font-weight: 700; color: #fff; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center; background: var(--sec, var(--navy)); opacity: .9; }
.collage { display: grid; width: 100%; height: 100%; gap: 2px; background: #fff; }
.collage.n1 { grid-template-columns: 1fr; }
.collage.n2 { grid-template-columns: 1fr 1fr; }
.collage.n3, .collage.n4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.collage img { width: 100%; height: 150px; object-fit: contain; background: #fff; padding: 6px; }
.sec-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sec-title { font-size: 17px; font-weight: 700; color: var(--navy); }
.sec-count { font-size: 12px; color: var(--muted); }
.sec-lead { font-size: 13px; color: #3c4752; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sec-subs { display: flex; flex-wrap: wrap; gap: 4px; }
.sec-foot { margin-top: auto; padding-top: 6px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.sec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px;
  padding-left: 12px; border-left: 4px solid var(--sec, var(--navy)); }
.sec-head h1 { margin: 0; }
.doc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); margin: 0; }
.doc-row:last-child { border-bottom: none; }

/* ---------- каталог: карточки товаров ---------- */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.pcard:hover { border-color: #b9c6d4; }
.pc-img { display: flex; align-items: center; justify-content: center; height: 170px; background: #fff; border-bottom: 1px solid var(--line); }
.pc-img img { max-width: 100%; max-height: 160px; object-fit: contain; }
.pc-img .ph { font-size: 44px; color: #c5ced8; font-weight: 700; }
.pc-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pc-name { font-weight: 600; color: var(--text); line-height: 1.3; }
.pc-prices { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; }
.pc-foot { margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.thumb { width: 40px; height: 40px; }

/* ---------- корзина КП ---------- */
.kp-add { padding: 4px 10px; font-size: 12px; background: #fff; color: var(--navy); border: 1px solid #b9c6d4; border-radius: 14px; white-space: nowrap; }
.kp-add:hover { background: var(--blue-bg); }
.kp-add.on { background: var(--green-bg); color: var(--green); border-color: #a9d2b7; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; text-align: center; line-height: 18px; }
.kp-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 30; background: var(--navy); color: #fff;
  border-radius: 24px; padding: 8px 10px 8px 18px; display: flex; align-items: center; gap: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.kp-bar .btn { background: #fff; color: var(--navy); border-color: #fff; border-radius: 16px; }
.kp-bar a.small { color: #cfdbe8; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg a { padding: 6px 12px; background: #fff; color: var(--muted); font-size: 13px; }
.seg a.on { background: var(--navy); color: #fff; }
.seg a:hover { text-decoration: none; }
button.small, .btn.small { padding: 4px 10px; font-size: 12px; }

/* ---------- выбор позиций в КП ---------- */
.picker { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.pick-row:last-child { border-bottom: none; }
.pick-row .thumb { width: 36px; height: 36px; flex: none; }
.thumb.ph { display: inline-block; background: repeating-linear-gradient(45deg, #f1f3f6, #f1f3f6 5px, #e7ebf0 5px, #e7ebf0 10px); }

/* ---------- калькулятор ---------- */
.calc { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .calc { grid-template-columns: 1fr; } }
.calc-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; align-content: start; }
.calc-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.calc-form label:last-child { grid-column: 1 / -1; }
.calc-form input { width: 100%; text-align: right; font-variant-numeric: tabular-nums; }
.break { font-variant-numeric: tabular-nums; font-size: 13px; }
.break div { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dotted var(--line); }
.break div:last-child { border-bottom: 0; border-top: 2px solid #b9c6d4; margin-top: 3px; padding-top: 7px; font-weight: 700; }
.break span { color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 6px; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #f7f8fa; }
.tile.hero { border-color: var(--navy); background: var(--blue-bg); }
.tile .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tile .big { font-size: 20px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.tile .sm { font-size: 11px; color: var(--muted); }
.note { background: var(--amber-bg); color: var(--amber); border-radius: 6px; padding: 8px 12px; font-size: 13px; }

/* строки КП: название — главное, ему ширину */
#rows td:first-child { width: 42%; }
#rows input[name="name"] { min-width: 260px; }

/* доска сделок */
.board { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: #eaeef3; border-radius: var(--radius); padding: 8px; min-height: 160px; }
.board-col.over { outline: 2px dashed var(--navy-2); outline-offset: -2px; }
.board-col h3 { font-size: 13px; margin: 2px 2px 8px; color: var(--navy); display: flex; justify-content: space-between; gap: 6px; }
.board-sum { font-size: 12px; color: var(--muted); margin: -4px 2px 8px; }
.deal-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin-bottom: 6px; color: var(--text); }
.deal-card:hover { text-decoration: none; border-color: var(--navy-2); }
.deal-card[draggable="true"] { cursor: grab; }
.deal-card.stale { border-left: 3px solid var(--amber); }
.deal-card b { display: block; color: var(--navy); }
@media (max-width: 900px) { .board { grid-template-columns: repeat(6, 220px); } }

/* ---------- документы ---------- */
.dtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.dtile { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fbfcfd; display: flex; flex-direction: column; gap: 4px; }
.dtile:hover { border-color: #b9c6d4; }
.dt-title { font-weight: 600; line-height: 1.3; color: var(--text); }
.tag.ext { background: #eef1f5; color: #44546a; font-weight: 600; letter-spacing: .02em; min-width: 42px; text-align: center; }
form.inline { display: inline; margin: 0; }
button.pin { background: none; border: none; font-size: 18px; line-height: 1; padding: 0 4px; color: #b3bcc7; cursor: pointer; }
button.pin:hover { color: var(--accent); }
button.pin.on { color: var(--accent); }
.doctable td { vertical-align: top; }
.nowrap { white-space: nowrap; }

.checks { display: flex; flex-direction: column; gap: 3px; }
.checks label { display: flex; gap: 6px; align-items: center; font-weight: normal; }

/* ---------- список компаний и карточка: сведения столбцами ---------- */
main.wide { max-width: 1680px; padding-left: 12px; padding-right: 12px; }
table.biglist th { vertical-align: bottom; }
table.biglist td { vertical-align: top; padding-top: 8px; padding-bottom: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
/* Разделители — тенями ячеек, а не фоном сетки: пустые ячейки в последней строке остаются белыми. */
.facts > div { padding: 10px 14px; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.facts .lbl { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }

.bulkbar { background: var(--blue-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; }
select.kindsel { padding: 3px 6px; font-size: 12px; max-width: 150px; }

/* Столбцы списка компаний: длинные названия, почты и телефоны переносятся, а не растягивают таблицу. */
table.biglist th, table.biglist td { padding-left: 7px; padding-right: 7px; }
table.biglist td.c-name { min-width: 160px; max-width: 210px; overflow-wrap: anywhere; }
table.biglist td.c-person { max-width: 170px; overflow-wrap: anywhere; }
table.biglist td.c-mail { min-width: 200px; max-width: 250px; overflow-wrap: anywhere; }
table.biglist td.c-phone { max-width: 170px; overflow-wrap: anywhere; }
table.biglist td.c-seg { min-width: 100px; max-width: 150px; }
select.kindsel { max-width: 118px; }

/* ---------- планерка: «Коротко» для тех, кого не было ---------- */
.brief h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin: 16px 0 6px; }
.brief ol.points { margin: 0; padding-left: 22px; }
.brief ol.points li { margin-bottom: 6px; line-height: 1.5; }
.brief ul.decisions { margin: 0; padding: 10px 14px 10px 30px; background: var(--green-bg); border-radius: var(--radius); }
.brief ul.decisions li { margin-bottom: 4px; }
.brief .people { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.brief .person { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: #fbfcfd; }
.brief .person ul { margin: 6px 0 0; padding-left: 18px; }
.brief .person li { margin-bottom: 6px; }
.brief .person li.done a, .brief .person li.done { color: var(--muted); text-decoration: line-through; }
.mtopics { color: var(--muted); font-size: 12px; margin-top: 2px; }
/* Длинные строки без пробелов (адреса, коды) переносятся внутри ячейки, а не наезжают на соседнюю. */
table.biglist td { overflow-wrap: anywhere; }

/* новое письмо в списке почты */
tr.newmail td { font-weight: 600; background: #fffaf0; }

/* Предпросмотр КП: лист как в Word, правка прямо на листе. */
.kp-dialog { width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.kp-dialog::backdrop { background: rgba(20, 30, 45, .45); }
.kp-dialog-bar { position: sticky; top: 0; z-index: 1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
#pv-body { padding: 16px; background: var(--bg); }
.kp-langs { margin-bottom: 10px; }
.kp-sheet { max-width: 800px; margin: 0 auto; background: #fff; border: 1px solid var(--line); padding: 36px 44px; font: 13px/1.45 Calibri, Arial, sans-serif; color: #1d2733; }
.kp-sheet p { margin: 0 0 6px; }
.kp-r { text-align: right; }
.kp-grey { color: #6b7785; }
.kp-b { font-weight: 700; }
.kp-title { font-size: 19px; font-weight: 700; color: var(--navy); margin: 14px 0 4px !important; }
.kp-h { font-size: 15px; font-weight: 700; color: var(--navy); margin: 18px 0 6px !important; }
.kp-total { font-size: 15px; font-weight: 700; color: var(--navy); margin-top: 8px !important; }
.kp-table th { background: var(--navy); color: #fff; text-transform: none; letter-spacing: 0; font-size: 12px; }
.kp-table td { font-size: 12px; padding: 6px 8px; }
.kp-table tr:nth-child(odd) td { background: #f3f6fa; }
.kp-terms td:first-child { width: 35%; }
.kp-foot { font-size: 11px; color: #6b7785; font-style: italic; }
.kp-cards { color: #6b7785; font-size: 12px; margin-top: 8px !important; }
.kp-note { margin-top: 10px !important; }
.kp-sign { margin-top: 20px; }
.kp-sign div { display: flex; justify-content: space-between; }
.kp-edit { border-bottom: 1px dashed #9fb3c8; outline: none; min-width: 1.5em; display: inline-block; white-space: pre-wrap; cursor: text; }
.kp-edit:hover { background: var(--amber-bg); }
.kp-edit:focus { background: var(--amber-bg); border-bottom-color: var(--accent); }
.kp-edit:empty::before { content: attr(data-placeholder); color: #9aa5b1; }
.kp-edit.ml { display: inline; }
@media (max-width: 700px) { .kp-sheet { padding: 18px 14px; } .kp-table { display: block; overflow-x: auto; } }

/* Колонки таблицы КП: галочки и перетаскивание. */
.col-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.col-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px 3px 5px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--muted); cursor: grab; user-select: none; }
.col-chip.on { color: var(--text); border-color: #9fb3c8; background: var(--blue-bg); }
.col-chip .grip { color: #9aa5b1; font-size: 11px; }
.col-chip.drag { opacity: .4; }
.col-chip.over, .kp-items th.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.kp-items { table-layout: fixed; }
.kp-items th { position: relative; cursor: grab; overflow-wrap: anywhere; }
.kp-items td { overflow-wrap: anywhere; }
.kp-rz { position: absolute; top: 0; right: -4px; bottom: 0; width: 8px; cursor: col-resize; z-index: 2; }
.kp-rz:hover { background: rgba(184, 116, 42, .5); }

/* Подпись факсимиле: страницы слева, панель справа. */
.sign-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.sign-panel { position: sticky; top: 12px; }
#pages { display: flex; flex-direction: column; align-items: center; background: #e9edf2; border-radius: var(--radius); padding: 16px; min-height: 300px; }
.sheet { position: relative; width: fit-content; line-height: 0; background: #fff; box-shadow: 0 1px 4px rgba(20, 30, 45, .25); touch-action: none; }
.sheet canvas, .sheet > img { display: block; max-width: 100%; }
.sheet-no { margin: 4px 0 14px; line-height: 1.2; }
.fac { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; margin-bottom: 8px; cursor: grab; background: #fff; }
.fac img { display: block; max-width: 100%; max-height: 70px; margin: 0 auto 6px; }
.mark { position: absolute; cursor: move; outline: 1px dashed rgba(184, 116, 42, .8); touch-action: none; }
.mark img { width: 100%; height: 100%; display: block; pointer-events: none; }
.mark:focus { outline: 2px solid var(--accent); }
.mark-x { position: absolute; top: -10px; right: -10px; width: 20px; height: 20px; border-radius: 50%; background: var(--red); color: #fff; font: 14px/20px sans-serif; text-align: center; cursor: pointer; }
.mark-rot { position: absolute; top: -10px; right: 14px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font: 14px/20px sans-serif; text-align: center; cursor: pointer; }
.mark-rz { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: var(--accent); border-radius: 2px; cursor: nwse-resize; }
@media (max-width: 900px) { .sign-grid { grid-template-columns: 1fr; } .sign-panel { position: static; } }
.sign-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.sign-panel { position: static; }
.fac.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(184, 116, 42, .35); }
#pages.placing .sheet { cursor: crosshair; }
@media (max-width: 900px) { .sign-side { position: static; max-height: none; } }
