:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --ink: #1b1f2a;
  --muted: #5b6270;
  --border: #d9dde4;
  --accent: #3b5bdb;
  --accent-ink: #ffffff;
  --success: #2f9e44;
  --info: #1c7ed6;
  --warning: #e67700;
  --danger: #e03131;
  --radius: 8px;
  --font-ui: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: "Space Grotesk", var(--font-ui);
}

@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.ttf") format("truetype");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 100 700;
  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;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -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;
}

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-bar__brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  border-radius: 8px;
}
.app-bar__title { margin: 0; font-size: 18px; font-weight: 700; font-family: var(--font-display); }
.app-bar__sub { margin: 0; font-size: 12px; color: var(--muted); }
.app-bar__meta { font-family: var(--font-data); font-size: 12px; color: var(--muted); }

.workspace { max-width: 1200px; margin: 0 auto; padding: 16px 24px 48px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 12px 0 16px;
}
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 220px; min-width: 180px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.field input, .field select, #status-control {
  font-family: var(--font-ui);
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  min-height: 44px;
}
.field input:focus, .field select:focus, #status-control:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 150ms cubic-bezier(0.22,1,0.36,1), background 150ms, color 150ms;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--primary:hover { background: #2f4ac7; }
.btn--ghost { background: transparent; }

.section-title { font-size: 14px; font-weight: 700; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.item-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 150ms, box-shadow 150ms;
}
.item:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.item:focus-within { border-color: var(--accent); }

.item__title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.item__meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted); font-family: var(--font-data); }
.item__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink);
}
.badge--todo { background: #e9ecef; color: #495057; }
.badge--in-progress { background: #dbe4ff; color: #2b4ac7; }
.badge--blocked { background: #ffe3e3; color: #c92a2a; }
.badge--done { background: #d3f9d8; color: #2b8a3e; }
.priority--high { color: var(--danger); font-weight: 700; }
.priority--medium { color: var(--warning); }
.priority--low { color: var(--muted); }

.open-item { min-width: 72px; }

.empty-state {
  padding: 48px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-top: 8px;
}
.empty-state__title { font-weight: 700; margin: 0 0 4px; }
.empty-state__body { color: var(--muted); margin: 0 0 12px; }

.detail {
  border: none;
  padding: 0;
  width: min(560px, 92vw);
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.detail::backdrop { background: rgba(10,12,20,0.45); }
.detail[open] { display: flex; flex-direction: column; }
.detail__header {
  display: flex; align-items: start; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.detail__title { margin: 0; font-size: 18px; font-family: var(--font-display); font-weight: 700; }
.detail__body { padding: 20px; overflow: auto; }
.detail__close { flex-shrink: 0; }

.detail-field { margin-bottom: 12px; }
.detail-field__label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px; }
.detail-field__value { font-size: 14px; }
.detail-body { white-space: pre-wrap; font-size: 14px; line-height: 1.6; margin-top: 12px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.status-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.status-row label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 13px; opacity: 0; pointer-events: none;
  transition: opacity 200ms;
  z-index: 50;
}
.toast.show { opacity: 1; }

@media (max-width: 640px) {
  .app-bar { padding: 10px 16px; }
  .workspace { padding: 12px 16px 40px; }
  .detail { width: 100vw; max-height: 100vh; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
