/* Pip design system: tokens from spec §9 (forest/mint/lime on warm off-white). */
:root {
  --forest: #103D2B; --forest-deep: #0B2B20; --botanical: #337D4B; --mint: #EAF5E5; --mint-2: #F3F9EF; --lime: #E6F59B;
  --paper: #FBFCF8; --ink: #1F2B24; --muted: #5E6B63; --line: #DDE6DA; --card: #FFFFFF; --amber: #B7791F; --amber-bg: #FDF3DC;
  --red: #B42318; --red-bg: #FDECEA; --blue-bg: #EAF1FB; --blue: #2D5BA8; --shadow: 0 1px 2px rgba(16,61,43,.06), 0 4px 14px rgba(16,61,43,.06);
  --radius: 14px; --nav-w: 232px; --assist-w: 360px;
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--paper);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-size: 14.5px; line-height: 1.45; }
a { color: var(--botanical); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 30px; margin: 0; color: var(--forest); letter-spacing: -.3px; }
h2 { font-size: 19px; margin: 0; color: var(--forest); }
h3 { font-size: 15.5px; margin: 0; color: var(--forest); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
#app { display: grid; grid-template-columns: var(--nav-w) 1fr var(--assist-w); height: 100vh; }
#app.no-assist { grid-template-columns: var(--nav-w) 1fr 0; }
#app.no-assist #assist { display: none; }
nav#nav { background: var(--forest); color: #fff; display: flex; flex-direction: column; padding: 18px 14px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 4px 22px; color: #fff; }
.brand svg { width: 52px; height: 52px; flex: none; }
.brand b { font-size: 26px; display: block; line-height: 1; }
.brand span { font-size: 11px; opacity: .85; }
.navlink { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; color: #E8F1EA; font-size: 15px; margin-bottom: 4px; }
.navlink svg { width: 20px; height: 20px; flex: none; }
.navlink:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.navlink.active { background: var(--lime); color: var(--forest); font-weight: 600; }
.navsep { border-top: 1px solid rgba(255,255,255,.15); margin: 14px 4px; }
.navfoot { margin-top: auto; background: rgba(255,255,255,.08); border-radius: 12px; padding: 12px; display: flex; gap: 10px; font-size: 12px; }
.navfoot svg { width: 26px; height: 26px; flex: none; }
.navfoot b { font-size: 13.5px; display: block; }
main#main { container-type: inline-size; overflow-y: auto; padding: 18px 28px 40px; position: relative; background:
  radial-gradient(900px 300px at 85% -60px, #E3F1DC 0, rgba(227,241,220,0) 70%), var(--paper); }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-bottom: 6px; min-height: 40px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  font-size: 12.5px; white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #9AA59E; }
.chip.ok .dot { background: #2E9B57; } .chip.warn .dot { background: #D69E2E; } .chip.bad .dot { background: var(--red); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--mint); color: var(--forest); font-weight: 700; display: grid; place-items: center;
  font-size: 13px; border: 2px solid #fff; box-shadow: var(--shadow); cursor: pointer; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

/* ---------- assistant ---------- */
aside#assist { border-left: 1px solid var(--line); background: #FDFEFB; display: flex; flex-direction: column; min-width: 0; }
.assist-head { padding: 16px 16px 10px; display: flex; gap: 10px; align-items: flex-start; }
.assist-head svg.bird { width: 54px; height: 54px; flex: none; }
.assist-head h2 { font-size: 20px; }
.assist-note { margin: 0 14px 10px; background: var(--mint); border-radius: 12px; padding: 9px 12px; display: flex; gap: 8px; font-size: 13px; color: var(--forest); }
.assist-note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.assist-log { flex: 1; overflow-y: auto; padding: 6px 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; }
.msg.user { align-self: flex-end; background: #EEF2EC; }
.msg.pip { align-self: flex-start; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.msg.pip ul { margin: 4px 0; padding-left: 18px; }
.msg .cites { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.msg .cites a { font-size: 11.5px; background: var(--mint); padding: 2px 8px; border-radius: 999px; }
.suggest { padding: 4px 14px 8px; }
.suggest h4 { margin: 4px 0 6px; font-size: 13.5px; color: var(--forest); display: flex; gap: 6px; align-items: center; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: var(--mint-2); border-radius: 10px; padding: 8px 11px; margin-bottom: 6px;
  cursor: pointer; font-size: 13px; }
.suggest button:hover { background: var(--mint); }
.assist-input { margin: 8px 14px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; display: flex; padding: 6px; gap: 6px; }
.assist-input textarea { flex: 1; border: 0; resize: none; outline: none; min-height: 44px; padding: 6px; font-size: 13.5px; }
.btn.assist-toggle { position: fixed; right: 16px; bottom: 16px; z-index: 30; display: none; }

/* ---------- cards & buttons ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 8px 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head .ic { width: 38px; height: 38px; display: grid; place-items: center; color: var(--forest); flex: none; }
.card-head .ic svg { width: 28px; height: 28px; }
.card-head .grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px;
  cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--forest); white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--mint-2); }
.btn.primary { background: var(--forest); color: #fff; border-color: var(--forest); }
.btn.primary:hover { background: var(--forest-deep); }
.btn.lime { background: var(--lime); border-color: #D5E58A; }
.btn.danger { color: var(--red); border-color: #F1C4BF; }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.ic-svg { vertical-align: -0.2em; flex: none; }
.linkbtn { white-space: nowrap; border: 0; background: none; color: var(--botanical); font-weight: 600; cursor: pointer; padding: 0; display: inline-flex; gap: 4px; align-items: center; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--mint); color: var(--forest); white-space: nowrap; }
.badge svg { width: 13px; height: 13px; }
.badge.lime { background: var(--lime); } .badge.amber { background: var(--amber-bg); color: #8A5A0B; } .badge.red { background: var(--red-bg); color: var(--red); }
.badge.grey { background: #EEF0EE; color: var(--muted); } .badge.blue { background: var(--blue-bg); color: var(--blue); }
.note { background: #F7FBEF; border: 1px solid #E2EDCF; border-radius: 12px; padding: 10px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.note.yellow { background: #FDFBE7; border-color: #F0EAB8; }
.note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-top: 1px solid #EEF2EC; }
.list-row:first-child { border-top: 0; }
.tile { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; gap: 12px; background: #fff; }
.tile:hover { border-color: #BFD6B8; }
.tile .ic { width: 42px; height: 42px; border-radius: 10px; background: var(--mint); display: grid; place-items: center; color: var(--forest); flex: none; }
.tile .ic svg { width: 22px; height: 22px; }
.empty { text-align: center; color: var(--muted); padding: 22px; font-size: 13.5px; }
input.inp, select.inp, textarea.inp { border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; background: #fff; width: 100%; outline: none; }
input.inp:focus, select.inp:focus, textarea.inp:focus { border-color: var(--botanical); box-shadow: 0 0 0 3px #E3F1DC; }
label.fld { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
.search { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow); }
.search input { border: 0; outline: none; flex: 1; font-size: 15px; background: transparent; }
.search svg { width: 20px; height: 20px; color: var(--muted); }
.kbd { border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-size: 12px; color: var(--muted); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
table.tbl td { white-space: normal; padding: 8px; border-bottom: 1px solid #EEF2EC; vertical-align: top; }

/* ---------- page header ---------- */
.hero { display: flex; align-items: center; gap: 18px; margin: 0 0 16px; }
.hero svg.bird { width: 96px; height: 96px; flex: none; }
.hero .sub { color: var(--muted); font-size: 15px; margin-top: 2px; }
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.meta-strip { display: flex; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; }
.meta-strip > div { padding: 10px 16px; border-right: 1px solid #EEF2EC; display: flex; gap: 10px; align-items: flex-start; min-width: 120px; }
.meta-strip > div:last-child { border-right: 0; }
.meta-strip svg { width: 20px; height: 20px; color: var(--forest); margin-top: 2px; }
.meta-strip b { display: block; font-size: 12.5px; }
.meta-strip span { font-size: 12.5px; color: var(--muted); }
.actions-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); gap: 14px; align-items: start; }

/* ---------- transcript ---------- */
.transcript-wrap { position: relative; border-radius: 12px; overflow: hidden; }
.transcript { max-height: 62vh; overflow-y: auto; padding: 4px 6px; user-select: none; -webkit-user-select: none; position: relative; }
.tline { display: grid; grid-template-columns: 78px 1fr; gap: 12px; padding: 7px 4px; border-radius: 8px; }
.tline:hover { background: #F6FAF3; }
.tline .ts { background: var(--mint); color: var(--forest); font-size: 12px; font-weight: 600; border-radius: 8px; padding: 3px 7px; height: fit-content; text-align: center; cursor: pointer; }
.tline.redaction .tx { color: #6A5B2E; background: repeating-linear-gradient(-45deg, #FBF6E3, #FBF6E3 6px, #F6EECF 6px, #F6EECF 12px); border-radius: 6px; padding: 2px 8px; width: fit-content; font-size: 13px; font-weight: 600; }
.tline.corrected .tx u { text-decoration: none; border-bottom: 2px dotted var(--botanical); }
.tline.annotation { background: var(--blue-bg); margin: 4px 0 4px 90px; grid-template-columns: 1fr; border-left: 3px solid var(--blue); }
.tline.annotation .tx { font-size: 13px; }
.tline.annotation .lbl { font-size: 11px; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: .4px; }
.tline .cmt-dot { font-size: 11px; color: var(--botanical); margin-left: 6px; cursor: pointer; }
.watermark { position: absolute; inset: 0; pointer-events: none; z-index: 2; opacity: .09; background-repeat: repeat; }
@media print { .watermark { opacity: .2; -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 6px 0; }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 14px; }
.kcol { background: #F4F8F1; border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-height: 300px; display: flex; flex-direction: column; }
.kcol h3 { display: flex; justify-content: space-between; align-items: center; margin: 2px 4px 10px; }
.klist { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; cursor: grab; box-shadow: var(--shadow); }
.kcard .t { font-weight: 600; font-size: 13.5px; }
.kcard .m { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.kcard.sortable-ghost { opacity: .4; }
.prio-high { border-left: 3px solid var(--red); } .prio-medium { border-left: 3px solid #D69E2E; } .prio-low { border-left: 3px solid #9AA59E; }

/* ---------- project ---------- */
.proj-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 14px; align-items: start; }
.subnav { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 10px; position: sticky; top: 0; }
.subnav h3 { margin: 4px 8px 10px; font-size: 14.5px; }
.subnav a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; color: var(--ink); font-size: 14px; }
.subnav a svg { width: 18px; height: 18px; color: var(--forest); }
.subnav a.active { background: var(--lime); font-weight: 600; }
.subnav a:hover { text-decoration: none; background: var(--mint-2); }
.gantt-box { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.gantt-box .gantt .bar-wrapper .bar { fill: #BFE3A4; }
.gantt-box .gantt .bar-progress { fill: var(--botanical) !important; }
.gantt-box .gantt-container { --g-bar-color: #CDEBB6; --g-bar-border: #8FC274; --g-progress-color: #337D4B; --g-today-highlight: #337D4B; --g-header-background: #F4F8F1; --g-row-color: #FBFCF8; }
.gantt-box .bar-wrapper.milestone .bar { fill: #FFD966 !important; }
.gantt-box .bar-wrapper.done .bar { fill: #8FC274 !important; }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(11,43,32,.35); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; padding: 20px 22px; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal h2 { margin-bottom: 8px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--forest); color: #fff; padding: 10px 18px; border-radius: 12px;
  z-index: 60; box-shadow: var(--shadow); font-size: 13.5px; }
#toast.err { background: var(--red); }
.progress { height: 8px; background: #E6EEE2; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--botanical); border-radius: 99px; transition: width .4s; }
.spinner { width: 16px; height: 16px; border: 2px solid #CFE3C6; border-top-color: var(--botanical); border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(800px 400px at 70% 10%, #E3F1DC, transparent), var(--paper); }
.login .card { width: min(400px, 92vw); padding: 26px; }
.login svg.bird { width: 90px; height: 90px; display: block; margin: 0 auto 4px; }

/* ---------- responsive: small laptop (1366x768) and below ---------- */
@media (max-width: 1400px) {
  :root { --nav-w: 200px; --assist-w: 0px; }
  #app { grid-template-columns: var(--nav-w) 1fr; }
  aside#assist { position: fixed; right: 0; top: 0; bottom: 0; width: 360px; z-index: 40; box-shadow: -8px 0 30px rgba(0,0,0,.12); transform: translateX(105%); transition: transform .2s; }
  #app.assist-open aside#assist { transform: none; }
  .btn.assist-toggle { display: inline-flex; }
  .hero svg.bird { width: 70px; height: 70px; }
  h1 { font-size: 26px; }
}
@media (max-width: 1100px) {
  .split, .grid2, .grid3 { grid-template-columns: 1fr; }
  .proj-layout { grid-template-columns: 1fr; }
  .subnav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .subnav h3 { width: 100%; }
  .kanban { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --nav-w: 64px; }
  .navlink span, .brand div, .navfoot div { display: none; }
  main#main { padding: 12px; }
}

/* main-area container queries (main width depends on the assistant panel) */
@container (max-width: 1000px) { .split { grid-template-columns: 1fr; } .grid3 { grid-template-columns: 1fr 1fr; } }
@container (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } .kanban { grid-template-columns: 1fr; } }
