/* Грин Таун 360 — общие стили.
   Шрифт один: Golos Text (сделан под кириллицу и интерфейсы). Цвет — фирменный зелёный Green Town.
   Сетка: верхняя панель во всю ширину, контент в колонке до 1120px; анкета — 720px. */
:root {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --surface-2: #f7f9f5;
  --ink: #18241a;
  --ink-2: #3c4a3b;
  --muted: #69766a;
  --line: #dfe5da;
  --line-strong: #c9d3c3;
  --brand: #3f7a35;
  --brand-hover: #356a2c;
  --brand-ink: #ffffff;
  --brand-soft: #e6f0e0;
  --brand-text: #2f6427;
  --leaf: #8bbf5a;
  --rose: #b8465f;
  --rose-soft: #f8e6ea;
  --amber: #9a6a14;
  --amber-soft: #f7edd6;
  --ok: #2f7d32;
  --focus: #2f6fd1;
  --shadow: 0 1px 2px rgba(24, 36, 26, .05), 0 2px 8px rgba(24, 36, 26, .04);
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 10px;
  --r-sm: 8px;
  --h: 36px;
  --h-sm: 30px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1410;
    --surface: #161d17;
    --surface-2: #1b231c;
    --ink: #e6ede3;
    --ink-2: #c3cfc0;
    --muted: #8f9d8c;
    --line: #263026;
    --line-strong: #344034;
    --brand: #6fae5f;
    --brand-hover: #82bd72;
    --brand-ink: #0c130b;
    --brand-soft: #1f2d1c;
    --brand-text: #93c884;
    --leaf: #9fd06c;
    --rose: #e58aa0;
    --rose-soft: #3a2229;
    --amber: #e0b35d;
    --amber-soft: #352b17;
    --ok: #8cc97f;
    --focus: #7aa8f0;
    --shadow: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--font); font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; font-weight: 600; }
h1 { font-size: 1.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.95rem; }
p { margin: 0; }
a { color: var(--brand-text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- каркас ---------- */
.appbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.appbar-in { max-width: 1120px; margin: 0 auto; padding-inline: 16px; display: flex; align-items: center; gap: 8px 24px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 0.98rem; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 0.78rem; line-height: 1.2; }
.nav { display: flex; gap: 4px; align-self: stretch; overflow-x: auto; }
.nav button { appearance: none; border: 0; background: none; padding: 0 12px; cursor: pointer; font-weight: 500; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav button:hover { color: var(--ink); }
.nav button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
.appbar .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
@media (max-width: 760px) { .nav { order: 3; width: 100%; min-height: 44px; } .appbar .tools { margin-left: auto; } }

.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 16px; padding-block: 24px 64px; display: grid; gap: 20px; }
.wrap.narrow { max-width: 720px; }
.page-head { display: flex; gap: 12px 20px; align-items: flex-end; flex-wrap: wrap; }
.page-head > div { min-width: 0; display: grid; gap: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; display: grid; gap: 16px; min-width: 0; box-shadow: var(--shadow); }
.panel-head { display: flex; gap: 8px 16px; align-items: center; flex-wrap: wrap; }
.panel-head > div { display: grid; gap: 2px; min-width: 0; }
.panel-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 600px) { .panel { padding: 16px; } }

.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.label { font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }

/* ---------- кнопки ---------- */
.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--h); padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 500; font-size: 0.92rem; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--rose); }
.btn.danger.armed { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn.sm { height: var(--h-sm); padding: 0 10px; font-size: 0.85rem; }
.btn.icon { width: var(--h-sm); height: var(--h-sm); padding: 0; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* ---------- поля ---------- */
.input, select.input, textarea.input {
  height: var(--h); border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm); padding: 0 12px; width: 100%; min-width: 0;
}
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%237d8a78' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
select.input.sm { height: var(--h-sm); font-size: 0.86rem; padding-left: 10px; }
.input:hover { border-color: var(--muted); }
.field { display: grid; gap: 6px; }
.field > span, .field > label { font-size: 0.85rem; font-weight: 500; color: var(--ink-2); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--brand); width: 16px; height: 16px; }

/* переключатель */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background .15s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- метки ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-text); white-space: nowrap; line-height: 1.5; }
.chip.rose { background: var(--rose-soft); color: var(--rose); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.grey { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; margin-inline: -4px; padding-inline: 4px; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.8rem; color: var(--muted); font-weight: 500; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
tr.group td { background: var(--surface-2); font-weight: 600; font-size: 0.85rem; color: var(--ink-2); padding-block: 8px; }

.progress { height: 6px; background: var(--brand-soft); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* ---------- уведомления ---------- */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 8px; font-weight: 500; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.toast.bad { background: var(--rose); color: #fff; }
.error { color: var(--rose); font-weight: 500; }
.note { display: flex; gap: 12px; align-items: flex-start; background: var(--brand-soft); border-radius: var(--r); padding: 12px 16px; font-size: 0.92rem; }
.note.amber { background: var(--amber-soft); }
.note svg { width: 20px; height: 20px; flex: none; color: var(--brand-text); margin-top: 2px; }
.note.amber svg { color: var(--amber); }

.empty { text-align: center; padding: 32px 16px; display: grid; gap: 8px; justify-items: center; color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .btn, .nav button, .input { transition: background-color .15s, border-color .15s, color .15s; }
}
