/* ============================================================
   Tandem — Team Inbox
   Flat design system: teal primary, warm mint surface, no shadows.
   ============================================================ */

@font-face {
  font-family: "Work Sans";
  src: url("assets/work-sans.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary: #0D9488;
  --primary-strong: #0F766E;
  --on-primary: #FFFFFF;
  --accent: #EA580C;
  --surface: #F0FDFA;
  --card: #FFFFFF;
  --ink: #16302C;
  --ink-soft: #425C58;
  --ink-faint: #5D706C;
  --line: #CBE5E0;
  --line-strong: #99C4BD;
  --muted: #E8F1EF;
  --ring: #0D9488;

  --danger: #B42318;
  --danger-bg: #FEECEB;
  --progress: #92400E;
  --progress-bg: #FDEFD7;
  --todo: #334155;
  --todo-bg: #E9EEF3;
  --done: #115E59;
  --done-bg: #D7F5EF;

  --radius: 12px;
  --radius-sm: 8px;
  --space: 16px;
}

* , *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: "Work Sans", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Focus & interaction basics ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}

button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.skip-link {
  position: absolute;
  left: 8px; top: -48px;
  z-index: 100;
  background: var(--primary-strong);
  color: var(--on-primary);
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: top 150ms ease;
}
.skip-link:focus { top: 8px; }

/* ---------- Layout shell ---------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 22px 0 16px;
  border-bottom: 2px solid var(--line);
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px;
  align-self: center;
  border-radius: 9px;
}
.brand-name {
  font-family: "Space Grotesk", "Work Sans", sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }

.field { position: relative; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 6px 2px;
}
.field-icon {
  position: absolute;
  left: 12px; bottom: 12px;
  width: 18px; height: 18px;
  color: var(--ink-faint);
  pointer-events: none;
}

.field input, .field select {
  height: 44px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 0 12px;
  transition: border-color 150ms ease;
}
.field input:hover, .field select:hover { border-color: var(--primary); }
.field input { padding-left: 38px; width: 260px; }
.field input::-webkit-search-cancel-button { cursor: pointer; }
.field select {
  appearance: none;
  padding-right: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23425C58' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}

/* ---------- Board head ---------- */
.board-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 26px 0 18px;
}
.board-title h1 {
  margin: 0;
  font-family: "Space Grotesk", "Work Sans", sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.board-count {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--ink-faint);
  font-weight: 500;
}

.overview {
  list-style: none;
  display: flex;
  gap: 8px;
  margin: 0; padding: 0;
  flex-wrap: wrap;
}
.overview li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px 6px 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.overview-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex: none;
}
.overview-num { font-variant-numeric: tabular-nums; }
.overview li[data-status="todo"] .overview-dot { background: var(--todo); }
.overview li[data-status="in-progress"] .overview-dot { background: #D97706; }
.overview li[data-status="blocked"] .overview-dot { background: #DC2626; }
.overview li[data-status="done"] .overview-dot { background: var(--primary); }

.overview li.is-active { outline: 2px solid var(--primary); outline-offset: 1px; }

/* ---------- Task list ---------- */
.task-list {
  list-style: none;
  margin: 0 0 48px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-row {
  background: var(--card);
  border: 2px solid transparent;
  outline: 1.5px solid var(--line);
  outline-offset: -1.5px;
  border-radius: var(--radius);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 8px 20px;
  align-items: center;
  transition: outline-color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.task-row:hover {
  outline-color: var(--line-strong);
  background: #FBFFFE;
}
.task-row.row-just-changed {
  border-color: var(--primary);
  outline-color: var(--primary);
}

.task-main { min-width: 0; }
.task-title-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  font-size: 17.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  border-radius: 4px;
}
.task-title-btn:hover { color: var(--primary-strong); text-decoration: underline; text-underline-offset: 3px; }
.task-sub {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--ink-faint);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.task-sub .sep { color: var(--line-strong); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: none;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}
.meta-item { display: inline-flex; align-items: center; gap: 7px; }
.meta-item svg { width: 16px; height: 16px; flex: none; color: var(--ink-faint); }
.meta-comments { color: var(--ink-faint); }
.meta-id { font-family: "IBM Plex Mono", monospace; font-size: 12.5px; color: var(--ink-faint); }

/* ---------- Status chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.chip[data-status="todo"] { background: var(--todo-bg); color: var(--todo); }
.chip[data-status="in-progress"] { background: var(--progress-bg); color: var(--progress); }
.chip[data-status="blocked"] { background: var(--danger-bg); color: var(--danger); }
.chip[data-status="done"] { background: var(--done-bg); color: var(--done); }

/* ---------- Priority & tags ---------- */
.tag {
  display: inline-block;
  background: var(--muted);
  color: var(--ink-soft);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12.5px;
  font-weight: 600;
}
.priority { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.priority svg { width: 14px; height: 14px; }
.priority[data-priority="high"] { color: #C2410C; }
.priority[data-priority="medium"] { color: #B45309; }
.priority[data-priority="low"] { color: var(--ink-faint); }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 56px 24px 64px;
  color: var(--ink-soft);
}
.empty-state[hidden] { display: none; }
.empty-art { width: 72px; height: 72px; margin-bottom: 8px; }
.empty-state h2 {
  margin: 8px 0 6px;
  font-family: "Space Grotesk", "Work Sans", sans-serif;
  font-size: 22px;
  color: var(--ink);
}
.empty-state p { margin: 0 auto 20px; max-width: 40ch; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  font-weight: 700;
  font-size: 15px;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.btn-secondary {
  background: var(--primary);
  color: var(--on-primary);
}
.btn-secondary:hover { background: var(--primary-strong); }

.icon-btn {
  width: 44px; height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink-soft);
  transition: border-color 150ms ease, color 150ms ease;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary-strong); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Detail dialog ---------- */
.detail-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(19, 48, 44, 0.38);
  opacity: 1;
}
.detail-scrim[hidden] { display: none; }
body.detail-open { overflow: hidden; }

.detail {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 50;
  width: min(480px, 100%);
  background: var(--card);
  border-left: 2px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.detail[hidden] { display: none; }

.detail-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: var(--card);
  border-bottom: 1.5px solid var(--line);
}
.detail-kicker {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-strong);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.detail-kicker svg { width: 15px; height: 15px; }
.detail-id { font-family: "IBM Plex Mono", monospace; font-size: 12.5px; letter-spacing: 0.04em; }

.detail-body { padding: 24px 24px 48px; }
.detail-title {
  margin: 0 0 14px;
  font-family: "Space Grotesk", "Work Sans", sans-serif;
  font-size: 26px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.detail-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }

.detail-section-title {
  margin: 26px 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.detail-text p { margin: 0 0 12px; font-size: 15.5px; color: var(--ink-soft); overflow-wrap: anywhere; }
.detail-text p strong { color: var(--ink); }

.detail-control {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.control-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.control-row select {
  width: 100%;
  height: 46px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 0 12px;
  padding-right: 36px;
  appearance: none;
  cursor: pointer;
  font-weight: 600;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23425C58' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}
.control-row select:hover { border-color: var(--primary); }
.control-feedback {
  margin: 10px 0 0;
  min-height: 22px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-strong);
  display: flex;
  align-items: center;
  gap: 7px;
}
.control-feedback svg { width: 16px; height: 16px; flex: none; }

.detail-meta {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 18px;
  font-size: 14.5px;
}
.detail-meta dt { font-weight: 600; color: var(--ink-faint); }
.detail-meta dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.detail-meta .mono { font-family: "IBM Plex Mono", monospace; font-size: 13.5px; }

.detail-tags { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.detail-tags .tag { font-size: 13.5px; padding: 4px 10px; }

/* ---------- Toast ---------- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: #F0FDFA;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 14.5px;
  font-weight: 600;
  box-shadow: 0 2px 0 rgba(19, 48, 44, 0.25);
}
.toast svg { width: 17px; height: 17px; color: #5EEAD4; flex: none; }

/* ---------- Animations ---------- */
@keyframes row-flash {
  0% { background: #E4FBF7; }
  100% { background: var(--card); }
}
@keyframes slide-in {
  from { transform: translateX(60px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes toast-in {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.task-row.row-just-changed { animation: row-flash 900ms ease-out; }
.detail:not([hidden]) { animation: slide-in 220ms cubic-bezier(0.2, 0.8, 0.3, 1); }
.detail-scrim:not([hidden]) { animation: fade-in 200ms ease; }
.toast { animation: toast-in 200ms ease-out; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .app { padding: 0 16px; }
  .app-header { padding-top: 16px; gap: 14px; }
  .toolbar { width: 100%; }
  .field input { width: 100%; }
  .field-search { flex: 1 1 100%; }
  .field-filter { flex: 1 1 auto; }
  .field-filter select { width: 100%; }

  .board-head { padding-top: 18px; }
  .board-title h1 { font-size: 26px; }

  .task-row {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }
  .task-meta {
    flex-wrap: wrap;
    gap: 10px 16px;
    white-space: normal;
  }
  .detail { width: 100%; border-left: 0; }
}

@media (max-width: 520px) {
  .brand-sub { display: none; }
  .overview { width: 100%; }
  .board-count { font-size: 13px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
