/* =====================================================================
   FINALYTI R&D PIPELINE — BOLD Gen-Z Design System (neo-brutalist)
   Archivo (heavy display) + Space Grotesk + Inter + JetBrains Mono
   Electric palette · chunky 2px borders · hard offset shadows
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* surfaces — Electric Night (dark default) */
  --bg:          #0c0c12;
  --bg-grad-1:   #1a0a2b;
  --bg-grad-2:   #0a0a11;
  --surface:     #15151f;
  --surface-2:   #1e1e2c;
  --surface-3:   #2a2a3c;
  --border:      #34344c;
  --border-2:    #4a4a68;
  --ink:         #0a0a11;          /* hard-shadow / outline ink */

  --text:        #f8f8ff;
  --text-dim:    #b4b4ce;
  --text-mute:   #75758f;

  /* ELECTRIC accents */
  --violet:      #9d5cff;
  --violet-2:    #6d3cff;
  --lime:        #c6ff2e;
  --lime-ink:    #16240a;
  --coral:       #ff2e93;          /* hot magenta */
  --cyan:        #19e3ff;
  --amber:       #ffd11a;
  --slate:       #9aa3c4;

  --success:     #38e08a;
  --warning:     #ffd11a;
  --danger:      #ff5d7d;

  /* gradients (saturated) */
  --grad-brand:  linear-gradient(135deg, #9d5cff 0%, #6d3cff 50%, #19e3ff 130%);
  --grad-lime:   linear-gradient(135deg, #d6ff4d 0%, #9ae600 100%);
  --grad-coral:  linear-gradient(135deg, #ff5db0 0%, #ff1f6a 100%);
  --grad-cyan:   linear-gradient(135deg, #4df0ff 0%, #00b8e6 100%);
  --grad-amber:  linear-gradient(135deg, #ffe14d 0%, #ffae00 100%);
  --grad-glow:   radial-gradient(120% 120% at 0% 0%, rgba(157,92,255,.22), transparent 55%);

  /* shape */
  --r-sm: 12px; --r-md: 16px; --r-lg: 20px; --r-xl: 26px; --r-pill: 999px;
  --bw: 2px;                       /* base border weight */

  /* HARD offset shadows (signature) */
  --sh-hard:   4px 4px 0 var(--ink);
  --sh-hard-sm:3px 3px 0 var(--ink);
  --sh-press:  0 0 0 var(--ink);
  --sh-glow:   0 6px 30px rgba(157,92,255,.40);
  --sh-soft:   0 10px 28px rgba(0,0,0,.45);

  --ease: cubic-bezier(.2,.8,.2,1);

  --display: 'Archivo', system-ui, sans-serif;
  --head:    'Space Grotesk', system-ui, sans-serif;
}

/* light — Bold Paper (black borders, cream ground) */
[data-theme="light"] {
  --bg:        #f3ecdf;
  --bg-grad-1: #ffe6cf;
  --bg-grad-2: #f3ecdf;
  --surface:   #fffdf7;
  --surface-2: #f7f0e2;
  --surface-3: #ece2cf;
  --border:    #15151f;
  --border-2:  #15151f;
  --ink:       #15151f;
  --text:      #15151f;
  --text-dim:  #45455e;
  --text-mute: #7c7c92;
  --lime-ink:  #16240a;
  --sh-soft:   0 10px 28px rgba(40,30,90,.12);
  --sh-glow:   0 6px 24px rgba(157,92,255,.28);
}

/* ---------- Reset ---------- */
*,*::before,*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px; line-height: 1.55; color: var(--text);
  background: var(--grad-glow), linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2) 520px);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; margin: 0; line-height: 1.05; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.mono { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
::selection { background: var(--lime); color: var(--lime-ink); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }

/* ---------- Layout shell ---------- */
.app { display: grid; grid-template-columns: 280px 1fr; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100dvh;
  display: flex; flex-direction: column; gap: 5px;
  padding: 22px 16px;
  background: var(--surface);
  border-right: var(--bw) solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--grad-brand); color: #fff; font-size: 22px; flex-shrink: 0;
  border: var(--bw) solid var(--ink); box-shadow: var(--sh-hard-sm);
}
.brand-name { font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.brand-sub  { font-size: 10px; color: var(--text-mute); letter-spacing: .22em; text-transform: uppercase; font-weight: 700; }

.nav-label { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-mute); padding: 18px 12px 8px; font-weight: 800; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 13px; border-radius: var(--r-sm);
  color: var(--text-dim); font-weight: 700; font-size: 14.5px;
  border: var(--bw) solid transparent;
  transition: transform .12s var(--ease), background .15s var(--ease), color .15s var(--ease), border-color .15s;
}
.nav-item i { font-size: 19px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.nav-item.active {
  color: #fff; background: var(--grad-brand);
  border-color: var(--ink); box-shadow: var(--sh-hard-sm);
}
[data-theme="light"] .nav-item.active { color: #fff; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: var(--bw) solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: var(--r-sm); }
.user-avatar {
  width: 36px; height: 36px; border-radius: 11px; background: var(--grad-coral);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; flex-shrink: 0;
  border: var(--bw) solid var(--ink); font-family: var(--display);
}

/* ---------- Main / topbar ---------- */
.main { min-width: 0; padding: 28px 32px 64px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-sub { color: var(--text-dim); font-size: 13.5px; margin-top: 4px; font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 46px; height: 46px; border-radius: var(--r-sm); border: var(--bw) solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center; font-size: 19px;
  transition: transform .1s var(--ease), box-shadow .12s var(--ease);
}
.icon-btn:hover { box-shadow: var(--sh-hard-sm); border-color: var(--ink); transform: translate(-1px,-1px); }
.icon-btn:active { transform: translate(2px,2px); box-shadow: var(--sh-press); }

/* ---------- Buttons (hard-shadow, press-in) ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 20px; border-radius: var(--r-pill);
  border: var(--bw) solid var(--ink); box-shadow: var(--sh-hard);
  font-weight: 800; font-size: 14px; min-height: 46px; letter-spacing: -.01em;
  transition: transform .1s var(--ease), box-shadow .1s var(--ease), filter .15s var(--ease);
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translate(4px,4px); box-shadow: var(--sh-press); }
.btn i { font-size: 17px; }
.btn-primary { background: var(--grad-brand); color: #fff; }
.btn-lime    { background: var(--grad-lime); color: var(--lime-ink); }
.btn-ghost   { background: var(--surface); color: var(--text); }
.btn-danger  { background: var(--grad-coral); color: #fff; }
.btn-sm { padding: 8px 14px; min-height: 38px; font-size: 13px; box-shadow: var(--sh-hard-sm); }
.btn-sm:active { transform: translate(3px,3px); box-shadow: var(--sh-press); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: var(--bw) solid var(--border); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--sh-soft);
}
[data-theme="light"] .card { border-color: var(--ink); box-shadow: var(--sh-hard); }
.card-glass { background: var(--surface-2); }

/* ---------- Stat tiles ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat {
  position: relative; overflow: hidden; padding: 20px 22px; border-radius: var(--r-lg);
  background: var(--surface); border: var(--bw) solid var(--ink); box-shadow: var(--sh-hard);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.stat:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--ink); }
.stat-ico {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 21px;
  color: #fff; margin-bottom: 14px; border: var(--bw) solid var(--ink);
}
.stat-val { font-family: var(--display); font-size: 27px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.stat-label { color: var(--text-dim); font-size: 12.5px; margin-top: 5px; font-weight: 600; }

.fill-violet { background: var(--grad-brand); }   .ic-violet { background: var(--grad-brand); }
.fill-lime   { background: var(--grad-lime); }     .ic-lime   { background: var(--grad-lime); color: var(--lime-ink)!important; }
.fill-coral  { background: var(--grad-coral); }    .ic-coral  { background: var(--grad-coral); }
.fill-cyan   { background: var(--grad-cyan); }     .ic-cyan   { background: var(--grad-cyan); color: var(--ink)!important; }
.fill-amber  { background: var(--grad-amber); }    .ic-amber  { background: var(--grad-amber); color: var(--ink)!important; }
.fill-slate  { background: linear-gradient(135deg,#aab2d4,#7d86a8); }

/* ---------- Badges / pills (sticker style) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 800; line-height: 1.4; white-space: nowrap;
  border: var(--bw) solid currentColor;
}
.badge i { font-size: 13px; }
.b-slate  { background: rgba(154,163,196,.14); color: #aab4d6; }
.b-cyan   { background: rgba(25,227,255,.14);  color: #5cefff; }
.b-lime   { background: rgba(198,255,46,.16);  color: #d4ff66; }
.b-coral  { background: rgba(255,46,147,.14);  color: #ff7ab8; }
.b-amber  { background: rgba(255,209,26,.16);  color: #ffdf5c; }
.b-violet { background: rgba(157,92,255,.18);  color: #c4a0ff; }
[data-theme="light"] .b-slate{background:#e7e9f3;color:#3a3a52}
[data-theme="light"] .b-cyan{background:#cdf6ff;color:#06647a}
[data-theme="light"] .b-lime{background:#ecffc2;color:#3f6212}
[data-theme="light"] .b-coral{background:#ffd7ea;color:#c01267}
[data-theme="light"] .b-amber{background:#fff0c2;color:#9a6a00}
[data-theme="light"] .b-violet{background:#eadcff;color:#5b21c4}

.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; border: 1.5px solid var(--ink); }
.d-slate{background:var(--slate)} .d-cyan{background:var(--cyan)} .d-lime{background:var(--lime)}
.d-coral{background:var(--coral)} .d-amber{background:var(--amber)} .d-violet{background:var(--violet)}

/* ---------- Progress ---------- */
.bar { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; border: var(--bw) solid var(--border); }
.bar > span { display: block; height: 100%; background: var(--grad-brand); transition: width .5s var(--ease); }
.bar.lime > span { background: var(--grad-lime); }

.ring { --p: 0; width: 104px; height: 104px; border-radius: 50%;
  background: conic-gradient(var(--lime) calc(var(--p)*1%), var(--surface-3) 0);
  display: grid; place-items: center; position: relative; border: var(--bw) solid var(--ink);
}
.ring::before { content:''; position:absolute; inset:8px; border-radius:50%; background: var(--surface); border: var(--bw) solid var(--ink); }
.ring b { position: relative; font-family: var(--display); font-weight: 900; font-size: 24px; letter-spacing: -.04em; }

/* ---------- Project grid ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px,1fr)); gap: 18px; }
.proj-card { display: flex; flex-direction: column; gap: 14px; border-color: var(--ink); box-shadow: var(--sh-hard); transition: transform .12s var(--ease), box-shadow .12s var(--ease); }
.proj-card:hover { transform: translate(-3px,-3px); box-shadow: 7px 7px 0 var(--ink); }
.proj-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.proj-code { font-size: 11px; color: var(--text-mute); letter-spacing: .12em; font-weight: 700; text-transform: uppercase; }
.proj-name { font-size: 16px; margin-top: 3px; font-family: var(--display); font-weight: 700; letter-spacing: -.02em; }
.proj-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--text-dim); font-size: 12.5px; font-weight: 600; }
.proj-meta span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Stage rail ---------- */
.stage-rail { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 24px; }
.stage-pill {
  flex: 1 0 auto; min-width: 158px; padding: 15px 16px; border-radius: var(--r-md);
  background: var(--surface); border: var(--bw) solid var(--border); position: relative; overflow: hidden;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), border-color .12s;
}
.stage-pill:hover { transform: translate(-2px,-2px); box-shadow: var(--sh-hard-sm); border-color: var(--ink); }
.stage-pill.is-current { border-color: var(--ink); box-shadow: var(--sh-hard); }
.stage-pill.is-current::before { content:''; position:absolute; inset:0; background: var(--grad-brand); opacity:.16; }
.stage-pill .sp-no { font-family: var(--display); font-weight: 800; font-size: 11px; color: var(--text-mute); letter-spacing: .12em; }
.stage-pill .sp-name { font-weight: 700; font-size: 13.5px; margin: 5px 0 12px; position: relative; }
.stage-pill .sp-pct  { font-family: var(--display); font-size: 24px; font-weight: 900; letter-spacing: -.04em; }

/* ---------- Activity board ---------- */
.stage-block { margin-bottom: 16px; border: var(--bw) solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
[data-theme="light"] .stage-block { border-color: var(--ink); box-shadow: var(--sh-hard); }
.stage-head {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer;
  background: var(--surface-2); user-select: none; border-bottom: var(--bw) solid transparent;
}
.stage-head:hover { background: var(--surface-3); }
.stage-num {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 900; color:#fff; flex-shrink: 0; font-size: 16px;
  border: var(--bw) solid var(--ink); box-shadow: var(--sh-hard-sm);
}
.stage-head h3 { font-size: 17px; font-weight: 800; }
.stage-head .meta { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.stage-head .chev { transition: transform .25s var(--ease); font-size: 22px; color: var(--text-dim); }
.stage-block.collapsed .chev { transform: rotate(-90deg); }
.stage-block.collapsed .stage-body { display: none; }
.stage-body { padding: 8px 10px 12px; }

.cat-label { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-mute); padding: 16px 12px 8px; font-weight: 800; }

.act { display: flex; align-items: center; gap: 14px; padding: 13px 14px; border-radius: var(--r-md); transition: background .12s var(--ease); }
.act:hover { background: var(--surface-2); }
.act + .act { border-top: var(--bw) solid var(--border); }
.act.done .act-name { color: var(--text-mute); text-decoration: line-through; text-decoration-thickness: 2px; }

.check {
  width: 30px; height: 30px; border-radius: 9px; border: var(--bw) solid var(--border-2);
  display: grid; place-items: center; flex-shrink: 0; color: transparent; font-size: 17px;
  transition: transform .1s var(--ease), background .15s, border-color .15s; background: transparent;
}
.check:hover { border-color: var(--violet); transform: scale(1.06); }
.check.on { background: var(--grad-lime); border-color: var(--ink); color: var(--lime-ink); box-shadow: var(--sh-hard-sm); }
.check.blocked { background: var(--grad-coral); border-color: var(--ink); color: #fff; box-shadow: var(--sh-hard-sm); }
.check.in_progress { border-color: var(--cyan); color: var(--cyan); }

.act-name { flex: 1; min-width: 0; font-weight: 600; font-size: 14.5px; }
.act-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.status-select {
  appearance: none; background: var(--surface-3); border: var(--bw) solid var(--border); color: var(--text);
  padding: 7px 30px 7px 13px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 700;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; cursor: pointer;
}
.status-select:focus { outline: none; border-color: var(--violet); }
.assignee-select { max-width: 172px; min-width: 128px; }
.assignee-select option[value=""] { color: var(--text-mute); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 800; color: var(--text-dim); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .06em; }
.input, .select, .textarea {
  width: 100%; padding: 13px 15px; min-height: 48px; border-radius: var(--r-md);
  background: var(--surface-2); border: var(--bw) solid var(--border); color: var(--text); font-size: 14.5px; font-weight: 500;
  transition: border-color .15s var(--ease), box-shadow .12s var(--ease), transform .1s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--ink); box-shadow: var(--sh-hard-sm); transform: translate(-1px,-1px);
}
.textarea { min-height: 100px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; border-color: var(--ink); box-shadow: var(--sh-hard); }
.auth-logo {
  width: 62px; height: 62px; border-radius: 18px; display: grid; place-items: center; background: var(--grad-brand);
  color:#fff; font-size: 30px; margin: 0 auto 18px; border: var(--bw) solid var(--ink); box-shadow: var(--sh-hard);
}

/* ---------- Misc ---------- */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.muted { color: var(--text-dim); }
.empty { text-align: center; padding: 60px 20px; color: var(--text-dim); font-weight: 600; }
.empty i { font-size: 48px; opacity: .5; display: block; margin-bottom: 14px; }
.divider { height: var(--bw); background: var(--border); margin: 18px 0; border-radius: 2px; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(140%);
  background: var(--surface); color: var(--text); border: var(--bw) solid var(--ink); box-shadow: var(--sh-hard);
  padding: 14px 22px; border-radius: var(--r-pill); font-weight: 800; font-size: 14px;
  z-index: 1000; transition: transform .32s var(--ease); display:flex; align-items:center; gap:10px;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: var(--ink); }
.toast i { color: var(--lime); }
.toast.ok i { color: var(--lime); }

/* ---------- Mobile ---------- */
.menu-toggle { display: none; }
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 90; width: 280px; left: 0; top: 0; transform: translateX(-100%); transition: transform .3s var(--ease); }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: grid; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 80; opacity:0; pointer-events:none; transition: opacity .3s; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .form-row { grid-template-columns: 1fr; }
  .main { padding: 22px 18px 54px; }
  .page-title { font-size: 21px; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Nav badge ---------- */
.nav-count {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--coral); color: #fff; font-size: 11.5px; font-weight: 800;
  display: inline-grid; place-items: center; border: 2px solid var(--ink);
}
.nav-item.active .nav-count { background: #fff; color: var(--violet-2); }

/* ---------- Task / request cards ---------- */
.task-list { display: flex; flex-direction: column; gap: 14px; }
.task-card { padding: 18px 20px; }

/* ---------- Modals ---------- */
.modal {
  position: fixed; inset: 0; z-index: 130; display: none; place-items: center; padding: 20px;
  overflow-y: auto;
}
.modal.show { display: grid; }
.modal .card { max-height: 92dvh; overflow-y: auto; }
.modal .textarea { min-height: 84px; }
input[type="file"].input { padding: 10px 12px; min-height: 44px; }
input[type="file"].input::file-selector-button {
  margin-right: 12px; padding: 6px 12px; border-radius: 8px; border: 2px solid var(--ink);
  background: var(--surface-3); color: var(--text); font-weight: 700; cursor: pointer; font-family: inherit;
}
