/* Палитра «воздух — море — чистота». Тёмная тема — альтернатива. */

:root {
  --bg: #f2f8fa;
  --surface: #ffffff;
  --ink: #0f3240;
  --muted: #5d818f;
  --accent: #0d97a5;
  --accent-ink: #ffffff;
  --accent-soft: #ddf1f4;
  --line: #dbe9ee;
  --warn: #b4632a;
  --warn-soft: #fbeee2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 60, 75, .06), 0 8px 24px rgba(16, 60, 75, .06);
}

:root[data-theme="dark"] {
  --bg: #0d1a20;
  --surface: #16272f;
  --ink: #e4f1f5;
  --muted: #8caebb;
  --accent: #33bccb;
  --accent-ink: #07222a;
  --accent-soft: #1d3a44;
  --line: #233d47;
  --warn: #e0a06a;
  --warn-soft: #33261a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1a20;
    --surface: #16272f;
    --ink: #e4f1f5;
    --muted: #8caebb;
    --accent: #33bccb;
    --accent-ink: #07222a;
    --accent-soft: #1d3a44;
    --line: #233d47;
    --warn: #e0a06a;
    --warn-soft: #33261a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }

/* Должно идти раньше любых display-правил: иначе скрытые блоки вроде .sheet
   (у неё display: flex) остаются на экране и перехватывают нажатия. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 6rem;
}

h1 { font-size: 1.35rem; margin: 0 0 .25rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: .8rem; margin: 1.75rem 0 .6rem; color: var(--muted);
     text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
p  { margin: 0 0 1rem; }

.sub { color: var(--muted); margin-bottom: 1.5rem; }

/* --- кнопки --- */

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 10px;
  padding: .6rem 1rem;
  transition: transform .08s ease, background .15s ease;
}
button:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: default; }

.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.ghost   { background: transparent; }

/* --- микрофон --- */

.mic-zone { text-align: center; padding: 1.5rem 0 .5rem; }

.mic {
  width: 104px; height: 104px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  border: none; box-shadow: var(--shadow);
  display: inline-flex; align-items: center; justify-content: center;
}
.mic svg { width: 42px; height: 42px; }
.mic.recording { background: var(--warn); animation: pulse 1.4s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180, 99, 42, .45); }
  50%      { box-shadow: 0 0 0 18px rgba(180, 99, 42, 0); }
}

.mic-hint { color: var(--muted); font-size: .9rem; margin-top: .75rem; min-height: 1.5em; }

/* --- список покупок ---
   Выделен намеренно: его открывают в магазине, ему нужен самый быстрый доступ. */

.shopping {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: .95rem 1.15rem; margin: .25rem 0 1.25rem;
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: var(--radius); font-size: 1.05rem; font-weight: 620;
  color: var(--ink);
}
.shopping[aria-pressed="true"] {
  background: var(--accent); color: var(--accent-ink); border-color: transparent;
}
.shopping-count { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.shopping-count:empty::after { content: "—"; }

/* Внутри списка покупок — компактный вид: проект и исполнитель очевидны, они лишние. */
#tasks.compact .card { padding: .6rem .85rem; margin-bottom: .35rem; }
#tasks.compact .card-meta { display: none; }
#tasks.compact .card-text { font-size: 1.05rem; }

/* --- карточки --- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin-bottom: .5rem;
  display: flex; gap: .75rem; align-items: flex-start;
}

.card.unparsed { background: var(--warn-soft); border-color: var(--warn); }

.check {
  flex: none; width: 22px; height: 22px; margin-top: .15rem;
  border: 2px solid var(--line); border-radius: 6px;
  background: transparent; padding: 0;
}
.check:hover { border-color: var(--accent); }

.card-body { flex: 1; min-width: 0; }
.card-text { margin-bottom: .2rem; }
.card-meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .5rem; }
.tag { background: var(--accent-soft); color: var(--ink); padding: .1rem .45rem; border-radius: 6px; }

.empty { color: var(--muted); padding: 1rem 0; }

/* --- предпросмотр разбора --- */

.sheet {
  position: fixed; inset: 0; background: rgba(10, 35, 45, .45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 20;
}
.sheet-inner {
  background: var(--bg); width: 100%; max-width: 34rem;
  border-radius: 18px 18px 0 0; padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto;
}
.sheet h2 { margin-top: 0; }
.heard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
         padding: .6rem .8rem; color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }
.sheet-actions { display: flex; gap: .6rem; margin-top: 1rem; }
.sheet-actions button { flex: 1; }

.drop { flex: none; background: transparent; border: none; color: var(--muted);
        font-size: 1.3rem; line-height: 1; padding: .2rem .4rem; }

/* --- вход --- */

.login { max-width: 20rem; margin: 15vh auto 0; padding: 0 1rem; }
.login input {
  width: 100%; font: inherit; padding: .7rem .85rem; margin-bottom: .6rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
}
.who { display: flex; gap: .5rem; margin-bottom: .6rem; }
.who button { flex: 1; }
.who button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.error { color: var(--warn); font-size: .9rem; min-height: 1.4em; }

/* --- прочее --- */

.tabs { display: flex; gap: .4rem; margin-bottom: .75rem; }
.tabs button { padding: .35rem .8rem; font-size: .9rem; border-radius: 20px; }
.tabs button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-soft); }

.topbar { display: flex; justify-content: space-between; align-items: baseline; }
.topbar button { border: none; background: none; color: var(--muted); font-size: .85rem; padding: 0; }

.projects { display: flex; flex-wrap: wrap; gap: .4rem; }
.projects button {
  font-size: .85rem; background: var(--surface); border: 1px solid var(--line);
  padding: .3rem .6rem; border-radius: 8px; color: var(--muted);
}
.projects button[aria-pressed="true"] {
  background: var(--accent-soft); border-color: var(--accent); color: var(--ink);
}
.projects .count { opacity: .6; margin-left: .3rem; }

/* --- поля ввода --- */

.select {
  width: 100%; font: inherit; padding: .6rem .75rem; margin-bottom: .6rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
}
.field { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .3rem; }
.field .select { margin-top: .25rem; }
.row { display: flex; gap: .6rem; }
.row .field { flex: 1; }

.danger {
  width: 100%; margin-top: .75rem;
  background: transparent; border-color: transparent; color: var(--warn);
}

/* --- управление проектами --- */

#projects-editor { margin-top: .5rem; }
.proj-row { display: flex; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.proj-row input { flex: 1; margin: 0; }
.proj-row button { flex: none; padding: .5rem .7rem; }
.add-project { display: flex; gap: .4rem; margin-top: .75rem; }
.add-project input { flex: 1; margin: 0; }
.add-project button { flex: none; }
