@import url("/fonts/fonts.css");

/* Идея: приборная панель. Сверху щиток со стрелочным прибором, ниже 5 зон жизни,
   у каждой свой цвет (цвета взяты из черновика и подсвечены для тёмного фона). */
:root {
  color-scheme: dark;
  --bg: #17161b;      /* графит с фиолетовым оттенком */
  --panel: #1f1e25;
  --raise: #28262f;
  --line: #35333d;
  --ink: #f2eff5;
  --muted: #9a96a5;
  --dim: #6d6977;
  --needle: #ff7a1a;
  --red: #ff4a4a;
  --amber: #ffc23d;

  --c-work: #ff7a1a;
  --c-sport: #ff4f6d;
  --c-projects: #5b78ff;
  --c-fun: #5ad1f0;
  --c-cars: #ffc23d;

  --f-display: "Russo One", "Golos Text", system-ui, sans-serif;
  --f-body: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", Consolas, ui-monospace, monospace;
}
* { box-sizing: border-box }
html, body { margin: 0 }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14px; line-height: 1.45 }
.wrap { max-width: 1560px; margin: 0 auto; padding: 28px 24px 72px; display: grid; gap: 20px }
@media (max-width: 600px) { .wrap { padding: 20px 16px 64px } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0) }
:focus-visible { outline: 2px solid var(--needle); outline-offset: 2px }
input, select, button { font: inherit; color: inherit }

/* ─── Шапка ─── */
.top { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end; justify-content: space-between }
h1 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: clamp(24px, 3.2vw, 34px); letter-spacing: .01em; line-height: 1.1 }
.date { margin: 4px 0 0; color: var(--muted); font-size: 14px }
.date::first-letter { text-transform: uppercase }
.top-tools { display: flex; gap: 18px; align-items: center; color: var(--muted); font-size: 13px }
.top-tools form { margin: 0 }
.toggle { display: inline-flex; gap: 7px; align-items: center; cursor: pointer }
.toggle input { accent-color: var(--needle) }
.ghost { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; color: var(--muted) }
.ghost:hover { color: var(--ink); border-color: var(--dim) }

/* ─── Быстрое добавление ─── */
.quick { display: flex; flex-wrap: wrap; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px }
.quick input, .quick select { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; min-width: 0 }
.q-title { flex: 1 1 320px }
.q-field { flex: 0 1 auto }
#q-group { max-width: 280px }
.primary { background: var(--needle); color: #1d0e00; border: 0; border-radius: 9px; padding: 9px 18px; font-weight: 700; cursor: pointer }
.primary:hover { filter: brightness(1.08) }

/* ─── Щиток ─── */
.cluster { display: grid; grid-template-columns: 270px minmax(0, 1fr) 240px; gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; overflow: hidden }
.cluster > * { padding: 18px 22px }
.cluster > * + * { border-left: 1px solid var(--line) }
@media (max-width: 1000px) {
  .cluster { grid-template-columns: 270px minmax(0, 1fr) }
  .readouts { grid-column: 1 / -1; border-left: 0 !important; border-top: 1px solid var(--line) }
}
@media (max-width: 640px) {
  .cluster { grid-template-columns: 1fr }
  .cluster > * + * { border-left: 0; border-top: 1px solid var(--line) }
}

.gauge-box { display: grid; justify-items: center; align-content: center; gap: 2px }
.gauge { width: 100%; max-width: 240px; height: auto; overflow: visible }
.gauge .track { fill: none; stroke: var(--raise); stroke-width: 10; stroke-linecap: round }
.gauge .fill { fill: none; stroke: var(--needle); stroke-width: 10; stroke-linecap: round }
.gauge .red { fill: none; stroke: var(--red); stroke-width: 10; opacity: .85 }
.gauge .tick { stroke: var(--dim); stroke-width: 2 }
.gauge .tick.major { stroke: var(--muted); stroke-width: 2.5 }
.gauge .needle { stroke: var(--needle); stroke-width: 3.5; stroke-linecap: round; transform-origin: 110px 110px }
.gauge .hub { fill: var(--panel); stroke: var(--needle); stroke-width: 3 }
.gauge .big { fill: var(--ink); font-family: var(--f-mono); font-weight: 700; font-size: 28px; text-anchor: middle }
.gauge .small { fill: var(--muted); font-family: var(--f-body); font-size: 11px; text-anchor: middle; letter-spacing: .06em; text-transform: uppercase }
@media (prefers-reduced-motion: no-preference) { .gauge .needle { transition: transform .9s cubic-bezier(.3, 1.4, .5, 1) } }
.gauge-cap { margin: 0; color: var(--muted); font-size: 12.5px; text-align: center }

.focus { display: grid; align-content: start; gap: 10px; min-width: 0 }
.focus-head { display: flex; align-items: baseline; gap: 10px }
.focus h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 20px }
.focus-n { color: var(--muted); font-family: var(--f-mono); font-size: 12px }
.focus-list { display: grid; gap: 4px }
.focus-empty { color: var(--muted); font-size: 13.5px; max-width: 52ch }

.readouts { margin: 0; display: grid; gap: 14px; align-content: center }
@media (max-width: 1000px) { .readouts { grid-template-columns: repeat(3, minmax(0, 1fr)) } }
@media (max-width: 640px) { .readouts { grid-template-columns: 1fr 1fr } .ro-wide { grid-column: 1 / -1 } }
.ro dt { color: var(--muted); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase }
.ro dd { margin: 2px 0 0; font-family: var(--f-mono); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums }
.ro-wide dd { font-family: var(--f-body); font-size: 16px; font-weight: 600 }
.ro-wide dd small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px }
.ro.alarm dd { color: var(--red) }

/* ─── Зоны ─── */
.lanes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; align-items: start }
@media (max-width: 1350px) { .lanes { grid-template-columns: repeat(3, minmax(0, 1fr)) } }
@media (max-width: 900px) { .lanes { grid-template-columns: repeat(2, minmax(0, 1fr)) } }
@media (max-width: 600px) { .lanes { grid-template-columns: 1fr } }

.lane { --c: var(--muted); display: grid; gap: 10px; min-width: 0 }
.c-work { --c: var(--c-work) }
.c-sport { --c: var(--c-sport) }
.c-projects { --c: var(--c-projects) }
.c-fun { --c: var(--c-fun) }
.c-cars { --c: var(--c-cars) }

.lane-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: 14px }
.lane-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); flex: none }
.lane-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round }
.lane-head h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 17px; flex: 1; min-width: 0 }
.lane-n { font-family: var(--f-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums }

.group { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 10px 8px; display: grid; gap: 4px }
.group-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px 4px; min-height: 26px }
.group-name { flex: 1; min-width: 0; font-weight: 700; font-size: 13.5px; cursor: text; word-break: break-word }
.group-meta { font-family: var(--f-mono); font-size: 11px; color: var(--dim) }
.badge { font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-radius: 5px; padding: 0 5px }
.items { display: grid; gap: 1px }

.item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: start; padding: 5px 6px; border-radius: 8px }
.item:hover { background: var(--raise) }
.item { position: relative; grid-template-columns: auto minmax(0, 1fr) }
.body { min-width: 0; padding-top: 1px; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 7px; row-gap: 3px }
.item .t { word-break: break-word; cursor: text }
.item.done .t { color: var(--dim); text-decoration: line-through; text-decoration-color: var(--dim) }
.star-mark { color: var(--amber); font-size: 12px }
/* Действия всплывают справа поверх строки при наведении */
.acts { position: absolute; top: 3px; right: 4px; display: none; gap: 1px; padding: 1px; border-radius: 7px; background: var(--raise); box-shadow: -10px 0 10px var(--raise) }
.item:hover .acts, .item:focus-within .acts, .acts.show { display: flex }
.acts .ic { opacity: 1 }
@media (hover: none) { .acts { position: static; display: flex; grid-column: 2; box-shadow: none; background: none; padding: 0 } }
.focus .item { grid-template-columns: auto minmax(0, 1fr) }
.where { font-size: 11px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; margin-left: auto }
.where::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c) }

/* Галочка в цвет зоны */
.check { appearance: none; -webkit-appearance: none; margin: 2px 0 0; width: 17px; height: 17px; border: 2px solid color-mix(in srgb, var(--c) 70%, var(--dim)); border-radius: 5px; cursor: pointer; display: grid; place-items: center; background: transparent; flex: none }
.check:checked { background: var(--c) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%2317161b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat; border-color: var(--c) }
@media (prefers-reduced-motion: no-preference) { .check { transition: background-color .15s, border-color .15s } }
.dot { width: 17px; height: 17px; display: grid; place-items: center; color: var(--c); flex: none }
.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8 }

.ic { opacity: 0; background: none; border: 0; color: var(--muted); padding: 1px 5px; border-radius: 5px; cursor: pointer; font-size: 12px; line-height: 1.5 }
.ic:hover { color: var(--ink); background: var(--line) }
.item:hover .ic, .group-head:hover .ic, .ic:focus-visible, .ic.on, .ic.armed { opacity: 1 }
.ic.star.on { color: var(--amber) }
.ic.armed { color: var(--red); font-weight: 700 }
@media (hover: none) { .ic { opacity: .75 } }

.due { border: 0; cursor: pointer; font-family: var(--f-mono); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--line); color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums }
.due.today { background: var(--amber); color: #241900 }
.due.late { background: var(--red); color: #fff }
.item.done .due { background: transparent; color: var(--dim) }

.due-edit { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 0 4px }
.due-edit .hint { width: 100%; font-size: 11.5px; color: var(--muted) }
.btn { background: var(--raise); border: 1px solid var(--line); border-radius: 7px; padding: 4px 10px; cursor: pointer; font-size: 12.5px }
.btn:hover { border-color: var(--dim) }
.btn.go { background: var(--c, var(--needle)); color: #17161b; border-color: transparent; font-weight: 700 }

.inp { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; color: var(--ink) }
.inp:focus { border-color: var(--c, var(--needle)); outline: none }
.inp.small { width: auto; padding: 3px 7px; font-size: 12.5px }
.inp::placeholder { color: var(--dim) }
.add { justify-self: start; background: none; border: 0; color: var(--dim); padding: 4px 6px; border-radius: 7px; cursor: pointer; font-size: 13px }
.add:hover { color: var(--c); background: var(--raise) }
.add-group { justify-self: stretch; text-align: center; border: 1px dashed var(--line); border-radius: 14px; padding: 9px }
.lane-empty { color: var(--muted); font-size: 13px; padding: 4px 4px 0 }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--raise); border: 1px solid var(--line); border-left: 4px solid var(--needle); border-radius: 10px; padding: 10px 16px; max-width: min(520px, calc(100vw - 32px)); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); z-index: 10 }
.toast.err { border-left-color: var(--red) }

/* ─── Вход ─── */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px }
.login { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--needle); border-radius: 18px; padding: 28px; display: grid; gap: 8px; width: 100%; max-width: 360px }
.login h1 { font-size: 24px; margin-bottom: 14px }
.login label { font-size: 12.5px; color: var(--muted); margin-top: 6px }
.login input { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px }
.login input:focus { border-color: var(--needle); outline: none }
.login button { margin-top: 16px; background: var(--needle); color: #1d0e00; border: 0; border-radius: 9px; padding: 11px; font-weight: 700; cursor: pointer }
.login-err { margin: 0; color: var(--red); font-size: 13px }
