:root{
    /* App shell - a medium-dark blue (not near-black), regardless of
       light/dark preference. Only the component surfaces (cards) below flip
       between the two themes. */
    --shell-bg: #123252;
    --shell-text: #EAF4FB;
    --shell-text-dim: #9CC3DD;
    --shell-accent: #3FC6E0;

    --bg: var(--shell-bg);
    --surface: #1E4468;
    --surface-2: #26557F;
    --border: #3E739E;
    --text: #F0F5F9;
    --text-dim: #9FB4C7;
    --text-faint: #6C829A;
    --accent: #2FBAD6;
    --blue: #4A90D9;
    --green: #34D399;
    --gray: #93A9BE;
    --yellow: #FBCB3B;
    --orange: #FF9438;
    --red: #FF5252;
    --number-color: #E9F1F7;
    --text-outline: rgba(0,0,0,.55);
    --hairline-alpha: .05;
    --hairline-rgb: 255,255,255;
    --green-rgb: 52,211,153;
    --gray-rgb: 147,169,190;
    --yellow-rgb: 251,203,59;
    --orange-rgb: 255,148,56;
    --red-rgb: 255,82,82;
    --blue-rgb: 74,144,217;
    --font-head: 'Heebo', 'Arial', sans-serif;
    --font-body: 'Assistant', 'Arial', sans-serif;
    --font-mono: 'Heebo', 'Arial', sans-serif;
  }

  /* Auto-adapt to the visitor's OS/browser light-mode preference.
     Note: the app shell (--shell-*, body background) stays a medium blue on
     purpose - only the card/component surfaces switch to a light sky-blue
     ("תכלת") palette, so numbers and text sit on soft light-blue cards
     instead of stark white, with soft dark-blue text instead of black. */
  @media (prefers-color-scheme: light){
    :root{
      --surface: #E1F1FB;
      --surface-2: #CBE6F5;
      --border: #5B9AC2;
      --text: #1B3A52;
      --text-dim: #3E6480;
      --text-faint: #6E93AC;
      --accent: #0E7C99;
      --blue: #2F6FB8;
      --green: #128A5E;
      --gray: #5C7288;
      --yellow: #9C7A0E;
      --orange: #C15E1A;
      --red: #D6362A;
      --number-color: #16324A;
      --text-outline: rgba(255,255,255,.85);
      --hairline-alpha: .08;
      --hairline-rgb: 16,32,46;
      --green-rgb: 18,138,94;
      --gray-rgb: 92,114,136;
      --yellow-rgb: 156,122,14;
      --orange-rgb: 193,94,26;
      --red-rgb: 214,54,42;
      --blue-rgb: 47,111,184;
    }
  }
  *{box-sizing:border-box; margin:0; padding:0;}
  html{overflow-x:hidden;}
  body{
    background:var(--shell-bg);
    color:var(--shell-text);
    font-family:var(--font-body);
    font-size:16px;
    min-height:100vh;
    padding:26px 20px 60px;
    overflow-x:hidden;
  }
  .app{max-width:1220px; margin:0 auto; width:100%;}

  header{
    display:flex; justify-content:space-between; align-items:flex-start;
    border-bottom:1px solid rgba(147,168,188,.25);
    padding-bottom:16px; margin-bottom:22px;
    flex-wrap:wrap; gap:14px;
  }
  .eyebrow{
    font-family:var(--font-mono); font-size:13px; letter-spacing:2px;
    color:var(--shell-accent); text-transform:uppercase; margin-bottom:6px; font-weight:700;
  }
  h1{font-family:var(--font-head); font-weight:800; font-size:29px; color:var(--shell-text);}
  .header-meta{text-align:left; font-family:var(--font-mono); font-size:14px; color:var(--shell-text-dim); font-weight:600;}
  .header-meta b{color:var(--shell-text);}

  /* ---------- Info tooltip ---------- */
  .info-icon{
    width:17px; height:17px; border-radius:50%; border:1.5px solid var(--text-faint);
    color:var(--text-faint); font-size:11px; font-style:italic; font-weight:700;
    display:inline-flex; align-items:center; justify-content:center; cursor:help;
    position:relative; font-family:var(--font-mono); flex:none;
  }
  .info-icon:hover, .info-icon:focus{border-color:var(--accent); color:var(--accent);}
  .info-icon:hover::after{
    content:attr(data-tip); position:absolute; bottom:135%; right:50%; transform:translateX(50%);
    background:var(--surface-2); border:1px solid var(--border); color:var(--text);
    padding:9px 11px; border-radius:6px; font-size:12.5px; font-family:var(--font-body);
    font-weight:400; white-space:normal; width:200px; text-align:right; z-index:30;
    box-shadow:0 6px 16px rgba(0,0,0,.35); line-height:1.5;
  }
  .info-icon:hover::before{
    content:""; position:absolute; bottom:122%; right:50%; transform:translateX(50%) rotate(45deg);
    width:8px; height:8px; background:var(--surface-2); border-left:1px solid var(--border);
    border-bottom:1px solid var(--border); z-index:29;
  }

  .kpi-row{display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:26px; align-items:stretch;}
  .kpi{
    background:var(--surface); border:3px solid var(--border); border-radius:8px;
    padding:12px 12px 11px; position:relative; overflow:visible; color:var(--text);
    display:flex; flex-direction:column; align-items:center; justify-content:flex-start; text-align:center;
  }
  .kpi.risk{border-color:rgba(var(--red-rgb),.55);}
  .kpi.ok{border-color:rgba(var(--green-rgb),.45);}
  .kpi .label-row{width:100%; display:flex; justify-content:center; align-items:center; gap:5px; margin-bottom:3px;}
  .kpi .label{font-size:12.5px; color:var(--text-dim); font-weight:600;}
  .kpi .value{font-family:var(--font-mono); font-size:54px; font-weight:700; line-height:1.05; white-space:nowrap; color:var(--number-color);}
  .kpi .sub{font-size:12px; color:var(--text-faint); margin-top:3px;}

  /* two mini stats shown below the big number (used for the budget KPI) */
  .kpi-mini-row{display:flex; gap:18px; margin-top:4px;}
  .kpi-mini-row .mini{display:flex; flex-direction:column; align-items:center; gap:1px;}
  .kpi-mini-row .mini .mini-label{font-size:10.5px; color:var(--text-faint);}
  .kpi-mini-row .mini .mini-value{font-family:var(--font-mono); font-size:14px; font-weight:700; color:var(--text-dim); white-space:nowrap;}

  .section-title{
    font-family:var(--font-head); font-weight:700; font-size:19px;
    color:var(--shell-text-dim); margin:0 0 10px 0; display:flex; align-items:center; gap:10px;
  }
  .section-title::after{content:""; flex:1; height:1px; background:rgba(147,168,188,.25);}

  /* ---------- Portfolio combined timeline ---------- */
  .portfolio-panel{
    background:var(--surface); border:3px solid var(--border); border-radius:8px;
    padding:18px 26px 14px; margin-bottom:24px; color:var(--text);
  }
  .timeline-wrap{position:relative; padding-top:22px;}
  .tl-bars-clip{position:relative;}
  .tl-inner{position:relative;}
  .timeline-axis{
    position:relative; height:26px; margin-bottom:6px;
    font-family:var(--font-mono); font-size:18px; color:var(--text-faint); font-weight:700;
  }
  .timeline-axis span{position:absolute; transform:translateX(50%);}
  .today-line{
    position:absolute; top:0; bottom:0; width:0; border-right:2px dashed var(--accent); z-index:5;
  }
  .today-label{
    position:absolute; top:-22px; transform:translateX(50%); font-family:var(--font-mono);
    font-size:13px; font-weight:800; color:var(--accent); white-space:nowrap;
  }
  .tl-row{position:relative; height:36px; margin-bottom:6px; max-width:100%;}
  .tl-track{position:absolute; top:8px; height:18px; left:0; right:0; max-width:100%;}
  .tl-bar{
    position:absolute; top:0; height:18px; border-radius:4px;
    background:var(--surface-2); border:1px solid var(--border); overflow:hidden;
  }
  .tl-bar-fill{position:absolute; top:0; right:0; height:100%; border-radius:4px 0 0 4px;}
  .tl-label{
    position:absolute; top:0; right:0; font-size:14px; color:var(--text-dim); font-weight:600;
    transform:translateY(-20px); max-width:95%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }

  .agg-header-wrap{cursor:pointer; padding:6px 4px 14px; border-radius:8px; transition:background .15s;}
  .agg-header-wrap:hover{background:rgba(var(--hairline-rgb),.06);}
  .agg-title{
    display:flex; align-items:center; gap:8px; font-family:var(--font-head); font-size:19px;
    font-weight:700; color:var(--text); margin-bottom:4px;
  }
  .agg-title .arrow{display:inline-block; transition:transform .2s; font-size:19px; color:var(--accent);}
  .portfolio-panel.expanded .agg-title .arrow{transform:rotate(90deg);}
  .agg-stats{
    font-family:var(--font-mono); font-size:14px; font-weight:600; color:var(--text-faint);
    margin-right:27px;
  }
  .agg-row{position:relative; cursor:pointer; border-radius:6px; transition:background .15s;}
  .agg-row:hover{background:rgba(var(--hairline-rgb),.06);}
  .agg-row .tl-bar{height:30px;}
  .agg-row .tl-track{top:0;}
  .agg-row .tl-row{height:30px;}
  .individual-rows{max-height:0; overflow:hidden; transition:max-height .3s ease;}
  .portfolio-panel.expanded .individual-rows{max-height:600px; margin-top:10px; padding-top:10px; border-top:1px dashed var(--border);}

  /* ---------- Flags ---------- */
  .flag{
    display:inline-flex; align-items:center; gap:6px; font-family:var(--font-mono);
    font-size:12.5px; font-weight:700; letter-spacing:.2px; padding:5px 12px; border-radius:20px;
    white-space:nowrap; height:fit-content;
  }
  .flag i{width:9px; height:9px; border-radius:50%; flex:none;}
  .flag.green{background:rgba(var(--green-rgb),.22); color:var(--green); border:1.5px solid rgba(var(--green-rgb),.6);}
  .flag.green i{background:var(--green);}
  .flag.gray{background:rgba(var(--gray-rgb),.22); color:var(--gray); border:1.5px solid rgba(var(--gray-rgb),.6);}
  .flag.gray i{background:var(--gray);}
  .flag.yellow{background:rgba(var(--yellow-rgb),.22); color:var(--yellow); border:1.5px solid rgba(var(--yellow-rgb),.6);}
  .flag.yellow i{background:var(--yellow);}
  .flag.orange{background:rgba(var(--orange-rgb),.22); color:var(--orange); border:1.5px solid rgba(var(--orange-rgb),.6);}
  .flag.orange i{background:var(--orange);}
  .flag.red{background:rgba(var(--red-rgb),.22); color:var(--red); border:1.5px solid rgba(var(--red-rgb),.6);}
  .flag.red i{background:var(--red);}

  .flags-legend{display:flex; gap:14px; flex-wrap:wrap; margin-top:16px; padding-top:14px; border-top:1px dashed var(--border);}
  .flags-legend .flag{font-size:11.5px;}

  /* ---------- Project cards ---------- */
  .projects{display:flex; flex-direction:column; gap:8px; margin-bottom:10px;}
  .project-card{
    background:var(--surface); border:3px solid var(--border); border-radius:8px;
    padding:16px 22px; cursor:pointer; transition:border-color .15s;
    color:var(--text);
  }
  .project-card:hover{border-color:var(--accent);}
  .project-card.open{border-color:var(--accent);}
  .pc-chevron{
    display:inline-flex; align-items:center; justify-content:center;
    width:26px; height:26px; border-radius:50%; flex:none;
    background:var(--accent); color:var(--surface); box-shadow:0 2px 6px rgba(0,0,0,.25);
    font-size:15px; font-weight:900; transition:transform .2s, background .2s;
  }
  .project-card:hover .pc-chevron{background:var(--blue);}
  .project-card.open .pc-chevron{transform:rotate(90deg);}
  .pc-top{display:flex; flex-direction:column; gap:2px;}
  .pc-top-row{display:flex; justify-content:space-between; align-items:center; gap:10px;}
  .pc-title-wrap{flex:1; min-width:0;}
  .pc-type-row{display:flex; align-items:center; gap:6px;}
  .pc-type{font-family:var(--font-mono); font-size:13px; color:var(--text-faint); letter-spacing:.5px; text-transform:uppercase; font-weight:700;}
  .pc-title-row{display:flex; align-items:center; gap:10px;}
  .pc-title{font-family:var(--font-head); font-size:24px; font-weight:700; color:var(--text-dim); margin:4px 0 4px;}
  .pc-dates{font-family:var(--font-mono); font-size:13.5px; color:var(--text-dim); font-weight:600;}

  .pc-metrics{display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-top:12px; padding-top:12px; border-top:1px solid rgba(var(--hairline-rgb),var(--hairline-alpha));}
  .metric .m-label{font-size:11.5px; color:var(--text-faint); margin-bottom:4px; font-weight:600;}
  .metric .m-value{font-family:var(--font-mono); font-size:36px; font-weight:700; white-space:nowrap; color:var(--number-color);}
  .metric .m-value.good{color:var(--green);}
  .metric .m-value.bad{color:var(--red);}
  .metric .m-note{font-size:11px; color:var(--text-faint); margin-top:2px;}
  .metric-group-divider{border-right:1px dashed var(--border);}

  .progress-track{position:relative; height:7px; background:var(--surface-2); border-radius:4px; margin-top:6px; overflow:visible;}
  .progress-fill{position:absolute; top:0; right:0; height:100%; border-radius:4px; background:var(--blue); overflow:hidden;}
  .progress-marker{position:absolute; top:-3px; width:2px; height:13px; background:var(--accent); z-index:3;}
  .progress-marker-label{
    position:absolute; top:-19px; transform:translateX(50%); font-size:10px; font-weight:700;
    color:var(--accent); white-space:nowrap;
  }

  .pc-next{
    margin-top:10px; padding-top:9px; border-top:1px dashed var(--border);
    font-size:13px; color:var(--text-dim); display:flex; gap:8px; align-items:center; flex-wrap:wrap;
  }
  .pc-next b{color:var(--text);}
  .dot{width:6px; height:6px; border-radius:50%; background:var(--accent); flex:none;}

  /* Small flag/bullet indicator instead of an alarm-style badge */
  .impact-flag{
    display:inline-flex; align-items:center; gap:5px; font-size:12.5px; font-weight:700;
    margin-inline-start:auto;
  }
  .impact-flag.bad{color:var(--orange);}
  .impact-flag.good{color:var(--green);}
  .impact-flag.neutral{color:var(--text-faint); font-weight:600;}

  .detail{max-height:0; overflow:hidden; transition:max-height .25s ease;}
  .detail.open{max-height:2000px; margin-top:14px; padding-top:14px; border-top:1px solid var(--border);}
  .phase-row{
    display:grid; grid-template-columns: 210px 1fr 90px 130px; gap:10px; align-items:center;
    padding:5px 0; border-bottom:1px solid rgba(var(--hairline-rgb),var(--hairline-alpha)); font-size:13.5px;
  }
  .phase-row.head{color:var(--text-faint); font-size:11.5px; font-family:var(--font-mono); text-transform:uppercase; letter-spacing:.5px; font-weight:700;}
  .phase-row.head > div{text-align:center;}
  .phase-row.head > div:first-child{text-align:right;}
  .phase-name{display:flex; align-items:center; gap:7px;}
  .crit-flag{width:7px; height:7px; border-radius:50%; background:var(--red); flex:none;}
  .phase-bar-wrap{position:relative; height:14px; background:var(--surface-2); border-radius:3px; overflow:hidden;}
  .phase-bar-plan{position:absolute; top:0; right:0; height:100%; background:rgba(var(--blue-rgb),.3);}
  .phase-bar-actual{position:absolute; top:0; right:0; height:100%; background:var(--blue);}
  .phase-pct{font-family:var(--font-mono); text-align:center; color:var(--text-dim); font-size:12.5px; font-weight:600;}
  .phase-budget{font-family:var(--font-mono); text-align:center; color:var(--text-dim); font-size:12.5px; font-weight:600;}

  .disclaimer{
    margin-top:24px; padding:13px 16px; background:var(--surface); border:1px dashed var(--border);
    border-radius:6px; font-size:12.5px; color:var(--text-faint); line-height:1.7;
  }
  .disclaimer b{color:var(--accent);}

  @media(max-width:900px){
    .kpi-row{grid-template-columns:repeat(2,1fr);}
    .pc-metrics{grid-template-columns:repeat(2,1fr);}
    .metric-group-divider{border-right:none; border-top:1px dashed var(--border); padding-top:8px;}
  }
  @media(max-width:560px){
    .kpi-row{grid-template-columns:1fr; gap:8px;}
    .kpi{padding:9px 10px 8px;}
    .kpi .label{font-size:13.5px;}
    .kpi .value{font-size:52px;}
    .kpi .sub{font-size:12.5px;}
    .kpi-mini-row .mini .mini-label{font-size:11.5px;}
    .kpi-mini-row .mini .mini-value{font-size:15px;}
    .flags-legend{
      flex-wrap:nowrap; gap:2px; padding-top:8px; margin-top:10px; justify-content:space-between;
    }
    .flags-legend .flag{
      font-size:clamp(5.5px, 2vw, 7.5px); padding:2px 3px; flex:1 1 0; min-width:0;
      justify-content:center; border-width:1px; gap:0; letter-spacing:-.2px; white-space:nowrap;
    }
    .flags-legend .flag i{display:none;}
  }
  @media(max-width:720px){
    .phase-row{
      display:grid; grid-template-columns:1fr 1fr; grid-template-areas:"bar bar" "budget budget";
      gap:1px; padding:4px 0;
    }
    .phase-row.head{display:none;}
    .phase-name{
      grid-area:bar; z-index:2; position:relative; justify-self:start; align-self:center;
      padding:0 8px; font-size:12px; font-weight:800; max-width:65%;
      color:var(--text);
      text-shadow: -1px -1px 0 var(--text-outline), 1px -1px 0 var(--text-outline),
                   -1px 1px 0 var(--text-outline), 1px 1px 0 var(--text-outline);
    }
    .phase-name span{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
    .phase-bar-wrap{grid-area:bar; height:26px;}
    .phase-pct{
      grid-area:bar; z-index:2; justify-self:end; align-self:center; text-align:left;
      padding:0 8px; font-size:12px; font-weight:800;
      color:var(--text);
      text-shadow: -1px -1px 0 var(--text-outline), 1px -1px 0 var(--text-outline),
                   -1px 1px 0 var(--text-outline), 1px 1px 0 var(--text-outline);
    }
    .phase-budget{grid-area:budget; text-align:left; font-size:10.5px; padding:1px 8px 0;}
    .num-a{display:inline-block; min-width:2.7em; text-align:right;}
    .pc-next{justify-content:flex-start;}
    .impact-flag{margin-inline-start:0; width:100%; text-align:right; justify-content:flex-start;}

    /* Compact the project card considerably */
    .project-card{padding:9px 12px;}
    .pc-type{font-size:11.5px;}
    .pc-title{font-size:17px; margin:1px 0 1px;}
    .pc-dates{font-size:12px; white-space:normal; line-height:1.4;}
    .pc-metrics{gap:8px; margin-top:8px; padding-top:8px;}
    .metric .m-label{font-size:11px; margin-bottom:2px;}
    .metric .m-value{font-size:27px;}
    .metric .m-note{font-size:10.5px;}
    .progress-track{margin-top:3px;}
    .pc-next{margin-top:6px; padding-top:6px; font-size:12.5px; gap:5px;}
    .impact-flag{font-size:12px; margin-top:2px;}
    .detail.open{margin-top:10px; padding-top:10px;}
  }
