@font-face{font-family:"Space Grotesk";src:url("./assets/space-grotesk.ttf") format("truetype");font-display:swap;font-weight:300 700}
@font-face{font-family:"Work Sans";src:url("./assets/work-sans.ttf") format("truetype");font-display:swap;font-weight:300 700}
@font-face{font-family:"IBM Plex Mono";src:url("./assets/ibm-plex-mono.ttf") format("truetype");font-display:swap;font-weight:400 600}
@font-face{font-family:"DM Sans";src:url("./assets/dm-sans.ttf") format("truetype");font-display:swap;font-weight:400 700}
*{box-sizing:border-box}
:root{
  --bg:#F6F4EE;
  --surface:#FFFFFF;
  --surface-2:#F0EDE6;
  --ink:#0F1110;
  --ink-2:#1E2120;
  --muted:#7A7D7B;
  --muted-2:#9A9D9B;
  --line:#E7E3DA;
  --line-strong:#D8D3C6;
  --accent:#E55325;
  --accent-2:#C43D14;
  --accent-soft:#FFF0EB;
  --todo:#8A8D8B;
  --inprog:#C08B1E;
  --blocked:#D93C3C;
  --done:#1B8A5D;
  --radius-lg:16px;
  --radius-md:10px;
  --radius-sm:8px;
  --shadow:0 1px 2px rgba(15,17,16,.06), 0 8px 24px rgba(15,17,16,.06);
  --shadow-lg:0 4px 20px rgba(15,17,16,.10), 0 20px 48px rgba(15,17,16,.12);
}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:"Work Sans", system-ui, -apple-system, sans-serif;
  background:var(--bg);
  color:var(--ink);
  -webkit-font-smoothing:antialiased;
  line-height:1.5;
}
a{color:inherit}
button{font:inherit}
img{max-width:100%;display:block}
.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}

/* Layout */
.app{
  display:grid;
  grid-template-columns:260px 1fr;
  min-height:100dvh;
  max-width:1600px;
  margin:0 auto;
}
.sidebar{
  background:#0F1110;
  color:#EDEBE6;
  padding:20px 16px;
  display:flex;
  flex-direction:column;
  gap:20px;
  position:sticky;
  top:0;
  height:100dvh;
  overflow:auto;
  border-right:1px solid rgba(255,255,255,.06);
}
.brand{
  display:flex;align-items:center;gap:12px;
  padding:4px 2px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.brand-mark{
  width:36px;height:36px;
  background:var(--accent);
  border-radius:9px;
  display:grid;place-items:center;
  font-family:"Space Grotesk",sans-serif;
  font-weight:700;font-size:15px;letter-spacing:-.02em;
  color:white;
  flex-shrink:0;
}
.brand-text{display:flex;flex-direction:column;line-height:1}
.brand-text strong{font-family:"Space Grotesk",sans-serif;font-size:15px;letter-spacing:-.02em;font-weight:700}
.brand-text span{font-family:"IBM Plex Mono",monospace;font-size:10px;letter-spacing:.14em;text-transform:uppercase;opacity:.6;margin-top:2px}

.nav-section{padding:6px 0}
.nav-label{
  font-family:"IBM Plex Mono",monospace;
  font-size:10px;letter-spacing:.14em;text-transform:uppercase;
  color:rgba(255,255,255,.45);margin:0 8px 8px;
}
.nav-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}
.nav-btn{
  width:100%;text-align:left;
  background:transparent;border:1px solid transparent;
  color:rgba(255,255,255,.72);
  padding:9px 10px;border-radius:9px;
  display:flex;align-items:center;gap:10px;
  font-size:13.5px;font-weight:500;
  cursor:pointer;transition:.15s;
}
.nav-btn:hover{background:rgba(255,255,255,.06);color:#fff}
.nav-btn.is-active{background:white;color:var(--ink);border-color:transparent}
.nav-btn .count{
  margin-left:auto;
  font-family:"IBM Plex Mono",monospace;font-size:11px;
  background:rgba(0,0,0,.08);padding:2px 6px;border-radius:20px;
}
.nav-btn.is-active .count{background:var(--ink);color:white}
.sidebar .nav-btn.is-active .count{background:var(--ink);color:white}
.sidebar-footer{
  margin-top:auto;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.08);
  border-radius:12px;
  padding:14px;
}
.sidebar-footer h4{margin:0 0 4px;font-family:"Space Grotesk",sans-serif;font-size:13px}
.sidebar-footer p{margin:0;font-size:12.5px;line-height:1.5;color:rgba(255,255,255,.6)}
.team-list{list-style:none;margin:10px 0 0;padding:0;display:flex;flex-direction:column;gap:6px}
.team-person{display:flex;align-items:center;gap:9px;font-size:13px;color:rgba(255,255,255,.7)}
.avatar{
  width:24px;height:24px;border-radius:50%;
  background:linear-gradient(135deg,#3A3A38,#6A6A68);
  display:grid;place-items:center;
  font-family:"IBM Plex Mono",monospace;font-size:10px;font-weight:600;color:white;
}
.team-person strong{font-weight:600;color:rgba(255,255,255,.88);font-size:12.5px}

/* Main */
.main{
  min-width:0;
  display:flex;
  flex-direction:column;
  background:var(--bg);
}
.topbar{
  display:none;
}
.workspace-head{
  padding:28px 28px 0;
  background:var(--bg);
  position:sticky;top:0;z-index:5;
  border-bottom:1px solid var(--line);
}
.head-row{
  display:flex;align-items:flex-start;justify-content:space-between;gap:16px;
}
.head-title h1{
  margin:0;
  font-family:"Space Grotesk",sans-serif;
  font-size:28px;letter-spacing:-.03em;line-height:1;font-weight:700;
}
.head-title h1 em{font-style:italic;font-weight:500;color:var(--accent);letter-spacing:-.04em}
.head-title p{
  margin:6px 0 0;
  font-size:13.5px;color:var(--muted);max-width:48ch;line-height:1.5;
}
.head-meta{
  display:flex;align-items:center;gap:10px;flex-shrink:0;margin-top:4px;
}
.meta-pill{
  font-family:"IBM Plex Mono",monospace;
  font-size:11px;letter-spacing:.06em;
  background:white;border:1px solid var(--line);
  padding:7px 10px;border-radius:20px;
  display:flex;align-items:center;gap:8px;
}
.meta-pill strong{font-weight:600;color:var(--ink)}
.live-dot{width:7px;height:7px;background:var(--done);border-radius:50%;display:inline-block;animation:pulse 2s infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.4}}
@media(prefers-reduced-motion:reduce){.live-dot{animation:none}}

/* Controls */
.controls{
  display:flex;align-items:center;gap:12px;
  padding:16px 0 14px;
  flex-wrap:wrap;
}
.search-wrap{
  flex:1 1 280px;min-width:220px;
  position:relative;
}
.search-wrap svg{position:absolute;left:11px;top:50%;transform:translateY(-50%);opacity:.45;pointer-events:none}
#search{
  width:100%;
  background:white;
  border:1px solid var(--line);
  border-radius:10px;
  padding:10px 12px 10px 36px;
  font-size:14px;
  color:var(--ink);
  outline:none;
  transition:border .15s, box-shadow .15s;
}
#search:focus{border-color:var(--ink);box-shadow:0 0 0 3px rgba(15,17,16,.08)}
#search::placeholder{color:var(--muted-2)}
.filter-wrap{
  display:flex;align-items:center;gap:8px;
  background:white;border:1px solid var(--line);border-radius:10px;
  padding:6px 8px 6px 10px;
}
.filter-wrap label{
  font-family:"IBM Plex Mono",monospace;
  font-size:11px;letter-spacing:.08em;text-transform:uppercase;
  color:var(--muted);font-weight:600;
}
#filter{
  border:none;background:transparent;
  font-size:13.5px;font-weight:600;color:var(--ink);
  padding:4px 18px 4px 6px;
  outline:none;cursor:pointer;
  font-family:"Work Sans",sans-serif;
}
.view-toggle{
  display:flex;background:white;border:1px solid var(--line);border-radius:10px;padding:3px;gap:2px;
}
.view-toggle button{
  padding:7px 12px;border-radius:8px;border:none;background:transparent;
  font-size:13px;font-weight:600;color:var(--muted);cursor:pointer;
}
.view-toggle button.is-active{background:var(--ink);color:white}

.status-pills{
  display:flex;gap:8px;flex-wrap:wrap;padding:0 0 16px;
}
.status-pill{
  appearance:none;
  border:1px solid var(--line);
  background:white;
  border-radius:20px;
  padding:6px 12px;
  font-size:13px;font-weight:600;
  display:flex;align-items:center;gap:7px;
  cursor:pointer;color:var(--ink);
  transition:.15s;
}
.status-pill:hover{border-color:var(--line-strong)}
.status-pill.is-active{background:var(--ink);color:white;border-color:var(--ink)}
.status-pill .dot{width:8px;height:8px;border-radius:50%;background:currentColor;opacity:.9}
.status-pill.is-active .dot{background:white}
.status-pill span.count{
  font-family:"IBM Plex Mono",monospace;
  font-size:11px;background:rgba(0,0,0,.06);padding:1px 6px;border-radius:20px;
}
.status-pill.is-active span.count{background:rgba(255,255,255,.18)}

/* Content area: list + detail */
.content{
  display:grid;
  grid-template-columns: 1fr 420px;
  gap:0;
  flex:1;
  min-height:0;
}
.list-pane{
  min-width:0;
  padding:18px 18px 28px 28px;
}
.list-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:4px 2px 12px;
}
.list-head h2{
  margin:0;
  font-family:"IBM Plex Mono",monospace;
  font-size:11px;letter-spacing:.12em;text-transform:uppercase;
  color:var(--muted);font-weight:600;
}
.list-head span{
  font-family:"IBM Plex Mono",monospace;font-size:11px;color:var(--muted-2);
}
.items{
  display:flex;flex-direction:column;gap:10px;
}
.item{
  background:white;
  border:1px solid var(--line);
  border-radius:14px;
  padding:14px 14px 12px;
  display:flex;flex-direction:column;gap:10px;
  transition:border .15s, box-shadow .15s, transform .15s;
  position:relative;
}
.item:hover{border-color:var(--line-strong);box-shadow:var(--shadow);transform:translateY(-1px)}
.item.is-selected{border-color:var(--ink);box-shadow:0 0 0 2px rgba(15,17,16,.06), var(--shadow)}
.item-top{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;
}
.badge{
  font-family:"IBM Plex Mono",monospace;
  font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;
  font-weight:600;
  padding:4px 8px;border-radius:20px;
  border:1px solid var(--line);
  background:white;
  display:inline-flex;align-items:center;gap:6px;
}
.badge-dot{width:7px;height:7px;border-radius:50%}
.badge.todo{color:#5A5E5C;border-color:#E0DDD6;background:#F7F7F5}
.badge.todo .badge-dot{background:var(--todo)}
.badge.in-progress{color:#7A5A10;border-color:#E8D9B0;background:#FFF8E6}
.badge.in-progress .badge-dot{background:var(--inprog)}
.badge.blocked{color:#8B1E1E;border-color:#F0C8C8;background:#FFF0F0}
.badge.blocked .badge-dot{background:var(--blocked)}
.badge.done{color:#0F5A3A;border-color:#BFE7D6;background:#EAF6F0}
.badge.done .badge-dot{background:var(--done)}
.priority{
  font-family:"IBM Plex Mono",monospace;
  font-size:10px;letter-spacing:.08em;text-transform:uppercase;
  padding:4px 7px;border-radius:20px;
  font-weight:600;
}
.priority.high{background:#FFF0EE;color:#B42318;border:1px solid #F2C6C0}
.priority.medium{background:#FFF6E0;color:#7A5A10;border:1px solid #EADFB8}
.priority.low{background:#F0EDE6;color:#6B6B6B;border:1px solid #E2DFD8}
.item-top .spacer{flex:1}
.item-title{
  margin:0;
  font-family:"Space Grotesk",sans-serif;
  font-size:15.5px;letter-spacing:-.02em;line-height:1.25;font-weight:600;
}
.item-summary{
  margin:0;
  font-size:13px;line-height:1.5;color:#5A5E5C;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
.item-meta{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;
  padding-top:8px;border-top:1px solid #F0EDE6;
  font-size:12px;color:var(--muted);
}
.meta-tag{
  background:var(--surface-2);border:1px solid var(--line);
  padding:3px 7px;border-radius:20px;
  font-family:"IBM Plex Mono",monospace;font-size:11px;
  color:var(--ink-2);font-weight:500;
}
.meta-dot{width:2px;height:2px;background:var(--muted-2);border-radius:50%}
.item-actions{
  display:flex;align-items:center;gap:8px;
}
.open-item{
  margin-left:auto;
  background:var(--ink);color:white;
  border:none;border-radius:9px;
  padding:7px 11px;
  font-size:13px;font-weight:600;
  display:inline-flex;align-items:center;gap:6px;
  cursor:pointer;transition:.15s;
}
.open-item:hover{background:var(--ink-2);transform:translateY(-1px)}
.open-item:active{transform:scale(.98)}
.item.is-selected .open-item{background:var(--accent);color:white}

/* Detail pane */
.detail-pane{
  border-left:1px solid var(--line);
  background:#FCFBF9;
  position:sticky;top:78px;
  height:calc(100dvh - 78px);
  overflow:auto;
  display:none;
}
.detail-pane.is-open{display:block}
.detail-empty{
  height:100%;
  display:grid;place-items:center;
  padding:32px 28px;
  text-align:center;
}
.detail-empty-inner{
  max-width:300px;
  display:flex;flex-direction:column;align-items:center;gap:14px;
}
.detail-empty-icon{
  width:56px;height:56px;border-radius:14px;
  background:white;border:1px solid var(--line);
  display:grid;place-items:center;
  color:var(--muted);
}
.detail-empty h3{margin:0;font-family:"Space Grotesk",sans-serif;font-size:16px;letter-spacing:-.02em}
.detail-empty p{margin:0;font-size:13.5px;line-height:1.55;color:var(--muted)}
.detail-card{
  background:white;
  border:1px solid var(--line);
  border-radius:16px;
  margin:16px;
  overflow:hidden;
  box-shadow:var(--shadow);
}
.detail-head{
  padding:16px 16px 14px;
  border-bottom:1px solid var(--line);
  display:flex;align-items:flex-start;justify-content:space-between;gap:12px;
}
.detail-head-main{flex:1;min-width:0}
.detail-kicker{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:8px;
}
.detail-title{
  margin:0;
  font-family:"Space Grotesk",sans-serif;
  font-size:19px;letter-spacing:-.02em;line-height:1.25;font-weight:700;
}
.close-detail{
  width:32px;height:32px;border-radius:9px;
  border:1px solid var(--line);background:white;
  display:grid;place-items:center;
  cursor:pointer;color:var(--muted);
  flex-shrink:0;transition:.15s;
}
.close-detail:hover{border-color:var(--ink);color:var(--ink);background:var(--bg)}
.close-detail:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.detail-body{
  padding:16px;
  display:flex;flex-direction:column;gap:16px;
}
.detail-prose{
  font-size:14px;line-height:1.65;color:#2E2F2E;
  white-space:pre-wrap;
  background:var(--bg);
  border:1px solid var(--line);
  border-radius:12px;
  padding:14px;
}
.detail-grid{
  display:grid;grid-template-columns:1fr 1fr;gap:12px;
}
.detail-field{
  background:var(--bg);border:1px solid var(--line);border-radius:12px;
  padding:11px 12px;
}
.detail-field label{
  display:block;
  font-family:"IBM Plex Mono",monospace;
  font-size:10px;letter-spacing:.1em;text-transform:uppercase;
  color:var(--muted);font-weight:600;margin-bottom:4px;
}
.detail-field p{margin:0;font-size:13.5px;font-weight:600;color:var(--ink)}
.detail-field small{font-size:12px;color:var(--muted);font-weight:400}
.status-control-wrap{
  background:white;border:1px solid var(--line);border-radius:12px;
  padding:12px;
}
.status-control-wrap label{
  display:block;
  font-family:"IBM Plex Mono",monospace;
  font-size:11px;letter-spacing:.08em;text-transform:uppercase;
  color:var(--muted);font-weight:600;margin-bottom:8px;
}
#status-control{
  width:100%;
  background:var(--bg);border:1px solid var(--line);
  border-radius:10px;
  padding:10px 12px;
  font-size:14px;font-weight:600;
  color:var(--ink);
  outline:none;
}
#status-control:focus{border-color:var(--ink);box-shadow:0 0 0 3px rgba(15,17,16,.08)}
.detail-tags{display:flex;flex-wrap:wrap;gap:6px}
.tag{
  font-family:"IBM Plex Mono",monospace;
  font-size:11px;font-weight:600;
  background:white;border:1px solid var(--line);
  padding:4px 8px;border-radius:20px;
}
.detail-actions{
  display:flex;gap:8px;
}
.btn-secondary{
  flex:1;
  background:white;border:1px solid var(--line);
  border-radius:10px;padding:10px;
  font-size:13.5px;font-weight:600;
  cursor:pointer;
}
.btn-secondary:hover{border-color:var(--ink)}

/* Empty state for list */
.empty-state{
  background:white;border:1px dashed var(--line-strong);
  border-radius:16px;
  padding:28px 20px;
  text-align:center;
  display:flex;flex-direction:column;align-items:center;gap:12px;
}
.empty-state h3{margin:0;font-family:"Space Grotesk",sans-serif;font-size:16px}
.empty-state p{margin:0;font-size:13.5px;color:var(--muted);max-width:36ch;line-height:1.5}
.empty-state button{
  margin-top:4px;
  background:var(--ink);color:white;border:none;
  border-radius:9px;padding:9px 14px;
  font-size:13.5px;font-weight:600;cursor:pointer;
}
.empty-state button:hover{background:var(--ink-2)}

/* Toast */
.toast-stack{
  position:fixed;bottom:16px;right:16px;
  display:flex;flex-direction:column;gap:8px;
  z-index:60;pointer-events:none;
}
.toast{
  background:var(--ink);color:white;
  padding:10px 14px;border-radius:10px;
  font-size:13px;font-weight:500;
  display:flex;align-items:center;gap:10px;
  box-shadow:var(--shadow-lg);
  pointer-events:auto;
  animation:toastIn .2s ease;
}
.toast .check{width:18px;height:18px;background:var(--done);border-radius:50%;display:grid;place-items:center;flex-shrink:0}
@keyframes toastIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){.toast{animation:none}}

/* Focus */
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
button:focus-visible, input:focus-visible, select:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

/* Overlay for mobile detail */
.detail-overlay{
  position:fixed;inset:0;
  background:rgba(15,17,16,.28);
  backdrop-filter:blur(2px);
  z-index:40;
  display:none;
}
.detail-overlay.is-open{display:block}

/* Mobile dialog */
@media(max-width:1023px){
  .app{grid-template-columns:1fr}
  .sidebar{display:none}
  .topbar{
    display:flex;align-items:center;justify-content:space-between;
    padding:12px 16px;
    background:#0F1110;color:#EDEBE6;
    position:sticky;top:0;z-index:20;
  }
  .topbar .brand{border:none;padding:0}
  .topbar-actions{display:flex;align-items:center;gap:8px}
  .menu-btn{
    width:36px;height:36px;border-radius:9px;
    background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);
    display:grid;place-items:center;color:white;cursor:pointer;
  }
  .workspace-head{padding:16px 16px 0}
  .head-row{flex-direction:column}
  .content{grid-template-columns:1fr}
  .list-pane{padding:14px 14px 24px}
  .detail-pane{
    position:fixed;inset:0;z-index:50;
    height:auto;max-height:92dvh;top:auto;bottom:0;
    border-radius:18px 18px 0 0;
    border:1px solid var(--line);border-bottom:none;
    box-shadow:0 -12px 40px rgba(15,17,16,.18);
    overflow:auto;
    transform:translateY(100%);
    transition:transform .28s cubic-bezier(.16,1,.3,1);
    display:block;
    pointer-events:none;
  }
  .detail-pane.is-open{transform:translateY(0);pointer-events:auto}
  .detail-pane .detail-empty{display:none}
  .detail-card{margin:0;border-radius:18px 18px 0 0;border:none;box-shadow:none}
  .detail-head{position:sticky;top:0;background:white;z-index:1}
  /* drag handle */
  .detail-card::before{
    content:"";display:block;width:36px;height:4px;background:#E0DDD6;border-radius:20px;
    margin:8px auto 0;
  }
}
@media(max-width:640px){
  .controls{flex-direction:column;align-items:stretch}
  .search-wrap{flex:1 1 auto}
  .filter-wrap{justify-content:space-between}
  .head-title h1{font-size:24px}
  .status-pills{overflow:auto;flex-wrap:nowrap;padding-bottom:12px;scrollbar-width:none}
  .status-pills::-webkit-scrollbar{display:none}
  .item-title{font-size:15px}
  .detail-grid{grid-template-columns:1fr}
}

/* Reduced motion */
@media(prefers-reduced-motion:reduce){
  *{animation:none !important;transition:none !important;scroll-behavior:auto !important}
}
