:root {
  --bg: #f4f1ea;
  --ink: #1c2430;
  --muted: #5c6673;
  --line: #d7d1c5;
  --card: #fffdf8;
  --accent: #1f4e5f;
  --accent-2: #b4532a;
  --ok: #215c3a;
  --err: #8a1f1f;
  --warn: #8a5a12;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font: 16px/1.45 "Segoe UI", system-ui, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
.top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 12px 20px; background: var(--accent); color: #fff; }
.top a, .top button.link { color: #fff; }
.brand { font-weight: 700; text-decoration: none; margin-right: auto; }
.langs a { margin-right: 8px; padding: 2px 8px; border: 1px solid rgba(255,255,255,.4); border-radius: 4px; text-decoration: none; }
.langs a.on { background: #fff; color: var(--accent); }
.who { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 52px); }
aside { background: #e8e2d6; padding: 16px 12px; display: flex; flex-direction: column; gap: 8px; }
aside a { text-decoration: none; padding: 8px 10px; border-radius: 6px; color: var(--ink); }
aside a:hover { background: #fff; }
main { padding: 24px; max-width: 1100px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 12px 0; }
.narrow { max-width: 420px; }
label { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 14px; }
input, select, button, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
input.date-dmy { max-width: 12rem; }
.date-field {
  display: flex;
  align-items: stretch;
  position: relative;
  max-width: 14.5rem;
  width: 100%;
}
.date-field .date-dmy {
  flex: 1;
  max-width: none;
  width: 100%;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.date-cal {
  width: 42px;
  min-width: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--card);
  color: var(--accent);
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 6px 6px 0;
}
.date-cal:hover { background: #eef4f6; }
.date-cal-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
button, .btn { background: var(--accent); color: #fff; border: 0; text-decoration: none; display: inline-block; cursor: pointer; }
button:disabled, .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.offer-check { flex-direction: row; align-items: flex-start; gap: 10px; }
.offer-check input { width: auto; margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.flash { padding: 10px 12px; border-radius: 6px; margin: 8px 0; }
.flash.ok { background: #e4f3e8; color: var(--ok); }
.flash.err { background: #f8e4e4; color: var(--err); }
.flash.warn { background: #f7ecd8; color: var(--warn); }
.muted { color: var(--muted); }
.grid2, .grid3 { display: grid; gap: 12px; }
.grid2 { grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: repeat(3, 1fr); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inline, .inline-grid { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.search { display: flex; gap: 8px; margin: 12px 0; }
.checks label { font-size: 12px; }
.source-readonly { color: var(--muted); font-weight: 600; white-space: nowrap; }
.share-widget { grid-column: 1 / -1; }
.share-edit { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.share-custom { display: flex; flex-wrap: wrap; gap: 12px; }
.share-widget [hidden] { display: none !important; }
.share-result { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0; }
.share-form { margin: 8px 0; }
.plain { padding-left: 18px; }
.table-wrap { overflow-x: auto; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0; }
fieldset.nested { margin-top: 8px; }
.child-row { margin: 8px 0; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.children-checks { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.children-checks .check { flex-direction: row; align-items: center; gap: 8px; }
.child-edit { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 8px; align-items: end; }
.child-edit .child-fio { grid-column: 1 / -1; font-weight: 600; }
.children-list li { margin: 12px 0; }
@media (max-width: 800px) {
  .child-edit { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  aside { flex-direction: row; flex-wrap: wrap; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .who { width: 100%; }
}
