:root{
  --ground:#F1F3F5; --surface:#FFFFFF; --sunk:#E7EAEE; --side:#14181D; --side-ink:#C9D1DA;
  --ink:#14181D; --ink-2:#414B57; --muted:#6B7683; --hair:#D8DDE3;
  --live:#0E5A69; --live-soft:#D3E7EB; --done:#2F7A4F; --done-soft:#D8EADF;
  --wait:#9A6200; --wait-soft:#F4E5C8; --stop:#A8352C; --stop-soft:#F3DAD7;
  --held:#7C8593; --held-soft:#E1E5EA;
  --shadow:0 1px 2px rgba(20,24,29,.06), 0 4px 14px rgba(20,24,29,.05);
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --ground:#0E1215; --surface:#171D22; --sunk:#1F262D; --side:#0A0D10; --side-ink:#B4BEC9;
    --ink:#EAEEF2; --ink-2:#B4BEC9; --muted:#8894A1; --hair:#2A333B;
    --live:#4FB3C4; --live-soft:#14333A; --done:#5FBE98; --done-soft:#13301F;
    --wait:#D9A23C; --wait-soft:#33270F; --stop:#E0776C; --stop-soft:#361A17;
    --held:#77828F; --held-soft:#1E252B; --shadow:0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"]{
  --ground:#0E1215; --surface:#171D22; --sunk:#1F262D; --side:#0A0D10; --side-ink:#B4BEC9;
  --ink:#EAEEF2; --ink-2:#B4BEC9; --muted:#8894A1; --hair:#2A333B;
  --live:#4FB3C4; --live-soft:#14333A; --done:#5FBE98; --done-soft:#13301F;
  --wait:#D9A23C; --wait-soft:#33270F; --stop:#E0776C; --stop-soft:#361A17;
  --held:#77828F; --held-soft:#1E252B; --shadow:0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
}
*{box-sizing:border-box}
html,body{margin:0; height:100%}
body{background:var(--ground); color:var(--ink); font:14px/1.5 "IBM Plex Sans",system-ui,-apple-system,sans-serif;
     -webkit-font-smoothing:antialiased;}
a{color:inherit}
.mono,code{font-family:"IBM Plex Mono",ui-monospace,monospace}
.muted{color:var(--muted)}

/* ------------------------------------------------------------ the shell: menu on the left */
.shell{display:grid; grid-template-columns:232px 1fr; min-height:100vh;
       background:linear-gradient(90deg, var(--side) 232px, var(--ground) 232px);}  /* menu runs the full page */
.side{background:var(--side); color:var(--side-ink); padding:20px 14px; position:sticky; top:0; height:100vh;
      display:flex; flex-direction:column; gap:18px;}
.brand{display:flex; align-items:center; gap:10px; font-family:"Fraunces",Georgia,serif; font-weight:600;
       font-size:19px; color:#fff; padding:0 6px;}
.brand.small{font-size:16px; color:var(--ink);}
.mark{width:22px; height:22px; border-radius:6px; background:var(--live); position:relative; flex:none;}
.mark::after{content:""; position:absolute; inset:6px; border:2.5px solid #fff; border-radius:50%;}
.acct{padding:8px 10px; border:1px solid rgba(255,255,255,.12); border-radius:8px; font-size:12.5px;}
.acct b{display:block; color:#fff; font-weight:500;}
.acct span{font-family:"IBM Plex Mono",monospace; font-size:10.5px; text-transform:uppercase; letter-spacing:.08em;
           color:var(--side-ink); opacity:.75;}
.nav{display:flex; flex-direction:column; gap:2px;}
.nav a{display:flex; align-items:center; gap:10px; padding:9px 10px; border-radius:8px; text-decoration:none;
       color:var(--side-ink); font-weight:500;}
.nav a:hover{background:rgba(255,255,255,.06); color:#fff;}
.nav a.on{background:rgba(79,179,196,.16); color:#fff;}
.ic{width:16px; height:16px; flex:none; border:2px solid currentColor; border-radius:4px; opacity:.85;}
.ic-proj{border-radius:3px; box-shadow:4px -4px 0 -1px var(--side), 4px -4px 0 1px currentColor;}
.ic-farm{border-radius:50%;}
.ic-act{border-width:0 0 2px 2px; border-radius:0;}
.side-foot{margin-top:auto; font-family:"IBM Plex Mono",monospace; font-size:11px; line-height:1.4;}
.side-foot .ok{color:#5FBE98;} .side-foot .stale{color:#E0776C;}
.top{display:none;}
.main{padding:28px 32px 64px; min-width:0; max-width:1180px;}

@media (max-width:820px){
  .shell{grid-template-columns:1fr; background:var(--ground);}
  .top{display:flex; align-items:center; gap:12px; padding:12px 16px; background:var(--surface);
       border-bottom:1px solid var(--hair); position:sticky; top:0; z-index:5;}
  .side{position:fixed; inset:0 auto 0 0; width:260px; z-index:10; transform:translateX(-100%);
        transition:transform .2s ease; height:100%;}
  .side.open{transform:none; box-shadow:0 0 0 100vmax rgba(0,0,0,.35);}
  .main{padding:18px 16px 56px;}
}
.menu{background:none; border:0; padding:6px; display:flex; flex-direction:column; gap:4px; cursor:pointer;}
.menu span{display:block; width:20px; height:2px; background:var(--ink); border-radius:2px;}

/* ------------------------------------------------------------ type and blocks */
h1{font-family:"Fraunces",Georgia,serif; font-weight:600; font-size:clamp(24px,4vw,32px); margin:0 0 4px;
   letter-spacing:-.015em;}
h2{font-family:"Fraunces",Georgia,serif; font-weight:600; font-size:18px; margin:0 0 10px;}
.head{display:flex; flex-wrap:wrap; align-items:flex-end; gap:10px 16px; margin-bottom:22px;}
.head .grow{flex:1; min-width:180px;}
.head p{margin:0; color:var(--muted);}
.sect{margin-bottom:32px;}
.back{font-size:13px; color:var(--muted); text-decoration:none; display:inline-block; margin-bottom:10px;}
.back:hover{color:var(--ink);}
.btn{font:inherit; font-weight:500; padding:9px 16px; border-radius:8px; border:1px solid var(--live);
     background:var(--live); color:#fff; cursor:pointer; text-decoration:none; display:inline-block;}
.btn.ghost{background:transparent; color:var(--live);}
.btn:disabled{opacity:.55; cursor:default;}
.card{background:var(--surface); border:1px solid var(--hair); border-radius:12px; box-shadow:var(--shadow);}

.pill{font-family:"IBM Plex Mono",monospace; font-size:10.5px; letter-spacing:.06em; text-transform:uppercase;
      border-radius:999px; padding:2px 9px; white-space:nowrap;}
.pill.live{background:var(--live-soft); color:var(--live);} .pill.done{background:var(--done-soft); color:var(--done);}
.pill.held{background:var(--held-soft); color:var(--held);} .pill.wait{background:var(--wait-soft); color:var(--wait);}
.pill.stop{background:var(--stop-soft); color:var(--stop);}
.kind{font-family:"IBM Plex Mono",monospace; font-size:10.5px; text-transform:uppercase; letter-spacing:.08em;
      color:var(--muted); border:1px solid var(--hair); border-radius:999px; padding:2px 9px;}

/* ------------------------------------------------------------ progress */
.prog{height:8px; border-radius:4px; background:var(--sunk); overflow:hidden;}
.prog i{display:block; height:100%; width:0; background:var(--live); border-radius:4px;}
.prog.done i{background:var(--done);} .prog.stop i{background:var(--stop);} .prog.held i{background:var(--held);}
.pct{font-family:"IBM Plex Mono",monospace; font-size:12px; color:var(--ink-2); font-variant-numeric:tabular-nums;}

/* ------------------------------------------------------------ dashboard: project cards */
.grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(290px,1fr)); gap:14px;}
.pcard{padding:16px; text-decoration:none; display:flex; flex-direction:column; gap:10px; min-width:0;
       transition:border-color .15s ease, transform .15s ease;}
.pcard:hover{border-color:var(--live); transform:translateY(-1px);}
.pcard .t{display:flex; align-items:flex-start; gap:8px;}
.pcard .t b{font-family:"Fraunces",Georgia,serif; font-weight:600; font-size:16px; flex:1; min-width:0;
            overflow-wrap:anywhere;}
.pcard .row{display:flex; align-items:center; gap:10px;} .pcard .row .prog{flex:1;}
.pcard .now{font-size:12.5px; color:var(--ink-2);}
.pcard .waits{font-size:12.5px; color:var(--wait); border-top:1px dashed var(--hair); padding-top:8px;
              overflow-wrap:anywhere;}
.pcard .waits.writer{color:var(--live);}
.finished{margin-top:12px; font-size:13px;}
.finished a{color:var(--live);}

/* ------------------------------------------------------------ what's going on */
.going{display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:14px;}
.going .card{padding:14px 16px;}
.going h3{font-size:12px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); margin:0 0 8px;
          font-weight:600;}
.li{font-size:13px; padding:6px 0; border-top:1px solid var(--hair); overflow-wrap:anywhere;}
.li:first-of-type{border-top:0;}
.li .at{font-family:"IBM Plex Mono",monospace; font-size:11px; color:var(--muted); margin-right:6px;}
.li.warn{color:var(--wait);} .li.alarm{color:var(--stop);}
.li a{text-decoration:none;} .li a:hover{text-decoration:underline;}

/* ------------------------------------------------------------ projects list */
.bar{display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:14px;}
.chip{font:inherit; font-size:12.5px; padding:5px 12px; border-radius:999px; border:1px solid var(--hair);
      background:var(--surface); color:var(--ink-2); cursor:pointer;}
.chip.on{border-color:var(--live); color:var(--live); background:var(--live-soft);}
.search{font:inherit; padding:7px 11px; border:1px solid var(--hair); border-radius:8px; background:var(--surface);
        color:var(--ink); min-width:200px; flex:1; max-width:320px;}
.table{width:100%; border-collapse:collapse;}
.table th{font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); font-weight:600;
          text-align:left; padding:10px 14px; border-bottom:1px solid var(--hair);}
.table td{padding:12px 14px; border-bottom:1px solid var(--hair); vertical-align:middle;}
.table tr:last-child td{border-bottom:0;}
.table tr.link{cursor:pointer;} .table tr.link:hover td{background:var(--sunk);}
.table .t{font-weight:500; overflow-wrap:anywhere;}
.table .p{min-width:120px;} .table .p .prog{margin-bottom:3px;}
@media (max-width:820px){ .table .hide-s{display:none;} }

/* ------------------------------------------------------------ detail */
.facts{display:flex; flex-wrap:wrap; gap:8px 18px; align-items:center; margin-top:8px; color:var(--muted); font-size:13px;}
.bigprog{display:flex; align-items:center; gap:12px; margin:16px 0 22px; max-width:560px;}
.bigprog .prog{flex:1; height:10px;}
.wait-box{padding:12px 14px; border-left:3px solid var(--wait); margin-bottom:8px; overflow-wrap:anywhere;}
.wait-box.writer{border-left-color:var(--live);}
.wait-box b{display:block; font-weight:600; margin-bottom:2px;}
.wait-box span{font-size:13px; color:var(--ink-2);}
.brief{padding:14px 16px; white-space:pre-wrap; overflow-wrap:anywhere; font-size:13.5px; max-height:320px; overflow:auto;}
.chain{display:flex; gap:3px; flex-wrap:wrap; padding:14px 16px;}
.seg{flex:1 1 64px; min-width:64px;}
.seg .b{height:7px; border-radius:2px; background:var(--sunk); overflow:hidden;}
.seg .b i{display:block; height:100%; width:0;}
.seg.done .b i{background:var(--done);} .seg.running .b i{background:var(--live);} .seg.pending .b i{background:var(--muted);}
.seg.blocked .b i{background:var(--held);} .seg.failed .b i{background:var(--stop);} .seg.waiting_approval .b i{background:var(--wait);}
.seg .l{font-family:"IBM Plex Mono",monospace; font-size:10px; color:var(--muted); margin-top:5px; white-space:nowrap;
        overflow:hidden; text-overflow:ellipsis;}
.seg .l span{display:block; color:var(--ink-2);}
.seg.done .l{color:var(--done);} .seg.running .l{color:var(--live); font-weight:500;}
.ladder{display:flex; flex-wrap:wrap; gap:6px; padding:0 16px 14px;}
.rung{font-family:"IBM Plex Mono",monospace; font-size:11px; border-radius:6px; padding:3px 9px; border:1px solid var(--hair);}
.rung.pass{border-color:var(--done); color:var(--done);} .rung.fail{border-color:var(--stop); color:var(--stop); background:var(--stop-soft);}
.rung.note{border-color:var(--wait); color:var(--wait);} .rung.none{color:var(--muted);}
.fault{font-size:13px; padding:10px 16px; border-top:1px solid var(--hair); overflow-wrap:anywhere;}
.fault .c{font-family:"IBM Plex Mono",monospace; font-size:11px; color:var(--stop); display:block;}
.fault .c.m{color:var(--muted);} .fault .c.a{color:var(--done);}
.watch{font-family:"IBM Plex Mono",monospace; font-size:12px; color:var(--live); text-decoration:none;
       border:1px solid var(--live); border-radius:999px; padding:3px 11px;}
.watch:hover{background:var(--live-soft);}

/* ------------------------------------------------------------ new project */
.form{padding:20px; max-width:720px;}
.form label{display:block; font-weight:600; margin:16px 0 6px;}
.form label:first-child{margin-top:0;}
.form .hint{font-weight:400; color:var(--muted); font-size:12.5px; display:block;}
.form input[type=text], .form input[type=number], .form textarea{width:100%; font:inherit; padding:10px 12px;
      border:1px solid var(--hair); border-radius:8px; background:var(--ground); color:var(--ink);}
.form textarea{min-height:220px; resize:vertical; line-height:1.5;}
.kinds{display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:8px;}
.kinds label{margin:0; font-weight:400; border:1px solid var(--hair); border-radius:10px; padding:10px 12px;
             cursor:pointer; background:var(--ground);}
.kinds label b{display:block; font-weight:600;}
.kinds label span{font-size:12px; color:var(--muted);}
.kinds input{position:absolute; opacity:0; pointer-events:none;}
.kinds label.on{border-color:var(--live); background:var(--live-soft);}
.form .actions{display:flex; gap:10px; align-items:center; margin-top:20px;}
.err{color:var(--stop); font-size:13px;}
.ok{color:var(--done); font-size:13px;}

.keybox{padding:22px; max-width:440px;}
.keybox input{width:100%; font:inherit; padding:9px 11px; border:1px solid var(--hair); border-radius:8px;
              background:var(--ground); color:var(--ink); margin:10px 0;}
.empty{padding:22px; color:var(--muted);}
.farmcards{display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:10px;}
.farmcards .card{padding:12px 14px;}
.farmcards b{font-family:"IBM Plex Mono",monospace; font-size:12.5px;}
.farmcards span{display:block; font-size:12.5px; color:var(--muted); overflow-wrap:anywhere;}
@media (prefers-reduced-motion:no-preference){
  .seg.running .b i, .prog.run i{animation:pulse 2.4s ease-in-out infinite;}
  @keyframes pulse{0%,100%{opacity:1} 50%{opacity:.55}}
}

/* ------------------------------------------------------------ storyboard and QA (review and decide) */
.tabs{display:flex; gap:4px; border-bottom:1px solid var(--hair); margin:0 0 20px;}
.tabs a{padding:8px 14px; text-decoration:none; color:var(--muted); font-weight:500; border-bottom:2px solid transparent; margin-bottom:-1px;}
.tabs a.on{color:var(--live); border-bottom-color:var(--live);}
.tabs a:hover{color:var(--ink);}
.wait-box .go{display:inline-block; margin-top:6px; font-size:13px; font-weight:500; color:var(--live); text-decoration:none;}
.wait-box .go:hover{text-decoration:underline;}
.pad{padding:14px 16px;}
.pad h3{font-size:13px; margin:12px 0 4px;} .pad h3:first-child{margin-top:0;}
.pad ul{margin:0 0 6px; padding-left:20px;}
.small{font-size:12px;}
.table.cost{margin:10px 0 6px;} .table.cost td,.table.cost th{padding:7px 10px; font-size:13px;}
.cast{display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:14px;}
.person{display:flex; gap:14px; padding:14px; min-width:0;}
.person .sheet{flex:0 0 120px;}
.person .sheet img{width:120px; border-radius:8px; display:block;}
.person .who{min-width:0; flex:1;}
.person .who b{font-family:"Fraunces",Georgia,serif; font-size:17px; display:block;}
.person .who p{margin:6px 0; font-size:13px; overflow-wrap:anywhere;}
.takes{display:flex; gap:10px; flex-wrap:wrap;}
.takes .take{display:flex; flex-direction:column; gap:4px; width:150px; font-size:11.5px; color:var(--muted);}
.takes.mini .take{width:64px;} .takes.mini .take span{font-size:10.5px;}
.takes.qa .take{width:200px;}
.takes img{width:100%; border-radius:6px; display:block; border:2px solid transparent;}
.takes .take.picked img{border-color:var(--live);}
.takes .take.picked > span:first-of-type{color:var(--live); font-weight:500;}
.noimg{aspect-ratio:9/16; max-height:180px; background:var(--sunk); border-radius:6px; display:flex; align-items:center;
       justify-content:center; text-align:center; padding:6px; font-size:11px; color:var(--muted);}
.takes.mini .noimg{font-size:9px;}
.v.pass{color:var(--done);} .v.flag{color:var(--stop); font-weight:500;} .v.none{color:var(--muted);}
.shot{padding:14px 16px; margin-bottom:12px;}
.shot-h{display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; margin-bottom:10px;}
.shot-h b{font-family:"Fraunces",Georgia,serif; font-size:17px;}
.shot-h .right{margin-left:auto;}
.shot-b{display:grid; grid-template-columns:auto 1fr; gap:14px;}
.shot-b dl{margin:0; font-size:13.5px; min-width:0;}
.shot-b dt{font-family:"IBM Plex Mono",monospace; font-size:10.5px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); margin-top:8px;}
.shot-b dt:first-child{margin-top:0;}
.shot-b dd{margin:2px 0 0; overflow-wrap:anywhere;}
.shot-b video.clip{grid-column:1 / -1; width:100%; max-width:360px; border-radius:8px; background:#000;}
video.cut{width:100%; max-width:420px; border-radius:10px; background:#000; display:block;}
.redo, .decide{margin-top:12px;}
.redo label{display:block; font-weight:600; margin-bottom:6px;}
.redo .hint{font-weight:400; color:var(--muted); font-size:12.5px; display:block;}
.redo textarea, .decide textarea{width:100%; font:inherit; padding:10px 12px; border:1px solid var(--hair); border-radius:8px;
       background:var(--ground); color:var(--ink); min-height:90px; resize:vertical;}
.redo .actions, .decide .actions{display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:10px;}
.decide{padding:18px 20px; border-left:3px solid var(--wait);}
.decide code{font-size:12.5px;}
@media (max-width:820px){
  .shot-b{grid-template-columns:1fr;}
  .takes .take{width:calc(33% - 7px); min-width:90px;}
  .takes.qa .take{width:calc(50% - 5px);}
  .person{flex-direction:column;} .person .sheet{flex:none;}
}
.undrawn{width:150px; aspect-ratio:9/16; max-height:120px; background:var(--sunk); border-radius:6px; display:flex;
         align-items:center; justify-content:center; text-align:center; padding:8px; font-size:11.5px; color:var(--muted);}
.takes.mini .chip{font-size:10.5px; padding:1px 8px; align-self:flex-start;}
@media (max-width:820px){ .undrawn{width:100%; aspect-ratio:auto; max-height:none;} }
