:root {
  --cream: #fbf3d6;
  --cream-line: #ecdfae;
  --ink: #1b2733;
  --muted: #5d6b7a;
  --link: #1769c0;
  --page: #eef1f5;
  --card: #fff;
  --line: #d5dbe3;
  --work: #2563eb;
  --private: #b45309;
  --danger: #9f1239;
  --ok: #166534;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.45 "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.top, .foot {
  background: var(--cream);
  color: var(--ink);
  border-color: var(--cream-line);
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--cream-line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand strong { display: block; font-size: 18px; }
.brand span { color: var(--muted); font-size: 13px; }
.logo { width: 42px; height: 42px; }
.top-actions, .row-actions, .aside-h, .sheet-h, .datenav, .modes {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.modes label { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); }
.modes label:has(input:disabled) { opacity: 0.45; }
.badge {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--cream-line);
  border-radius: 999px;
  padding: 2px 8px;
  background: #fffdf6;
}
.badge.on { color: var(--ok); }
.top-actions select { width: auto; background: #fffdf6; border-color: var(--cream-line); }
.sheet.narrow { width: min(520px, 100%); display: grid; gap: 10px; }
.user-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line); }
.user-row span, .user-row input { flex: 1; min-width: 8em; }
.node .role { font-size: 11px; color: var(--muted); }
fieldset.members { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 8px; margin: 0; padding: 8px 10px 10px; }
.members { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.members legend { padding: 0 4px; }
.fields .wide { grid-column: 1 / -1; }

button, .primary {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
}
button.primary, .primary {
  background: #1b2733;
  color: #fff;
  border-color: #1b2733;
}
button.text { border: 0; background: transparent; color: var(--link); padding: 4px; }
button:disabled { opacity: 0.5; cursor: default; }
button.active {
  background: #1b2733;
  color: #fff;
  border-color: #1b2733;
}
button.danger { color: var(--danger); }

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 18px;
  flex-wrap: wrap;
}
.views, .spheres { display: flex; gap: 6px; flex-wrap: wrap; }
.datenav strong { min-width: 12rem; text-align: center; }

.workspace {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
  padding: 0 18px 18px;
  min-height: calc(100vh - 168px);
}
aside, .card, .column, .editor, .sheet, .event-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
aside { padding: 12px; overflow: auto; max-height: calc(100vh - 180px); }
.aside-h { justify-content: space-between; margin-bottom: 8px; }
.aside-h h2 { font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 14px; border-left: 1px solid var(--line); }
.node {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.node.selected { background: #e7eef8; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--work); }
.dot.private { background: var(--private); }
.node em { font-style: normal; font-size: 11px; color: var(--link); }
.node small { margin-left: auto; color: var(--muted); }

main { min-width: 0; }
.columns { display: grid; gap: 8px; }
.columns.n7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.columns.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.columns.n12 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.column { padding: 8px; min-height: 120px; }
.column.today { outline: 2px solid var(--work); }
.column h3 { font-size: 13px; margin-bottom: 8px; }
.chip {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
  padding: 6px 8px;
}
.chip.work { border-left: 3px solid var(--work); }
.chip.private { border-left: 3px solid var(--private); }
.chip b { display: block; font-weight: 600; }
.chip small, .muted { color: var(--muted); }
.chip.done { opacity: 0.55; text-decoration: line-through; }
.empty { color: var(--muted); padding: 24px 8px; }

.editor { padding: 16px; }
.path { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.path button { border: 0; background: transparent; color: var(--link); padding: 0; }
.fields, .draft-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.wide { grid-column: 1 / -1; }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  background: #fff;
  color: var(--ink);
}
.checks { display: flex; align-items: center; gap: 8px; }
.checks input { width: auto; }

.plans { display: grid; gap: 12px; margin-top: 8px; }
.plan {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}
.plan h3 { font-size: 15px; margin-bottom: 8px; }
.plan-row, .draft-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  border-top: 1px solid #eef2f6;
}
.plan-row > span:nth-child(2) { flex: 1; min-width: 8em; }
.plan-row select { width: auto; }
.add-line { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.add-line input, .add-line select { flex: 1; min-width: 120px; }

.overdue, .spans { margin-bottom: 12px; }
.event-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.event-card { padding: 12px; text-align: left; width: 100%; }
.event-card b { display: block; font-size: 16px; }

.foot { border-top: 1px solid var(--cream-line); padding: 10px 18px; font-size: 13px; color: var(--muted); }
.toast {
  position: fixed; bottom: 16px; right: 16px;
  background: #1b2733; color: #fff; padding: 10px 14px; border-radius: 8px;
  max-width: 360px;
}
.hidden { display: none !important; }
.error { color: var(--danger); min-height: 1.2em; }

.login {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  background: var(--cream);
  padding: 24px;
}
.login .card { padding: 24px; width: min(420px, 100%); display: grid; gap: 12px; background: #fff; }

.modal {
  position: fixed; inset: 0;
  background: rgba(27, 39, 51, 0.35);
  display: grid; place-items: start center;
  overflow: auto;
  padding: 24px 12px 48px;
}
.sheet { width: min(860px, 100%); padding: 16px; }
.sheet-h { justify-content: space-between; }
.draft-block { margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--line); }
.subproject { margin: 8px 0 8px 12px; padding-left: 10px; border-left: 2px solid var(--cream-line); }
.kind {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}

@media (max-width: 900px) {
  .top { flex-wrap: wrap; }
  .top-actions { justify-content: flex-end; }
  .workspace { grid-template-columns: 1fr; }
  aside { max-height: 220px; }
  .columns.n7, .columns.n3, .columns.n12 { grid-template-columns: 1fr; }
  .fields, .draft-fields { grid-template-columns: 1fr; }
  .datenav strong { min-width: 0; }
}
