/* ============================================================
   SmarterWorker — Project & Budget Planner (animated, dark)
   Excel-style programme planner recreated in SW chrome
   ============================================================ */

:root {
  --gold: #c9a84c;
  --gold-bright: #e0c46a;
  --gold-deep: #9c7e2e;
  --gold-tint: rgba(201, 168, 76, .15);

  --bg: #0d0f14;
  --panel: #161a22;
  --panel-2: #1b2029;
  --panel-3: #20262f;
  --line: #2a313c;
  --line-soft: #232a34;

  --ink: #e9ebef;
  --ink-soft: #9aa1ac;
  --ink-faint: #6b727d;

  --green: #5fae7e;
  --green-bright: #7bd29a;
  --amber: #d9a441;
  --red: #d65a5a;
  --red-deep: #b94747;
  --grey-bar: #525a66;

  /* role palette — muted, distinct on dark */
  --r-po:  #c9a84c;  /* Product Owner */
  --r-ba:  #6fa8c7;  /* Business Analyst */
  --r-db:  #9182cf;  /* Database Developer */
  --r-sd:  #5fae7e;  /* Server Developer */
  --r-pl:  #d9a441;  /* Performance Lead */
  --r-ar:  #c77b9e;  /* Architect */
  --r-ux:  #d98a5a;  /* UX Designer */
  --r-te:  #7c93a8;  /* Tester */

  --st-done: #5fae7e;
  --st-prog: #c9a84c;
  --st-todo: #4a525e;

  --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Scaling stage ---------- */
#viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle, rgba(201,168,76,.05) 1.1px, transparent 1.2px) 0 0 / 30px 30px,
    radial-gradient(1200px 700px at 80% -10%, rgba(201,168,76,.05), transparent 60%),
    var(--bg);
}
/* centred via absolute + translate so it can NEVER drift to one side,
   regardless of how large the frame is or whether content overflows. */
#camera {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: center center;
  transform: translate(-50%, -50%) scale(1);
}
#canvas {
  width: 1920px;
  height: 1080px;
  display: flex;
  flex-direction: column;
  padding: 22px 24px 18px;
  gap: 13px;
  background: linear-gradient(180deg, #12151c, #0f1218);
  border-radius: 18px;
  border: 1px solid #272d38;
  box-shadow: 0 1px 2px rgba(0,0,0,.5), 0 50px 110px -40px rgba(0,0,0,.8);
  transform-origin: 0 0;
  transition: transform 1.15s var(--ease);
  position: relative;
  overflow: hidden;
}
#canvas::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright), var(--gold-deep));
  z-index: 5;
}
#canvas > * { position: relative; z-index: 1; }

/* ============================================================
   HEADER
   ============================================================ */
.dash-head { display: flex; align-items: center; gap: 30px; padding: 2px 4px 0; flex-shrink: 0; }
.dash-logo { width: 58px; height: 58px; flex-shrink: 0; }
.dash-logo img { width: 100%; height: 100%; object-fit: contain; }
.head-dates { display: flex; gap: 30px; margin-left: auto; }
.head-date { text-align: right; }
.head-date .big { font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.head-date .big.gold { color: var(--gold-bright); }
.head-date .lbl { font-size: 11px; font-weight: 700; color: var(--ink-faint); margin-top: 3px; text-transform: uppercase; letter-spacing: .08em; }
.dash-title { flex: 1; text-align: center; font-size: 33px; font-weight: 800; letter-spacing: -.025em; color: var(--ink); white-space: nowrap; padding-left: 200px; }
.head-spacer { width: 58px; }

/* ============================================================
   SLICERS
   ============================================================ */
.slicers { display: flex; align-items: flex-end; gap: 16px; padding: 0 4px; flex-shrink: 0; }
.slicer { position: relative; flex: 1; max-width: 340px; }
.slicer-label {
  position: absolute; top: -9px; left: 14px;
  font-size: 12px; font-weight: 700; color: var(--ink-soft); background: var(--panel); padding: 0 8px;
  text-transform: uppercase; letter-spacing: .06em;
}
.slicer-box {
  border: 1px solid var(--line); border-radius: 9px; height: 42px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; color: var(--ink); font-size: 14.5px; font-weight: 600;
  background: var(--panel);
}
.slicer-box i { color: var(--ink-faint); }
.colour-toggles { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ct-label { font-size: 12px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; margin-right: 4px; }
.ctoggle {
  min-width: 92px; height: 44px; border-radius: 9px; border: 1.5px solid var(--line);
  background: var(--panel); color: var(--ink-soft); font-weight: 700; font-size: 15px; font-family: var(--font-sans);
  cursor: pointer; transition: all .18s var(--ease);
}
.ctoggle:hover { border-color: var(--gold-deep); color: var(--ink); }
.ctoggle.active { background: var(--gold); border-color: var(--gold); color: #1a1407; }

/* ============================================================
   PANELS
   ============================================================ */
.toprow { display: grid; grid-template-columns: 1.78fr 1fr; gap: 13px; height: 470px; flex-shrink: 0; }
.lower { flex: 1; display: grid; grid-template-columns: 1.32fr .92fr 1.12fr; gap: 13px; min-height: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px 16px 13px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-shrink: 0; gap: 10px; }
.panel-title { font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.panel-meta { display: flex; align-items: center; gap: 12px; }
.tag { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .06em; padding: 3px 9px; border-radius: 20px; text-transform: uppercase; }
.tag-gold { color: var(--gold-bright); background: var(--gold-tint); }
.tag-soft { color: var(--ink-soft); background: var(--panel-3); }
.legend-mini { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.legend-mini .sw { width: 11px; height: 11px; border-radius: 3px; }
.legend-mini .lm-bar { width: 18px; height: 7px; border-radius: 3px; background: var(--gold); }
.sw-ok { background: var(--green); } .sw-amber { background: var(--amber); } .sw-red { background: var(--red); }
.sw-hol { background: var(--grey-bar); }
.panel-body { flex: 1; min-height: 0; position: relative; }

/* ============================================================
   GANTT
   ============================================================ */
.gantt { display: grid; grid-template-columns: 224px 1fr; height: 100%; min-height: 0; }
.gantt-left { display: flex; flex-direction: column; padding-top: 38px; }
.gantt-rowlabel {
  height: 18px; display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden;
}
.gantt-rowlabel .rl-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.gantt-rowlabel .rl-name { overflow: hidden; text-overflow: ellipsis; }
.gantt-right { position: relative; overflow: hidden; }
.gantt-axis { position: absolute; top: 0; left: 0; height: 36px; }
.gantt-month { position: absolute; top: 0; font-size: 12px; font-weight: 700; color: var(--gold-bright); letter-spacing: .04em; text-transform: uppercase; }
.gantt-tick { position: absolute; top: 18px; font-size: 10.5px; color: var(--ink-faint); transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.gantt-col { position: absolute; top: 36px; bottom: 0; }
.gantt-col.weekend { background: rgba(255,255,255,.022); }
.gantt-col.holiday { background: rgba(120,128,140,.16); }
.gantt-col.holiday::after {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(45deg, transparent 0 4px, rgba(120,128,140,.22) 4px 8px);
}
.gantt-rows { position: absolute; top: 38px; left: 0; right: 0; }
.gantt-row { position: relative; height: 18px; }
.gantt-bar {
  position: absolute; top: 2.5px; height: 13px; border-radius: 3px;
  transform: scaleX(0); transform-origin: left;
  transition: transform .8s var(--ease) var(--d, 0s);
  overflow: hidden;
}
#canvas.go .gantt-bar { transform: scaleX(1); }
.gantt-bar .fill { position: absolute; inset: 0; border-radius: 4px; opacity: .42; background: var(--role-col, var(--grey-bar)); }
.gantt-bar .done { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--role-col, var(--grey-bar)); }
#canvas.mode-status .gantt-bar .fill { background: var(--stat-col, var(--grey-bar)); }
#canvas.mode-status .gantt-bar .done { background: var(--stat-col, var(--grey-bar)); }
.gantt-hol-flag { position: absolute; top: 38px; bottom: 0; width: 0; border-left: 1px dashed rgba(214,90,90,.55); }
.gantt-hol-flag .hf-lbl { position: absolute; top: -34px; left: 4px; font-size: 10px; color: var(--red); white-space: nowrap; font-weight: 700; }
.gantt-today { position: absolute; top: 30px; bottom: 0; width: 2px; background: var(--gold); opacity: .8; }
.gantt-today .td-lbl { position: absolute; top: -2px; left: 5px; font-size: 9.5px; color: var(--gold-bright); font-weight: 700; white-space: nowrap; font-family: var(--font-mono); }

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline { display: flex; flex-direction: column; gap: 0; height: 100%; justify-content: space-between; padding: 2px 0; }
.tl-row { display: grid; grid-template-columns: 1fr; gap: 3px; }
.tl-top { display: flex; align-items: baseline; justify-content: space-between; }
.tl-name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70%; }
.tl-pct { font-size: 12px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tl-track { height: 8px; border-radius: 6px; background: var(--panel-3); position: relative; overflow: hidden; }
.tl-fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  width: 0; transition: width .9s var(--ease) var(--d, 0s);
}
.tl-fill.done { background: linear-gradient(90deg, #3f7d5a, var(--green)); }
.tl-dates { font-size: 10.5px; color: var(--ink-faint); font-family: var(--font-mono); }

/* ============================================================
   RESOURCE ALLOCATION GRID
   ============================================================ */
.res { display: grid; height: 100%; min-height: 0; }
.res-cell { display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-variant-numeric: tabular-nums; border-radius: 4px; }
.res-corner { color: var(--ink-faint); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; justify-content: flex-start; padding-left: 2px; }
.res-colhead { color: var(--ink-soft); font-weight: 700; font-size: 11.5px; font-family: var(--font-mono); }
.res-rowhead { color: var(--ink); font-weight: 600; justify-content: flex-start; padding-left: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-val {
  margin: 2px; color: var(--ink-soft); font-weight: 600; background: var(--panel-2);
  opacity: 0; transform: scale(.8); transition: opacity .4s var(--ease) var(--d,0s), transform .4s var(--ease) var(--d,0s);
}
#canvas.go .res-val { opacity: 1; transform: none; }
.res-val.lvl-ok    { color: var(--green-bright); background: rgba(95,174,126,.13); }
.res-val.lvl-mid   { color: var(--ink-soft); background: var(--panel-2); }
.res-val.lvl-amber { color: #f1c069; background: rgba(217,164,65,.16); }
.res-val.lvl-red   { color: #ff8d8d; background: rgba(214,90,90,.2); font-weight: 800; box-shadow: inset 0 0 0 1px rgba(214,90,90,.5); }
.res-val.lvl-zero  { color: var(--ink-faint); background: transparent; }
.res-flag { position: relative; }
.res-flag::after {
  content: ""; position: absolute; top: 4px; right: 5px; width: 5px; height: 5px; border-radius: 50%;
  background: var(--red); opacity: 0; transition: opacity .3s var(--d,0s);
}
#canvas.go .res-flag::after { opacity: 1; animation: flagpulse 1.8s var(--ease) infinite; animation-delay: 1.4s; }
@keyframes flagpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(214,90,90,.5); } 50% { box-shadow: 0 0 0 4px rgba(214,90,90,0); } }

/* ============================================================
   BUDGET vs ACTUALS
   ============================================================ */
.budget { display: flex; flex-direction: column; height: 100%; }
.budget-row { display: grid; grid-template-columns: 1fr; gap: 5px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.budget-row:last-child { border-bottom: 0; }
.budget-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.budget-name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.budget-var { font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.budget-var.over { color: #ff8d8d; } .budget-var.under { color: var(--green-bright); } .budget-var.on { color: var(--ink-soft); }
.budget-bars { position: relative; height: 18px; }
.bb-track { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); height: 100%; }
.bb-budget {
  position: absolute; left: 0; top: 0; height: 8px; border-radius: 3px; background: var(--grey-bar);
  width: 0; transition: width .85s var(--ease) var(--d,0s);
}
.bb-actual {
  position: absolute; left: 0; bottom: 0; height: 8px; border-radius: 3px;
  width: 0; transition: width .85s var(--ease) calc(var(--d,0s) + .12s);
}
.bb-actual.over { background: var(--red); }
.bb-actual.under { background: var(--green); }
.bb-actual.on { background: var(--gold); }
.budget-figs { display: flex; gap: 14px; font-size: 10.5px; color: var(--ink-faint); font-family: var(--font-mono); }
.budget-figs b { color: var(--ink-soft); font-weight: 600; }
.budget-foot { margin-top: auto; padding-top: 10px; border-top: 1.5px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.budget-foot .bf-lbl { font-size: 11px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; }
.budget-foot .bf-val { font-size: 22px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ============================================================
   CALENDAR
   ============================================================ */
.cal { display: flex; flex-direction: column; height: 100%; gap: 6px; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; flex-shrink: 0; }
.cal-dow span { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; gap: 4px; flex: 1; min-height: 0; }
.cal-day {
  background: var(--panel-2); border-radius: 6px; padding: 4px 5px; position: relative;
  display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: hidden;
  opacity: 0; transform: translateY(5px); transition: opacity .4s var(--ease) var(--d,0s), transform .4s var(--ease) var(--d,0s);
}
#canvas.go .cal-day { opacity: 1; transform: none; }
.cal-day.empty { background: transparent; }
.cal-day.weekend { background: rgba(255,255,255,.016); }
.cal-day.holiday { background: rgba(120,128,140,.13); box-shadow: inset 0 0 0 1px rgba(120,128,140,.3); }
.cal-num { font-size: 11px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cal-day.holiday .cal-num { color: var(--ink-faint); }
.cal-hol { font-size: 8.5px; color: var(--ink-faint); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; line-height: 1.15; }
.cal-blocks { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.cal-block { height: 5px; border-radius: 2px; transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease) var(--d,0s); }
#canvas.go .cal-block { transform: scaleX(1); }

/* generic card entrance */
.pop { opacity: 0; transform: translateY(10px); transition: opacity .55s var(--ease) var(--d, 0s), transform .55s var(--ease) var(--d, 0s); }
#canvas.go .pop { opacity: 1; transform: none; }

/* ============================================================
   CHROME — controls + brand chip (outside the scaled canvas)
   ============================================================ */
.controls { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; z-index: 50; }
.ctrl {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-sans); font-weight: 700; font-size: 14px;
  padding: 11px 20px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid transparent; transition: all .2s var(--ease);
  background: #20262f; color: var(--ink);
}
.ctrl:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -12px rgba(0,0,0,.6); }
.ctrl.gold { background: var(--gold); color: #1a1407; }
.ctrl.gold:hover { background: var(--gold-bright); }
.ctrl.ghost { background: rgba(32,38,47,.8); color: var(--ink); border-color: var(--line); }
.ctrl.ghost:hover { border-color: var(--ink-soft); }
.ctrl[disabled] { opacity: .45; pointer-events: none; }

.brand-chip {
  position: fixed; top: 20px; left: 22px; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  background: rgba(22,26,34,.82); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px 7px 8px;
  box-shadow: 0 6px 20px -10px rgba(0,0,0,.6);
}
.brand-chip img { width: 32px; height: 32px; }
.brand-chip .bc-name { font-weight: 800; font-size: 14px; letter-spacing: -.02em; line-height: 1.05; }
.brand-chip .bc-name .s { color: var(--ink-soft); }
.brand-chip .bc-name .w { color: var(--gold-bright); }
.brand-chip .bc-sub { display: block; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .2em; color: var(--ink-faint); }

/* tour caption */
.tour-caption {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(10px);
  background: #1b2029; color: var(--ink); padding: 13px 24px; border-radius: 12px;
  font-weight: 600; font-size: 16px; max-width: 660px; text-align: center; line-height: 1.4;
  opacity: 0; pointer-events: none; transition: opacity .4s var(--ease), transform .4s var(--ease);
  z-index: 51; box-shadow: 0 18px 40px -16px rgba(0,0,0,.7); border: 1px solid var(--line);
}
.tour-caption .eb { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .18em; color: var(--gold-bright); text-transform: uppercase; margin-bottom: 5px; }
.tour-caption.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  #canvas, #canvas * { transition-duration: .001s !important; animation: none !important; }
}

/* safety: settle to final state once build window elapses (backgrounded tabs) */
#canvas.built .pop, #canvas.built .gantt-bar, #canvas.built .tl-fill, #canvas.built .res-val,
#canvas.built .bb-budget, #canvas.built .bb-actual, #canvas.built .cal-day, #canvas.built .cal-block {
  transition: none !important;
}
#canvas.built .pop { opacity: 1 !important; transform: none !important; }
#canvas.built .gantt-bar, #canvas.built .cal-block { transform: scaleX(1) !important; }
#canvas.built .res-val, #canvas.built .cal-day { opacity: 1 !important; transform: none !important; }
