:root{
  --blue:#2f6df6; --blue-d:#1f57d6; --ink:#101a33; --ink-2:#48536b; --ink-3:#77839c;
  --line:#e4e8f2; --bg:#f5f7fc; --card:#fff; --radius:14px;
  --shadow:0 1px 2px rgba(16,26,51,.05), 0 8px 24px rgba(16,26,51,.06);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font:15px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Roboto,Helvetica,Arial,sans-serif;
  color:var(--ink); background:var(--bg);
  background-image:radial-gradient(1000px 420px at 12% -8%, #e6edff 0%, rgba(230,237,255,0) 65%);
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;text-decoration:none}
h1{font-size:25px;margin:0 0 4px;letter-spacing:-.02em}
h2{font-size:17px;margin:0;letter-spacing:-.01em}
h3{font-size:16px;margin:0;letter-spacing:-.01em}
h4{font-size:12px;margin:0;text-transform:uppercase;letter-spacing:.09em;color:var(--ink-3)}
p.sub{margin:2px 0 0;color:var(--ink-2);font-size:13.5px}

/* ---------- top bar ---------- */
.topbar{
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  padding:0 22px;height:58px;background:#fff;border-bottom:1px solid var(--line);
  position:sticky;top:0;z-index:20;
}
.brand{display:flex;align-items:center;gap:10px;font-weight:700;letter-spacing:-.02em}
.logo{
  width:28px;height:28px;border-radius:9px;background:var(--blue);color:#fff;
  display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:14px;
}
.logo.big{width:44px;height:44px;border-radius:13px;font-size:20px;margin-bottom:14px}
.topnav{display:flex;align-items:center;gap:6px;font-size:13.5px}
.topnav a{padding:7px 12px;border-radius:9px;color:var(--ink-2)}
.topnav a:hover{background:#f1f4fb;color:var(--ink)}
.topnav a.ghost{border:1px solid var(--line)}

/* ---------- shell ---------- */
.shell{display:grid;grid-template-columns:258px minmax(0,1fr);gap:24px;max-width:1240px;margin:0 auto;padding:24px 22px 80px}
.side{position:sticky;top:82px;align-self:start}
.side-head{font-size:11.5px;text-transform:uppercase;letter-spacing:.1em;color:var(--ink-3);margin:2px 0 10px 10px}
.plist{list-style:none;margin:0;padding:0}
.plist li{margin-bottom:4px}
.plist a{display:flex;align-items:center;gap:8px;justify-content:space-between;padding:8px 11px;border-radius:10px;font-size:14px;color:var(--ink-2)}
.plist a:hover{background:#eef2fc;color:var(--ink)}
.plist a.on{background:var(--blue);color:#fff;font-weight:600;box-shadow:0 4px 12px rgba(47,109,246,.28)}
.plist a.arch .pname{opacity:.55}
.pname{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pmeta{font-size:11.5px;opacity:.8;font-variant-numeric:tabular-nums}
.bar{height:3px;border-radius:99px;background:#e2e8f6;margin:0 11px;overflow:hidden}
.bar i{display:block;height:100%;background:var(--blue);border-radius:99px}
.bar.wide{height:6px;margin:12px 0 0;max-width:420px}
.newproj{margin-top:14px}
.newproj summary{cursor:pointer;font-size:13.5px;color:var(--blue);padding:7px 11px;border-radius:10px;list-style:none}
.newproj summary::-webkit-details-marker{display:none}
.newproj summary:hover{background:#eef2fc}
.newproj form{background:#fff;border:1px solid var(--line);border-radius:12px;padding:12px;margin-top:8px;display:grid;gap:8px}

/* ---------- cards ---------- */
.main{min-width:0}
.pagehead{margin:2px 0 18px}
.headmeta{margin-top:10px;font-size:13px;color:var(--ink-3);display:flex;gap:14px;align-items:center;flex-wrap:wrap}
.headmeta details.inline-edit[open]{margin-top:4px}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:18px 20px;margin-bottom:16px}
.card.empty{color:var(--ink-3);text-align:center;padding:40px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:16px}
.card.proj{display:block;transition:transform .12s ease, box-shadow .12s ease}
.card.proj:hover{transform:translateY(-2px);box-shadow:0 2px 4px rgba(16,26,51,.06),0 14px 32px rgba(16,26,51,.10)}
.proj-top{display:flex;align-items:center;justify-content:space-between;gap:10px}
.stagechips{display:flex;flex-wrap:wrap;gap:6px;margin-top:14px}
.chip{font-size:11.5px;padding:3px 9px;border-radius:99px;background:#f1f4fb;color:var(--ink-2);border:1px solid var(--line)}

/* ---------- status colours ---------- */
.pill{font-size:11.5px;font-weight:600;padding:3px 10px;border-radius:99px;white-space:nowrap}
.pill.grey,.chip.s-not_started{background:#f1f4fb;color:#64708a;border:1px solid var(--line)}
.pill.blue{background:#e7efff;color:var(--blue-d)}
.pill.red{background:#fdeaea;color:#c0392b}
.pill.s-not_started{background:#f1f4fb;color:#64708a}
.pill.s-in_progress,.chip.s-in_progress{background:#e7efff;color:var(--blue-d);border-color:#cfe0ff}
.pill.s-blocked,.chip.s-blocked{background:#fdeaea;color:#c0392b;border-color:#f8d4d4}
.pill.s-review,.chip.s-review{background:#fff3da;color:#9a6700;border-color:#f7e3bd}
.pill.s-done,.chip.s-done{background:#e4f6ec;color:#1b7f4b;border-color:#c9ebd8}

/* ---------- stage ---------- */
.stage-head{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}
.stage-title{display:flex;align-items:center;gap:10px;min-width:0}
.num{width:22px;height:22px;border-radius:7px;background:#eef2fc;color:var(--ink-3);font-size:11.5px;font-weight:700;display:inline-flex;align-items:center;justify-content:center}
.stage-meta{display:flex;align-items:center;gap:12px;flex-wrap:wrap;justify-content:flex-end}
.meta{font-size:12.5px;color:var(--ink-3)}
.section{margin-top:16px;padding-top:14px;border-top:1px solid var(--line)}
.sec-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}

/* ---------- notes: always full-width stacked bars ---------- */
.note{background:#f8fafd;border:1px solid var(--line);border-radius:11px;padding:12px 14px;margin-bottom:8px}
.note-body{font-size:14px;color:var(--ink);white-space:normal}
.note-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:8px;font-size:11.5px;color:var(--ink-3)}

/* ---------- files ---------- */
.thumbs{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:10px}
.thumb{margin:0}
.thumb a{display:block;aspect-ratio:4/3;border-radius:10px;overflow:hidden;background:#f1f4fb;border:1px solid var(--line)}
.thumb img{width:100%;height:100%;object-fit:cover;display:block}
.thumb .pdf{display:flex;width:100%;height:100%;align-items:center;justify-content:center;font-weight:700;color:var(--ink-3);font-size:13px}
.thumb figcaption{display:flex;align-items:center;justify-content:space-between;gap:6px;font-size:11px;color:var(--ink-3);margin-top:5px}
.thumb figcaption span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ---------- forms ---------- */
input,select,textarea{
  font:inherit;font-size:14px;color:var(--ink);background:#fff;
  border:1px solid #d7deeb;border-radius:10px;padding:9px 11px;outline:none;width:100%;
}
input:focus,select:focus,textarea:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(47,109,246,.16)}
textarea{resize:vertical}
label{display:block;font-size:12.5px;font-weight:600;color:var(--ink-2);margin:12px 0 5px}
.chk{display:flex;align-items:center;gap:7px;font-weight:400;font-size:13px;margin:0}
.chk input{width:auto}
.btn{
  background:var(--blue);color:#fff;border:0;border-radius:10px;padding:10px 16px;
  font:inherit;font-size:14px;font-weight:600;cursor:pointer;
}
.btn:hover{background:var(--blue-d)}
.btn.block{width:100%;margin-top:18px;padding:11px}
.btn.sm{padding:7px 13px;font-size:13px;width:auto}
.btn.danger{background:#fdeaea;color:#c0392b}
.btn.danger:hover{background:#f8d4d4}
.btn.ghostbtn{background:#f1f4fb;color:var(--blue-d)}
.btn.ghostbtn:hover{background:#e7efff}
.rowform{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:10px}
.rowform.wrap input,.rowform.wrap select{width:auto;min-width:150px;flex:1 1 150px}
.rowform .chk{flex:0 0 auto;width:auto;color:var(--ink-2)}
.rowform .chk input{flex:0 0 auto;min-width:0;width:auto;margin:0}
.rowform input,.rowform select{width:auto;flex:1 1 160px;min-width:120px}
.rowform button{flex:0 0 auto}
.ib{display:inline-flex;gap:2px;width:auto;margin:0}
.icon{background:none;border:1px solid var(--line);border-radius:7px;color:var(--ink-3);cursor:pointer;font-size:10px;padding:4px 7px;line-height:1;width:auto}
.icon:hover{background:#f1f4fb;color:var(--ink)}
.icon.danger:hover{background:#fdeaea;color:#c0392b}

details.inline-edit{width:auto}
details.inline-edit[open]{width:100%}
details.adder{width:100%}
details.inline-edit>summary,details.adder>summary{cursor:pointer;list-style:none;font-size:12.5px;color:var(--blue-d)}
details.inline-edit>summary::-webkit-details-marker,details.adder>summary::-webkit-details-marker{display:none}
details.inline-edit[open]>summary,details.adder[open]>summary{margin-bottom:8px}
details.adder>summary{display:inline-block}
details.adder form{display:grid;gap:8px;margin-bottom:12px}
details.inline-edit.right{margin-left:auto;width:auto}
.card.addstage>summary{cursor:pointer;list-style:none;color:var(--blue-d);font-size:14px;font-weight:600}
.card.addstage>summary::-webkit-details-marker{display:none}
.userrow details.inline-edit{margin-top:12px}

/* ---------- flash + login ---------- */
.flash{max-width:1240px;margin:16px auto -4px;padding:11px 16px;border-radius:11px;background:#e4f6ec;color:#1b7f4b;font-size:13.5px;border:1px solid #c9ebd8}
.flash-err{background:#fdeaea;color:#c0392b;border-color:#f8d4d4}
body.plain .flash{max-width:420px;margin:24px auto -8px}
.loginwrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px}
.card.login{width:100%;max-width:400px;padding:30px 32px 34px;margin:0}
.card.login h1{font-size:27px}

@media (max-width:860px){
  .shell{grid-template-columns:1fr;padding:16px 14px 60px}
  .side{position:static}
}


/* ===== Aliber Cowork visual refresh — 2026 ===== */
:root{
  --blue:#4f46e5;
  --blue-d:#3730a3;
  --accent:#06b6d4;
  --ink:#172033;
  --ink-2:#526078;
  --ink-3:#7f8ca4;
  --line:rgba(136,151,177,.22);
  --bg:#f3f6fc;
  --card:rgba(255,255,255,.92);
  --radius:20px;
  --shadow:0 1px 2px rgba(20,31,57,.04),0 14px 36px rgba(41,55,92,.09);
}

html{min-height:100%;background:#f3f6fc}
body{
  min-height:100vh;
  font-size:15px;
  color:var(--ink);
  background:
    radial-gradient(900px 520px at -8% -12%,rgba(99,102,241,.16),transparent 66%),
    radial-gradient(760px 460px at 108% 6%,rgba(6,182,212,.11),transparent 62%),
    linear-gradient(180deg,#f8faff 0,#f3f6fc 46%,#eef3fb 100%);
  background-attachment:fixed;
}
body::before{
  content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;opacity:.38;
  background-image:linear-gradient(rgba(109,124,154,.055) 1px,transparent 1px),linear-gradient(90deg,rgba(109,124,154,.055) 1px,transparent 1px);
  background-size:32px 32px;
  mask-image:linear-gradient(to bottom,black,transparent 72%);
}
::selection{background:rgba(79,70,229,.2);color:var(--ink)}
:focus-visible{outline:3px solid rgba(79,70,229,.28);outline-offset:3px}

h1{font-size:clamp(28px,3vw,38px);line-height:1.12;letter-spacing:-.045em;font-weight:780}
h2{font-size:19px;letter-spacing:-.025em}
h3{font-size:17px;letter-spacing:-.02em}
h4{font-size:11px;letter-spacing:.14em;font-weight:750}
p.sub{font-size:14px;line-height:1.65;color:var(--ink-2)}

.topbar{
  height:72px;padding:0 clamp(18px,3vw,38px);
  background:rgba(255,255,255,.82);border-color:rgba(136,151,177,.18);
  box-shadow:0 1px 0 rgba(255,255,255,.75),0 8px 28px rgba(35,48,82,.055);
  backdrop-filter:saturate(150%) blur(18px);-webkit-backdrop-filter:saturate(150%) blur(18px);
}
.brand{gap:12px;font-size:16px;font-weight:760;color:#202a43}
.logo{
  width:36px;height:36px;border-radius:12px;font-size:16px;
  background:linear-gradient(145deg,#6366f1 8%,#4338ca 62%,#312e81 100%);
  box-shadow:0 7px 18px rgba(79,70,229,.28),inset 0 1px 0 rgba(255,255,255,.34);
}
.logo.big{width:52px;height:52px;border-radius:17px;font-size:22px;box-shadow:0 12px 28px rgba(79,70,229,.3)}
.topnav{gap:5px;font-size:13.5px}
.topnav a{padding:9px 13px;border-radius:11px;color:#5b6880;font-weight:560;transition:.18s ease}
.topnav a:hover{background:rgba(79,70,229,.075);color:#3730a3;transform:translateY(-1px)}
.topnav a.ghost{background:#fff;border-color:rgba(136,151,177,.24);box-shadow:0 3px 10px rgba(34,46,77,.05)}

.shell{
  grid-template-columns:276px minmax(0,1fr);gap:34px;max-width:1440px;
  padding:34px clamp(18px,3vw,38px) 90px;
}
.side{
  top:98px;padding:18px 14px;border:1px solid rgba(136,151,177,.2);border-radius:20px;
  background:rgba(255,255,255,.68);box-shadow:0 12px 30px rgba(44,57,90,.055);
  backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);
}
.side-head{margin:1px 0 12px 10px;color:#8b96aa;font-size:10.5px;font-weight:760}
.plist li{margin-bottom:6px}
.plist a{padding:10px 12px;border-radius:12px;color:#59667e;transition:background .18s,color .18s,transform .18s}
.plist a:hover{background:rgba(79,70,229,.07);color:#312e81;transform:translateX(2px)}
.plist a.on{
  background:linear-gradient(135deg,#5b5fe9,#4338ca);color:white;
  box-shadow:0 9px 20px rgba(67,56,202,.25),inset 0 1px 0 rgba(255,255,255,.22);
}
.bar{height:4px;margin:2px 12px 0;background:rgba(128,143,172,.15)}
.bar i{background:linear-gradient(90deg,#6366f1,#06b6d4)}
.newproj{margin-top:16px;padding-top:12px;border-top:1px solid var(--line)}
.newproj summary{padding:9px 11px;font-weight:650;color:#4f46e5}
.newproj summary:hover{background:rgba(79,70,229,.07)}
.newproj form{border-radius:14px;border-color:rgba(136,151,177,.22);box-shadow:0 12px 28px rgba(34,46,77,.08)}

.main{width:100%;max-width:1080px}
.pagehead{position:relative;margin:2px 0 24px;padding:4px 0 0}
.pagehead::after{content:"";display:block;width:48px;height:4px;margin-top:16px;border-radius:99px;background:linear-gradient(90deg,#4f46e5,#06b6d4)}
.headmeta{margin-top:12px;color:#7a879f}

.card{
  border-color:rgba(136,151,177,.2);border-radius:20px;padding:22px 24px;margin-bottom:18px;
  background:rgba(255,255,255,.9);box-shadow:var(--shadow);
  backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
}
.grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,350px),1fr));gap:20px}
.card.proj{position:relative;min-height:190px;padding:24px;overflow:hidden;transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease}
.card.proj::before{
  content:"";position:absolute;inset:0 0 auto;height:4px;
  background:linear-gradient(90deg,#4f46e5,#7c3aed 50%,#06b6d4);
}
.card.proj::after{
  content:"";position:absolute;width:170px;height:170px;right:-92px;top:-98px;border-radius:50%;
  background:radial-gradient(circle,rgba(99,102,241,.14),transparent 68%);pointer-events:none;
}
.card.proj:hover{transform:translateY(-5px);border-color:rgba(79,70,229,.24);box-shadow:0 22px 48px rgba(41,52,87,.14)}
.proj-top{position:relative;z-index:1}
.proj-top h2{font-size:20px}
.card.proj p.sub{min-height:45px;margin-top:5px}
.stagechips{gap:7px;margin-top:17px;padding-top:15px;border-top:1px solid rgba(136,151,177,.15)}
.chip{padding:5px 10px;border:0;font-size:11px;font-weight:620;background:#f2f4f9}
.card.empty{padding:54px 24px;border-style:dashed;background:rgba(255,255,255,.58)}

.pill{padding:5px 11px;font-size:11px;letter-spacing:.015em}
.pill.blue{background:#eef2ff;color:#4338ca}
.pill.red{background:#fff1f2;color:#be123c}
.pill.s-in_progress,.chip.s-in_progress{background:#eef2ff;color:#4338ca;border-color:transparent}
.pill.s-blocked,.chip.s-blocked{background:#fff1f2;color:#be123c;border-color:transparent}
.pill.s-review,.chip.s-review{background:#fff7ed;color:#c2410c;border-color:transparent}
.pill.s-done,.chip.s-done{background:#ecfdf5;color:#047857;border-color:transparent}

.stage-head{gap:18px}
.stage-title{gap:12px}
.num{width:30px;height:30px;border-radius:10px;background:linear-gradient(145deg,#eef2ff,#e0e7ff);color:#4f46e5;font-size:12px}
.section{margin-top:20px;padding-top:18px;border-color:rgba(136,151,177,.18)}
.sec-head{margin-bottom:12px}
.note{padding:14px 16px;border-radius:14px;background:#f8faff;border-color:rgba(136,151,177,.18);transition:border-color .18s,background .18s}
.note:hover{background:#fff;border-color:rgba(79,70,229,.18)}
.note-body{line-height:1.65}

.thumbs{grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:14px}
.thumb a{border-radius:14px;background:#f3f5fa;border-color:rgba(136,151,177,.2);box-shadow:0 6px 16px rgba(41,54,88,.06);transition:.18s ease}
.thumb a:hover{transform:translateY(-3px);box-shadow:0 13px 25px rgba(41,54,88,.12)}
.thumb figcaption{margin-top:7px}

input,select,textarea{
  border-color:rgba(136,151,177,.32);border-radius:12px;padding:10px 12px;background:rgba(255,255,255,.96);
  transition:border-color .16s,box-shadow .16s,background .16s;
}
input:hover,select:hover,textarea:hover{border-color:rgba(99,102,241,.38)}
input:focus,select:focus,textarea:focus{border-color:#6366f1;box-shadow:0 0 0 4px rgba(99,102,241,.12);background:#fff}
label{font-size:12px;color:#59667e}
.btn{
  border-radius:12px;padding:10px 17px;background:linear-gradient(135deg,#5b5fe9,#4338ca);
  box-shadow:0 7px 16px rgba(67,56,202,.2);transition:transform .16s ease,box-shadow .16s ease,filter .16s ease;
}
.btn:hover{background:linear-gradient(135deg,#6366f1,#3730a3);transform:translateY(-1px);box-shadow:0 10px 22px rgba(67,56,202,.28)}
.btn:active{transform:translateY(0)}
.btn.danger{background:#fff1f2;color:#be123c;box-shadow:none}
.btn.ghostbtn{background:#eef2ff;color:#4338ca;box-shadow:none}
.icon{border-radius:9px;padding:5px 8px}
details.inline-edit>summary,details.adder>summary{font-weight:650;color:#4f46e5}
.card.addstage{background:rgba(255,255,255,.62);border-style:dashed;box-shadow:none}

.flash{max-width:1364px;margin:20px auto -8px;border-radius:14px;padding:13px 17px;background:#ecfdf5;color:#047857;border-color:#a7f3d0;box-shadow:0 8px 22px rgba(4,120,87,.08)}
.flash-err{background:#fff1f2;color:#be123c;border-color:#fecdd3;box-shadow:0 8px 22px rgba(190,18,60,.07)}
.loginwrap{position:relative;overflow:hidden;padding:28px}
.loginwrap::before,.loginwrap::after{content:"";position:absolute;border-radius:50%;filter:blur(2px);pointer-events:none}
.loginwrap::before{width:420px;height:420px;left:-170px;top:-180px;background:radial-gradient(circle,rgba(99,102,241,.22),transparent 68%)}
.loginwrap::after{width:390px;height:390px;right:-150px;bottom:-180px;background:radial-gradient(circle,rgba(6,182,212,.17),transparent 68%)}
.card.login{position:relative;z-index:1;max-width:430px;padding:38px 40px 42px;border-radius:26px;box-shadow:0 28px 70px rgba(35,46,78,.17)}
.card.login h1{font-size:32px}

@media (max-width:900px){
  .shell{grid-template-columns:1fr;gap:22px;padding:22px 16px 60px}
  .side{position:static;padding:13px 12px;border-radius:17px}
  .side-head{margin:0 8px 9px}
  .plist{display:flex;gap:7px;overflow-x:auto;padding:0 0 3px;scrollbar-width:thin}
  .plist li{flex:0 0 auto;margin:0}
  .plist a{min-width:150px}
  .bar{display:none}
  .newproj{margin-top:10px;padding-top:9px}
  .main{max-width:none}
}
@media (max-width:620px){
  .topbar{height:auto;min-height:66px;padding:11px 14px;align-items:center;flex-wrap:wrap;gap:8px}
  .brand{font-size:15px}
  .logo{width:34px;height:34px}
  .topnav{width:100%;overflow-x:auto;padding-top:7px;border-top:1px solid rgba(136,151,177,.16);scrollbar-width:none}
  .topnav::-webkit-scrollbar{display:none}
  .topnav a{flex:0 0 auto;padding:8px 11px}
  .shell{padding:18px 12px 48px}
  .side{top:auto}
  h1{font-size:29px}
  .pagehead{margin-bottom:19px}
  .pagehead::after{margin-top:13px}
  .card{padding:18px 16px;border-radius:17px}
  .card.proj{min-height:170px;padding:20px 18px}
  .grid{grid-template-columns:1fr;gap:14px}
  .stage-head{align-items:flex-start}
  .stage-meta{width:100%;justify-content:flex-start;padding-left:42px}
  .rowform{align-items:stretch}
  .rowform input,.rowform select,.rowform.wrap input,.rowform.wrap select{width:100%;min-width:100%;flex-basis:100%}
  .rowform button{width:100%}
  .thumbs{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .note-foot{align-items:flex-start;flex-direction:column}
  .card.login{padding:31px 24px 34px;border-radius:22px}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}
}


/* ===== Multi-project carousel + colorful component grid ===== */
.plist{
  max-height:calc(100vh - 250px);overflow-y:auto;overscroll-behavior:contain;
  scrollbar-width:thin;scrollbar-color:rgba(79,70,229,.28) transparent;
  padding-right:3px;
}
.plist::-webkit-scrollbar,.grid::-webkit-scrollbar{width:7px;height:8px}
.plist::-webkit-scrollbar-thumb,.grid::-webkit-scrollbar-thumb{background:linear-gradient(#818cf8,#22d3ee);border-radius:99px}
.plist::-webkit-scrollbar-track,.grid::-webkit-scrollbar-track{background:rgba(128,143,172,.09);border-radius:99px}

.main > .grid{
  display:grid;grid-template-columns:none;grid-auto-flow:column;
  grid-auto-columns:minmax(350px,430px);justify-content:start;
  overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;
  padding:4px 5px 24px;margin:-4px -5px 0;gap:18px;
}
.main > .grid > .proj{scroll-snap-align:start}

.main:has(> .stage){
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  align-items:start;gap:20px;
}
.main:has(> .stage) > .pagehead,
.main:has(> .stage) > .addstage{grid-column:1/-1}
.main:has(> .stage) > .stage{margin:0;min-width:0}

.stage{
  --stage-accent:#6366f1;--stage-accent-2:#8b5cf6;--stage-soft:rgba(99,102,241,.12);
  position:relative;overflow:hidden;border-radius:25px;padding:24px;
  background:
    radial-gradient(circle at 100% 0,var(--stage-soft),transparent 34%),
    rgba(255,255,255,.94);
  box-shadow:0 16px 38px rgba(43,54,91,.09);
}
.stage:nth-of-type(4n+2){--stage-accent:#0ea5e9;--stage-accent-2:#06b6d4;--stage-soft:rgba(14,165,233,.13)}
.stage:nth-of-type(4n+3){--stage-accent:#f97316;--stage-accent-2:#f59e0b;--stage-soft:rgba(249,115,22,.13)}
.stage:nth-of-type(4n+4){--stage-accent:#ec4899;--stage-accent-2:#a855f7;--stage-soft:rgba(236,72,153,.12)}
.stage:nth-of-type(4n+5){--stage-accent:#10b981;--stage-accent-2:#22c55e;--stage-soft:rgba(16,185,129,.13)}
.stage::before{
  content:"";position:absolute;left:0;top:0;bottom:0;width:5px;
  background:linear-gradient(180deg,var(--stage-accent),var(--stage-accent-2));
}
.stage::after{
  content:"";position:absolute;right:-38px;top:-48px;width:135px;height:135px;border-radius:50%;
  border:22px solid var(--stage-soft);pointer-events:none;
}
.stage .stage-head,.stage .section{position:relative;z-index:1}
.stage .num{
  color:white;background:linear-gradient(145deg,var(--stage-accent),var(--stage-accent-2));
  box-shadow:0 7px 15px var(--stage-soft);
}
.stage h3{font-size:18px}
.stage .section{background:rgba(248,250,255,.72);border:1px solid rgba(136,151,177,.14);border-radius:16px;padding:14px;margin-top:15px}
.stage .section + .section{margin-top:10px}
.stage .sec-head{margin:0}
.stage .adder[open]{margin-top:10px}
.stage details.adder>summary{
  display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:99px;
  color:var(--stage-accent);background:var(--stage-soft);
}
.stage .icon:hover{color:var(--stage-accent);background:var(--stage-soft)}

.card.addstage{
  min-height:82px;display:flex;align-items:center;justify-content:center;
  border:2px dashed rgba(99,102,241,.24);border-radius:23px;
  background:linear-gradient(135deg,rgba(238,242,255,.74),rgba(236,254,255,.66));
}
.card.addstage>summary{padding:10px 18px;border-radius:99px;background:white;box-shadow:0 8px 20px rgba(67,56,202,.1)}
.card.addstage[open]{display:block}

@media (max-width:900px){
  .plist{max-height:none;overflow-y:hidden;overflow-x:auto;padding-bottom:4px}
  .main:has(> .stage){grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
  .stage{padding:20px 18px;border-radius:21px}
}
@media (max-width:680px){
  .main > .grid{grid-auto-columns:minmax(285px,86vw);padding-bottom:20px}
  .main:has(> .stage){grid-template-columns:1fr}
  .main:has(> .stage) > .pagehead,
  .main:has(> .stage) > .addstage{grid-column:1}
  .stage .stage-meta{padding-left:42px}
}


/* ===== Component subsections ===== */
.stage .subsection-section{
  background:linear-gradient(135deg,rgba(255,255,255,.88),var(--stage-soft));
  border-color:rgba(99,102,241,.16);
}
.subsection-list{list-style:none;margin:12px 0 0;padding:0;display:grid;gap:8px}
.subsection-item{
  display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px;
  padding:10px 11px;border:1px solid rgba(136,151,177,.17);border-radius:15px;
  background:rgba(255,255,255,.9);box-shadow:0 5px 14px rgba(41,54,88,.045);
}
.subsection-letter{
  width:31px;height:31px;border-radius:11px;display:grid;place-items:center;
  color:#fff;font-size:12px;font-weight:800;
  background:linear-gradient(145deg,var(--stage-accent),var(--stage-accent-2));
  box-shadow:0 6px 13px var(--stage-soft);
}
.subsection-copy{min-width:0;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.subsection-name{min-width:0;font-size:13.5px;font-weight:720;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.subsection-actions{display:flex;align-items:center;gap:6px}
.subsection-actions .inline-edit{position:relative}
.subsection-actions .inline-edit>summary{padding:5px 8px;border-radius:9px;background:var(--stage-soft);white-space:nowrap}
.subsection-actions .inline-edit[open]{position:absolute;z-index:8;right:18px;margin-top:8px;width:min(390px,calc(100% - 36px));padding:12px;border:1px solid rgba(136,151,177,.24);border-radius:14px;background:#fff;box-shadow:0 18px 40px rgba(35,48,82,.18)}
.subsection-actions .inline-edit[open]>summary{margin-bottom:8px}
.subsection-actions .rowform{margin-top:0}
.subsection-actions .inline-edit>form:last-child{margin-top:8px}
.subsection-empty{margin:11px 0 1px;color:var(--ink-3);font-size:12.5px;line-height:1.5}
.subsection-add-form{grid-template-columns:minmax(0,1fr) auto!important;align-items:center}
.subsection-add-form .btn{width:auto}
@media (max-width:620px){
  .subsection-item{grid-template-columns:auto minmax(0,1fr);align-items:start}
  .subsection-actions{grid-column:2;justify-content:flex-start}
  .subsection-actions .inline-edit[open]{left:16px;right:16px;width:auto}
  .subsection-copy{padding-top:3px}
  .subsection-add-form{grid-template-columns:1fr!important}
  .subsection-add-form .btn{width:100%}
}
