/* The palace is a decorative backdrop. Report values, status colors, native
   controls and the document order come from the existing workspace. */
@layer stone-city {
@media screen and (forced-colors: none) {
  html[data-hub-theme="dark"] {
    --sc-text: #fff8ec;
    --sc-sub: #eadfd1;
    --sc-muted: #e5d5c0;
    --sc-gold: #f3d29f;
    --sc-gold-light: #ffdfa2;
    --sc-line: rgb(220 184 131 / 31%);
    --sc-edge: rgb(234 199 149 / 59%);
    --sc-inset: rgb(255 225 184 / 13%);
    --sc-solid: #2d1b20;
    --sc-active: linear-gradient(118deg,#762838,#591429 63%,#410e20);
    --sc-brass: linear-gradient(155deg,#fff1c4,#e8c184 42%,#b48a49 75%,#e7c68e);
    --sc-control: linear-gradient(125deg,rgb(103 71 66 / 60%),rgb(52 31 37 / 94%)),#322126;
    --sc-glass: linear-gradient(118deg,rgb(83 44 49 / 14%),rgb(58 28 39 / 10%) 52%,rgb(36 18 28 / 13%)),rgb(22 13 20 / 62%);
    --sc-shadow: inset 0 1px 0 var(--sc-inset),0 8px 24px rgb(18 8 12 / 20%);
    --castle-landscape: url("/brand/castle-palace.webp");
    background: #21191e !important;
  }

  /* Keep the flags, facade, stairway and courtyard on one continuous plane.
     The shared width/position retains a right-of-centre crest on wide windows
     and keeps the image edges outside the viewport. */
  html[data-hub-theme="dark"] body::before,
  html[data-hub-theme="dark"] body:has(.welcome-screen)::before {
    --palace-width: max(132vw,218svh);
    --palace-x: min(0px,calc(69vw - var(--palace-width) * .51));
    --palace-y: min(0px,calc(31svh - var(--palace-width) * .222));
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    transform: none !important;
    background:
      linear-gradient(95deg,rgb(24 16 24 / 46%),rgb(24 16 23 / 22%) 46%,rgb(23 16 22 / 10%) 76%),
      linear-gradient(0deg,rgb(27 15 22 / 15%),transparent 44%,rgb(27 16 23 / 6%)),
      var(--castle-landscape) var(--palace-x) var(--palace-y) / var(--palace-width) auto no-repeat,
      #241c22 !important;
  }

  html[data-hub-theme="dark"] .hub-flow-sidebar {
    background: linear-gradient(132deg,rgb(73 39 46 / 19%),transparent 56%),rgb(28 17 25 / 70%) !important;
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  }
  html[data-hub-theme="dark"] .hub-flow-sidebar .brand strong { color: var(--sc-text) !important; }
  html[data-hub-theme="dark"] .hub-flow-sidebar .brand span { color: var(--sc-gold) !important; }
  html[data-hub-theme="dark"] .hub-flow-nav-link[aria-current="page"] {
    color: var(--sc-text) !important;
    background: var(--sc-active) !important;
    box-shadow: inset 0 0 0 1px rgb(225 170 119 / 60%),inset 0 1px 0 rgb(255 235 201 / 14%) !important;
  }
  html[data-hub-theme="dark"] .hub-flow-nav-link[aria-current="page"] svg { color: var(--sc-gold-light) !important; }
  html[data-hub-theme="dark"] :is(.page-heading,.breadcrumb,.app-footer,.hub-phone-applied-range,.sync-state) {
    text-shadow: 0 1px 3px #1a1017,0 2px 9px rgb(24 13 19 / 85%);
  }
  html[data-hub-theme="dark"] .hub-flow-header .eyebrow { color: var(--sc-gold-light) !important; }
  html[data-hub-theme="dark"] .hub-session-compact {
    background: rgb(40 25 27 / 80%) !important; border-color: var(--sc-line) !important;
  }
  html[data-hub-theme="dark"] :is(.hub-global-kpis,.team-hub-kpis,.panel,.hub-elite,.hub-flow-stats,.team-hub-controls,.hub-scope-toolbar,.hub-period-pair,.guide-header),
  html[data-hub-theme="dark"] .welcome-screen::before {
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  }
  html[data-hub-theme="dark"] #hub-main .overview-middle > .hub-org-targets {
    background: var(--sc-glass) !important;
    border: 1px solid var(--sc-edge) !important; border-radius: var(--sc-radius) !important;
    box-shadow: var(--sc-shadow) !important; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  }
  html[data-hub-theme="dark"] #hub-main .overview-middle > .hub-org-targets > .hub-official-targets {
    background: transparent !important; box-shadow: none !important;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  html[data-hub-theme="dark"] #hub-main :is(.hero-metric .metric-number,.team-hub-kpi-value,.hub-official-values strong) { color: var(--sc-text) !important; }
  html[data-hub-theme="dark"] #hub-main .hub-chart-bar {
    background: linear-gradient(180deg,#cb4c65,#8c203d 57%,#5c122b) !important;
    box-shadow: inset 0 1px 0 rgb(255 200 198 / 52%) !important;
  }
  html[data-hub-theme="dark"] #hub-main .hub-chart-day.is-zero .hub-chart-bar { background: #c7ae8e !important; }
  html[data-hub-theme="dark"] #hub-main .hub-chart-day:is(.is-selected,:hover) .hub-chart-bar {
    background: var(--sc-brass) !important;
  }
  html[data-hub-theme="dark"] #hub-main .progress-track > div { background: var(--sc-brass) !important; }
  html[data-hub-theme="dark"] .entry-actions,
  html[data-hub-theme="dark"] .hub-nav-bottom { background-color: var(--sc-solid); }
  html[data-hub-theme="dark"] :is(.hub-story-dialog,.hub-period-dialog,.modal,.modal-card,dialog[open]) {
    background: linear-gradient(135deg,#442831,#2c1921 73%) !important;
    border-color: var(--sc-edge) !important;
  }

  @media (min-width: 1000px) {
    html[data-hub-theme="dark"] .welcome-screen {
      margin: 0 auto 0 0 !important;
      width: clamp(420px,39vw,580px) !important;
      min-height: auto !important;
    }
    html[data-hub-theme="dark"] .welcome-screen > .brand-logo-welcome {
      position: relative !important; inset: auto !important;
      width: 76px !important; height: 76px !important; margin: 0 !important;
    }
    html[data-hub-theme="dark"] .welcome-screen > .eyebrow {
      position: static !important; width: auto; font-size: .86rem !important;
      letter-spacing: .14em !important; color: var(--sc-gold-light) !important;
    }
    html[data-hub-theme="dark"] #hub-main > .hub-session-compact {
      width: fit-content; max-width: 100%; align-self: start;
    }
    html #root #hub-main[data-hub-route-content="overview"] { --hub-flow-gap: clamp(18px,2.25vh,26px); }
    html #root #hub-main[data-hub-route-content="overview"] > .hub-flow-header {
      min-block-size: clamp(120px,18.5svh,210px);
      max-inline-size: min(100%,max(56%,35rem));
      justify-content: flex-start; align-content: center;
      gap: 8px 18px !important;
    }
    html #root #hub-main[data-hub-route-content="overview"] > .hub-flow-header h1 {
      font-size: clamp(2.5rem,4.1vw,4.25rem) !important; font-weight: 710 !important;
      line-height: 1.06 !important; letter-spacing: -.035em !important;
    }
  }
  @media (min-width:1200px) {
    html[data-hub-theme="dark"] .main-shell:has(#hub-main[data-hub-route-content="overview"]) > .topbar {
      width: min(100%,max(74%,47rem)); flex-wrap: wrap;
      justify-content: flex-start !important; gap: 6px 18px !important;
    }
    /* The open edge beside the Overview cards lets the architecture read at
       full contrast. Long standings and controls keep their usual full width. */
    html #root #hub-main[data-hub-route-content="overview"] > .overview-middle {
      inline-size: calc(100% - clamp(78px,11vw,200px));
    }
  }
  @media (min-width:1241px) {
    html #root #hub-main[data-hub-route-content="overview"] > .hub-global-kpis {
      grid-template-columns: minmax(280px,1.85fr) repeat(4,minmax(0,1fr)) !important;
    }
    html #root #hub-main[data-hub-route-content="overview"] > .hub-global-kpis .hero-metric {
      container-type: inline-size;
    }
    html #root #hub-main[data-hub-route-content="overview"] > .hub-global-kpis .hero-metric .metric-number {
      font-size: clamp(2rem,18cqi,3.25rem) !important;
    }
  }

  @media (max-width:900px) and (orientation:portrait) {
    html[data-hub-theme="dark"] {
      --castle-landscape: none;
      --castle-portrait: url("/brand/castle-palace-portrait.webp");
    }
    html[data-hub-theme="dark"] body::before,
    html[data-hub-theme="dark"] body:has(.welcome-screen)::before {
      background:
        linear-gradient(96deg,rgb(25 15 24 / 46%),rgb(25 15 22 / 16%) 48%,rgb(25 15 22 / 10%) 85%),
        linear-gradient(0deg,rgb(24 14 20 / 13%),transparent 60%),
        var(--castle-portrait) var(--palace-portrait-position,center top) / var(--palace-portrait-size,cover) no-repeat,
        #241a20 !important;
    }
  }
  @media (max-width:350px) and (max-aspect-ratio:3/5) {
    html[data-hub-theme="dark"] body:has(#hub-main[data-hub-route-content="overview"])::before {
      --palace-portrait-position: 30% top;
      --palace-portrait-size: auto 108%;
    }
  }
  @media (max-width:760px), (max-width:960px) and (max-height:540px) and (orientation:landscape) {
    html[data-hub-theme="dark"] .app-shell .main-shell > .topbar {
      background: linear-gradient(90deg,rgb(28 17 25 / 52%),rgb(28 17 25 / 14%) 55%,transparent) !important;
      -webkit-backdrop-filter: none; backdrop-filter: none;
    }
    html[data-hub-theme="dark"] .app-shell .hub-nav-utility {
      background: linear-gradient(90deg,rgb(31 19 25 / 74%),rgb(31 19 25 / 51%)) !important;
    }
    html[data-hub-theme="dark"] .app-shell .hub-nav-bottom {
      background: linear-gradient(110deg,#342027,#291a21) !important;
      border-top-color: var(--sc-edge) !important;
    }
    html[data-hub-theme="dark"] #root .app-shell .hub-phone-applied-range,
    html[data-hub-theme="dark"] #root .app-shell .sync-state {
      color: var(--sc-text) !important;
      background: rgb(28 17 24 / 68%) !important;
      border-radius: 3px;
      box-shadow: 0 0 0 2px rgb(28 17 24 / 68%);
      text-shadow: 0 1px 3px #20131a;
    }
    html[data-hub-theme="dark"] #root .app-shell #hub-main > .hub-flow-header {
      background: linear-gradient(90deg,rgb(29 17 25 / 73%),rgb(29 17 25 / 41%) 58%,transparent);
    }
  }

  @media (max-width:760px) and (orientation:portrait) {
    /* Maintain the clear camera view beside the title while the same facade
       continues above and below it, behind the rest of the dashboard. */
    html #root #hub-main[data-hub-route-content="overview"] > .hub-session-compact {
      box-sizing: border-box; inline-size: fit-content; max-inline-size: 57%;
      align-self: start; font-size: .75rem; line-height: 1.3;
      padding: 5px 8px !important;
    }
    html[data-hub-theme="dark"] #root .app-shell #hub-main[data-hub-route-content="overview"] > .hub-flow-header {
      box-sizing: border-box;
      min-block-size: clamp(160px,43vw,218px);
      padding: 12px clamp(98px,36vw,205px) 13px 0 !important;
      align-content: center; align-items: start !important; gap: 8px !important;
      background: linear-gradient(90deg,rgb(27 16 24 / 78%),rgb(27 16 24 / 60%) 39%,transparent 67%) !important;
    }
    html #root #hub-main[data-hub-route-content="overview"] .hub-flow-header > div { min-inline-size: 0; }
    html #root #hub-main[data-hub-route-content="overview"] .hub-flow-header .eyebrow {
      font-size: .75rem !important; line-height: 1.3; margin-bottom: 5px !important;
      white-space: normal; overflow-wrap: anywhere;
    }
    html #root #hub-main[data-hub-route-content="overview"] .hub-flow-header p {
      font-size: .8rem !important; line-height: 1.38 !important;
      margin: 6px 0 0 !important; letter-spacing: 0;
    }
    html #root #hub-main[data-hub-route-content="overview"] > .hub-flow-header > .hub-flow-actions {
      width: auto !important; justify-self: start; margin: 0 !important;
    }
  }

  @media (prefers-reduced-transparency: reduce) {
    html[data-hub-theme="dark"] { --sc-glass: #302027; }
    html[data-hub-theme="dark"] :is(.hub-flow-sidebar,.sidebar,.panel,.kpi-grid,.team-hub-kpis,.hub-flow-stats,
       .hub-period-pair,.team-hub-controls,.hub-scope-toolbar,.hub-agent-help .hub-help-panel,.guide-header),
    html[data-hub-theme="dark"] #hub-main .overview-middle > .hub-org-targets,
    html[data-hub-theme="dark"] .welcome-screen::before {
      background: #302027 !important; -webkit-backdrop-filter: none; backdrop-filter: none;
    }
    html[data-hub-theme="dark"] #root .app-shell .main-shell > :is(.topbar,.hub-nav-utility),
    html[data-hub-theme="dark"] #root .app-shell #hub-main > .hub-flow-header { background: #251b20 !important; }
  }
}
@media print, (forced-colors: active) {
  html[data-hub-theme] body::before,
  html[data-hub-theme] body::after { content: none !important; }
}
}
