/* Админ-панель «Генератора актов». Без внешних шрифтов и библиотек. */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1d2330;
  --muted: #667085;
  --line: #d9dde5;
  --accent: #1f5fbf;
  --accent-soft: #e8f0fc;
  --good: #1e7a46;
  --good-soft: #e5f4ec;
  --warn: #8a5a00;
  --warn-soft: #fff4d6;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; line-height: 1.45;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; }
h1 small { color: var(--muted); font-weight: normal; font-size: 1rem; }
h2 { font-size: 1.2rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1.05rem; }
code, .code { font-family: ui-monospace, Consolas, "Courier New", monospace; }
code.big { font-size: 1.3rem; background: var(--accent-soft); padding: .15rem .5rem; border-radius: 4px; user-select: all; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem;
  padding: .6rem 1.2rem; background: #16243d; color: #fff;
}
.top a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; }
.top nav { display: flex; flex-wrap: wrap; gap: .2rem; }
.top nav a { padding: .3rem .6rem; border-radius: 6px; }
.top nav a:hover, .top nav a[aria-current="page"] { background: rgba(255,255,255,.16); }
.who { margin-left: auto; display: flex; align-items: center; gap: .8rem; font-size: .92rem; }
.who a, .who .link { color: #cfd8ea; }

main { max-width: 1200px; margin: 0 auto; padding: 1.2rem; }
.bottom { max-width: 1200px; margin: 0 auto; padding: 1rem 1.2rem 2rem; color: var(--muted); font-size: .85rem; }
section.narrow { max-width: 560px; }

.notice, .warning, .error {
  padding: .7rem 1rem; border-radius: var(--radius); margin: 0 0 1rem;
}
.notice { background: var(--good-soft); color: var(--good); }
.warning { background: var(--warn-soft); color: var(--warn); }
.error { background: var(--bad-soft); color: var(--bad); }
.hint { color: var(--muted); font-size: .9rem; margin: .2rem 0 .6rem; }
small.hint { display: block; }
.danger-text label { color: var(--bad); }

/* Формы */
form.stack { display: flex; flex-direction: column; gap: .35rem; }
form.stack.wide { max-width: none; }
form.inline { display: inline; }
label { font-weight: 600; font-size: .92rem; }
input, select, textarea, button, .button {
  font: inherit; color: inherit;
}
input:not([type="checkbox"]), select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
textarea { resize: vertical; }
textarea.code { font-size: .85rem; line-height: 1.35; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; margin: 0; }
.check { display: inline-flex; align-items: center; gap: .4rem; }
.check label { font-weight: normal; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem 1rem; margin: 0 0 1rem; background: var(--panel); }
legend { font-weight: 700; padding: 0 .4rem; }
button, .button {
  display: inline-block; padding: .5rem 1rem; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; text-decoration: none; color: var(--text); white-space: nowrap;
}
button:hover, .button:hover { border-color: var(--accent); }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover { background: #174c9a; }
.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.link { background: none; border: none; padding: 0; text-decoration: underline; cursor: pointer; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem 1rem; align-items: end; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.person { margin-bottom: .6rem; }
.filters { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }
.filters.row label { font-weight: normal; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 800px) { .columns { grid-template-columns: 1fr; } .who { margin-left: 0; } }

/* Таблицы */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #eef1f6; font-weight: 600; }
tr:last-child td { border-bottom: none; }
tr.muted td { color: var(--muted); }
.nowrap { white-space: nowrap; }
td.details span { display: inline-block; margin-right: .5rem; color: var(--muted); font-size: .85rem; }
.pager { display: flex; gap: 1rem; margin: 1rem 0; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .82rem; background: #eef1f6; }
.badge.good, .status-closed { background: var(--good-soft); color: var(--good); }
.badge.warn, .status-in_progress { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.status-draft { background: #eef1f6; }
.status-archive { background: #ece8f7; color: #4b3a8c; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0 0 1rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: var(--text); }
.card .num { display: block; font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.card small { display: block; color: var(--muted); margin-top: .3rem; }

nav.tabs { display: flex; flex-wrap: wrap; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
nav.tabs a { padding: .45rem .8rem; text-decoration: none; border-radius: 6px 6px 0 0; }
nav.tabs a[aria-current="page"] { background: var(--panel); border: 1px solid var(--line); border-bottom-color: var(--panel); margin-bottom: -1px; font-weight: 600; color: var(--text); }

/* Замечания */
.remark { border-top: 1px solid var(--line); padding: .7rem 0; display: flex; flex-direction: column; gap: .3rem; }
.remark:first-of-type { border-top: none; }
.remark.resolved textarea { color: var(--muted); text-decoration: line-through; background: #f3f4f6; }
.remark.new label { color: var(--muted); font-weight: normal; }
.remark-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.2rem; font-size: .9rem; }
.remark-tools label { font-weight: normal; }
.remark-tools select { width: auto; max-width: 16rem; padding: .25rem; }
.remark-tools input[size] { width: 5rem; padding: .25rem; }
.remark-group.excluded { opacity: .6; }
.sticky-save { position: sticky; bottom: 0; background: var(--bg); padding: .8rem 0; border-top: 1px solid var(--line); }
details.help { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem; margin-bottom: 1rem; }
details summary { cursor: pointer; font-weight: 600; }
pre.code { white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); padding: 1rem; border-radius: var(--radius); font-size: .82rem; }

/* Акт в виде текста */
.act-print {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 2rem;
  font-family: "Times New Roman", Times, serif; font-size: 1.02rem; max-width: 900px;
}
.act-print p { margin: .25rem 0; }
.act-print .center { text-align: center; }
.act-print .split { display: flex; justify-content: space-between; }
.act-items { list-style: none; padding-left: 0; margin: .2rem 0 .8rem; }
.act-items li { padding-left: 3.2rem; text-indent: -3.2rem; margin: .15rem 0; }
.act-items .num { display: inline-block; min-width: 3rem; text-indent: 0; }
.remark-tools > span { display: inline-flex; align-items: center; gap: .35rem; }
