:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --soft: #eef3f9;
  --line: #d7e0ec;
  --text: #111827;
  --muted: #627185;
  --accent: #1b66b3;
  --accent-soft: #e5f0fb;
  --good: #0f7a58;
  --warn: #9a5d00;
  --bad: #a43a32;
  --violet: #6450b8;
  --shadow: 0 18px 42px rgba(15, 23, 42, .08);
  font-family: Inter, Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  overflow-wrap: anywhere;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(10px);
}
.top-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text);
}
.brand strong { font-size: 1.02rem; }
.brand span { color: var(--muted); font-size: .82rem; }
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nav a,
.button,
.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-weight: 900;
}
.nav a {
  min-height: 38px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: .9rem;
}
.nav a.active,
.nav a:hover,
.button.primary,
.btn.primary {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}
.button.disabled,
.btn.disabled {
  background: var(--soft);
  color: var(--muted);
  cursor: not-allowed;
}

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 16px 56px;
}
.hero,
.section,
.card,
.hub-card,
.stage-card,
.task-card,
.column,
.note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.hero {
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.section {
  padding: 22px;
  margin-bottom: 16px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 950;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
}
h2 { margin: 0 0 14px; font-size: 1.45rem; line-height: 1.2; }
h3 { margin: 0 0 8px; font-size: 1.04rem; line-height: 1.25; }
p { margin: 0 0 12px; }
.lead {
  max-width: 900px;
  color: var(--muted);
  font-size: 1.06rem;
  margin: 14px 0 0;
}
.section > .lead { margin-bottom: 16px; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card,
.hub-card,
.stage-card,
.task-card,
.column,
.note {
  padding: 16px;
}
.hub-card {
  min-height: 196px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.card p,
.hub-card p,
.stage-card p,
.task-card p,
.note p {
  color: var(--muted);
}
.actions,
.links,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 28px;
  margin-bottom: 10px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 950;
}
.badge.done { background: #e5f7ef; color: var(--good); }
.badge.active,
.badge.current,
.badge.open { background: var(--accent-soft); color: var(--accent); }
.badge.template,
.badge.draft { background: #f0edff; color: var(--violet); }
.badge.locked,
.badge.no { background: #fdebea; color: var(--bad); }
.rule-ok { border-left: 4px solid var(--good); }
.rule-warn { border-left: 4px solid var(--warn); }
.rule-no { border-left: 4px solid var(--bad); }

.map,
.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.node {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent-soft);
  font-weight: 900;
}
.arrow { color: var(--muted); font-weight: 900; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 10px;
}
table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: var(--panel);
}
th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  background: var(--soft);
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
tr:last-child td { border-bottom: 0; }

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.column { background: var(--soft); min-height: 260px; }
.column h3 { display: flex; justify-content: space-between; align-items: center; }
.task-card { background: var(--panel); margin-top: 10px; }
.task-meta {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.task-meta span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 7px;
  background: var(--soft);
  font-size: .88rem;
}

.footer {
  color: var(--muted);
  font-size: .9rem;
  margin-top: 18px;
}

@media (max-width: 1020px) {
  .grid,
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kanban { grid-template-columns: 1fr 1fr; }
  .top-inner { align-items: flex-start; flex-direction: column; }
  .nav { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav a { justify-content: center; min-height: 44px; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  main { padding: 12px 10px 44px; }
  .hero,
  .section,
  .card,
  .hub-card,
  .stage-card,
  .task-card,
  .column,
  .note { padding: 16px; }
  .grid,
  .grid.two,
  .grid.four { grid-template-columns: 1fr; }
  .nav { grid-template-columns: 1fr 1fr; }
  .nav a,
  .button,
  .btn { min-height: 46px; }
  .hub-card { min-height: auto; }
  .map,
  .flow { display: grid; }
  .arrow { display: none; }
  .kanban { display: grid; grid-template-columns: 1fr; overflow: visible; }
  .actions,
  .links { display: grid; grid-template-columns: 1fr; }
  .button,
  .btn { width: 100%; }
  table { min-width: 560px; }
}
