:root {
  --bg: #f5f4f0; --card: #fff; --ink: #1d1d1b; --muted: #77756f; --line: #e3e1da;
  --accent: #2f5d50; --accent-soft: #e4eeea; --danger: #b3412f;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 17px; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 13px; }

/* верхняя панель с вкладками проектов */
.top { display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--ink); color: #fff; height: 52px; position: sticky; top: 0; z-index: 2; }
.brand { color: #fff; font-weight: 600; }
.ptabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; align-self: stretch; align-items: flex-end; }
.ptabs a { color: #cfcdc6; padding: 8px 14px; border-radius: 8px 8px 0 0; white-space: nowrap; }
.ptabs a:hover { color: #fff; text-decoration: none; }
.ptabs a.active { background: var(--bg); color: var(--ink); font-weight: 600; }
.ptabs a.add { font-weight: 700; }
.me { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.me a, .me .link { color: #cfcdc6; }

/* вкладки внутри проекта */
.stabs { display: flex; gap: 2px; padding: 12px 20px 0; border-bottom: 1px solid var(--line); max-width: 1000px; margin: 0 auto; }
.stabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.stabs a.active { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.stabs a:hover { text-decoration: none; color: var(--ink); }

main { max-width: 1000px; margin: 0 auto; padding: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px; margin-bottom: 16px; }
.bar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.bar h1, .bar h2 { margin: 0; margin-right: auto; }
.flash { background: var(--accent-soft); border: 1px solid #c7dbd3; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.error { background: #f8e7e3; color: var(--danger); padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }

input, textarea, select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; }
textarea { resize: vertical; }
.editor { min-height: 65vh; font: 14px/1.5 ui-monospace, Menlo, Consolas, monospace; margin-top: 8px; }
.editor.small { min-height: 40vh; }
button, .btn { font: inherit; background: var(--accent); color: #fff; border: 0; padding: 8px 16px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(1.1); }
button.danger { background: var(--danger); }
button.link { background: none; padding: 0; color: inherit; }
button.link.danger { color: var(--danger); background: none; }
form.inline { display: flex; gap: 8px; align-items: center; }
form.stack { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
details form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
details form button { align-self: flex-start; }
summary { cursor: pointer; font-weight: 600; }
.card > input[name=title] { margin-bottom: 4px; }

.login { max-width: 360px; margin: 12vh auto; }
.login h1 { margin-bottom: 16px; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }

/* задачи */
.tasks { list-style: none; padding: 6px 24px; }
.tasks li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tasks li:last-child { border-bottom: 0; }
.tasks .title { flex: 1; }
.tasks select { width: auto; padding: 4px 8px; font-size: 13px; }
.tasks .st-doing .title::before { content: "●"; color: #c98a1b; margin-right: 8px; }
.tasks .st-done .title { color: var(--muted); text-decoration: line-through; }

/* текст в Markdown */
.md h2 { font-size: 19px; margin: 26px 0 8px; } .md h2:first-child { margin-top: 0; }
.md h3 { font-size: 16px; margin: 20px 0 6px; }
.md table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 14px; }
.md th, .md td, table th, table td { border-bottom: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.md th, table th { background: #faf9f6; font-weight: 600; }
table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.md code, code { background: #f0eee8; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.note h2 { font-size: 16px; }

.ref-status p { margin: 0 0 6px; } .ref-status p:last-child { margin: 0; }
.warn { color: #9a6a10; }
.scroll { overflow-x: auto; }
table.ref { font-size: 14px; margin: 0; }
table.ref td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ref-fields { display: flex; gap: 12px; margin-bottom: 8px; }
.ref-fields label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
button:disabled { opacity: .45; cursor: default; }

@media (max-width: 700px) {
  .ref-fields { flex-direction: column; }
  .top { flex-wrap: wrap; height: auto; padding: 8px 12px 0; gap: 8px; }
  .ptabs { order: 3; flex-basis: 100%; }
  main { padding: 12px; } .card { padding: 14px; }
  form.inline { flex-wrap: wrap; }
}
