:root {
  --ink: #16181d;
  --paper: #f6f4ef;
  --panel: #ffffff;
  --line: #e2ded5;
  --line-strong: #c9c4b8;
  --amber: #d98a2b;
  --amber-deep: #b06a14;
  --teal: #1f6f6a;
  --muted: #7c776d;
  --muted-2: #9a958b;
  --green: #2f7d4f;
  --green-bg: #e6f1e9;
  --red: #b5402f;
  --red-bg: #f7e6e2;
  --blue: #2f5d8f;
  --blue-bg: #e6edf5;
  --gray-bg: #efece5;
  --shadow: 0 1px 2px rgba(20,24,29,.06), 0 4px 16px rgba(20,24,29,.04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--paper); color: var(--ink);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.mono { font-family: 'SF Mono','JetBrains Mono',ui-monospace,'Cascadia Code',monospace; }

/* topbar */
.topbar { height: 56px; background: var(--ink); color: #f6f4ef; display: flex;
  align-items: center; padding: 0 20px; gap: 18px; position: sticky; top: 0; z-index: 50; }
.brand { font-weight: 700; letter-spacing: .04em; font-size: 15px; display: flex;
  align-items: center; gap: 9px; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber);
  box-shadow: 0 0 0 3px rgba(217,138,43,.22); }
.brand .sub { color: var(--muted-2); font-weight: 500; letter-spacing: .12em;
  font-size: 10px; text-transform: uppercase; margin-left: 2px; }
.brand-logo { height: 34px; width: auto; display: block; background: #fff;
  border-radius: 8px; padding: 3px 8px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.topbar .spacer { flex: 1; }
.bell { position: relative; cursor: pointer; font-size: 18px; padding: 6px;
  border-radius: 7px; }
.bell:hover { background: rgba(255,255,255,.08); }
.bell .bdot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--amber); border: 2px solid var(--ink); }
.who { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--amber);
  color: #1a1206; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.who .nm { font-weight: 600; }
.who .rl { color: var(--muted-2); font-size: 11px; text-transform: capitalize; }
.logout { color: var(--muted-2); font-size: 12px; padding: 6px 10px; border-radius: 7px; }
.logout:hover { background: rgba(255,255,255,.08); color: #fff; }

/* layout */
.shell { display: flex; min-height: calc(100vh - 56px); }
.side { width: 210px; border-right: 1px solid var(--line); background: var(--panel);
  padding: 14px 10px; flex-shrink: 0; }
.navsec { font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted-2); padding: 14px 10px 6px; }
.navitem { display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 7px; cursor: pointer; color: var(--ink); font-weight: 500;
  margin-bottom: 1px; transition: background .12s; }
.navitem:hover { background: var(--gray-bg); }
.navitem.active { background: var(--ink); color: #f6f4ef; }
.navitem .ic { width: 18px; opacity: .65; text-align: center; }
.navitem.active .ic { opacity: 1; }
.navitem .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 10px;
  font-weight: 700; border-radius: 20px; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; }
.navitem.active .badge { background: var(--amber); color: #1a1206; }

.main { flex: 1; padding: 24px 28px; overflow: auto; max-width: 100%; }
.page-h { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 4px; }
.page-h h1 { font-size: 22px; letter-spacing: -.01em; font-weight: 700; }
.page-sub { color: var(--muted); margin-bottom: 22px; font-size: 13px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
  padding: 15px 16px; box-shadow: var(--shadow); }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin-bottom: 7px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat.flag .v { color: var(--red); }
.stat .trend { font-size: 11px; color: var(--muted-2); margin-top: 3px; }

/* toolbar + buttons */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search { flex: 1; min-width: 180px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; font-family: inherit; font-size: 13px; outline: none; }
.search:focus { border-color: var(--line-strong); }
.btn { border: 1px solid var(--line-strong); background: var(--panel); border-radius: 8px;
  padding: 9px 14px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--ink); display: inline-flex; align-items: center; gap: 7px; transition: all .12s; }
.btn:hover { background: var(--gray-bg); }
.btn.primary { background: var(--ink); color: #f6f4ef; border-color: var(--ink); }
.btn.primary:hover { background: #2a2e36; }
.btn.amber { background: var(--amber); border-color: var(--amber-deep); color: #1a1206; }
.btn.amber:hover { background: var(--amber-deep); color: #fff; }
.pill-filter { display: flex; gap: 5px; }
.pf { padding: 7px 12px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--panel); font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted); }
.pf.on { background: var(--ink); color: #f6f4ef; border-color: var(--ink); }

/* project cards */
.plist { display: flex; flex-direction: column; gap: 10px; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); cursor: pointer; overflow: hidden;
  transition: border-color .12s, transform .04s; display: block; }
.pcard:hover { border-color: var(--line-strong); }
.pcard:active { transform: translateY(1px); }
.pcard.flagged { border-left: 3px solid var(--red); }
.pcard-top { padding: 15px 18px 13px; display: flex; align-items: flex-start; gap: 14px; }
.pcard .title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 3px; }
.pcard .client { color: var(--muted); font-size: 12.5px; }
.pcard .meta-r { margin-left: auto; text-align: right; flex-shrink: 0; }
.pcard .value { font-weight: 700; font-size: 15px; }
.pcard .pm { font-size: 11.5px; color: var(--muted-2); margin-top: 3px; }
.tmpl-tag { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; padding: 2px 8px; border-radius: 5px; margin-bottom: 6px;
  background: var(--gray-bg); color: var(--muted); }

/* pipeline */
.pipe { display: flex; align-items: center; padding: 12px 18px 16px; overflow-x: auto; }
.stage { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1;
  min-width: 64px; position: relative; }
.stage .node { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; border: 2px solid var(--line-strong); background: var(--panel);
  color: var(--muted-2); z-index: 2; }
.stage.done .node { background: var(--green); border-color: var(--green); color: #fff; }
.stage.current .node { background: var(--amber); border-color: var(--amber-deep); color: #1a1206;
  box-shadow: 0 0 0 4px rgba(217,138,43,.18); }
.stage.current.overdue .node { background: var(--red); border-color: var(--red); color: #fff;
  box-shadow: 0 0 0 4px rgba(181,64,47,.18); }
.stage .lbl { font-size: 10px; text-align: center; color: var(--muted); line-height: 1.25; max-width: 72px; }
.stage.current .lbl { color: var(--ink); font-weight: 700; }
.stage.done .lbl { color: var(--ink); }
.stage .connector { position: absolute; top: 13px; left: 50%; width: 100%; height: 2px;
  background: var(--line-strong); z-index: 1; }
.stage.done .connector { background: var(--green); }
.stage:last-child .connector { display: none; }
.stage .days { font-size: 9px; padding: 1px 5px; border-radius: 4px; background: var(--gray-bg);
  color: var(--muted-2); font-weight: 600; }
.stage.current.overdue .days { background: var(--red-bg); color: var(--red); }

.empty { text-align: center; color: var(--muted-2); padding: 40px; font-size: 13px; }
.role-note { background: #f0e7d8; border: 1px solid #e0d3bb; border-radius: 9px;
  padding: 10px 14px; font-size: 12.5px; color: var(--amber-deep); margin-bottom: 18px;
  display: flex; align-items: center; gap: 9px; }
.nas-banner { border-radius: 9px; padding: 11px 14px; font-size: 12.5px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 9px; }
.nas-banner.ok { background: var(--green-bg); border: 1px solid #bfdcc9; color: var(--green); }
.nas-banner.off { background: var(--red-bg); border: 1px solid #e6c2ba; color: var(--red); }
.nas-banner.info { background: var(--blue-bg); border: 1px solid #c2d2e6; color: var(--blue); }

@media (max-width: 860px) {
  .side { display: none; }
  .stats { grid-template-columns: repeat(2,1fr); }
}
