/* ==========================================================
   STEMS* — Component Library
   Every screen is assembled from these parts.
   ========================================================== */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 46px;
  padding: 0 22px;
  border-radius: var(--r-input);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: transform var(--t-micro) var(--ease), background var(--t-micro), border-color var(--t-micro), color var(--t-micro), opacity var(--t-micro);
  user-select: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn svg { flex: none; }

.btn--primary {
  background: var(--green);
  color: var(--black);
}
.btn--primary:hover { background: #b7ff5c; }

.btn--secondary {
  background: transparent;
  color: var(--offwhite);
  border: 1px solid rgba(255, 255, 255, 0.28);
}
.btn--secondary:hover { border-color: var(--offwhite); }

.btn--ghost {
  background: transparent;
  color: var(--g300);
  border: 1px solid transparent;
}
.btn--ghost:hover { color: var(--offwhite); }

.btn--danger {
  background: rgba(217, 100, 89, 0.14);
  color: var(--red);
  border: 1px solid rgba(217, 100, 89, 0.35);
}

.btn--sm { height: 36px; padding: 0 16px; font-size: 11px; }
.btn--lg { height: 52px; padding: 0 28px; }
.btn--block { width: 100%; }

/* Tertiary link: text + green arrow */
.tlink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--offwhite);
  transition: color var(--t-micro);
}
.tlink svg { color: var(--green); transition: transform var(--t-micro) var(--ease); }
.tlink:hover svg { transform: translateX(3px); }
.tlink:hover { color: var(--green); }

/* Icon button */
.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-input);
  color: var(--g300);
  border: 1px solid transparent;
  transition: all var(--t-micro);
  flex: none;
}
.iconbtn:hover { color: var(--offwhite); background: rgba(255, 255, 255, 0.06); }
.iconbtn.is-active { color: var(--green); background: var(--green-dim); }
.iconbtn--line { border-color: var(--line); }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-input);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  color: var(--g100);
  background: transparent;
  white-space: nowrap;
  transition: all var(--t-micro);
}
.chip--static { pointer-events: none; }
button.chip:hover, label.chip:hover { border-color: var(--line-hover); color: var(--offwhite); cursor: pointer; }
.chip.is-on {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-dim);
}
.chip--lg { height: 44px; padding: 0 18px; font-size: 14px; border-radius: var(--r-input); }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge--green { background: var(--green-dim); color: var(--green); }
.badge--solid { background: var(--green); color: var(--black); }
.badge--grey { background: rgba(255, 255, 255, 0.07); color: var(--g300); }
.badge--amber { background: rgba(217, 164, 65, 0.14); color: var(--amber); }
.badge--red { background: rgba(217, 100, 89, 0.14); color: var(--red); }
.badge--line { border: 1px solid var(--line); color: var(--g300); background: transparent; }
.badge svg { width: 11px; height: 11px; }

/* Verified mark */
.vmark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Avatars ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--g800);
  color: var(--g100);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: none;
  border: 1px solid var(--line-soft);
  position: relative;
  overflow: hidden;
}
.avatar--sm { width: 28px; height: 28px; font-size: 10px; }
.avatar--lg { width: 56px; height: 56px; font-size: 17px; }
.avatar--xl { width: 88px; height: 88px; font-size: 26px; }
.avatar--green { background: var(--green-dim); color: var(--green); border-color: var(--green-soft); }
.avatar--photo { background: linear-gradient(145deg, #2e2f2c 0%, #191a18 60%, #101110 100%); }

.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { margin-left: -9px; border: 2px solid var(--black); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack--card .avatar { border-color: var(--charcoal); }

/* ---------- Cards ---------- */
.card {
  background: var(--charcoal);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  padding: var(--s5);
  position: relative;
  transition: border-color var(--t-ui) var(--ease), transform var(--t-ui) var(--ease);
}
a.card, .card--click { display: block; cursor: pointer; }
a.card:hover, .card--click:hover { border-color: var(--line-hover); }
.card--panel { border-radius: var(--r-panel); padding: var(--s6); }
.card--flat { background: transparent; border: 1px solid var(--line); }
.card--green { border-color: var(--green-soft); background: linear-gradient(160deg, rgba(166,255,51,0.05) 0%, var(--charcoal) 55%); }

/* Card media (atmospheric image placeholder) */
.media {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #141513;
}
.media::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 20% 10%, rgba(166,255,51,0.06) 0%, transparent 45%),
    radial-gradient(150% 120% at 85% 95%, rgba(0,0,0,0.55) 0%, transparent 55%);
  pointer-events: none;
}
.media--43 { aspect-ratio: 4/3; }
.media--45 { aspect-ratio: 4/5; }
.media--169 { aspect-ratio: 16/9; }
.media--wide { aspect-ratio: 21/9; }
.media svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.media .media__tag {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 2;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(242,242,240,0.5);
}

/* ---------- Section headers ---------- */
.sechead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s4);
}
.sechead .eyebrow { margin-bottom: 0; }

.pagehead { margin-bottom: var(--s6); }
.pagehead .eyebrow { margin-bottom: 10px; }

/* ---------- Inputs ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field > label { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--g300); }
.input, .select, .textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  height: 48px;
  padding: 0 16px;
  font-size: 15px;
  color: var(--offwhite);
  transition: border-color var(--t-micro), background var(--t-micro);
}
.textarea { height: auto; min-height: 110px; padding: 14px 16px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--g600); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--line-hover); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--green); background: rgba(255, 255, 255, 0.06); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23A1A1A1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

/* Search field */
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search svg.search__icon {
  position: absolute;
  left: 15px;
  color: var(--g600);
  pointer-events: none;
}
.search .input { padding-left: 44px; }

/* ---------- Rows & lists ---------- */
.row {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.row:last-child { border-bottom: none; }
.row__main { flex: 1; min-width: 0; }
.row__title { font-size: 15px; font-weight: 600; }
.row__sub { font-size: 12px; color: var(--g300); margin-top: 2px; }
.row--click { cursor: pointer; margin: 0 calc(-1 * var(--s3)); padding: 14px var(--s3); border-radius: var(--r-sm); transition: background var(--t-micro); border-bottom: 1px solid var(--line-soft); }
.row--click:hover { background: rgba(255, 255, 255, 0.03); }

/* ---------- Divider ---------- */
.divider { height: 1px; background: var(--line-soft); border: none; margin: var(--s5) 0; }

/* ---------- Progress ---------- */
.progressbar {
  height: 5px;
  border-radius: 3px;
  background: var(--g800);
  overflow: hidden;
}
.progressbar > i {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 600ms var(--ease);
}

/* Path steps — horizontal compact */
.path {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding: var(--s2) 0;
  scrollbar-width: none;
  min-width: 0;
  max-width: 100%;
}
.path::-webkit-scrollbar { display: none; }
.path__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 74px;
  position: relative;
  color: var(--g600);
}
.path__dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--g600);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  z-index: 1;
  flex: none;
  transition: all var(--t-ui);
}
.path__dot svg { width: 12px; height: 12px; }
.path__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
}
.path__step::before {
  content: '';
  position: absolute;
  top: 13px;
  left: calc(-50% + 13px);
  right: calc(50% + 13px);
  height: 1.5px;
  background: var(--g800);
}
.path__step:first-child::before { display: none; }
.path__step.is-done { color: var(--g300); }
.path__step.is-done .path__dot { border-color: var(--green); background: var(--green); color: var(--black); }
.path__step.is-done::before { background: var(--green-soft); }
.path__step.is-active { color: var(--offwhite); }
.path__step.is-active .path__dot {
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 0 5px var(--green-dim);
}
.path__step.is-active::before { background: var(--green-soft); }

/* ---------- Waveform ---------- */
.wave { position: relative; width: 100%; }
.wave svg { width: 100%; height: 100%; display: block; }
.wave__base rect { fill: var(--g600); opacity: 0.55; }
.wave__played { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.wave__played rect { fill: var(--green); }

/* Audio player */
.player {
  background: var(--charcoal);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  padding: var(--s4) var(--s5);
}
.player__top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.player__art {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--g800);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  flex: none;
}
.player__meta { flex: 1; min-width: 0; }
.player__title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player__by { font-size: 12px; color: var(--g300); }
.player__wavewrap { position: relative; cursor: pointer; }
.player__markers { position: absolute; inset: 0; pointer-events: none; }
.player__marker {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: var(--black);
  border: 1.5px solid var(--green);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  transition: transform var(--t-micro);
}
.player__marker:hover { transform: scale(1.25); }
.player__marker svg { width: 8px; height: 8px; }
.player__controls { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.player__time { font-size: 12px; color: var(--g300); font-variant-numeric: tabular-nums; }
.playbtn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green);
  color: var(--black);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: transform var(--t-micro) var(--ease), background var(--t-micro);
}
.playbtn:hover { background: #b7ff5c; }
.playbtn:active { transform: scale(0.94); }
.playbtn--sm { width: 34px; height: 34px; }
.playbtn--ghost { background: rgba(255,255,255,0.08); color: var(--offwhite); }

/* Timestamp comment bubble */
.tscomment {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-input);
}
.tscomment__time {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
  cursor: pointer;
}

/* ---------- Map ---------- */
.mapnode { cursor: pointer; }
.mapnode circle.core { fill: var(--green); transition: r var(--t-micro); }
.mapnode circle.ring {
  fill: none;
  stroke: var(--green);
  stroke-opacity: 0.35;
  stroke-width: 1;
  transition: all var(--t-micro);
}
.mapnode:hover circle.ring, .mapnode.is-active circle.ring { stroke-opacity: 0.9; r: 14; }
.mapnode.is-active circle.core { r: 6; }
.mapnode text {
  fill: var(--g300);
  font-size: 10px;
  font-family: var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mapcluster { cursor: pointer; }
.mapcluster circle { fill: rgba(166, 255, 51, 0.1); stroke: var(--green-soft); stroke-width: 1; transition: fill var(--t-micro); }
.mapcluster:hover circle { fill: rgba(166, 255, 51, 0.2); }
.mapcluster text {
  fill: var(--green);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  text-anchor: middle;
  dominant-baseline: central;
}

/* ---------- Overlays: modal / drawer / sheet ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 5, 0.72);
  backdrop-filter: blur(3px);
  z-index: 90;
  opacity: 0;
  transition: opacity var(--t-ui);
}
.overlay.is-open { opacity: 1; }

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.98);
  width: min(520px, calc(100vw - 40px));
  max-height: 84vh;
  overflow-y: auto;
  background: var(--charcoal);
  border: 1px solid var(--line);
  border-radius: var(--r-sheet);
  padding: var(--s6);
  z-index: 100;
  opacity: 0;
  transition: opacity var(--t-ui) var(--ease), transform var(--t-ui) var(--ease);
}
.modal.is-open { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 100vw);
  background: var(--charcoal);
  border-left: 1px solid var(--line);
  z-index: 100;
  transform: translateX(100%);
  transition: transform var(--t-page) var(--ease);
  overflow-y: auto;
}
.drawer.is-open { transform: translateX(0); }

.bsheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--charcoal);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  z-index: 100;
  transform: translateY(102%);
  transition: transform var(--t-page) var(--ease);
  max-height: 88vh;
  overflow-y: auto;
  padding: var(--s3) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom));
}
.bsheet.is-open { transform: translateY(0); }
.bsheet__grab {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--g600);
  margin: 6px auto 18px;
}
@media (min-width: 769px) {
  .bsheet {
    left: 50%;
    right: auto;
    width: 560px;
    transform: translate(-50%, 102%);
  }
  .bsheet.is-open { transform: translate(-50%, 0); }
}

.overlay-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
}

/* ---------- Toast ---------- */
.toasts {
  position: fixed;
  bottom: calc(var(--bottomnav-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
@media (min-width: 769px) { .toasts { bottom: 28px; } }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--g800);
  border: 1px solid var(--line);
  color: var(--offwhite);
  font-size: 13px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: toast-in var(--t-ui) var(--ease);
}
.toast svg { color: var(--green); flex: none; }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: all var(--t-ui); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Research prompt (pilot layer) ---------- */
.research {
  position: fixed;
  bottom: calc(var(--bottomnav-h) + 16px);
  right: 16px;
  width: min(320px, calc(100vw - 32px));
  background: var(--charcoal);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--s4) var(--s4) var(--s4);
  z-index: 85;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  animation: toast-in var(--t-page) var(--ease);
}
@media (min-width: 769px) { .research { bottom: 24px; right: 24px; } }
.research__tag {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--g600);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.research__tag i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--green); display: inline-block;
}
.research__q { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.research__opts { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Empty / error / offline states ---------- */
.state {
  text-align: center;
  padding: var(--s8) var(--s5);
  border: 1px dashed var(--line);
  border-radius: var(--r-panel);
}
.state__icon { display: flex; justify-content: center; margin-bottom: var(--s4); color: var(--g600); }
.state__title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.state__sub { font-size: 13px; color: var(--g300); margin-bottom: var(--s5); }
.state__actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 130;
  background: var(--g800);
  border-bottom: 1px solid var(--line);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.offline-banner i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.offline-banner span { color: var(--g300); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ---------- Loading ---------- */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s4);
  padding: var(--s8) 0;
  color: var(--g300);
  font-size: 13px;
}
.loading__ast {
  font-size: 40px;
  font-weight: 700;
  color: var(--green);
  line-height: 1;
  animation: ast-spin 1.6s var(--ease) infinite;
}
@keyframes ast-spin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.15); }
  100% { transform: rotate(360deg) scale(1); }
}

/* ---------- Signature connection motion ---------- */
.connect-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(11, 11, 11, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--s6);
  opacity: 0;
  transition: opacity var(--t-page);
}
.connect-overlay.is-open { opacity: 1; }
.connect-overlay .cnodes { width: min(420px, 80vw); }
.connect-overlay .cline {
  stroke: var(--green);
  stroke-width: 1.5;
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: draw-line 900ms var(--ease) 500ms forwards;
}
.connect-overlay .cnode { opacity: 0; animation: node-in 400ms var(--ease) forwards; }
.connect-overlay .cnode.b { animation-delay: 260ms; }
.connect-overlay .cripple {
  fill: none;
  stroke: var(--green);
  opacity: 0;
  animation: ripple 1400ms var(--ease) 1300ms forwards;
}
.connect-overlay__label {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--g300);
  opacity: 0;
  animation: node-in 500ms var(--ease) 1500ms forwards;
  text-align: center;
}
.connect-overlay__label strong { color: var(--offwhite); display: block; font-size: 16px; margin-top: 6px; letter-spacing: 0.04em; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
@keyframes node-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
@keyframes ripple {
  0% { opacity: 0.7; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(1.8); }
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line-soft);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--g600);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--t-micro);
}
.tab:hover { color: var(--g300); }
.tab.is-active { color: var(--offwhite); border-bottom-color: var(--green); }

/* ---------- Grids ---------- */
.grid { display: grid; gap: var(--s4); }
.grid > * { min-width: 0; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* ---------- Task rows ---------- */
.task {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--charcoal);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-input);
}
.task__check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--g600);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all var(--t-micro);
  cursor: pointer;
}
.task__check:hover { border-color: var(--green); }
.task.is-done .task__check { background: var(--green); border-color: var(--green); color: var(--black); }
.task.is-done .task__title { color: var(--g600); text-decoration: line-through; }
.task__title { font-size: 14px; font-weight: 600; }
.task__meta { font-size: 12px; color: var(--g300); margin-top: 1px; }

/* ---------- File rows ---------- */
.file {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: var(--charcoal);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-input);
}
.file__icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--g300);
  flex: none;
}
.file__icon--audio { color: var(--green); background: var(--green-dim); }
.file__name { font-size: 14px; font-weight: 600; word-break: break-all; }
.file__meta { font-size: 11.5px; color: var(--g300); margin-top: 1px; }

/* ---------- Chat ---------- */
.chat-msg { display: flex; gap: 12px; margin-bottom: 18px; }
.chat-msg__bubble {
  background: var(--charcoal);
  border: 1px solid var(--line-soft);
  border-radius: 4px 14px 14px 14px;
  padding: 11px 15px;
  font-size: 14px;
  max-width: 480px;
}
.chat-msg--me { flex-direction: row-reverse; }
.chat-msg--me .chat-msg__bubble {
  background: var(--green-dim);
  border-color: rgba(166, 255, 51, 0.2);
  border-radius: 14px 4px 14px 14px;
}
.chat-msg__who { font-size: 11px; font-weight: 600; color: var(--g300); margin-bottom: 4px; letter-spacing: 0.04em; }
.chat-msg__time { font-size: 10px; color: var(--g600); margin-top: 5px; }
.chat-sys {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
  font-size: 11.5px;
  color: var(--g600);
  letter-spacing: 0.03em;
}
.chat-sys::before, .chat-sys::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }
.chat-sys b { color: var(--g300); font-weight: 600; }
.chat-sys svg { color: var(--green); width: 12px; height: 12px; flex: none; }

/* Voice note */
.voicenote {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 6px 16px 6px 6px;
}

/* ---------- Split rows ---------- */
.split-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}
.split-row:last-of-type { border-bottom: none; }
.split-row__pct {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 68px;
  text-align: right;
}

/* ---------- Stat blocks (pilot) ---------- */
.stat { padding: var(--s5); border: 1px solid var(--line-soft); border-radius: var(--r-card); background: var(--charcoal); }
.stat__num { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.stat__label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--g300); margin-top: 8px; }

/* ---------- Utility ---------- */
.flex { display: flex; }
.aic { align-items: center; }
.jcb { justify-content: space-between; }
.g2 { gap: var(--s2); } .g3 { gap: var(--s3); } .g4 { gap: var(--s4); } .g5 { gap: var(--s5); }
.mt2 { margin-top: var(--s2); } .mt3 { margin-top: var(--s3); } .mt4 { margin-top: var(--s4); }
.mt5 { margin-top: var(--s5); } .mt6 { margin-top: var(--s6); } .mt7 { margin-top: var(--s7); }
.mb2 { margin-bottom: var(--s2); } .mb3 { margin-bottom: var(--s3); } .mb4 { margin-bottom: var(--s4); }
.mb5 { margin-bottom: var(--s5); } .mb6 { margin-bottom: var(--s6); }
.tac { text-align: center; }
.nowrap { white-space: nowrap; }
.hide-mobile { display: initial; }
.show-mobile { display: none; }
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: initial; }
}
