/* AI Tasks — same stone/mono utility look as Monkbeast.
   Ember orange is the machines; Monkbeast violet is you. */
:root {
  color-scheme: dark light;
  --bg: #1C1917;
  --surface: #211f1c;
  --surface-2: #2b2724;
  --input-bg: #151311;
  --panel-bg: #151311;
  --topbar-bg: rgba(28, 25, 23, 0.97);
  --text: #f5f5f4;
  --muted: #a8a29e;
  --faint: #78716c;
  --line: #3a3632;
  --line-strong: #57534e;
  --ember: #f97316;
  --ember-soft: #fdba74;
  --violet: #818cf8;
  --amber: #f0bd3d;
  --green: #5ec36f;
  --red: #ef5350;
  --soft-violet-bg: rgba(129, 140, 248, .09);
  --shadow: rgba(0, 0, 0, .55);
  --backdrop: rgba(0, 0, 0, .62);
  --radius: 4px;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f7f7;
    --surface: #eeeeee;
    --surface-2: #e2e2e2;
    --input-bg: #ffffff;
    --panel-bg: #ffffff;
    --topbar-bg: rgba(247, 247, 247, 0.97);
    --text: #111111;
    --muted: #525252;
    --faint: #737373;
    --line: #d4d4d4;
    --line-strong: #a3a3a3;
    --ember: #c2410c;
    --ember-soft: #ea580c;
    --violet: #4f46e5;
    --amber: #a16207;
    --green: #15803d;
    --red: #b91c1c;
    --soft-violet-bg: rgba(79, 70, 229, .07);
    --shadow: rgba(0, 0, 0, .18);
    --backdrop: rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { font-size: 13px; }
body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h2, h3, p, ol { margin: 0; padding: 0; font-weight: inherit; font-size: inherit; }
:focus-visible { outline: 1px solid var(--ember); outline-offset: 1px; }

/* Stage colour. Every dot, rail and tag reads its colour from --tone. */
.tone--inbox { --tone: var(--faint); }
.tone--waiting { --tone: var(--muted); }
.tone--working { --tone: var(--ember); }
.tone--qa { --tone: var(--violet); }
.tone--blocked { --tone: var(--red); }
.tone--done { --tone: var(--green); }
.tone--silent { --tone: var(--amber); }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 34px;
  padding: 4px 8px 0;
  background: var(--topbar-bg);
}
.brand { display: flex; }
/* Same box and offsets as the Monkbeast board footer (notepad.css), so switching apps does not move the wordmark. */
.brand__mark { width: 282px; height: 114px; max-width: 100%; object-fit: contain; object-position: left center; }
/* The wordmark sits bottom-left, under the first column; it never covers a task. */
.foot { margin-top: auto; padding: 16px 26px; }
.topbar__actions { position: relative; display: flex; align-items: center; gap: 6px; }

.add > summary {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
}
.add > summary::-webkit-details-marker { display: none; }
.add[open] > summary { color: var(--ember); border-color: var(--ember); }
.add__form {
  position: absolute;
  top: 32px;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 6px;
  width: min(320px, calc(100vw - 16px));
  padding: 8px;
  background: var(--panel-bg);
  border: 1px solid var(--line-strong);
  box-shadow: 0 12px 34px var(--shadow);
}
.add__form input,
.add__form textarea,
.reply textarea,
.sheet__foot select,
.sheet__foot input {
  width: 100%;
  padding: 5px 7px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  resize: vertical;
}

.btn {
  padding: 5px 10px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
}
.btn--go { color: #1C1917; background: var(--ember); border-color: var(--ember); font-weight: 700; }
.btn--back { color: var(--violet); border-color: var(--violet); background: var(--soft-violet-bg); }

/* Board */
.shell { padding: 0 8px 8px; }
.board { display: grid; gap: 10px; align-items: start; }

.strip { display: flex; align-items: center; gap: 12px; min-height: 22px; font-size: 11px; color: var(--faint); }
.strip__stat { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.strip__stat b { font-weight: 700; }
.strip__stat .dot { opacity: .35; }
.strip__stat--on { color: var(--text); }
.strip__stat--on .dot { opacity: 1; }
.toggle { display: flex; margin-left: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.toggle__item { padding: 2px 8px; color: var(--faint); }
.toggle__item--active { color: var(--text); background: var(--surface-2); }

.dot {
  display: inline-block;
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tone, var(--faint));
}
.dot.tone--working, .strip__stat--on.tone--working .dot { animation: pulse 1.6s ease-in-out infinite; }

/* Lanes */
.lanes { display: grid; gap: 10px; align-content: start; min-width: 0; }
.lane { display: grid; align-content: start; gap: 2px; min-width: 0; }
.lane__head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.lane__head::after { content: ""; flex: 1; order: 1; height: 1px; background: var(--line); }
.lane__head b { order: 2; font-weight: 400; color: var(--faint); }
.lane__head small { font-size: inherit; color: var(--faint); }
.lane--you .lane__head { color: var(--violet); }
.lane--working .lane__head { color: var(--ember-soft); }
/* Narrow: read in order of what needs attention; skip empty stages. */
.lane--you { order: 0; }
.lane--working { order: 1; }
.lane--waiting { order: 2; }
.lane--inbox { order: 3; }
.lane--done { order: 4; }
.lane--empty { display: none; }

/* Task row */
.t {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 7px;
  padding: 6px 6px 8px 7px;
  border-left: 2px solid transparent;
  border-radius: 2px;
}
.t:hover { background: var(--surface-2); }
.t--you { border-left-color: var(--tone); }
.t__where { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; color: var(--muted); }
.t__where i { font-style: normal; color: var(--text); }
.t__where b { font-weight: 700; color: var(--ember-soft); text-transform: uppercase; letter-spacing: .04em; }
.t__title { grid-column: 2 / -1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; line-height: 1.5; }
.t--done .t__title { color: var(--muted); }
.t__side { display: flex; align-items: center; gap: 5px; }
.t__age { min-width: 22px; text-align: right; font-size: 10px; color: var(--faint); }
.t__meta { grid-column: 2 / -1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10px; line-height: 1.35; color: var(--faint); }
.t__meta:empty { display: none; }

.rail { display: inline-flex; gap: 1px; }
.rail__seg { width: 4px; height: 11px; border-radius: 1px; background: var(--line-strong); opacity: .55; }
.rail__seg--past { background: var(--tone); opacity: .4; }
.rail__seg--here { background: var(--tone); opacity: 1; }
.tone--working .rail__seg--here { animation: pulse 1.6s ease-in-out infinite; }

.tag { font-style: normal; font-size: 9px; letter-spacing: .04em; padding: 0 4px; border: 1px solid currentColor; border-radius: 2px; white-space: nowrap; }
.tag--blocked { color: var(--red); }
.tag--silent { color: var(--amber); }
.tag--pending { color: var(--violet); }

.empty { padding: 8px 4px; font-size: 11px; color: var(--faint); }
.empty code { color: var(--ember-soft); }

/* Task sheet: a pop-up centred on the screen, over a dimmed board. */
.sheet {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 40;
  display: grid;
  align-content: start;
  gap: 12px;
  width: min(760px, calc(100vw - 16px));
  max-height: calc(100svh - 16px);
  padding: 14px 14px 16px;
  overflow-y: auto;
  transform: translate(-50%, -50%);
  background: var(--panel-bg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  /* The second shadow is the backdrop: it dims everything behind the pop-up. */
  box-shadow: 0 24px 60px var(--shadow), 0 0 0 100vmax var(--backdrop);
}
.sheet__head { position: relative; display: grid; gap: 6px; padding-right: 30px; }
.sheet__crumb { font-size: 10px; color: var(--faint); }
.sheet__close {
  position: absolute;
  top: -4px;
  right: -4px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font-size: 18px;
  color: var(--muted);
}
.sheet__title { font-size: 14px; line-height: 1.3; font-weight: 700; }
.sheet__title span { color: var(--faint); font-weight: 400; }
.sheet__state { font-size: 11px; color: var(--tone); }
.sheet__orca { font-size: 11px; color: var(--muted); }
.sheet__link { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; color: var(--ember-soft); }
.sheet__body { font-size: 12px; line-height: 1.5; color: var(--muted); white-space: pre-wrap; }

.track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; margin-right: -30px; }
.track__step { display: grid; gap: 3px; font-size: 9px; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.track__step i { height: 4px; border-radius: 1px; background: var(--line-strong); opacity: .55; }
.track__step--past i { background: var(--tone); opacity: .4; }
.track__step--here { color: var(--tone); }
.track__step--here i { background: var(--tone); opacity: 1; }
.tone--working .track__step--here i { animation: pulse 1.6s ease-in-out infinite; }

.reply { display: grid; gap: 6px; }
.reply textarea { font-size: 16px; }
.reply__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.reply__error { font-size: 11px; color: var(--red); }

.timeline { display: grid; gap: 1px; list-style: none; }
.ev { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; padding: 5px 0 5px 8px; border-left: 2px solid var(--line-strong); font-size: 11px; }
.ev--agent { border-left-color: var(--ember); }
.ev--vincent { border-left-color: var(--violet); }
.ev__who { font-weight: 700; }
.ev--agent .ev__who { color: var(--ember-soft); }
.ev--vincent .ev__who { color: var(--violet); }
.ev__status { color: var(--muted); }
.ev__age { margin-left: auto; font-size: 10px; color: var(--faint); }
.ev__msg { flex-basis: 100%; font-size: 12px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }

.sheet__foot { display: flex; align-items: end; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.sheet__foot form { flex: 1; min-width: 0; }
.sheet__foot label { display: grid; gap: 2px; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.sheet__foot select, .sheet__foot input { font-size: 12px; text-transform: none; letter-spacing: 0; }
.sheet__archive { width: 28px; height: 28px; color: var(--faint); background: none; border: 0; font-size: 16px; cursor: pointer; }
.sheet__archive:hover { color: var(--red); }

@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) {
  .dot, .rail__seg, .track__step i { animation: none !important; }
}

/* Unfolded / desktop: a roomier pop-up. */
@media (min-width: 640px) {
  .sheet { min-height: min(520px, calc(100svh - 80px)); max-height: calc(100svh - 80px); padding: 20px 22px 18px; }
  .reply textarea { font-size: 12px; }
}

/* Desktop: the stage view becomes a five-column kanban. */
@media (min-width: 900px) {
  .board--stage .lanes { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
  .board--stage .lane { order: 0; }
  .board--stage .lane--empty { display: grid; }
  .board--project .lanes { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px 14px; }
}
