/* Палитра OpenCode, тёмная тема (internal/tui/theme/opencode.go) */
:root {
  --bg: #212121;
  --panel: #252525;
  --selected: #303030;
  --fg: #e0e0e0;
  --muted: #6a6a6a;
  --primary: #fab283;
  --secondary: #5c9cf5;
  --accent: #9d7cd8;
  --red: #e06c75;
  --orange: #f5a742;
  --green: #7fd88f;
  --cyan: #56b6c2;
  --yellow: #e5c07b;
  --border: #4b4c5c;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.55 ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  overflow-wrap: break-word;
}

a { color: var(--secondary); text-decoration: none; }
a:hover { text-decoration: underline; }

.inline { display: inline; }

/* --- верхняя панель --- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.5rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.bar-left, .bar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.dot {
  width: 9px; height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--green);
}

.brand { color: var(--primary); font-weight: 700; white-space: nowrap; }
.sep { color: var(--muted); flex: none; }
.crumb { color: var(--yellow); }

button, .btn-ghost, .btn-ok, .btn-danger {
  font: inherit;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  color: var(--secondary);
}

.btn-ghost:hover, .btn-ok:hover, .btn-danger:hover { text-decoration: underline; }
.btn-ok { color: var(--green); }
.btn-danger { color: var(--red); }

/* --- тело --- */
main {
  flex: 1;
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.45rem;
  margin: 0 0 1.1rem;
}
.sigil { color: var(--green); }
.path { color: var(--secondary); }
.empty { color: var(--muted); }
.error, .path.error { color: var(--red); }

/* --- счётчик --- */
.counter { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem; color: var(--muted); }
.counter b { font-weight: 700; }
.c-total b { color: var(--fg); }
.c-active b { color: var(--orange); }
.c-done b { color: var(--green); }
.c-subs b { color: var(--accent); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border);
}

/* --- список задач --- */
.tasks { list-style: none; margin: 0; padding: 0; }

.task {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.35rem 0.4rem;
  border-left: 2px solid transparent;
}

.task:hover { background: var(--panel); border-left-color: var(--border); }
.task[open] { background: var(--panel); border-left-color: var(--primary); }
.task.is-done .title { color: var(--muted); text-decoration: line-through; }

.toggle { flex: none; padding-top: 0; }
.toggle button { color: var(--orange); line-height: 1.55; white-space: nowrap; }
.task.is-done .toggle button { color: var(--green); }

.disclosure { flex: 1; min-width: 0; }

.disclosure summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.5rem;
  cursor: pointer;
  list-style: none;
}
.disclosure summary::-webkit-details-marker { display: none; }

.marker { color: var(--muted); transition: transform 0.12s ease; }
.disclosure[open] .marker { transform: rotate(90deg); color: var(--primary); }

.title { min-width: 0; }
.has-body { color: var(--cyan); font-size: 0.85em; }
.progress { color: var(--accent); font-size: 0.85em; }
.progress.is-full { color: var(--green); }

.meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  white-space: nowrap;
}
time { color: var(--muted); font-size: 0.8em; }

.body { margin: 0.5rem 0 0.25rem 0.9rem; min-width: 0; }

.body pre {
  margin: 0;
  padding: 0.6rem 0.75rem;
  background: var(--selected);
  border-left: 2px solid var(--border);
  color: var(--fg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
}

/* --- подзадачи --- */
.subs { list-style: none; margin: 0.5rem 0 0; padding: 0; }

.sub {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.1rem 0;
  min-width: 0;
}
.sub > button { color: var(--orange); line-height: 1.55; white-space: nowrap; }
.sub.is-done > button { color: var(--green); }
.sub-title { min-width: 0; flex: 1; }
.sub.is-done .sub-title { color: var(--muted); text-decoration: line-through; }
.sub .btn-danger { visibility: hidden; font-size: 0.85em; }
.sub:hover .btn-danger, .sub .btn-danger:focus { visibility: visible; }

.hint { margin: 0.45rem 0 0; color: var(--muted); font-size: 0.85em; }

.sub-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.55rem;
}
.sub-form input { flex: 1; }
.sub-form button { white-space: nowrap; color: var(--primary); }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  margin-top: 0.55rem;
  font-size: 0.85em;
}
.row-actions .muted { color: var(--muted); }
.spacer { flex: 1 1 auto; }

/* --- формы --- */
.form { display: flex; flex-direction: column; gap: 0.9rem; max-width: 38rem; }

.line { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.key { color: var(--secondary); }

input, textarea {
  padding: 0.45rem 0.6rem;
  background: var(--selected);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 0;
  font: inherit;
  width: 100%;
  min-width: 0;
}

input:focus, textarea:focus { outline: 1px solid var(--primary); outline-offset: 0; }
textarea { resize: vertical; }

.form > button[type="submit"] {
  align-self: flex-start;
  padding: 0.4rem 1.1rem;
  background: var(--primary);
  color: var(--bg);
  border: 0;
  font-weight: 700;
}
.form > button[type="submit"]:hover { filter: brightness(1.08); }

.form-actions { display: flex; align-items: center; gap: 1rem; }

/* --- нижняя панель: голос --- */
.dock { position: sticky; bottom: 0; z-index: 20; background: var(--bg); }

.voice { border-top: 1px solid var(--border); background: var(--panel); }

.voice-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1rem;
}

.mic {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: none;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  color: var(--fg);
}
.mic:hover { border-color: var(--primary); }
.mic:disabled { opacity: 0.5; cursor: not-allowed; }
.mic-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }

.mic.is-live { border-color: var(--primary); color: var(--primary); }
.mic.is-live .mic-dot { background: var(--red); animation: pulse 1s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: 0.25; } }

.voice-hint {
  min-width: 0;
  color: var(--muted);
  font-size: 0.85em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice-hint.is-live { color: var(--primary); }
.voice-hint.is-error { color: var(--red); }

.voice-body { display: none; padding: 0 1rem 0.75rem; }
.voice.is-open .voice-body { display: block; }

.voice-actions { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.5rem; }

.voice-actions > button[type="submit"], #voice-apply {
  padding: 0.35rem 0.9rem;
  background: var(--primary);
  color: var(--bg);
  border: 0;
  font-weight: 700;
}
#voice-apply:disabled { filter: grayscale(0.5) brightness(0.85); cursor: progress; }

.voice-log { color: var(--muted); font-size: 0.85em; }
.voice-results { list-style: none; margin: 0.5rem 0 0; padding: 0; font-size: 0.9em; max-height: 40vh; overflow-y: auto; }
.voice-results li { padding: 0.1rem 0; }
.v-reply { color: var(--cyan); }
.v-ok { color: var(--green); }
.v-warn { color: var(--orange); }
.v-confirm { color: var(--red); }
.v-confirm button { font-size: 0.9em; }

/* --- нижняя строка --- */
.statusbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  background: var(--selected);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8em;
}

.cursor { color: var(--primary); animation: blink 1.1s steps(1) infinite; }

@keyframes blink { 50% { opacity: 0; } }

/* --- узкие экраны --- */
@media (max-width: 700px) {
  body { font-size: 14px; }

  .bar { padding: 0.45rem 0.75rem; font-size: 0.85em; flex-wrap: wrap; }
  .bar-left, .bar-right { gap: 0.6rem; flex-wrap: wrap; }
  .bar-right { margin-left: auto; }
  .crumb-wrap, .bar-left .sep { display: none; }

  .toolbar { flex-wrap: wrap; gap: 0.5rem 1rem; }

  main { padding: 1rem 0.75rem 2.5rem; }

  .counter { flex-basis: 100%; margin-left: 0; }

  .task { padding: 0.3rem 0.2rem; gap: 0.4rem; }
  .disclosure summary { gap: 0.4rem; }
  .body { margin-left: 0.5rem; }
  .row-actions { gap: 0.4rem 0.75rem; }
  .spacer { flex-basis: 100%; height: 0; }
  .sub .btn-danger { visibility: visible; }
}

@media (max-width: 380px) {
  .bar { font-size: 0.78em; }
  .bar-left, .bar-right { gap: 0.5rem; }
  .meta { gap: 0.35rem; }
  time { font-size: 0.72em; }
  .body { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  .marker { transition: none; }
  .mic.is-live .mic-dot { animation: none; }
}
