/* Manifest - team task inbox
   Dark "ops console" theme: single-theme lock, one amber accent,
   8px radius on controls, pill radius on badges (documented exception). */

:root {
  --bg: #0c0e11;
  --surface: #14171b;
  --surface-2: #191d22;
  --surface-hover: #1e232a;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e7e9ec;
  --text-muted: #9aa1ab;
  --text-faint: #6b7280;

  --accent: #f0a93a;
  --accent-strong: #ffc266;
  --accent-on: #1a1206;

  --status-todo-bg: rgba(148, 163, 184, 0.16);
  --status-todo-fg: #cbd5e1;
  --status-inprogress-bg: rgba(240, 169, 58, 0.18);
  --status-inprogress-fg: #f0a93a;
  --status-blocked-bg: rgba(248, 113, 113, 0.16);
  --status-blocked-fg: #fca5a5;
  --status-done-bg: rgba(52, 211, 153, 0.16);
  --status-done-fg: #6ee7b7;

  --radius: 8px;
  --radius-pill: 999px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.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;
}

button, input, select {
  font-family: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
  border-radius: 4px;
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  flex-shrink: 0;
}

.brand-mark {
  width: 22px;
  height: 22px;
}

.brand-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 360px;
}

.search-field .field-icon {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}

#searchInput {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
}

#searchInput::placeholder {
  color: var(--text-faint);
}

#searchInput:focus-visible {
  border-color: var(--accent);
}

.filter-field {
  flex-shrink: 0;
}

#filterSelect {
  height: 36px;
  padding: 0 32px 0 12px;
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6' fill='none' stroke='%239aa1ab' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  cursor: pointer;
}

#filterSelect:focus-visible {
  border-color: var(--accent);
}

.topbar-summary {
  margin: 0;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---------- Workspace layout ---------- */

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: 0;
}

.rail {
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.rail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.rail-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.rail-item[aria-pressed="true"] {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
  font-weight: 600;
}

.rail-label {
  flex: 1;
}

.rail-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}

.rail-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.swatch-todo { background: var(--status-todo-fg); }
.swatch-in-progress { background: var(--status-inprogress-fg); }
.swatch-blocked { background: var(--status-blocked-fg); }
.swatch-done { background: var(--status-done-fg); }

/* ---------- List panel ---------- */

.list-panel {
  min-width: 0;
  padding: 20px 28px 40px;
  overflow-y: auto;
}

.list-columns {
  display: grid;
  grid-template-columns: 1fr 160px 110px 130px;
  gap: 16px;
  max-width: 980px;
  padding: 0 16px 8px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 980px;
}

.task-row {
  border-bottom: 1px solid var(--border);
}

.task-row:first-child {
  border-top: 1px solid var(--border);
}

.task-open {
  display: grid;
  grid-template-columns: 1fr 160px 110px 130px;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.task-row.status-todo .task-open { border-left-color: var(--status-todo-fg); }
.task-row.status-in-progress .task-open { border-left-color: var(--status-inprogress-fg); }
.task-row.status-blocked .task-open { border-left-color: var(--status-blocked-fg); }
.task-row.status-done .task-open { border-left-color: var(--status-done-fg); }

.task-open:hover {
  background: var(--surface-hover);
}

.task-open:focus-visible {
  outline-offset: -2px;
}

.task-main {
  min-width: 0;
}

.task-title {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-subline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.task-priority {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.priority-high { color: var(--status-blocked-fg); }
.priority-medium { color: var(--status-inprogress-fg); }
.priority-low { color: var(--text-faint); }

.task-comments {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
}

.task-comments svg {
  width: 12px;
  height: 12px;
}

.task-assignee {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.assignee-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-due {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.status-todo { background: var(--status-todo-bg); color: var(--status-todo-fg); }
.status-badge.status-in-progress { background: var(--status-inprogress-bg); color: var(--status-inprogress-fg); }
.status-badge.status-blocked { background: var(--status-blocked-bg); color: var(--status-blocked-fg); }
.status-badge.status-done { background: var(--status-done-bg); color: var(--status-done-fg); }

/* ---------- Empty state ---------- */

.empty-state {
  max-width: 980px;
  margin-top: 40px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
}

.empty-state svg {
  width: 28px;
  height: 28px;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.empty-state p {
  margin: 0 0 16px;
  font-size: 14.5px;
}

.empty-state button {
  height: 36px;
  padding: 0 16px;
  background: var(--accent);
  color: var(--accent-on);
  border: none;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.empty-state button:hover {
  background: var(--accent-strong);
}

/* ---------- Detail drawer ---------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 7, 0.6);
  z-index: 20;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: -24px 0 48px rgba(0, 0, 0, 0.4);
  z-index: 21;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
}

@media (prefers-reduced-motion: no-preference) {
  .detail-drawer {
    animation: drawer-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
}

.icon-button svg {
  width: 16px;
  height: 16px;
}

.icon-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.drawer-body {
  padding: 20px 24px 32px;
  overflow-y: auto;
  flex: 1;
}

.drawer-project {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.drawer-title {
  margin: 0 0 20px;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.3;
}

.drawer-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin: 0 0 18px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.meta-item dt {
  margin: 0 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

.meta-item dd {
  margin: 0;
  font-size: 13.5px;
  color: var(--text);
}

.drawer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.drawer-tags li {
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--text-muted);
}

.drawer-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 24px;
}

.drawer-text p {
  margin: 0 0 12px;
}

.drawer-text p:last-child {
  margin-bottom: 0;
}

.status-control-group {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.status-control-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

#statusControl {
  width: 100%;
  height: 40px;
  padding: 0 32px 0 14px;
  background-color: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6' fill='none' stroke='%239aa1ab' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
}

#statusControl:focus-visible {
  border-color: var(--accent);
}

.status-feedback {
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--status-done-fg);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .detail-drawer {
    width: 100%;
    border-left: none;
  }
}

@media (max-width: 768px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 14px 16px;
    gap: 12px;
  }

  .toolbar {
    order: 3;
    width: 100%;
    flex-wrap: wrap;
  }

  .search-field {
    max-width: none;
  }

  .topbar-summary {
    order: 2;
    margin-left: auto;
  }

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

  .rail {
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    padding: 10px 12px;
  }

  .rail-item {
    width: auto;
    flex-shrink: 0;
  }

  .list-panel {
    padding: 16px 16px 32px;
  }

  .list-columns {
    display: none;
  }

  .task-open {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px;
  }

  .task-assignee,
  .task-due {
    font-size: 12.5px;
  }

  .task-due::before {
    content: "Due ";
    color: var(--text-faint);
  }

  .status-badge {
    justify-self: start;
  }

  .drawer-meta {
    grid-template-columns: 1fr 1fr;
  }
}
