:root {
  --ground: #F4F5F7; --surface: #FFFFFF; --ink: #151821; --muted: #5A6072; --line: #E3E6EC;
  --side: #111522; --side-active: #222A44; --side-text: #C9CEDC;
  --accent: #2B50E0; --accent-dark: #2340B8; --danger: #B3261E;
  --ok-bg: #E3F3E9; --ok: #14603A; --warn-bg: #FFF0D9; --warn: #8A4B00;
  --mute-bg: #ECEEF3; --mute: #454B5C; --info-bg: #E4EAFF; --info: #2340B8;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5;
  color: var(--ink); background: var(--ground); -webkit-font-smoothing: antialiased; }
h1 { font-size: 26px; line-height: 1.2; margin: 0; font-weight: 800; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 14px; margin: 16px 0 6px; font-weight: 700; }
p { margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* каркас */
.app { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); padding: 20px 12px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; color: #fff; font-weight: 800; font-size: 17px; }
.brand i { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center;
  font-style: normal; font-size: 15px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 8px;
  color: var(--side-text); font-weight: 600; }
.nav a:hover { background: #1A2034; text-decoration: none; }
.nav a.on { background: var(--side-active); color: #fff; }
.nav a span { font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }
.nav .add { margin-top: 14px; background: var(--accent); color: #fff; justify-content: center; }
.nav .add:hover, .nav .add.on { background: var(--accent-dark); }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #252C44; font-size: 13px; }
.side-foot b { color: #fff; display: block; font-weight: 700; }
.linkbtn { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; text-decoration: underline; font-size: 13px; }
.main { padding: 28px 32px 60px; min-width: 0; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head p { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }

/* блоки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  color: inherit; display: block; }
.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile b { display: block; font-size: 30px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 13px; }

.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: var(--mute-bg); color: var(--mute); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.info { background: var(--info-bg); color: var(--info); }
.idnum { display: inline-block; min-width: 34px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 8px 14px; font-weight: 700;
  cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #C5CAD6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.x:hover { background: var(--mute-bg); color: var(--danger); }

input[type=text], input[type=email], input[type=search], input[type=url], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; background: #fff; }
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-weight: 700; font-size: 13px; margin: 14px 0 5px; }
label .muted { font-weight: 500; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 500; font-size: 15px; margin: 14px 0 0; cursor: pointer; }
.check input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }

/* списки-рядки */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); align-items: baseline; }
.rows li:first-child { border-top: 0; padding-top: 0; }
.rows .grow { flex: 1; min-width: 0; }
.rows .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.rows a.t { color: var(--ink); font-weight: 700; }

/* таблиця ідей */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer;
  font-weight: 600; font-size: 13px; }
.seg button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: #FAFBFC; white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #F8F9FC; }
td .t { font-weight: 700; display: block; }
td .s { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* дошка */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px;
  align-items: start; }
.col { background: #EBEDF2; border-radius: var(--radius); padding: 10px; min-height: 140px; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col h2 { display: flex; justify-content: space-between; font-size: 13px; margin: 2px 4px 10px; }
.col h2 span { color: var(--muted); font-variant-numeric: tabular-nums; }
.kc { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
  display: block; color: inherit; cursor: grab; }
.kc:hover { border-color: var(--accent); text-decoration: none; }
.kc b { display: block; font-weight: 700; line-height: 1.3; }
.kc .idnum { min-width: 0; margin-right: 6px; }
.kc small { color: var(--muted); display: block; margin-top: 4px; }
.col .none { color: var(--muted); font-size: 13px; padding: 6px 4px; }
.shelf { margin-top: 16px; }
.shelf summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.shelf .pile { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-top: 8px; }
.shelf .kc { margin: 0; }

/* картка ідеї */
.idea { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.lead { font-size: 17px; max-width: 68ch; }
.quote { border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; color: var(--muted); font-style: italic; margin: 0 0 4px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0 0; }
.fact { background: #FAFBFC; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.fact span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.fact b { font-weight: 700; }
.bul { margin: 0; padding-left: 20px; }
.bul li { margin: 0 0 6px; }
.proof { list-style: none; margin: 0; padding: 0; }
.proof li { padding: 10px 0; border-top: 1px solid var(--line); }
.proof li:first-child { border-top: 0; padding-top: 0; }
.proof .src { color: var(--muted); font-size: 13px; }
.note { border-top: 1px solid var(--line); padding: 12px 0; }
.note:first-child { border-top: 0; }
.note .who { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.note .who b { color: var(--ink); }
.note.claude { background: #F7F9FF; border: 1px solid #D9E1FF; border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.md h4 { font-size: 14px; margin: 12px 0 4px; }
.md p, .md ul { margin: 0 0 8px; }
.md ul { padding-left: 20px; }
.md { overflow-wrap: anywhere; }
.step { display: flex; gap: 9px; align-items: flex-start; padding: 7px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; }
.step input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.step .grow { flex: 1; min-width: 0; }
.step.done .grow { color: var(--muted); text-decoration: line-through; }
.step small { display: block; color: var(--muted); }
.inline { display: flex; gap: 8px; margin-top: 8px; }
.inline > * { min-width: 0; }
.inline > input, .inline > select { flex: 1 1 0; width: auto; }
.inline > .btn { flex: none; }
.job { font-size: 13px; padding: 8px 0; border-top: 1px solid var(--line); }
.job .st { font-weight: 700; }
.job .st.run { color: var(--warn); }
.job .st.err { color: var(--danger); }
.job .st.ok { color: var(--ok); }
.hints { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.hints button { border: 1px dashed #C5CAD6; background: none; border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; color: var(--muted); }
.hints button:hover { color: var(--accent); border-color: var(--accent); }
.hist { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.hist li { padding: 6px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.hist li:first-child { border-top: 0; }
.hist time { color: var(--muted); display: block; font-size: 12px; }
.formcard { max-width: 760px; }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; align-items: center; }
.head .actions { margin-top: 0; }
.err { color: var(--danger); font-weight: 600; margin-top: 10px; }

/* вхід */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 400px; padding: 28px; }
.login h1 { font-size: 22px; margin-bottom: 6px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: 10px; font-weight: 600; z-index: 20; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.toast[hidden] { display: none; }

@media (max-width: 1080px) {
  .idea { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; padding: 10px 12px; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
  .brand { padding: 0 6px 0 0; font-size: 15px; }
  .nav { flex-direction: row; flex: 1 0 100%; order: 3; overflow-x: auto; gap: 4px; }
  .nav a { padding: 7px 10px; white-space: nowrap; gap: 6px; }
  .nav .add { margin-top: 0; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; gap: 8px; align-items: center; }
  .side-foot b { display: none; }
  .main { padding: 18px 16px 50px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none; }
  h1 { font-size: 22px; }
  .inline { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: no-preference) {
  .kc, .tile, .btn { transition: border-color .12s, background .12s; }
}
