/* Settlement Factory — визуальный язык: деловой, спокойный, нейтральный.
   Ни одна сторона не должна по оформлению выглядеть "правой" (§2.2, §26).
   Тревожные акценты используются только там, где без них теряется смысл. */

:root {
  /* Палитра перенесена с mediation.privacycorp.ru, чтобы продукты семейства
     читались как одно целое: navy / graphite / steel / mist / teal.
     Вёрстка и шрифты платформы остаются собственными. */
  --bg: #f5f7fa;          /* offwhite */
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #0b1220;         /* navy */
  --ink-2: #1a2233;       /* graphite */
  --muted: #5b6475;       /* steel */
  --line: #e3e7ee;
  --line-strong: #c2cad8;

  --accent: #2d6f6d;      /* teal */
  --accent-ink: #22524f;  /* tealdk */
  --accent-soft: #e4efee;

  --good: #2b6b57;
  --good-soft: #e3efe9;
  --wait: #8a6420;
  --wait-soft: #f6efe2;
  --attention: #9c4a35;
  --attention-soft: #f6eae6;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(11, 18, 32, .06), 0 4px 12px rgba(11, 18, 32, .05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0 0 .6rem; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8rem; }

/* ---------- каркас ---------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: .7rem 1.2rem;
  display: flex; align-items: center; gap: 1.2rem;
}
.brand { font-weight: 600; color: var(--ink); font-size: 1.02rem; letter-spacing: -.01em; white-space: nowrap; }
.brand span { color: var(--accent); }
.topnav { display: flex; gap: 1rem; flex-wrap: wrap; margin-left: auto; align-items: center; }
.topnav a { color: var(--ink-2); font-size: .93rem; }
.topnav a.active { color: var(--accent); font-weight: 600; }
.topnav form { margin: 0; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1.4rem 1.2rem 3rem; }
.narrow { max-width: 720px; }
.mid { max-width: 940px; }

.page-head { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head .grow { flex: 1 1 320px; min-width: 0; }
.page-head h1 { margin-bottom: .25rem; }
.subtle { color: var(--muted); font-size: .9rem; }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 880px) { .split { grid-template-columns: 1fr; } }

/* ---------- карточки ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.card.tight { padding: .85rem 1rem; }
.card.plain { box-shadow: none; }
.card-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .grow { flex: 1; }

.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem .9rem; }
.stat .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.22rem; font-weight: 600; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.stat .hint { color: var(--muted); font-size: .84rem; }

/* ---------- бейджи и статусы ---------- */

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; padding: .18rem .55rem; border-radius: 100px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.wait { background: var(--wait-soft); color: var(--wait); border-color: transparent; }
.badge.attention { background: var(--attention-soft); color: var(--attention); border-color: transparent; }
.badge.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.muted { background: var(--surface-2); color: var(--muted); }
.badge.private { background: #eceff4; color: #1a2233; border-color: transparent; }

.pill-row { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------- таблицы ---------- */

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
thead th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem;
  text-transform: uppercase; letter-spacing: .04em; padding: .5rem .6rem;
  border-bottom: 1px solid var(--line);
}
tbody td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

/* ---------- формы ---------- */

label { display: block; font-size: .87rem; color: var(--ink-2); margin-bottom: .25rem; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  width: 100%; padding: .5rem .6rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 84px; resize: vertical; }
.field { margin-bottom: .85rem; }
.field .hint { color: var(--muted); font-size: .82rem; margin-top: .25rem; }
.field-row { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.check { display: flex; gap: .5rem; align-items: flex-start; margin-bottom: .5rem; }
.check input { margin-top: .25rem; }
.check label { margin: 0; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
legend { padding: 0 .4rem; font-weight: 600; font-size: .95rem; color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  font: inherit; font-size: .92rem; font-weight: 500; cursor: pointer;
  padding: .48rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--accent); padding-inline: .3rem; }
.btn.small { font-size: .85rem; padding: .3rem .6rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* ---------- сообщения ---------- */

.flash { border-radius: var(--radius-sm); padding: .6rem .85rem; margin-bottom: .9rem; font-size: .92rem; border: 1px solid transparent; }
.flash.ok { background: var(--good-soft); color: var(--good); }
.flash.warn { background: var(--wait-soft); color: var(--wait); }
.flash.error { background: var(--attention-soft); color: var(--attention); }

.note {
  background: var(--surface-2); border-left: 3px solid var(--line-strong);
  padding: .6rem .85rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-2); font-size: .9rem; margin-bottom: .9rem;
}
.note.private { border-left-color: var(--accent); background: var(--accent-soft); color: #22524f; }

/* ---------- специальные блоки ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 .85rem 1.15rem; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: .42rem; width: 8px; height: 8px;
  border-radius: 50%; background: var(--line-strong);
}
.timeline .when { color: var(--muted); font-size: .8rem; }

.progress { height: 8px; border-radius: 100px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--good); }

.kv { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: .35rem .9rem; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.schedule td.date { white-space: nowrap; }
.scenario-head { display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap; }
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.score { background: var(--surface-2); border-radius: var(--radius-sm); padding: .5rem .7rem; border: 1px solid var(--line); }
.score .name { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.score .val { font-weight: 600; }

.diff td.from { color: var(--muted); text-decoration: line-through; }
.diff td.to { font-weight: 600; }

.side-a { border-left: 3px solid #5b6475; }
.side-b { border-left: 3px solid #2d6f6d; }

.msg { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .75rem; margin-bottom: .55rem; background: var(--surface-2); }
.msg .meta { color: var(--muted); font-size: .8rem; margin-bottom: .25rem; }

.empty { color: var(--muted); font-size: .92rem; padding: .6rem 0; }

.footer { color: var(--muted); font-size: .85rem; text-align: center; padding: 2rem 1rem 1rem; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 1rem; }
.steps > li { counter-increment: step; position: relative; padding-left: 2.1rem; margin-bottom: 1.4rem; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: .05rem;
  width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-size: .82rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

details.inline > summary { cursor: pointer; color: var(--accent); font-size: .9rem; list-style: none; }
details.inline > summary::-webkit-details-marker { display: none; }
details.inline > summary::before { content: "+ "; }
details.inline[open] > summary::before { content: "− "; }
details.inline > div, details.inline > form { margin-top: .7rem; }

.hero { padding: 2.4rem 0 1.4rem; }
.hero h1 { font-size: 2rem; max-width: 22ch; }
.hero p { max-width: 62ch; color: var(--ink-2); font-size: 1.02rem; }
