:root {
  --green: #2e5e4e;
  --green-soft: #e8f0ec;
  --red: #b00020;
  --red-soft: #fdecee;
  --text: #1d2521;
  --muted: #68736d;
  --line: #dde3df;
  --bg: #f5f7f6;
  --card: #ffffff;
  --radius: 10px;
}

* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
.hidden { display: none !important; }
a { color: var(--green); }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 1.2em; }
button, .button {
  font: inherit; border: 1px solid var(--green); background: var(--green); color: #fff;
  border-radius: 8px; padding: 7px 14px; cursor: pointer;
}
button.secondary, .button.secondary { background: #fff; color: var(--green); }
.button { display: inline-block; text-decoration: none; }
button.danger { background: #fff; color: var(--red); border-color: var(--red); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; color: var(--text);
}
textarea { width: 100%; min-height: 70px; resize: vertical; }
input[type="date"] { cursor: pointer; }

/* Вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { background: var(--card); padding: 28px; border-radius: var(--radius); width: min(360px, 100%); display: grid; gap: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.login-box h1 { margin: 0; color: var(--green); }

/* Каркас */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: var(--green); color: #fff; padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
.side .brand { font-weight: 700; font-size: 18px; padding: 4px 10px 16px; }
.side a { color: #fff; text-decoration: none; padding: 8px 10px; border-radius: 8px; opacity: .9; }
.side a.active, .side a:hover { background: rgba(255,255,255,.14); opacity: 1; }
.side .logout { margin-top: auto; opacity: .7; }
.badge { background: #fff; color: var(--green); border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.badge:empty { display: none; }
main { padding: 20px 28px 40px; width: 100%; min-width: 0; }
.topbar { display: flex; gap: 10px; max-width: 1100px; }
.topbar .search { flex: 1; }
.search { max-width: 1100px; }

/* Разделитель в плане дня (08.10.2026): полоса с подписью посередине. */
.plan-sep { align-items: center; gap: 10px; background: #fafcfb; padding: 6px 14px; }
.plan-sep .sep-line { flex: 1; height: 2px; background: var(--green); opacity: .35; }
.plan-sep .sep-label { font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: .04em; font-size: 13px; cursor: text; }
.row.drop-after { box-shadow: inset 0 -3px 0 var(--green); }
.plan-row.dragging, .plan-sep.dragging { opacity: .35; background: var(--green-soft); }
.dragging-active .plan-row, .dragging-active .plan-sep { transition: box-shadow .05s; }
.label-chip { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #eef2f7; color: #3a4a5c; margin-left: 6px; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; align-items: center; margin-top: 12px; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips button { background: #fff; color: var(--text); border-color: var(--line); }
.chips button.current { background: var(--green); color: #fff; border-color: var(--green); }

/* Список и открытая задача рядом (на широком экране). */
.workspace { display: grid; grid-template-columns: minmax(0, 1100px); gap: 20px; align-items: start; }
.workspace.with-detail { grid-template-columns: minmax(380px, 1fr) minmax(420px, 1fr); }
.detail { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px 18px; margin-top: 18px; }
.detail .panel { border: 0; padding: 10px 0 0; margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0; }
.detail-close { float: right; background: none; border: 0; color: var(--muted); font-size: 20px; padding: 0 4px; }
.row.selected { background: var(--green-soft); }

/* План дня */
.plan-row { align-items: center; }
.plan-row .num { color: var(--muted); min-width: 22px; text-align: right; }
.plan-row.done .title { text-decoration: line-through; color: var(--muted); }
.plan-row .handle { cursor: grab; color: var(--muted); user-select: none; padding: 0 2px; }
.plan-row.dragging { opacity: .4; }
.plan-row.drop-before { box-shadow: inset 0 3px 0 var(--green); }
.icon-button { background: none; border: 0; color: var(--muted); padding: 2px 6px; font-size: 15px; }
.icon-button:hover { color: var(--green); }
.check { width: 18px; height: 18px; accent-color: var(--green); }
.more { padding: 10px 14px; color: var(--green); cursor: pointer; border-top: 1px solid var(--line); }
.day-nav { display: flex; gap: 6px; align-items: center; }
.search input { width: 100%; padding: 10px 14px; }
#view { margin-top: 18px; }
h2 { margin: 6px 0 12px; font-size: 20px; }
h3 { margin: 22px 0 8px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* Списки */
.list { background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.row { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.row:first-child { border-top: 0; }
.row:hover { background: #fafcfb; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .sub { color: var(--muted); font-size: 13.5px; }
.row .note { color: #33691e; font-size: 13.5px; }
.row .side-info { color: var(--muted); font-size: 13px; white-space: nowrap; text-align: right; }
.row.urgent .title::before { content: "🔥 "; }
.row.urgent .sub { color: var(--red); }
.row input[type=checkbox] { margin-top: 4px; }
.empty { padding: 16px; color: var(--muted); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; }
.tile .num { font-size: 26px; font-weight: 700; }
.tile.hot .num { color: var(--red); }

/* Задача */
.task-head { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.task-head h2 { flex: 1; min-width: 240px; }
.pill { display: inline-block; font-size: 12.5px; padding: 2px 9px; border-radius: 10px; background: var(--green-soft); color: var(--green); margin-right: 6px; }
.pill.red { background: var(--red-soft); color: var(--red); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 12px; }
.panel .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.history-item { padding: 6px 0; border-top: 1px dashed var(--line); }
.history-item:first-child { border-top: 0; }
.source { border-top: 1px solid var(--line); padding: 10px 0; }
.source:first-child { border-top: 0; }
.source summary { cursor: pointer; font-weight: 600; }
.source pre { white-space: pre-wrap; font: inherit; background: var(--bg); padding: 10px; border-radius: 8px; max-height: 420px; overflow: auto; }
.snippet { font-size: 13.5px; color: var(--muted); }
mark { background: #fff2a8; }
.dialog-back { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; padding: 16px; z-index: 10; }
.dialog { background: #fff; border-radius: var(--radius); padding: 18px; width: min(560px, 100%); max-height: 80vh; overflow: auto; }
.dialog .list { max-height: 50vh; overflow: auto; margin-top: 10px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 9px 16px; border-radius: 8px; z-index: 20; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-content: flex-start; padding: 8px; }
  .side .brand { width: 100%; padding: 4px 8px 6px; }
  .side .logout { margin-top: 0; }
  main { padding: 14px 16px 32px; }
  .workspace.with-detail { grid-template-columns: 1fr; }
  .row .side-info { display: none; }
}

/* Отклик по задаче из плана (19.10.2026): отложенная — бледнее, «пора вернуться» — заметно. */
.plan-row .num[data-place] { cursor: pointer; }
.plan-row .num[data-place]:hover { color: var(--green); text-decoration: underline; }
.plan-row.snoozed { opacity: .55; }
.plan-row.due { background: #fff6d6; box-shadow: inset 4px 0 0 #e0a800; }
.plan-row .sub b { font-weight: 600; color: var(--text); }
.outcome-button { padding: 4px 10px; font-size: 14px; white-space: nowrap; }
.outcome-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.outcome-choices button { padding: 12px 10px; font-size: 16px; }
