/* Relay — Team Inbox
   Plain CSS, no build step. Light/dark themes via prefers-color-scheme. */

@font-face {
  font-family: "DM Sans";
  src: url("/artifacts/team-inbox--v1--s1--glm-5.2--web-design-guidelines--2026-09-17T05-28-53-374Z/assets/dm-sans.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Serif Display";
  src: url("/artifacts/team-inbox--v1--s1--glm-5.2--web-design-guidelines--2026-09-17T05-28-53-374Z/assets/dm-serif.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "DM Serif Display", Georgia, "Times New Roman", serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 56px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.22), 0 8px 24px rgba(0, 0, 0, 0.14);

  --focus-ring: 0 0 0 3px var(--ring);

  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);

  color-scheme: light;
}

:root[data-theme="light"] {
  --bg: #f5f4f1;
  --bg-elev: #ffffff;
  --bg-subtle: #efece6;
  --bg-inset: #f0eee9;
  --border: #e2dfd7;
  --border-strong: #d0ccc2;
  --fg: #1a1b1f;
  --fg-muted: #5c5d63;
  --fg-soft: #7b7c81;
  --accent: #4338ca;
  --accent-fg: #ffffff;
  --accent-soft: #e9e7ff;
  --ring: rgba(67, 56, 202, 0.32);

  --st-todo-fg: #5b5547;
  --st-todo-bg: #efece3;
  --st-todo-bd: #ddd8cb;
  --st-progress-fg: #1d4ed8;
  --st-progress-bg: #e6ecff;
  --st-progress-bd: #cdd9ff;
  --st-blocked-fg: #b42318;
  --st-blocked-bg: #fde9e6;
  --st-blocked-bd: #f7cfc9;
  --st-done-fg: #15803d;
  --st-done-bg: #e3f5e6;
  --st-done-bd: #c6e6cc;

  --priority-high: #b42318;
  --priority-med: #b54708;
  --priority-low: #475467;
}

:root[data-theme="dark"] {
  --bg: #15161a;
  --bg-elev: #1d1e24;
  --bg-subtle: #20212a;
  --bg-inset: #16171d;
  --border: #2c2d36;
  --border-strong: #3a3b46;
  --fg: #f2f1ee;
  --fg-muted: #a9aab2;
  --fg-soft: #82838b;
  --accent: #9d96ff;
  --accent-fg: #15161a;
  --accent-soft: #2a2747;
  --ring: rgba(157, 150, 255, 0.42);

  --st-todo-fg: #c8c3b3;
  --st-todo-bg: #2a2820;
  --st-todo-bd: #3d3a2f;
  --st-progress-fg: #b3c4ff;
  --st-progress-bg: #1d2540;
  --st-progress-bd: #2c3a63;
  --st-blocked-fg: #ffb4a8;
  --st-blocked-bg: #3a1f1c;
  --st-blocked-bd: #5a2b25;
  --st-done-fg: #a7e7b4;
  --st-done-bg: #163021;
  --st-done-bd: #245236;

  --priority-high: #ff9b8e;
  --priority-med: #ffc987;
  --priority-low: #aab0bd;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #15161a; --bg-elev: #1d1e24; --bg-subtle: #20212a; --bg-inset: #16171d;
    --border: #2c2d36; --border-strong: #3a3b46;
    --fg: #f2f1ee; --fg-muted: #a9aab2; --fg-soft: #82838b;
    --accent: #9d96ff; --accent-fg: #15161a; --accent-soft: #2a2747;
    --ring: rgba(157, 150, 255, 0.42);
    --st-todo-fg: #c8c3b3; --st-todo-bg: #2a2820; --st-todo-bd: #3d3a2f;
    --st-progress-fg: #b3c4ff; --st-progress-bg: #1d2540; --st-progress-bd: #2c3a63;
    --st-blocked-fg: #ffb4a8; --st-blocked-bg: #3a1f1c; --st-blocked-bd: #5a2b25;
    --st-done-fg: #a7e7b4; --st-done-bg: #163021; --st-done-bd: #245236;
    --priority-high: #ff9b8e; --priority-med: #ffc987; --priority-low: #aab0bd;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.5);
    --shadow-md: 0 4px 14px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.4);
    --shadow-lg: 0 24px 60px rgba(0,0,0,.6), 0 8px 24px rgba(0,0,0,.5);
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--fg);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }

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

.skip-link {
  position: absolute;
  left: 50%;
  top: -48px;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-decoration: none;
  transition: top 150ms var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- Focus ---------- */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--accent);
}

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) max(var(--space-6), env(safe-area-inset-left)) var(--space-4) max(var(--space-6), env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-fg);
  flex: 0 0 auto;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-name {
  font-family: var(--font-serif);
  font-size: 22px;
  letter-spacing: 0.1px;
}
.brand-sub {
  font-size: 12px;
  color: var(--fg-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-count {
  margin: 0;
  font-size: 13px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.header-count strong { color: var(--fg); font-weight: 600; }

/* ---------- Main ---------- */
.app-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: var(--space-6) max(var(--space-5), env(safe-area-inset-right)) var(--space-9) max(var(--space-5), env(safe-area-inset-left));
  scroll-margin-top: 80px;
}

/* ---------- Controls ---------- */
.controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-3);
  align-items: end;
  margin-bottom: var(--space-6);
}

.field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.field-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.input-wrap:focus-within { border-color: var(--accent); }
.input-wrap[data-icon="search"] svg {
  position: absolute;
  left: var(--space-3);
  color: var(--fg-soft);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-7);
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 15px;
  border-radius: var(--radius-md);
}
.search-input::placeholder { color: var(--fg-soft); }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.select-wrap { position: relative; display: inline-flex; }
.select-wrap .chevron {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-soft);
  pointer-events: none;
}
.filter-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: var(--space-3) var(--space-7) var(--space-3) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background-color: var(--bg-elev);
  color: var(--fg);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.filter-select:hover { border-color: var(--accent); }

/* ---------- List ---------- */
.list-section { display: flex; flex-direction: column; }
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.list-heading {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.active-filter {
  font-size: 13px;
  color: var(--fg-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.task-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease), transform 140ms var(--ease);
  min-width: 0;
  scroll-margin-top: 88px;
}
.task-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.task-item.is-done .task-title { color: var(--fg-muted); }

.task-top {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.task-main { min-width: 0; flex: 1 1 auto; }

.task-title-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 2px 4px;
  margin: -2px 0 -2px -4px;
  color: inherit;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  border-radius: var(--radius-sm);
  text-wrap: pretty;
}
.task-title-btn:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.task-title-btn .open-chevron {
  color: var(--fg-soft);
  margin-left: 2px;
  transition: transform 140ms var(--ease);
  display: inline-block;
}
.task-title-btn:hover .open-chevron { color: var(--accent); transform: translateX(2px); }

.task-summary {
  color: var(--fg-muted);
  font-size: 14px;
  margin: 0 0 var(--space-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  font-size: 13px;
  color: var(--fg-muted);
}
.task-meta > * { min-width: 0; }
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.meta-chip .meta-label { color: var(--fg-soft); }
.meta-chip[data-kind="assignee"] .avatar {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
  color: #fff;
  flex: 0 0 auto;
}
.meta-chip[data-kind="due"] { font-variant-numeric: tabular-nums; }
.meta-chip[data-kind="due"].is-overdue { color: var(--priority-high); font-weight: 600; }

.priority-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.priority-dot[data-priority="high"] { background: var(--priority-high); }
.priority-dot[data-priority="medium"] { background: var(--priority-med); }
.priority-dot[data-priority="low"] { background: var(--priority-low); }

.tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  white-space: nowrap;
}

.comment-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

/* ---------- Status badge ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
  flex: 0 0 auto;
  line-height: 1.2;
}
.status-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.status-badge[data-status="todo"] { color: var(--st-todo-fg); background: var(--st-todo-bg); border-color: var(--st-todo-bd); }
.status-badge[data-status="in-progress"] { color: var(--st-progress-fg); background: var(--st-progress-bg); border-color: var(--st-progress-bd); }
.status-badge[data-status="blocked"] { color: var(--st-blocked-fg); background: var(--st-blocked-bg); border-color: var(--st-blocked-bd); }
.status-badge[data-status="done"] { color: var(--st-done-fg); background: var(--st-done-bg); border-color: var(--st-done-bd); }

/* ---------- Empty state ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-9) var(--space-5);
  color: var(--fg-muted);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
}
.empty-state svg { color: var(--fg-soft); }
.empty-title { font-size: 18px; font-weight: 600; color: var(--fg); }
.empty-body { margin: 0 0 var(--space-3); }
.empty-state .btn { margin-top: var(--space-2); }

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.btn-secondary {
  background: var(--bg-elev);
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background-color 140ms var(--ease), color 140ms var(--ease), border-color 140ms var(--ease);
}
.icon-btn:hover { background: var(--bg-subtle); color: var(--fg); border-color: var(--border); }

/* ---------- Detail dialog ---------- */
.detail {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--fg);
  max-width: none;
  max-height: none;
  width: min(560px, 100%);
  margin: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  left: auto;
  height: 100dvh;
  overscroll-behavior: contain;
}
.detail::backdrop {
  background: rgba(10, 12, 20, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fade-in 180ms var(--ease);
}
.dialog-open { overflow: hidden; }

.detail-inner {
  height: 100%;
  overflow-y: auto;
  background: var(--bg-elev);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6) max(var(--space-6), env(safe-area-inset-right)) var(--space-8) max(var(--space-6), env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  animation: slide-in 240ms var(--ease);
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.detail-eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.detail-project {
  font-size: 13px;
  color: var(--fg-muted);
  font-weight: 500;
}
.close-btn { flex: 0 0 auto; }

.detail-title {
  font-family: var(--font-serif);
  font-size: 26px;
  letter-spacing: 0.1px;
  text-wrap: balance;
  margin-top: -4px;
}

.detail-meta { padding: var(--space-5) 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4) var(--space-5);
  margin: 0;
}
.meta-item { min-width: 0; }
.meta-item dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-soft);
  margin-bottom: 2px;
}
.meta-item dd {
  margin: 0;
  font-size: 15px;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.meta-tags dd { display: flex; flex-wrap: wrap; gap: 6px; }

.detail-status-control {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.select-wrap-inline { width: 100%; }
.status-feedback {
  margin: 0;
  font-size: 13px;
  color: var(--st-done-fg);
  min-height: 18px;
}

.detail-section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: var(--space-3);
}
.detail-body-text {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--fg);
  white-space: pre-line;
  text-wrap: pretty;
}
.detail-body-text .outcome-label {
  display: block;
  margin-top: var(--space-4);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--accent);
}

.detail-comments { border-top: 1px solid var(--border); padding-top: var(--space-4); }
.comment-count { margin: 0; color: var(--fg-muted); font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------- Footer ---------- */
.app-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-5) max(var(--space-6), env(safe-area-inset-right));
  text-align: center;
  color: var(--fg-soft);
  font-size: 12px;
}
.app-footer p { margin: 0; }

/* ---------- Animations ---------- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .detail::backdrop { animation: none; }
  .detail-inner { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .app-header { padding: var(--space-4) max(var(--space-4), env(safe-area-inset-left)) var(--space-3) max(var(--space-4), env(safe-area-inset-right)); }
  .brand-name { font-size: 20px; }
  .brand-sub { display: none; }
  .header-count { font-size: 12px; }
  .app-main { padding: var(--space-4) max(var(--space-4), env(safe-area-inset-right)) var(--space-8) max(var(--space-4), env(safe-area-inset-left)); }

  .controls { grid-template-columns: 1fr; gap: var(--space-3); }

  .task-item { padding: var(--space-4); }
  .task-title-btn { font-size: 16px; }

  .detail { width: 100%; }
  .detail-inner { padding: var(--space-5) max(var(--space-5), env(safe-area-inset-right)) var(--space-8) max(var(--space-5), env(safe-area-inset-left)); }
  .detail-title { font-size: 22px; }
  .meta-grid { grid-template-columns: 1fr; gap: var(--space-3); }
}
