:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4f;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --repeat: #f59e0b;
  --question: #a78bfa;
  --font: "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

.layout {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}

header h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

header p {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.mode-3 { background: #4c1d95; color: #c4b5fd; }

.toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar button, .toolbar a {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
}

.toolbar button:hover, .toolbar a:hover {
  border-color: var(--accent);
}

.toolbar button.is-active {
  border-color: var(--accent);
  background: #1e3a5f;
}

.toolbar button.is-empty {
  opacity: 0.55;
}

.filter-moe-povtorit.is-active { border-color: #f59e0b; background: #422006; color: #fcd34d; }
.filter-moe-vopros.is-active { border-color: #a78bfa; background: #2e1065; color: #c4b5fd; }
.filter-moe-zametka.is-active { border-color: #3b82f6; background: #1e3a5f; color: #93c5fd; }
.filter-moe-agent-note.is-active { border-color: #14b8a6; background: #134e4a; color: #5eead4; }
.filter-moe-termin.is-active { border-color: #d946ef; background: #4a044e; color: #f0abfc; }
.filter-moe-vazhno.is-active { border-color: #ef4444; background: #7f1d1d; color: #fca5a5; }
.filter-moe-oshibka.is-active { border-color: #dc2626; background: #450a0a; color: #f87171; }
.filter-moe-ideya.is-active { border-color: #10b981; background: #064e3b; color: #6ee7b7; }
.filter-moe-todo.is-active { border-color: #94a3b8; background: #1e293b; color: #e2e8f0; }
.filter-moe-stiker.is-active { border-color: #fbbf24; background: #713f12; color: #fde68a; }

main {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 0;
}

aside {
  border-right: 1px solid var(--border);
  padding: 1rem;
  overflow: auto;
  background: #121820;
}

aside h2 {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

aside pre {
  margin: 0 0 1rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  line-height: 1.45;
  overflow: auto;
  white-space: pre-wrap;
}

.syntax-line { color: #86efac; }
.syntax-meta { color: #93c5fd; }
.syntax-comment { color: var(--muted); }

.stats {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stat {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.stat strong { font-size: 1.1rem; }

.content {
  overflow: auto;
  padding: 1.25rem 1.5rem;
}

.type-group {
  margin-bottom: 2rem;
}

.type-group h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
}

.type-moe-povtorit { background: #422006; color: #fcd34d; }
.type-moe-vopros { background: #2e1065; color: #c4b5fd; }
.type-moe-zametka { background: #1e3a5f; color: #93c5fd; }
.type-moe-agent-note { background: #134e4a; color: #5eead4; }
.type-moe-termin { background: #4a044e; color: #f0abfc; }
.type-moe-vazhno { background: #7f1d1d; color: #fca5a5; }
.type-moe-oshibka { background: #450a0a; color: #f87171; }
.type-moe-ideya { background: #064e3b; color: #6ee7b7; }
.type-moe-todo { background: #1e293b; color: #e2e8f0; }
.type-moe-stiker { background: #713f12; color: #fde68a; }

.file-group {
  margin-bottom: 1.25rem;
}

.file-group h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.file-dates {
  font-size: 0.72rem;
  font-weight: 400;
  color: #64748b;
}

.marker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.marker-item {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

.marker-item:hover {
  border-color: var(--accent);
}

.marker-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
}

.marker-meta .section {
  color: var(--muted);
}

.marker-meta .line {
  color: #64748b;
  flex-shrink: 0;
}

.marker-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 1.3;
  border: 1px solid var(--border);
  background: #121820;
  color: var(--muted);
}

.date-added { border-color: #1e3a5f; color: #93c5fd; }
.date-updated { border-color: #334155; color: #94a3b8; }
.date-review { border-color: #422006; color: #fcd34d; }
.date-status.status-открыто { border-color: #1e3a5f; color: #93c5fd; }
.date-status.status-закрыто { border-color: #064e3b; color: #6ee7b7; }
.date-status.status-отложено { border-color: #422006; color: #fcd34d; }
.date-extra { border-color: #334155; color: #94a3b8; font-size: 0.65rem; }

.marker-source {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-size: 0.62rem;
  color: #93c5fd;
  background: #1e3a5f;
  vertical-align: middle;
}

.marker-item.is-block {
  border-left: 3px solid #3b82f6;
}

.marker-text {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

.marker-text.is-multiline {
  white-space: pre-wrap;
}

.marker-link {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
}

.marker-link:hover { text-decoration: underline; }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 3rem;
}

.type-group.is-hidden { display: none; }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  aside { max-height: 220px; border-right: none; border-bottom: 1px solid var(--border); }
}
