/* =========================================================================
   LONG-TERM PROJECTS — desktop panel

   Master/detail: the portfolio list stays visible on the left while one
   project is read on the right. That split is the whole reason this surface
   is better on the desktop than the phone — you can see that four things
   have gone quiet while you work on the fifth.

   Uses the app's tokens throughout (--accent, --line, --card…) so a theme
   change carries here for free, and reuses .eo-btn / .eo-input / .eo-field
   from empirium.css wherever they already fit. Only the parts with no
   existing equivalent are defined below.
   ========================================================================= */

#longProjectsPanel { min-height: 0; }

/* ---------------- split ---------------- */
.lp-split {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.lp-list,
.lp-detail {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.lp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.lp-detail {
  border-left: 1px solid var(--line);
  padding-left: 16px;
}

/* Narrow windows: the split stops earning its keep well before the app's
   own responsive breakpoints, so it collapses to one column here. */
@media (max-width: 1100px) {
  .lp-split { grid-template-columns: minmax(0, 1fr); }
  .lp-detail { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; }
}

/* ---------------- header extras ---------------- */
.lp-stat {
  font-size: var(--fs-caption);
  color: var(--muted);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(var(--card-subtle-rgb), .5);
}
.lp-stat b { color: var(--text); font-family: var(--font-mono, monospace); }
.lp-stat-warn { border-color: rgba(var(--warn-rgb), .4); }
.lp-stat-warn b { color: var(--warn); }

/* ---------------- list controls ---------------- */
.lp-listbar { display: flex; gap: 4px; }
.lp-filter {
  flex: 1;
  padding: 5px 8px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--faint);
  font: inherit;
  font-size: var(--fs-caption);
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.lp-filter:hover { color: var(--text); background: var(--card-hover); }
.lp-filter.is-on {
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), .45);
  background: rgba(var(--accent-rgb), .08);
}

.lp-newrow { display: flex; gap: 6px; }
.lp-newinput { flex: 1; min-width: 0; }

.lp-group {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 10px 2px 2px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--faint);
}
.lp-group span { font-family: var(--font-mono, monospace); opacity: .7; }

.lp-empty,
.lp-none {
  color: var(--faint);
  font-size: var(--fs-caption);
  line-height: 1.6;
  padding: 10px 2px;
  margin: 0;
}

/* ---------------- list item ---------------- */
.lp-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: var(--card-subtle);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, transform .08s ease;
}
.lp-item:hover { background: var(--card-hover); border-color: var(--line-bright); }
.lp-item:active { transform: scale(.995); }
.lp-item.is-sel {
  border-color: rgba(var(--accent-rgb), .5);
  background: rgba(var(--accent-rgb), .07);
  box-shadow: var(--glow-accent);
}
.lp-item.is-done { opacity: .7; }
.lp-item.is-arch { opacity: .5; }

.lp-item-top { display: flex; align-items: center; gap: 8px; }
.lp-item-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 13.5px;
  /* Ambition names run long; a wrapped three-line title pushes the status
     row out of view on every card in the list. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lp-star { color: var(--accent); font-style: normal; margin-right: 4px; }

.lp-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.lp-item-prog {
  height: 3px;
  margin-top: 8px;
  background: rgba(var(--text-rgb), .08);
  border-radius: 2px;
  overflow: hidden;
}
.lp-item-prog span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.lp-item-progn {
  margin-top: 3px;
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  color: var(--faint);
}

.lp-item-next {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}

/* ---------------- status / health / chips ---------------- */
.lp-status,
.lp-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: var(--r-sm);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .3px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.lp-status.is-active { color: var(--accent); border-color: rgba(var(--accent-rgb), .4); background: rgba(var(--accent-rgb), .1); }
.lp-status.is-done { color: var(--good); border-color: rgba(var(--good-rgb), .4); background: rgba(var(--good-rgb), .1); }
.lp-status.is-paused { color: var(--faint); }
.lp-status.is-explore { color: var(--accent-2); border-color: rgba(var(--accent-2-rgb), .4); background: rgba(var(--accent-2-rgb), .1); }
.lp-chip-warn { color: var(--warn); border-color: rgba(var(--warn-rgb), .4); background: rgba(var(--warn-rgb), .1); }

/* Traffic light, not a word — readable in peripheral vision while scanning. */
.lp-health {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 6px currentColor;
}
.lp-health.is-ok { background: var(--good); }
.lp-health.is-warn { background: var(--warn); }
.lp-health.is-bad { background: var(--danger); }

/* ---------------- blank detail ---------------- */
.lp-blank {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  height: 100%;
}
.lp-blank-inner { max-width: 380px; text-align: center; color: var(--faint); }
.lp-blank-mark { font-size: 30px; color: var(--line-bright); margin-bottom: 10px; }
.lp-blank-inner p { margin: 0 0 8px; font-size: var(--fs-caption); line-height: 1.6; }
.lp-blank-sub { opacity: .75; }

/* ---------------- detail header ---------------- */
.lp-dhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lp-dtitle {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  outline: none;
  color: var(--text);
  font-family: var(--font-display, inherit);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.2px;
  padding: 3px 2px;
}
.lp-dtitle:hover { border-bottom-color: var(--line); }
.lp-dtitle:focus { border-bottom-color: var(--accent); }
.lp-dactions { flex: none; display: flex; gap: 6px; }
.lp-on { color: var(--accent) !important; }

.lp-dmeta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.lp-cycle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-caption);
  cursor: pointer;
}
.lp-cycle:hover { border-color: var(--line); background: var(--card-hover); }

.lp-dprog {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--muted);
}
.lp-dprog-bar {
  display: block;
  width: 90px;
  height: 3px;
  background: rgba(var(--text-rgb), .08);
  border-radius: 2px;
  overflow: hidden;
}
.lp-dprog-bar span { display: block; height: 100%; background: var(--accent); }
.lp-muted { color: var(--faint); }

/* ---------------- detail tabs ---------------- */
.lp-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.lp-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--faint);
  font: inherit;
  font-size: var(--fs-caption);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: -1px;
}
.lp-tab:hover { color: var(--text); }
.lp-tab.is-on { color: var(--accent); border-bottom-color: var(--accent); }
.lp-tabn {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  opacity: .7;
  padding: 0 5px;
  border-radius: 8px;
  background: rgba(var(--text-rgb), .08);
}

.lp-tabbody { display: flex; flex-direction: column; gap: 4px; padding-bottom: 24px; }

/* ---------------- fields ---------------- */
.lp-anchors { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 4px; }
@media (max-width: 900px) { .lp-anchors { grid-template-columns: minmax(0, 1fr); } }
.lp-field { min-width: 0; }
.lp-ta { resize: vertical; line-height: 1.55; }
.lp-row { margin: 4px 0 8px; }
.lp-narrow { max-width: 110px; flex: none; }

.lp-sechead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 20px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-display, inherit);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
}
.lp-sechead em {
  font-style: normal;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--faint);
}

.lp-hint { font-size: 11px; color: var(--faint); }
.lp-hintblock { line-height: 1.6; margin: 0 0 12px; font-size: var(--fs-caption); }

.lp-addrow { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.lp-addrow .eo-input { flex: 1; min-width: 0; }

.lp-del {
  flex: none;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--faint);
  font: inherit;
  font-size: 12px;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
}
.lp-del:hover { color: var(--text); background: var(--card-hover); }

/* ---------------- milestones ---------------- */
.lp-ms { display: flex; flex-direction: column; gap: 3px; }
.lp-msrow {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
}
.lp-msrow:hover { background: var(--card-hover); }
.lp-msrow.is-done .lp-mstitle { color: var(--faint); text-decoration: line-through; }
.lp-check {
  flex: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--line-bright);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  position: relative;
}
.lp-check.is-on { background: var(--accent); border-color: var(--accent); }
.lp-check.is-on::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: solid var(--on-accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.lp-mstitle { flex: 1; min-width: 0; font-size: 13px; }

/* ---------------- measures ---------------- */
.lp-measures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.lp-measure {
  padding: 10px 12px;
  background: var(--card-subtle);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.lp-measure.is-improving { border-color: rgba(var(--good-rgb), .35); }

.lp-mhead { display: flex; align-items: center; gap: 8px; }
.lp-mlabel {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lp-trend {
  flex: none;
  font-family: var(--font-mono, monospace);
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-sm);
}
.lp-trend.is-up { color: var(--good); background: rgba(var(--good-rgb), .12); }
.lp-trend.is-down { color: var(--danger); background: rgba(var(--danger-rgb), .12); }
.lp-trend.is-flat { color: var(--faint); background: rgba(var(--text-rgb), .06); }

.lp-spark { height: 40px; margin: 8px 0 6px; }
.lp-spark svg { display: block; width: 100%; height: 100%; }
.lp-spark-line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.lp-spark-area { fill: rgba(var(--accent-rgb), .10); stroke: none; }

.lp-mfoot { display: flex; align-items: baseline; gap: 8px; }
.lp-mval {
  flex: none;
  width: 82px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-family: var(--font-mono, monospace);
  font-size: 17px;
  font-weight: 700;
  padding: 2px 0;
  outline: none;
}
.lp-mval:focus { border-bottom-color: var(--accent); }
.lp-munit { font-size: 11px; color: var(--muted); }
.lp-mtarget { font-family: var(--font-mono, monospace); font-size: 10px; color: var(--faint); }
.lp-mpts { margin-left: auto; font-family: var(--font-mono, monospace); font-size: 10px; color: var(--faint); }

/* ---------------- log ---------------- */
.lp-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.lp-kindbtn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-caption);
  font-weight: 600;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.lp-kindbtn:hover { background: var(--card-hover); color: var(--text); }

/* Entry types are colour-coded, not label-only: finding "the last handover"
   in a long log should not mean reading every tag. */
.lp-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  border: 1px solid;
  white-space: nowrap;
}
.lp-k-handover { color: var(--accent); border-color: rgba(var(--accent-rgb), .4); background: rgba(var(--accent-rgb), .1); }
.lp-k-decision { color: var(--accent-2); border-color: rgba(var(--accent-2-rgb), .45); background: rgba(var(--accent-2-rgb), .12); }
.lp-k-journal  { color: var(--good); border-color: rgba(var(--good-rgb), .4); background: rgba(var(--good-rgb), .1); }
.lp-k-measure  { color: var(--warn); border-color: rgba(var(--warn-rgb), .4); background: rgba(var(--warn-rgb), .1); }
.lp-k-note     { color: var(--muted); border-color: var(--line); background: rgba(var(--text-rgb), .05); }

.lp-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  margin-bottom: 16px;
  background: var(--card-2);
  border: 1px solid rgba(var(--accent-rgb), .3);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
}
.lp-comphead { display: flex; align-items: center; justify-content: space-between; }
.lp-comprow { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.lp-comprow .lp-hint { margin-right: auto; }

.lp-entries { display: flex; flex-direction: column; gap: 10px; }
.lp-entry {
  padding: 12px 14px;
  background: var(--card-subtle);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.lp-entry.is-pinned {
  border-color: rgba(var(--accent-rgb), .4);
  background: rgba(var(--accent-rgb), .05);
}
.lp-ehead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.lp-etitle {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lp-edate {
  margin-left: auto;
  font-family: var(--font-mono, monospace);
  font-size: 10.5px;
  color: var(--faint);
  white-space: nowrap;
}
.lp-ehead .lp-etitle + .lp-edate { margin-left: 0; }

/* <pre> so a handover's headings, bullets and blank lines survive exactly
   as written. pre-wrap, not pre — long lines must fold, not scroll. */
.lp-ebody {
  margin: 0;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
  border-radius: var(--r-sm);
  padding: 2px 4px;
  margin-left: -4px;
}
.lp-ebody:hover { background: rgba(var(--text-rgb), .04); }

/* ---------------- links ---------------- */
.lp-links { display: flex; flex-direction: column; gap: 6px; }
.lp-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--card-subtle);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.lp-linkmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lp-linktitle {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lp-linkmeta { font-size: 11px; color: var(--faint); }

.lp-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.lp-pick {
  padding: 5px 11px;
  background: transparent;
  border: 1px dashed var(--line-bright);
  border-radius: var(--r-sm);
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-caption);
  cursor: pointer;
}
.lp-pick:hover { color: var(--accent); border-color: var(--accent); border-style: solid; background: rgba(var(--accent-rgb), .08); }

/* ---------------- destructive ---------------- */
.lp-danger {
  display: flex;
  gap: 8px;
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
