/* Actionable — email-client-shaped task UI. Neo-brutalist skin, three panes. */

:root {
  --paper: #f4f2ec;
  --ink: #0a0a0a;
  --cobalt: #2036d6;
  --yellow: #ffd02f;
  --green: #2fbf71;
  --pink: #ff90e8;
  --muted: #55565c;
  --card: #ffffff;
  --bw: 3px;
  --shadow-sm: 4px 4px 0 var(--ink);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

a { color: inherit; }
::selection { background: var(--yellow); }

[hidden] { display: none !important; }

.client {
  display: grid;
  grid-template-columns: 14rem 19rem 1fr 18rem;
  height: 100vh;
}

/* ================= LEFT RAIL ================= */

.rail {
  border-right: var(--bw) solid var(--ink);
  background: var(--card);
  padding: 1.4rem 1.1rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.wordmark { font-family: "IBM Plex Mono", monospace; font-size: 0.875rem; font-weight: 600; text-decoration: none; }
.wordmark-at { color: var(--cobalt); }

.rail-user { font-family: "IBM Plex Mono", monospace; font-size: 0.68rem; color: var(--muted); margin: 0.4rem 0 2rem; }

.proto-badge {
  background: var(--pink);
  border: 2px solid var(--ink);
  border-radius: 3px;
  padding: 0.02rem 0.3rem;
  font-weight: 600;
  color: var(--ink);
}

.folders { display: flex; flex-direction: column; gap: 0.45rem; }

.folder {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9375rem;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
}

.folder:hover { border-color: var(--ink); background: var(--paper); }

.folder.active {
  border-color: var(--ink);
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--ink);
}

.folder-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
.dot-hot { background: var(--yellow); }
.dot-live { background: var(--cobalt); }
.dot-done { background: var(--green); }

.folder-short { display: none; }

.folder-count {
  margin-left: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  font-weight: 600;
  border: 2px solid var(--ink);
  border-radius: 99px;
  padding: 0 0.4rem;
  background: var(--card);
}

.count-hot { background: var(--yellow); }

.rail-foot { margin-top: auto; padding-top: 2rem; }

.rail-hint { font-size: 0.8125rem; color: var(--muted); line-height: 1.6; }
.rail-hint a { color: var(--cobalt); font-weight: 700; }

/* ================= MIDDLE LIST ================= */

.list {
  border-right: var(--bw) solid var(--ink);
  overflow-y: auto;
  padding: 1.2rem 1rem;
  background: var(--paper);
}

.group { margin-bottom: 1.8rem; }

.group-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.7rem;
}

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.1rem 0.8rem;
  text-decoration: none;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--card);
  padding: 0.75rem 0.95rem;
  margin-bottom: 0.65rem;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 100ms ease, box-shadow 100ms ease;
}

.item:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }

.item.open { background: #fffbea; border-width: 3px; }

.item-name { font-weight: 700; font-size: 0.9375rem; }

.item-time { font-family: "IBM Plex Mono", monospace; font-size: 0.64rem; color: var(--muted); align-self: center; }

.item-preview { grid-column: 1 / -1; font-size: 0.8125rem; color: var(--muted); }

.item-needs {
  grid-column: 1 / -1;
  margin-top: 0.4rem;
  justify-self: start;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.64rem;
  font-weight: 600;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
}

.item-done { opacity: 0.65; box-shadow: none; }
.item-done .item-name { text-decoration: line-through; text-decoration-thickness: 2px; }

/* ================= THREAD PANE ================= */

.thread-pane { overflow-y: auto; background: var(--paper); }

.thread-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--muted);
  text-align: center;
  padding: 2rem;
}

.empty-glyph { font-size: 2.4rem; }
.empty-sub { font-size: 0.8125rem; max-width: 22rem; }

.thread { padding: 1.4rem 1.8rem 3rem; max-width: 46rem; }

.t-head {
  margin-bottom: 1.2rem;
  padding-bottom: 0.9rem;
  border-bottom: 2px dashed #d8d5ca;
}

.t-title {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.t-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.t-back, .t-details-btn {
  display: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--card);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  color: var(--ink);
}

.t-details-btn { background: var(--yellow); }

.chip {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 0.12rem 0.5rem;
  background: var(--card);
}

.chip-live { background: var(--cobalt); color: #fff; }
.chip-hot { background: var(--yellow); }
.chip-done { background: var(--green); }

/* ================= RIGHT DETAILS RAIL ================= */

.details {
  border-left: var(--bw) solid var(--ink);
  background: var(--card);
  overflow-y: auto;
  padding: 1.4rem 1.2rem;
}

.d-block { margin-bottom: 1.8rem; }

.d-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.65rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--ink);
}

.d-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.d-row { font-size: 0.8125rem; padding: 0.22rem 0; display: flex; gap: 0.6rem; }

.d-row strong {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  flex: 0 0 2.9rem;
  padding-top: 0.2rem;
}

.d-next { font-weight: 700; }
.d-next strong { color: var(--cobalt); }

.d-convo { font-size: 0.8125rem; padding: 0.25rem 0; }
.d-convo-n { font-family: "IBM Plex Mono", monospace; font-size: 0.68rem; color: var(--muted); }

.d-note { font-size: 0.7rem; color: var(--muted); margin-top: 0.5rem; line-height: 1.5; }

.details .artifact { display: block; width: 100%; text-align: left; margin-bottom: 0.5rem; }

.details-close {
  display: none;
  position: absolute;
  top: 0.8rem;
  right: 0.9rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  font-weight: 600;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--card);
  box-shadow: 2px 2px 0 var(--ink);
  width: 1.9rem;
  height: 1.9rem;
  cursor: pointer;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.45);
  z-index: 55;
}

/* decision card */

.decide {
  border: var(--bw) solid var(--ink);
  border-radius: 8px;
  background: #fffbea;
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}

.decide-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

.options { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.9rem; }

.option {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  background: var(--card);
}

.option:hover { background: #fff6d6; }
.option:has(input:checked) { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); }
.option input { accent-color: var(--ink); }
.option-name { font-weight: 700; font-size: 0.9375rem; }
.option-detail { font-family: "IBM Plex Mono", monospace; font-size: 0.7rem; color: var(--muted); margin-left: auto; text-align: right; }

.myread { font-size: 0.875rem; color: var(--muted); margin-bottom: 1rem; }

.myread-tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--cobalt);
  color: #fff;
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  margin-right: 0.4rem;
}

/* artifacts */

.artifacts { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1.6rem; }

.artifact {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--card);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 100ms ease, box-shadow 100ms ease;
}

.artifact:hover { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }

.artifact-meta { color: var(--muted); font-weight: 400; }

/* messages */

.msgs { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 1.6rem; }

.m {
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0.85rem 1.05rem;
  background: var(--card);
  max-width: 92%;
}

.m-you { align-self: flex-end; background: #eef1ff; border-style: dashed; }
.m-act { align-self: flex-start; border-left: 4px solid var(--cobalt); box-shadow: var(--shadow-sm); }
.m-ext { align-self: flex-start; background: #f7f7f3; }

.m-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.64rem;
  margin-bottom: 0.4rem;
  color: var(--muted);
}

.m-from { font-weight: 600; color: var(--ink); }
.m-act .m-from { color: var(--cobalt); }

.m-tag {
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  padding: 0 0.3rem;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--paper);
}

.m-tag-ai { background: var(--cobalt); color: #fff; border-color: var(--ink); }

.m-time { margin-left: auto; }

.m-body { font-size: 0.9375rem; }

.m-details { margin-top: 0.5rem; }
.m-details summary {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--cobalt);
  cursor: pointer;
  list-style: none;
  width: fit-content;
}
.m-details summary::-webkit-details-marker { display: none; }
.m-details[open] summary { color: var(--muted); }

.mail-excerpt {
  margin-top: 0.5rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.7;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 0.8rem 0.95rem;
  white-space: pre-wrap;
}

/* conversation blocks — agent ↔ external party sub-threads */

.convo {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}

.convo-head {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.7rem 0.95rem;
  cursor: pointer;
  list-style: none;
  background: #f7f7f3;
  font-size: 0.8125rem;
}

.convo-head::-webkit-details-marker { display: none; }

.convo-head:hover { background: #f1f1ea; }

.convo[open] .convo-head { border-bottom: 2px solid var(--ink); background: var(--yellow); }

.convo-arrows { font-weight: 700; color: var(--cobalt); }

.convo-party { font-weight: 700; font-size: 0.875rem; }

.convo-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  font-weight: 600;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  padding: 0 0.3rem;
  background: var(--card);
}

.convo-last {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.convo-time { font-family: "IBM Plex Mono", monospace; font-size: 0.64rem; color: var(--muted); flex: none; }

.convo-body { padding: 0.9rem 0.95rem 0.6rem; display: flex; flex-direction: column; gap: 0.6rem; background: #fbfbf8; }

.cm {
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  max-width: 88%;
  font-size: 0.8438rem;
}

.cm-act { align-self: flex-start; border-left: 3px solid var(--cobalt); background: var(--card); }
.cm-ext { align-self: flex-end; background: #f7f7f3; }

.cm-head {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.25rem;
  display: flex;
  gap: 0.5rem;
}

.cm-act .cm-head { color: var(--cobalt); }

.cm-time { margin-left: auto; font-weight: 400; }

.cm-body { line-height: 1.5; }

/* pending conversation — agent chasing, no reply yet */

.convo-pending { border-color: #c98a00; }

.convo-pending .convo-head { background: #fff3d0; }

.convo-pending[open] .convo-head { background: var(--yellow); }

.convo-await {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--yellow);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  white-space: nowrap;
}

.convo-chase {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  font-weight: 600;
  background: #fff3d0;
  border: 2px dashed #c98a00;
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  text-align: center;
}

.d-await {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--yellow);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  padding: 0 0.3rem;
}

.convo-note {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  color: var(--muted);
  text-align: center;
  padding: 0.3rem 0 0.4rem;
}

/* system events */

.ev {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--muted);
  padding: 0 0.3rem;
}

.ev::before, .ev::after { content: ""; flex: 1; border-top: 2px dashed #d8d5ca; }
.ev::before { flex: 0 0 1.2rem; }

.ev-time { font-weight: 600; }

/* reply — email-client style */

.reply-area { margin-top: 1.4rem; }

.composer-card {
  border: var(--bw) solid var(--ink);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.composer-to {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  padding: 0.6rem 0.95rem;
  border-bottom: 2px solid var(--ink);
  background: #f7f7f3;
}

.composer-to span { color: var(--muted); margin-right: 0.6rem; }

.composer-text {
  display: block;
  width: 100%;
  border: 0;
  resize: vertical;
  font-family: "Schibsted Grotesk", sans-serif;
  font-size: 0.9375rem;
  line-height: 1.55;
  padding: 0.85rem 0.95rem;
  background: var(--card);
}

.composer-text:focus { outline: none; background: #fffdf4; }

.composer-actions {
  display: flex;
  gap: 0.6rem;
  padding: 0.7rem 0.95rem;
  border-top: 2px dashed #d8d5ca;
}

/* buttons */

.btn {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 0.9063rem;
  padding: 0.6rem 1.1rem;
  border: var(--bw) solid var(--ink);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 100ms ease, box-shadow 100ms ease;
}

.btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.btn:focus-visible { outline: 3px dashed var(--cobalt); outline-offset: 3px; }

.btn-primary { background: var(--cobalt); color: #fff; }

/* toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  border-radius: 6px;
  padding: 0.65rem 1rem;
  max-width: min(34rem, calc(100vw - 2rem));
  z-index: 50;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 1280px) {
  .client { grid-template-columns: 13rem 18rem 1fr; }

  /* details rail becomes a flyout drawer */
  .details {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(20rem, 86vw);
    z-index: 60;
    border-left: var(--bw) solid var(--ink);
    box-shadow: -12px 0 40px rgba(10, 10, 10, 0.3);
    transform: translateX(105%);
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
    padding-top: 3.2rem;
  }

  body.details-open .details { transform: none; }

  .details-close { display: block; }
  .t-details-btn { display: inline-block; }
}

@media (prefers-reduced-motion: reduce) {
  .details { transition: none; }
}

@media (max-width: 1000px) {
  .client { grid-template-columns: 13rem 1fr; }
  .thread-pane { display: none; }
  body.show-thread .list { display: none; }
  body.show-thread .thread-pane { display: block; }
  .t-back { display: inline-block; }
}

@media (max-width: 640px) {
  body { overflow: auto; }
  .client { display: block; height: auto; min-height: 100vh; }
  .rail {
    border-right: 0;
    border-bottom: var(--bw) solid var(--ink);
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    padding: 0.9rem 1.1rem;
  }
  .rail-user { margin: 0; }
  .folders {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.4rem;
    flex: 1 1 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.15rem;
  }
  .folders::-webkit-scrollbar { display: none; }
  .folder { flex: none; white-space: nowrap; }
  .folder { padding: 0.35rem 0.55rem; font-size: 0.8125rem; box-shadow: none; }
  .folder.active { box-shadow: 2px 2px 0 var(--ink); }
  .folder-name { display: none; }
  .folder-short { display: inline; }
  .rail-foot { display: none; }
  .list { border-right: 0; padding: 1rem 0.9rem; }
  body:not(.show-thread) .thread-pane { display: none; }
  .thread { padding: 1.1rem 0.95rem 3rem; }
  .m { max-width: 100%; }

  /* conversation header wraps instead of squeezing */
  .convo-head { flex-wrap: wrap; row-gap: 0.2rem; }
  .convo-last { flex-basis: 100%; order: 9; white-space: normal; }

  /* decision options stack their price line */
  .option { flex-wrap: wrap; row-gap: 0.15rem; }
  .option-detail { margin-left: 1.55rem; text-align: left; flex-basis: 100%; }

  .decide, .composer-card { box-shadow: var(--shadow-sm); }
  .toast { bottom: 0.9rem; font-size: 0.7rem; }
}
