/* «Моя жизнь» — стили. Цвета задаются токенами; тёмная тема — те же роли с другими значениями. */

:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #efeee9;
  --surface-3: #e4e3dd;
  --border: rgba(11, 11, 11, 0.1);
  --border-strong: rgba(11, 11, 11, 0.18);
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #6d6b65;
  --accent: #2a78d6;
  --accent-strong: #256abf;
  --accent-hover: #1c5cab;
  --accent-text: #1c5cab;
  --accent-soft: #e2edfb;
  --danger: #c43333;
  --good: #006300;
  --good-fill: #0ca30c;
  --warn-text: #8a5a00;
  --warn-soft: #fdf3dc;
  /* Квадранты = категориальная палитра, проверена на различимость при дальтонизме */
  --q1: #eb6834;
  --q2: #2a78d6;
  --q3: #1baf7a;
  --q4: #eda100;
  --q-none: #a3a29b;
  /* Календарь: задачи, события, сроки — первые три цвета палитры, различимы при любом цветовосприятии */
  --cal-task: #2a78d6;
  --cal-event: #1baf7a;
  --cal-deadline: #eb6834;
  /* Тепловая карта: один оттенок, от светлого к тёмному */
  --heat-0: #e8e7e1;
  --heat-1: #b7d3f6;
  --heat-2: #6da7ec;
  --heat-3: #2a78d6;
  --heat-4: #184f95;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.04);
  --overlay: rgba(20, 20, 18, 0.38);
  --radius: 14px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #242422;
    --surface-3: #2f2f2c;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);
    --text: #ffffff;
    --text-2: #c3c2b7;
    --muted: #9a9890;
    --accent: #3987e5;
    --accent-strong: #256abf;
    --accent-hover: #2a78d6;
    --accent-text: #86b6ef;
    --accent-soft: #172a42;
    --danger: #e66767;
    --good: #0ca30c;
    --good-fill: #0ca30c;
    --warn-text: #fab219;
    --warn-soft: #2e2410;
    --q1: #d95926;
    --q2: #3987e5;
    --q3: #199e70;
    --q4: #c98500;
    --q-none: #6b6a64;
    --cal-task: #3987e5;
    --cal-event: #199e70;
    --cal-deadline: #d95926;
    --heat-0: #262624;
    --heat-1: #184f95;
    --heat-2: #256abf;
    --heat-3: #3987e5;
    --heat-4: #86b6ef;
    --grid: #2c2c2a;
    --axis: #383835;
    --shadow: none;
    --overlay: rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #242422;
  --surface-3: #2f2f2c;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #ffffff;
  --text-2: #c3c2b7;
  --muted: #9a9890;
  --accent: #3987e5;
  --accent-strong: #256abf;
  --accent-hover: #2a78d6;
  --accent-text: #86b6ef;
  --accent-soft: #172a42;
  --danger: #e66767;
  --good: #0ca30c;
  --good-fill: #0ca30c;
  --warn-text: #fab219;
  --warn-soft: #2e2410;
  --q1: #d95926;
  --q2: #3987e5;
  --q3: #199e70;
  --q4: #c98500;
  --q-none: #6b6a64;
  --cal-task: #3987e5;
  --cal-event: #199e70;
  --cal-deadline: #d95926;
  --heat-0: #262624;
  --heat-1: #184f95;
  --heat-2: #256abf;
  --heat-3: #3987e5;
  --heat-4: #86b6ef;
  --grid: #2c2c2a;
  --axis: #383835;
  --shadow: none;
  --overlay: rgba(0, 0, 0, 0.6);
}

/* ---------- База ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

body.has-sheet {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 17px;
  line-height: 1.3;
  font-weight: 650;
}

h3 {
  font-size: 16px;
  line-height: 1.35;
  font-weight: 600;
}

small {
  font-size: 0.55em;
  font-weight: 500;
  color: var(--text-2);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.i {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.hint {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
}

.link {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.danger {
  color: var(--danger) !important;
}

.success {
  margin-top: 8px;
  color: var(--good);
  font-weight: 600;
}

.pre {
  white-space: pre-wrap;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.clamp-2,
.clamp-4 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clamp-2 {
  -webkit-line-clamp: 2;
}

.clamp-4 {
  -webkit-line-clamp: 4;
}

kbd {
  font: 600 11px var(--font);
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid currentColor;
  opacity: 0.7;
}

/* ---------- Каркас ---------- */

.layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 14px;
  border-right: 1px solid var(--border);
}

.sidebar .btn-primary kbd {
  margin-left: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  font-weight: 700;
  font-size: 17px;
}

.brand-mark {
  width: 24px;
  height: 24px;
  flex: none;
}

.brand-mark.big {
  width: 48px;
  height: 48px;
}

.bm1 { fill: var(--q1); }
.bm2 { fill: var(--q2); }
.bm3 { fill: var(--q3); }
.bm4 { fill: var(--q4); }

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--text-2);
  font-weight: 550;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-link.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border), var(--shadow);
}

.nav-link .badge,
.nav-link .dot {
  margin-left: auto;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

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

.main {
  width: 100%;
  max-width: 980px;
  padding: 36px 48px 96px;
}

.main > * + * {
  margin-top: 16px;
}

.tabbar {
  display: none;
}

@media (max-width: 860px) {
  .layout {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: calc(18px + env(safe-area-inset-top)) 16px calc(100px + env(safe-area-inset-bottom));
  }

  .tabbar {
    position: fixed;
    z-index: 20;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
  }

  .tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 0;
    font-size: 11px;
    font-weight: 550;
    color: var(--text-2);
  }

  .tab .i {
    width: 22px;
    height: 22px;
  }

  .tab.is-active {
    color: var(--accent-text);
  }

  .tab .badge,
  .tab .dot {
    position: absolute;
    top: 0;
    left: calc(50% + 6px);
  }

  .tab .badge {
    min-width: 18px;
    height: 18px;
    font-size: 11px;
  }

  .tab-add {
    justify-self: center;
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border: 0;
    border-radius: 16px;
    background: var(--accent-strong);
    color: #fff;
    cursor: pointer;
  }

  .tab-add .i {
    width: 26px;
    height: 26px;
    stroke-width: 2.4;
  }

  h1 {
    font-size: 26px;
  }
}

/* ---------- Заголовки страниц ---------- */

.page-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.page-head.row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.head-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-2);
}

.head-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.head-stats .i {
  width: 16px;
  height: 16px;
}

.head-stats b {
  color: var(--text);
}

.group-title {
  margin-top: 26px !important;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-2);
  font-weight: 550;
  font-size: 15px;
}

.back:hover {
  color: var(--text);
}

.day-head {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.page-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.card.stack {
  display: flex;
}

.card.is-warn {
  background: var(--warn-soft);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.card-head h2,
.card-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-head > .muted {
  margin-left: auto;
  font-size: 14px;
  text-align: right;
}

.card-head h2 .i {
  color: var(--text-2);
}

.card-link {
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.15s;
}

.card-link:hover {
  border-color: var(--border-strong);
}

.card-link .grow {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-link > .i {
  color: var(--muted);
}

.icon-tile {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-2);
}

.icon-tile.emoji {
  font-size: 22px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
  margin-top: 10px !important;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.empty b {
  color: var(--text);
  font-size: 17px;
}

.empty .btn {
  margin-top: 10px;
}

.callout {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--warn-soft);
  font-size: 14px;
  line-height: 1.45;
}

.callout > .i {
  color: var(--warn-text);
  margin-top: 1px;
}

/* ---------- Кнопки и поля ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-primary {
  background: var(--accent-strong);
  border-color: transparent;
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-sm {
  min-height: 34px;
  padding: 5px 11px;
  font-size: 14px;
}

.btn-sm .i {
  width: 16px;
  height: 16px;
}

.btn.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn-block {
  width: 100%;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.add-focus {
  margin: 6px 0 0 -10px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn.sm {
  width: 30px;
  height: 30px;
}

.icon-btn.sm .i {
  width: 16px;
  height: 16px;
}

.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 16px;
  line-height: 1.45;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder,
.quick input::placeholder,
.inline-add input::placeholder,
.title-input::placeholder,
.h1-input::placeholder {
  color: var(--muted);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea.input {
  resize: vertical;
  min-height: 76px;
}

.input-lg {
  padding: 12px 14px;
  font-size: 18px;
}

.input-date {
  width: auto;
  padding: 6px 10px;
  font-size: 15px;
}

.input.auto {
  width: auto;
}

select.input {
  padding-right: 30px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.field .hint {
  font-size: 13px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 550;
  cursor: pointer;
}

.check-line input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-strong);
}

.form-error {
  color: var(--danger);
  font-size: 14px;
}

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: var(--surface-2);
  align-self: flex-start;
}

.seg-btn {
  padding: 7px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
}

.seg-btn.is-on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), inset 0 0 0 1px var(--border);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.chip-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
}

.chip-btn:hover {
  color: var(--text);
}

.chip-btn.sm {
  padding: 3px 10px;
  font-size: 13px;
}

.chip-btn.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Быстрый ввод ---------- */

.quick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.quick:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.quick input {
  flex: 1;
  min-width: 0;
  padding: 11px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.quick-hint {
  display: none;
  font-size: 13px;
  color: var(--text-2);
}

.quick:focus-within + .quick-hint {
  display: block;
}

.main > .quick-hint {
  margin-top: 6px;
}

.quick.flat {
  margin: 12px 0 6px;
  box-shadow: none;
  background: var(--surface-2);
  border-color: transparent;
}

/* ---------- Задачи ---------- */

.list {
  display: flex;
  flex-direction: column;
}

.task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 -10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s, opacity 0.2s;
}

.task:hover {
  background: var(--surface-2);
}

.task-main {
  flex: 1;
  min-width: 0;
}

.task-title {
  overflow-wrap: anywhere;
}

.task.is-done .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.task.is-completing {
  opacity: 0.55;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 2px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
}

.chip .i {
  width: 14px;
  height: 14px;
}

.chip.is-overdue {
  color: var(--danger);
  font-weight: 600;
}

.chip.is-today {
  color: var(--warn-text);
  font-weight: 600;
}

.chip.is-focus {
  color: var(--accent-text);
}

.check {
  --qc: var(--q-none);
  position: relative;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  margin-top: 1px;
  padding: 0;
  border: 2px solid var(--qc);
  border-radius: 50%;
  background: transparent;
  color: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

/* Область нажатия больше самого кружка */
.check::before {
  content: '';
  position: absolute;
  inset: -11px;
}

.check .i {
  width: 13px;
  height: 13px;
  stroke-width: 3;
}

.check:hover {
  color: var(--qc);
}

.check.q-1 { --qc: var(--q1); }
.check.q-2 { --qc: var(--q2); }
.check.q-3 { --qc: var(--q3); }
.check.q-4 { --qc: var(--q4); }

.check.q-done,
.task.is-completing .check {
  --qc: var(--good-fill);
  background: var(--good-fill);
  color: #fff;
}

.check.sm {
  width: 18px;
  height: 18px;
  margin: 0;
}

.check.sm .i {
  width: 11px;
  height: 11px;
}

.qdot {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 3px;
  background: var(--q-none);
}

.qdot.q-1 { background: var(--q1); }
.qdot.q-2 { background: var(--q2); }
.qdot.q-3 { background: var(--q3); }
.qdot.q-4 { background: var(--q4); }

.row-with-actions {
  padding-bottom: 8px;
}

.row-with-actions + .row-with-actions {
  border-top: 1px solid var(--border);
  padding-top: 4px;
}

.row-with-actions .btn-row {
  padding-left: 34px;
}

/* ---------- Матрица ---------- */

.matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 1100px) {
  .matrix {
    grid-template-columns: 1fr;
  }
}

.quad {
  --qc: var(--q-none);
  position: relative;
  overflow: hidden;
  padding: 18px 20px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.quad::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--qc);
}

.quad.q-1 { --qc: var(--q1); }
.quad.q-2 { --qc: var(--q2); }
.quad.q-3 { --qc: var(--q3); }
.quad.q-4 { --qc: var(--q4); }

.quad-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.quad-head > div {
  flex: 1;
}

.quad-head .hint {
  font-size: 13px;
}

.count {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.quad-empty {
  padding: 6px 0;
}

.inline-add input {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  margin-left: -10px;
  width: calc(100% + 20px);
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 15px;
}

.inline-add input:focus {
  outline: none;
  background: var(--surface-2);
}

/* ---------- Вкладки ---------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  padding: 10px 12px;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  font-weight: 550;
  white-space: nowrap;
}

.tabs a:hover {
  color: var(--text);
}

.tabs a.is-on {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* ---------- Входящие ---------- */

.triage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.triage {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
}

.triage-title {
  font-weight: 550;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.triage-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.triage-label {
  font-size: 13px;
  color: var(--muted);
  margin-right: 2px;
}

/* ---------- Проекты ---------- */

.project-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s;
}

.project-card:hover {
  border-color: var(--border-strong);
}

.pc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.area {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.progress {
  height: 6px;
  border-radius: 99px;
  background: var(--accent-soft);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
}

.next {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 14px;
  color: var(--text-2);
}

.next .i {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.next.is-warn {
  color: var(--warn-text);
  font-weight: 550;
}

.h1-input {
  width: 100%;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.h1-input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.pj-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.pj-controls .input {
  width: auto;
  padding: 6px 30px 6px 10px;
  font-size: 15px;
}

.date-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-2);
}

details.more {
  margin-top: 10px;
}

details.more > summary,
.table-view > summary {
  cursor: pointer;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 550;
  padding: 4px 0;
}

details.card.more > summary {
  font-size: 15px;
  color: var(--text);
}

details.card.more[open] > summary {
  margin-bottom: 10px;
}

.link-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-weight: 550;
}

.link-list a:first-child {
  border-top: 0;
}

/* ---------- Блокнот ---------- */

.list-card {
  padding-top: 4px;
  padding-bottom: 4px;
}

.entry-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.entry-row:first-child {
  border-top: 0;
}

.entry-row .grow {
  display: flex;
  flex-direction: column;
}

.entry-row .mood {
  width: 28px;
  font-size: 22px;
  text-align: center;
  color: var(--muted);
}

.entry-date {
  font-weight: 600;
}

.moods {
  display: flex;
  gap: 8px;
}

.mood-btn {
  flex: 1;
  max-width: 64px;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  font-size: 26px;
  cursor: pointer;
  filter: grayscale(0.7);
  opacity: 0.65;
  transition: opacity 0.15s, filter 0.15s;
}

.mood-btn:hover {
  opacity: 1;
  filter: none;
}

.mood-btn.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  filter: none;
  opacity: 1;
}

.note-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.note-card:hover {
  border-color: var(--border-strong);
}

.note-card p {
  color: var(--text-2);
  font-size: 15px;
  white-space: pre-wrap;
}

.pinned .i {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

/* ---------- Обзор недели ---------- */

.step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.step-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 650;
}

.step-num .i {
  width: 15px;
  height: 15px;
  stroke-width: 3;
}

.step.is-ok .step-num {
  background: var(--good-fill);
  color: #fff;
}

.step .list,
.step .btn,
.step .link-list {
  margin-top: 8px;
}

/* ---------- Настройки и меню ---------- */

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.setting:first-child {
  border-top: 0;
  padding-top: 0;
}

.setting:last-child {
  padding-bottom: 0;
}

.guide {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 15px;
  color: var(--text-2);
}

.guide b {
  color: var(--text);
}

.menu-list {
  padding-top: 4px;
  padding-bottom: 4px;
}

.menu-list a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.menu-list a:first-child {
  border-top: 0;
}

.menu-list .grow {
  display: flex;
  flex-direction: column;
}

.menu-list a > .i {
  color: var(--muted);
}

/* ---------- Статистика ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

@media (max-width: 560px) {
  .tiles {
    grid-template-columns: 1fr 1fr;
  }
}

.tile {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.tiles.compact .tile {
  background: var(--surface-2);
  border: 0;
  box-shadow: none;
}

.tile-label {
  font-size: 13px;
  color: var(--text-2);
}

.tile-value {
  margin: 2px 0;
  font-size: 30px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.tiles.compact .tile-value {
  font-size: 24px;
}

.tile-sub {
  font-size: 13px;
  line-height: 1.4;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 650;
}

.delta .i {
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
}

.delta.is-good {
  color: var(--good);
}

.delta.is-bad {
  color: var(--danger);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-2);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sw {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* Столбцы по неделям */
.cc {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  grid-template-rows: 180px auto;
  column-gap: 8px;
  margin-top: 26px;
}

.cc-y {
  position: relative;
}

.cc-y span {
  position: absolute;
  right: 0;
  transform: translateY(50%);
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cc-plot {
  position: relative;
  border-bottom: 1px solid var(--axis);
}

.cc-grid {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--grid);
}

.cc-cols {
  position: absolute;
  inset: 0;
  display: flex;
}

.cc-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  border-radius: 6px 6px 0 0;
  outline-offset: -2px;
}

.cc-col:hover,
.cc-col:focus-visible {
  background: color-mix(in srgb, var(--text) 5%, transparent);
}

.cc-stack {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  width: min(24px, 64%);
}

.cc-stack > div {
  min-height: 2px;
}

.cc-stack > div:last-child {
  border-radius: 4px 4px 0 0;
}

.cc-cap {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding-bottom: 4px;
  font-size: 12px;
  font-weight: 650;
}

.cc-x {
  grid-column: 2;
  position: relative;
  height: 24px;
}

/* Подпись стоит по центру своего столбца и не раздвигает график */
.cc-x span {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .cc-x span:nth-child(even) {
    display: none;
  }
}

/* Тепловая карта */
.heat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 480px;
}

.heat-months,
.heat-grid {
  display: grid;
  grid-template-columns: 22px repeat(18, minmax(0, 1fr));
  gap: 3px;
}

.heat-months span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: visible;
}

.heat-grid {
  grid-template-rows: repeat(7, auto);
  grid-auto-flow: column;
}

.heat-day {
  font-size: 10px;
  line-height: 1;
  color: var(--muted);
  align-self: center;
}

.heat-cell {
  display: block;
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--heat-0);
}

.heat-cell.l1 { background: var(--heat-1); }
.heat-cell.l2 { background: var(--heat-2); }
.heat-cell.l3 { background: var(--heat-3); }
.heat-cell.l4 { background: var(--heat-4); }

.heat-cell.is-future {
  background: transparent;
}

.heat-grid .heat-cell[data-tip]:hover {
  outline: 2px solid var(--text);
  outline-offset: -1px;
}

.heat-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-2);
}

.heat-legend .heat-cell {
  width: 12px;
}

/* Настроение */
.mood-chart {
  height: 170px;
}

.mood-chart svg {
  display: block;
  overflow: visible;
}

.mc-grid {
  stroke: var(--grid);
  stroke-width: 1;
}

.mc-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mc-dot {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
}

.mc-hit {
  fill: transparent;
}

.mc-label {
  font-size: 12px;
  fill: var(--muted);
}

.mc-emoji {
  font-size: 13px;
}

/* Сферы жизни */
.hbars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.hbar-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.hbar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}

.hbar-track {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hbar {
  height: 14px;
  min-width: 2px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}

.hbar-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Таблица под графиком */
.table-view {
  margin-top: 12px;
}

.table-wrap {
  overflow-x: auto;
}

.table-view table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.table-view th,
.table-view td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.table-view th {
  font-weight: 600;
  color: var(--text-2);
}

.table-view th:first-child,
.table-view td:first-child {
  text-align: left;
}

/* Подсказка у графиков */
#tooltip {
  position: fixed;
  z-index: 70;
  min-width: 150px;
  max-width: 260px;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  font-size: 13px;
  pointer-events: none;
}

.tip-title {
  margin-bottom: 4px;
  color: var(--text-2);
}

.tip-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.tip-row b {
  font-variant-numeric: tabular-nums;
}

.tip-row span:last-child {
  color: var(--text-2);
}

.tip-key {
  width: 12px;
  height: 3px;
  flex: none;
  border-radius: 2px;
}

/* ---------- Шторка ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--overlay);
  animation: fade-in 0.15s ease-out;
}

.sheet {
  position: fixed;
  z-index: 41;
  top: 7vh;
  left: 50%;
  display: flex;
  flex-direction: column;
  width: min(580px, calc(100vw - 32px));
  max-height: 86vh;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  animation: pop-in 0.16s ease-out;
}

.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 22px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 860px) {
  .sheet {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 92dvh;
    transform: none;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
    animation: slide-up 0.22s ease-out;
  }

  .sheet-body {
    padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: -4px;
}

.sheet-head .icon-btn {
  margin-right: -8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.pill .i {
  width: 14px;
  height: 14px;
}

.pill.is-good {
  color: var(--good);
}

.te-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.te-title .check {
  margin-top: 6px;
}

.title-input {
  flex: 1;
  min-height: 34px;
  padding: 2px 0;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 21px;
  font-weight: 650;
  line-height: 1.35;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.step-item.is-done .grow {
  color: var(--muted);
  text-decoration: line-through;
}

.step-add .input {
  margin-top: 4px;
  padding: 7px 10px;
  font-size: 15px;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.pick-chosen-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pick-chosen {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 550;
}

.pick-chosen .grow {
  color: var(--text);
}

.pick-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pick-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pick-group .field-label {
  margin-bottom: 4px;
}

.pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.pick-item:hover {
  background: var(--surface-2);
}

.pick-item > .i {
  color: var(--muted);
}

/* ---------- Уведомления, вход, загрузка ---------- */

#toasts {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  pointer-events: none;
}

@media (max-width: 860px) {
  #toasts {
    bottom: calc(82px + env(safe-area-inset-bottom));
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-radius: 12px;
  background: #1f1f1d;
  color: #fff;
  font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  pointer-events: auto;
  animation: pop-in 0.18s ease-out;
  transition: opacity 0.3s;
}

:root[data-theme='dark'] .toast {
  background: #34342f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .toast {
    background: #34342f;
  }
}

.toast button {
  padding: 0;
  border: 0;
  background: none;
  color: #86b6ef;
  font-weight: 650;
  cursor: pointer;
}

.toast.out {
  opacity: 0;
}

#sync-pill {
  position: fixed;
  z-index: 50;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 6px 14px;
  transform: translateX(-50%);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text-2);
  font-size: 13px;
  text-align: center;
}

#sync-pill.is-offline {
  color: var(--warn-text);
}

.login,
.boot {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.boot {
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--text-2);
  text-align: center;
}

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(380px, 100%);
  text-align: center;
}

.login-card .brand-mark {
  margin-bottom: 4px;
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateX(-50%) translateY(6px) scale(0.98); }
}

@keyframes slide-up {
  from { transform: translateY(40px); opacity: 0; }
}

.toast {
  animation-name: toast-in;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* =====================================================================
   Календарь, шкала дня, расписание, планирование
   ===================================================================== */

.k-task { --kc: var(--cal-task); }
.k-event { --kc: var(--cal-event); }
.k-deadline { --kc: var(--cal-deadline); }
.sw.k-task, .sw.k-event, .sw.k-deadline { background: var(--kc); }

.cal-legend {
  margin-bottom: 0;
}

.cal-head {
  align-items: center;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.input-time {
  width: auto;
  padding: 6px 10px;
  font-size: 15px;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 10px;
}

.status-line.is-good {
  color: var(--good);
}

.hint.center {
  text-align: center;
}

.card-link.is-accent {
  background: var(--accent-soft);
  border-color: transparent;
}

.card-link.is-accent .icon-tile {
  background: var(--surface);
  color: var(--accent-text);
}

.te-subject {
  font-size: 17px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.pick-list.compact {
  max-height: 300px;
  overflow-y: auto;
  gap: 2px;
}

.pick-item.is-on {
  background: var(--accent-soft);
}

.pick-item.is-on > .i {
  color: var(--accent-text);
}

/* ---------- Месяц ---------- */

.month {
  padding: 0;
  overflow: hidden;
}

.mc-head,
.mc-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.mc-head span {
  padding: 10px 0 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.mc-day {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 108px;
  padding: 6px 6px 8px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  overflow: hidden;
  transition: background 0.12s;
}

.mc-day:nth-child(7n + 1) {
  border-left: 0;
}

.mc-day:hover {
  background: var(--surface-2);
}

.mc-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.mc-day.is-weekend .mc-num {
  color: var(--muted);
}

.mc-day.is-out {
  background: color-mix(in srgb, var(--surface-2) 45%, transparent);
}

.mc-day.is-out .mc-num {
  color: var(--muted);
  font-weight: 500;
}

.mc-day.is-today .mc-num {
  background: var(--accent-strong);
  color: #fff;
}

.mc-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mc-item {
  display: block;
  padding: 1px 4px 1px 6px;
  border-left: 3px solid var(--kc);
  border-radius: 3px;
  background: color-mix(in srgb, var(--kc) 12%, transparent);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mc-item b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.mc-item.is-done {
  color: var(--muted);
  text-decoration: line-through;
}

.mc-more {
  font-size: 12px;
  color: var(--text-2);
  padding-left: 6px;
}

.mc-dots {
  display: none;
  justify-content: center;
  gap: 3px;
}

.mc-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--kc);
}

@media (max-width: 700px) {
  .mc-day {
    align-items: center;
    min-height: 62px;
    padding: 6px 2px;
  }

  .mc-items {
    display: none;
  }

  .mc-dots {
    display: flex;
  }

  .cal-head h1 {
    font-size: 24px;
  }

  .cal-nav .btn-primary {
    padding: 5px 9px;
  }
}

/* Ближайшие дни */
.ag-day {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.ag-day:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.ag-date {
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

.ag-date span {
  color: var(--text-2);
  font-size: 13px;
}

.ag-items {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 5px 6px;
  margin: 0 -6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.ag-row:hover {
  background: var(--surface-2);
}

.ag-row .grow {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-time {
  flex: none;
  width: 74px;
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.ag-mark {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--kc);
}

.is-done {
  color: var(--muted);
  text-decoration: line-through;
}

@media (max-width: 560px) {
  .ag-day {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .ag-date {
    flex-direction: row;
    gap: 8px;
    align-items: baseline;
  }
}

/* ---------- День ---------- */

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.ws-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 0 5px;
  border-radius: 12px;
  color: var(--text-2);
  font-size: 12px;
}

.ws-day b {
  font-size: 17px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.ws-day i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.ws-day i.has {
  background: var(--muted);
}

.ws-day:hover {
  background: var(--surface-2);
}

.ws-day.is-today b {
  color: var(--accent-text);
}

.ws-day.is-on {
  background: var(--text);
  color: var(--bg);
}

.ws-day.is-on b {
  color: var(--bg);
}

.ws-day.is-on i.has {
  background: var(--bg);
}

.load-text {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  margin-bottom: 6px;
}

.load-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--accent-soft);
  overflow: hidden;
}

.load-bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
}

.load.is-high .load-bar > span {
  background: var(--q4);
}

.load.is-over .load-bar > span {
  background: var(--danger);
}

.load .hint,
.load-warn {
  margin-top: 6px;
}

.load-warn {
  display: flex;
  gap: 6px;
  font-size: 14px;
  color: var(--danger);
}

.load-warn .i {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.day-allday {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.day-allday .field-label:not(:first-child) {
  margin-top: 10px;
}

.ut-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ut-row .task {
  flex: 1;
  min-width: 0;
}

.ut-row .btn {
  flex: none;
}

.tl-card {
  padding: 14px 14px 18px 8px;
}

.tl-empty {
  margin: 0 0 12px 8px;
}

.tl {
  position: relative;
  margin-top: 8px;
}

.tl-hour {
  position: absolute;
  left: 52px;
  right: 0;
  border-top: 1px solid var(--grid);
}

.tl-hour span {
  position: absolute;
  left: -52px;
  top: 0;
  width: 44px;
  transform: translateY(-50%);
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tl-area {
  position: absolute;
  inset: 0 0 0 52px;
  cursor: copy;
}

.tl-blocks {
  position: absolute;
  inset: 0 0 0 52px;
  pointer-events: none;
}

.tl-block {
  position: absolute;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 8px;
  border-left: 3px solid var(--kc);
  border-radius: 8px;
  background: color-mix(in srgb, var(--kc) 14%, var(--surface));
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
  transition: filter 0.12s;
}

.tl-block:hover {
  filter: brightness(0.97);
}

.tl-block .check {
  margin-top: 1px;
}

.tl-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tl-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-time {
  color: var(--text-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tl-block.is-short {
  align-items: center;
  padding-top: 2px;
  padding-bottom: 2px;
}

.tl-block.is-short .tl-text {
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}

.tl-block.is-done {
  opacity: 0.6;
}

.tl-block.is-done .tl-title {
  text-decoration: line-through;
}

.tl-now {
  position: absolute;
  left: 46px;
  right: 0;
  height: 2px;
  background: var(--danger);
  pointer-events: none;
  z-index: 2;
}

.tl-now::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}

/* ---------- Расписание на «Сегодня» ---------- */

.sc-allday {
  margin-bottom: 8px;
}

.sc-list {
  display: flex;
  flex-direction: column;
}

.sc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 -10px;
  width: calc(100% + 20px);
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.sc-row:hover {
  background: var(--surface-2);
}

.sc-row .grow {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sc-time {
  flex: none;
  width: 92px;
  font-size: 14px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.sc-row.is-past {
  opacity: 0.5;
}

.sc-row.is-now {
  background: var(--accent-soft);
}

.sc-badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.sc-badge.is-now {
  background: var(--accent-strong);
  color: #fff;
}

@media (max-width: 700px) {
  .hide-sm {
    display: none;
  }
}
