/* stdout — team task inbox
   Recipe: Terminal Utilitarian, dark console world.
   Two voices: a bold system-sans wordmark/numeral, a monospace workhorse for
   everything else (labels, data, body). */

:root {
  --bg: #0a0f0a;
  --surface: #10160f;
  --surface-2: #182018;
  --surface-3: #1e2a1e;
  --line: #263424;
  --ink: #e7f3e7;
  --muted: #93ac93;
  --muted-dim: #7c9c7c;
  --accent: #3fe073;
  --accent-strong: #6bffa0;
  --accent-ink: #06210f;
  --warn: #ff6b6b;
  --amber: #ffcc66;
  --blue: #7fb4ff;

  --font-display: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo,
    Consolas, "Liberation Mono", monospace;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;

  --dur: 180ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: clip;
  padding-bottom: 56px; /* clears fixed terminal bar */
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- decorative scanline texture ---------- */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.025) 0px,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

/* ---------- header / hero ---------- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: radial-gradient(120% 160% at 10% 0%, #10190f 0%, var(--bg) 60%);
  padding: var(--sp-7) var(--sp-5) var(--sp-6);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand stat"
    "strip strip";
  column-gap: var(--sp-6);
  row-gap: var(--sp-6);
  align-items: end;
}

.brand {
  grid-area: brand;
}

.brand-path {
  margin: 0 0 var(--sp-2);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted-dim);
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 8vw, 72px);
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: var(--ink);
}

.cursor {
  display: inline-block;
  color: var(--accent);
  margin-left: 2px;
  animation: blink 1s steps(2, jump-none) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
    opacity: 1;
  }
}

@keyframes blink {
  0%, 45% { opacity: 1; }
  50%, 95% { opacity: 0; }
  100% { opacity: 1; }
}

.brand-tag {
  margin: var(--sp-3) 0 0;
  color: var(--muted);
  font-size: 15px;
}

.hero-stat {
  grid-area: stat;
  justify-self: end;
  text-align: right;
  padding-left: var(--sp-6);
  border-left: 1px solid var(--line);
}

.hero-stat-label {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-dim);
}

.hero-stat-number {
  margin: var(--sp-1) 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(56px, 10vw, 108px);
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.hero-stat-sub {
  margin: var(--sp-1) 0 0;
  font-size: 13px;
  color: var(--muted);
}

.status-strip {
  grid-area: strip;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin: 0;
  padding: 0;
}

.status-chip {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .status-chip:hover {
    border-color: var(--accent);
    color: var(--ink);
  }
}

.status-chip:active {
  background: var(--surface-3);
}

.status-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.status-chip[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--surface-2);
  color: var(--ink);
}

.status-chip .count {
  font-weight: 700;
  color: var(--ink);
}

.status-chip[aria-pressed='true'] .count {
  color: var(--accent);
}

/* ---------- controls ---------- */
main {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5) var(--sp-9);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 220px auto;
  gap: var(--sp-4);
  align-items: end;
  margin-bottom: var(--sp-6);
}

.field label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: var(--sp-2);
}

.field label::before {
  content: "$ ";
  color: var(--accent);
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 16px;
  padding: 0 var(--sp-3);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.field select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: calc(100% - 20px) center, calc(100% - 14px) center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: var(--sp-7);
}

.field input:hover,
.field select:hover {
  border-color: var(--muted);
}

.field input:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.result-count {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  padding-bottom: var(--sp-2);
}

/* ---------- queue list ---------- */
.queue {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}

.queue-head {
  display: grid;
  grid-template-columns: 120px 1fr 160px 90px 48px;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-dim);
  border-bottom: 1px solid var(--line);
}

.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row + .row {
  border-top: 1px solid var(--line);
}

.row-btn {
  all: unset;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 120px 1fr 160px 90px 48px;
  gap: var(--sp-3);
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .row-btn:hover {
    background: var(--surface-2);
    border-left-color: var(--accent);
  }
}

.row-btn:active {
  background: var(--surface-3);
}

.row-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--surface-2);
}

.row-status {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.status-todo { color: var(--blue); }
.status-in-progress { color: var(--amber); }
.status-blocked { color: var(--warn); }
.status-done { color: var(--accent); }

.row-title {
  color: var(--ink);
  font-size: 15px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-owner,
.row-due {
  color: var(--muted);
  font-size: 13px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-pri {
  font-size: 14px;
  text-align: left;
}

.pri-high { color: var(--warn); }
.pri-medium { color: var(--amber); }
.pri-low { color: var(--muted-dim); }

/* ---------- empty state ---------- */
.empty-state {
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  color: var(--muted);
}

.empty-code {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 8vw, 64px);
  color: var(--surface-3);
  letter-spacing: -0.02em;
}

.empty-message {
  margin: var(--sp-2) 0 var(--sp-5);
  font-size: 15px;
}

.empty-message strong {
  color: var(--ink);
}

/* ---------- buttons ---------- */
.btn {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 20px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
}

@media (hover: hover) and (pointer: fine) {
  .btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
  }
}

.btn-secondary:active {
  transform: scale(0.97);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- terminal footer bar ---------- */
.terminal-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 44px;
  padding: 0 var(--sp-5);
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
}

.terminal-bar .prompt {
  color: var(--accent);
  flex-shrink: 0;
}

.echo-line {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
}

.echo-line.flash {
  animation: echoIn 260ms var(--ease);
}

@keyframes echoIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .echo-line.flash {
    animation: none;
  }
}

/* ---------- detail dialog ---------- */
.detail-dialog {
  border: none;
  padding: 0;
  background: transparent;
  color: inherit;
  max-width: 640px;
  width: min(640px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 64px));
  border-radius: var(--r-lg);
}

.detail-dialog::backdrop {
  background: rgba(4, 8, 5, 0.72);
}

.window {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: min(760px, calc(100vh - 64px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.window-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.window-dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--line);
}

.window-path {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.close-btn {
  all: unset;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 var(--sp-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .close-btn:hover {
    color: var(--warn);
    background: var(--surface-3);
  }
}

.close-btn:active {
  transform: scale(0.97);
}

.close-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.window-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: var(--sp-5);
  overflow-y: auto;
}

.detail-status-line {
  margin: 0 0 var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: 13px;
}

.detail-status-tag {
  font-weight: 700;
}

.detail-id {
  color: var(--muted-dim);
}

#detail-title {
  margin: 0 0 var(--sp-5);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 4vw, 30px);
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--ink);
}

.detail-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3) var(--sp-4);
  margin: 0 0 var(--sp-5);
  padding: var(--sp-4);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

.detail-facts div {
  min-width: 0;
}

.detail-facts dt {
  margin: 0 0 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-dim);
}

.detail-facts dd {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.detail-body {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: var(--sp-6);
}

.detail-body p {
  margin: 0 0 var(--sp-4);
}

.detail-body p:last-child {
  margin-bottom: 0;
}

.status-control-row {
  border-top: 1px solid var(--line);
  padding-top: var(--sp-5);
}

.status-control-row label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: var(--sp-2);
}

.status-control-row label::before {
  content: "$ ";
  color: var(--accent);
}

#status-control {
  width: 100%;
  min-height: 44px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 16px;
  padding: 0 var(--sp-3);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: calc(100% - 20px) center, calc(100% - 14px) center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: var(--sp-7);
  transition: border-color var(--dur) var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  #status-control:hover {
    border-color: var(--muted);
  }
}

#status-control:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.status-feedback {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: var(--sp-3) 0 0;
  padding: 0 var(--sp-1);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-strong);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease),
    padding var(--dur) var(--ease);
}

.status-feedback:not(:empty) {
  padding: 4px var(--sp-3);
  background: var(--accent);
  color: var(--accent-ink);
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .topbar-inner {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "stat"
      "strip";
  }

  .hero-stat {
    justify-self: start;
    text-align: left;
    padding-left: 0;
    border-left: none;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .result-count {
    padding-bottom: 0;
  }

  .queue-head {
    display: none;
  }

  .row-btn {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "status pri"
      "title title"
      "owner due";
    row-gap: var(--sp-2);
    min-height: unset;
    padding: var(--sp-4);
  }

  .row-status {
    grid-area: status;
  }

  .row-pri {
    grid-area: pri;
    justify-self: end;
  }

  .row-title {
    grid-area: title;
    white-space: normal;
  }

  .row-owner {
    grid-area: owner;
  }

  .row-due {
    grid-area: due;
    text-align: right;
  }

  .detail-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
  }

  .window {
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }

  .detail-facts {
    grid-template-columns: 1fr;
  }

  .terminal-bar .prompt {
    display: none;
  }
}

@media (max-width: 480px) {
  .brand-name {
    font-size: 42px;
  }

  .hero-stat-number {
    font-size: 64px;
  }
}
