/* ============================================================
   GOALS.CSS — страница «Цели» и редактор цели
   ============================================================ */

/* Сетка карточек целей */
.gl-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(280px, 1fr));
  gap:14px;
}
.gl-card {
  background:#fff; border-radius:16px; padding:14px;
  box-shadow:0 1px 3px rgba(74,55,40,.08);
  cursor:pointer; transition:transform .08s ease;
  display:flex; flex-direction:column; gap:8px;
}
.gl-card:hover { transform:scale(1.02); }
.gl-card.g-done { opacity:.75; }
.gl-name { font-weight:800; font-size:15px; }
.gl-days {
  display:inline-block; font-size:12px; font-weight:700;
  padding:3px 10px; border-radius:999px;
  background:var(--accent-soft); color:var(--accent);
}
.gl-days.over { background:rgba(217,83,79,.12); color:var(--red); }
.gl-bar {
  height:10px; border-radius:999px; background:var(--surface2);
  overflow:hidden;
}
.gl-bar > div {
  height:100%; border-radius:999px;
  background:linear-gradient(90deg, var(--accent), #d9a05f);
  transition:width .3s ease;
}
.gl-meta { display:flex; gap:10px; flex-wrap:wrap; font-size:12px; color:var(--muted); }
.gl-meta b { color:var(--text); }
.gl-tag {
  font-size:10px; padding:2px 8px; border-radius:999px;
  background:var(--surface2); color:var(--muted);
  display:inline-flex; gap:4px; align-items:center; width:fit-content;
}
.gl-tag .lg-dot { margin:0; }
.gl-purpose { font-size:11px; color:var(--muted); font-style:italic; }

/* ---------- РЕДАКТОР ---------- */
.ed-wrap {
  position:fixed; inset:0; z-index:1100;
  background:#faf5ec;
  display:none; flex-direction:column;
}
.ed-wrap.open { display:flex; }
.ed-topbar {
  background:var(--surface); padding:10px 14px;
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  border-bottom:1px solid var(--border); flex-wrap:wrap;
  box-shadow:0 1px 4px rgba(74,55,40,.08); z-index:5;
}
.ed-canvas {
  flex:1; position:relative; overflow:auto;
  background:
    radial-gradient(circle, rgba(185,119,63,.10) 1px, transparent 1px) 0 0/24px 24px;
}

/* Окно в редакторе */
.ed-win {
  position:absolute;
  background:#fff; border-radius:14px;
  box-shadow:0 4px 18px rgba(74,55,40,.14);
  display:flex; flex-direction:column;
  min-width:220px; min-height:80px;
  overflow:hidden;
  border:1px solid var(--border);
}
.ed-win.pinned { box-shadow:0 4px 18px rgba(74,55,40,.14), 0 0 0 2px var(--accent); }
.ed-win.maxim {
  left:8px !important; top:8px !important;
  width:calc(100% - 16px) !important;
  height:calc(100% - 16px) !important;
  z-index:50;
}
.ed-head {
  display:flex; align-items:center; gap:6px;
  background:var(--surface);
  padding:5px 8px;
  cursor:grab; user-select:none;
  border-bottom:1px solid var(--border);
  flex-shrink:0;
}
.ed-win.pinned .ed-head { cursor:not-allowed; }
.ed-head.dragging { cursor:grabbing; }
.ed-wtitle {
  font-size:12px; font-weight:700; flex:1;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.ed-wbtn {
  border:none; background:none; cursor:pointer;
  font-size:13px; padding:1px 4px; border-radius:6px; flex-shrink:0;
}
.ed-wbtn:hover { background:var(--surface2); }
.ed-wbody {
  flex:1; overflow-y:auto; padding:8px; font-size:12px;
}

/* Настройки таблицы внутри окна */
.ed-cfg {
  display:flex; gap:6px; flex-wrap:wrap; align-items:center;
  padding:6px 8px; background:var(--accent-soft);
  border-bottom:1px dashed var(--border); font-size:11px; flex-shrink:0;
}
.ed-cfg label { color:var(--muted); }
.ed-cfg input, .ed-cfg select {
  padding:3px 6px; border:1px solid var(--border); border-radius:6px;
  font-family:inherit; font-size:11px; width:56px;
}
.ed-cfg select { width:auto; }

/* Таблица */
.ed-table { border-collapse:collapse; width:100%; }
.ed-table th, .ed-table td {
  border:1px solid var(--border); padding:2px 4px; font-size:11px;
}
.ed-table th {
  background:var(--surface); font-size:10px; color:var(--muted);
  padding:3px 4px;
}
.ed-table th input, .ed-table td.rowlab input {
  width:100%; border:none; background:none; font-family:inherit;
  font-size:11px; color:var(--text); padding:0;
}
.ed-cell {
  width:26px; height:22px; text-align:center; cursor:pointer;
  font-size:11px; user-select:none;
}
.ed-cell.on { background:var(--green); color:#fff; border-radius:4px; }
.ed-cell.off { background:rgba(217,83,79,.15); color:var(--red); border-radius:4px; }

/* Чек-лист окна */
.ed-check-item { display:flex; gap:6px; align-items:center; margin:3px 0; }
.ed-check-item.done span { text-decoration:line-through; color:var(--muted); }
.ed-add-row { display:flex; gap:4px; margin-top:6px; }
.ed-add-row input {
  flex:1; min-width:0; padding:4px 8px;
  border:1px solid var(--border); border-radius:8px; font-size:11px; font-family:inherit;
}
.ed-add-row button { padding:3px 9px; border-radius:8px; font-size:12px; }

/* Мини-календарь в окне */
.mini-cal { font-size:11px; }
.mini-cal .mc-week {
  display:grid; grid-template-columns:repeat(7,1fr); gap:2px; margin-bottom:2px;
  text-align:center; color:var(--muted); font-size:9px;
}
.mini-cal .mc-days {
  display:grid; grid-template-columns:repeat(7,1fr); gap:2px;
}
.mc-day {
  aspect-ratio:1; border-radius:5px; background:var(--surface);
  display:flex; align-items:center; justify-content:center;
  font-size:9px; position:relative; cursor:pointer;
}
.mc-day.today { outline:2px solid var(--accent); outline-offset:-2px; }
.mc-day .mc-dot {
  position:absolute; bottom:1px; width:5px; height:5px; border-radius:50%;
  background:var(--accent);
}
.mc-day .mc-dot.urgent { background:var(--red); }
.mc-day.has { background:var(--accent-soft); }

/* Привычки в окне */
.hwin-row { display:flex; align-items:center; gap:6px; margin:4px 0; flex-wrap:wrap; }
.hwin-name { font-size:11px; font-weight:600; flex:1; min-width:80px; }
.hwin-chip {
  width:24px; height:22px; border-radius:6px; border:1px solid var(--border);
  background:#fff; cursor:pointer; font-size:9px; font-family:inherit; padding:0;
}
.hwin-chip.done { background:var(--green); color:#fff; border-color:var(--green); }
.hwin-chip.part { border:2px solid var(--yellow); }
.hwin-chip.off { opacity:.35; cursor:default; }

/* Аналитика */
.an-cfg { display:flex; gap:6px; align-items:center; flex-wrap:wrap; margin-bottom:6px; }
.an-cfg select {
  padding:3px 6px; border:1px solid var(--border); border-radius:6px;
  font-family:inherit; font-size:11px;
}
.an-legend { font-size:11px; color:var(--muted); }
.an-legend div { margin:2px 0; }
