/* Цвета из бренда: /root/projects/brand/brand-tokens.css («тёмный орех») */
:root {
  --bg: #513C2C;
  --bg-deep: #45301F;
  --surface: #634A38;
  --line: rgba(255, 247, 222, .12);
  --text: #FFF7DE;
  --text-2: #E7D8C4;
  --muted: #B4B2BF;
  --accent: #40BCD8;
  --accent-ink: #0C3D48;
  --accent-text: #5FD0E8;
  --accent-soft: rgba(64, 188, 216, .14);
  --rose-text: #E4B9C2;
  --danger: #EB9DAD;
  --font-display: 'Rubik', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg-deep);
  color: var(--text);
  font: 14px/1.4 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }

/* ---------- вход ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box {
  width: 100%; max-width: 320px; background: var(--surface);
  border-radius: 16px; padding: 28px; display: grid; gap: 12px;
}
.login-box h1 { font: 800 28px var(--font-display); margin: 0; }
.login-box p { margin: 0 0 8px; color: var(--muted); }
.login-box input {
  background: var(--bg-deep); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px;
}
.btn {
  background: var(--accent); color: var(--accent-ink); border: 0;
  border-radius: 10px; padding: 12px; font-weight: 600; cursor: pointer;
}
.login-error { color: var(--danger); }

/* ---------- раскладка ---------- */
.app {
  display: grid;
  grid-template-columns: 210px 190px minmax(0, 1fr);
  gap: 10px; padding: 12px; min-height: 100vh; align-items: start;
}
.app > * { min-width: 0; }
.side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; position: sticky; top: 12px; }
.card { background: var(--bg); border-radius: 14px; padding: 14px; }
.label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 8px;
}
.link {
  background: none; border: 0; color: var(--accent-text); cursor: pointer;
  padding: 2px 4px; text-align: left; justify-self: start;
}

.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.week-nav .label { margin: 0; text-align: center; }
.week-title { font: 700 15px var(--font-display); text-align: center; white-space: nowrap; }
.arrow {
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--surface); font-size: 20px; line-height: 1;
}
.arrow:hover { background: var(--accent-soft); color: var(--accent-text); }

/* цели */
.goal { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.goal input[type=text] {
  flex: 1; min-width: 0; width: 100%; background: none; border: 0;
  border-bottom: 1px solid var(--line); padding: 4px 0;
}
.goal input[type=text]:focus { outline: none; border-color: var(--accent); }
.goal.done input[type=text] { text-decoration: line-through; color: var(--muted); }

/* итог */
.summary { display: grid; gap: 10px; }
.summary .big { display: flex; align-items: center; gap: 12px; }
.summary .row { display: flex; justify-content: space-between; gap: 8px; color: var(--text-2); white-space: nowrap; }
.summary .row b { color: var(--text); font-weight: 600; }

/* кольцо */
.ring { flex: none; }
.ring .track { stroke: var(--surface); }
.ring .fill { stroke: var(--accent); transition: stroke-dashoffset .3s; }
.ring text { fill: var(--text); font: 700 11px var(--font-display); }
.ring.big text { font-size: 16px; }

/* ---------- колонки дней ---------- */
.weeks { display: grid; gap: 10px; }
.next-title { margin: 6px 0 -2px 4px; }
.days {
  display: grid; grid-template-columns: repeat(7, minmax(128px, 1fr));
  gap: 10px; overflow-x: auto; padding-bottom: 4px;
}
.col {
  background: var(--bg); border-radius: 14px; padding: 12px 10px;
  display: flex; flex-direction: column; gap: 8px; min-height: 260px;
}
.col.today { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.today-col { position: sticky; top: 12px; }
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-name { font: 700 15px var(--font-display); }
.days .day-name { font-size: 14px; }
.col.today .day-name { color: var(--accent-text); }
.day-date { color: var(--muted); font-size: 12px; }
.day-count { color: var(--text-2); font-size: 12px; min-height: 17px; }
.day-stat { display: flex; align-items: center; gap: 8px; }
.days .task { font-size: 13px; }

.task { position: relative; display: flex; align-items: flex-start; gap: 6px; padding: 3px 0; }
.task input[type=checkbox], .goal input[type=checkbox] {
  flex: none; width: 18px; height: 18px; margin: 1px 0 0;
  accent-color: var(--accent); cursor: pointer;
}
.task .body { flex: 1; min-width: 0; }
.task .text { display: block; overflow-wrap: break-word; cursor: text; }
.task .time { color: var(--accent-text); font-weight: 600; }
.task.done .text, .task.done .time { text-decoration: line-through; color: var(--muted); }
.goal-chip { font-size: 11px; color: var(--rose-text); margin-top: 1px; overflow-wrap: break-word; }
.task .edit {
  flex: 1; min-width: 0; width: 100%; background: var(--bg-deep); border: 1px solid var(--accent);
  border-radius: 6px; padding: 2px 6px;
}
.acts { display: flex; flex: none; }
.act {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  padding: 0 3px; font-size: 15px; line-height: 1.2;
}
.act:hover { color: var(--accent-text); }
.act:last-child:hover { color: var(--danger); }
/* на компьютере кнопки появляются при наведении и не отнимают ширину */
@media (hover: hover) {
  .acts {
    position: absolute; right: -4px; top: 1px; display: none;
    background: var(--bg); border-radius: 6px; padding: 1px 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  }
  .col.today .acts { background: #40453F; }
  .task:hover .acts { display: flex; }
  .task[draggable=true] { cursor: grab; }
}
.task.dragging { opacity: .35; }
.task.drop-before { box-shadow: 0 -2px 0 var(--accent); }
.add-row.drop-end { box-shadow: 0 -2px 0 var(--accent); }

/* меню выбора цели */
.menu {
  position: absolute; z-index: 10; min-width: 180px; max-width: 260px;
  background: var(--surface); border-radius: 10px; padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.menu-item {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  border-radius: 6px; padding: 7px 10px; cursor: pointer; color: var(--text);
}
.menu-item:hover { background: var(--accent-soft); }
.menu-item.on { color: var(--accent-text); }
.menu-item.on::before { content: '✓ '; }
.menu-empty { padding: 7px 10px; color: var(--muted); }
.goal-progress { font-size: 11px; color: var(--rose-text); flex: none; }

.add-row { display: flex; align-items: center; gap: 4px; border-bottom: 1px dashed var(--line); }
.add-row:focus-within { border-bottom-color: var(--accent); }
.add {
  flex: 1; min-width: 0; background: none; border: 0; padding: 6px 0;
}
.plus {
  flex: none; background: none; border: 0; cursor: pointer; padding: 0 2px 0 0;
  color: var(--accent-text); font-size: 18px; line-height: 1;
}
.plus:hover { color: var(--accent-hover, #7FDCEE); }
.add::placeholder { color: var(--muted); }
.add:focus { outline: none; }
.empty { color: var(--muted); font-size: 13px; }

.note {
  margin-top: auto; width: 100%; min-height: 70px; resize: vertical;
  background: var(--bg-deep); border: 1px solid transparent; border-radius: 8px;
  padding: 8px; color: var(--text-2); font-size: 13px;
}
.col.today .note { background: rgba(69, 48, 31, .7); }
.note:focus { outline: none; border-color: var(--accent); }
.note::placeholder { color: var(--muted); }

/* ---------- телефон и узкое окно ---------- */
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; }
  .side, .today-col { position: static; }
  .today-col { order: -1; min-height: 0; }
  .days { grid-template-columns: minmax(0, 1fr); overflow: visible; }
  .col { min-height: 0; }
  .task { padding: 6px 0; }
}
