/*
 * UI P2 system layer — shared light / deep-navy themes for V1.16.1.
 * Scope is deliberately limited to pages carrying .ui-p2-system.
 */

html.pcui-preview {
  --p2-bg: #e6eef9;
  --p2-bg-soft: #f3f6fb;
  --p2-surface: #ffffff;
  --p2-surface-2: #f5f8fc;
  --p2-surface-3: #edf3fb;
  --p2-text: #10213e;
  --p2-muted: #6b7e9d;
  --p2-line: #d5dfed;
  --p2-blue: #3472ed;
  --p2-blue-deep: #174cae;
  --p2-blue-soft: #e7efff;
  --p2-positive: #16805f;
  --p2-warning: #b77905;
  --p2-danger: #df3f49;
  --p2-shadow: 0 10px 30px rgba(20, 45, 84, .08);
  --p2-shadow-soft: 0 5px 18px rgba(20, 45, 84, .055);
  --p2-radius: 18px;
  --p2-radius-sm: 12px;
  color-scheme: light;
}

html.pcui-preview[data-pc-theme="navy"] {
  --p2-bg: #071327;
  --p2-bg-soft: #0a1830;
  --p2-surface: #0f1e39;
  --p2-surface-2: #142744;
  --p2-surface-3: #182d4c;
  --p2-text: #f3f7ff;
  --p2-muted: #95a8c8;
  --p2-line: #284166;
  --p2-blue: #6792ff;
  --p2-blue-deep: #8aabff;
  --p2-blue-soft: #1a345f;
  --p2-positive: #4fd3a6;
  --p2-warning: #ffc65b;
  --p2-danger: #ff7c84;
  --p2-shadow: 0 12px 34px rgba(0, 0, 0, .25);
  --p2-shadow-soft: 0 6px 20px rgba(0, 0, 0, .18);
  color-scheme: dark;
}

html.pcui-preview body.ui-p2-system {
  color: var(--p2-text);
  background:
    radial-gradient(circle at 82% -12%, rgba(66, 118, 232, .2), transparent 34rem),
    linear-gradient(150deg, var(--p2-bg), var(--p2-bg-soft));
  transition: color .2s ease, background-color .2s ease;
}

html.pcui-preview body.ui-p2-system :is(h1, h2, h3, h4, strong, b) { color: inherit; }
html.pcui-preview body.ui-p2-system :is(p, small, em) { color: var(--p2-muted); }
html.pcui-preview body.ui-p2-system a { color: var(--p2-blue-deep); }
html.pcui-preview body.ui-p2-system :is(input, select, textarea) {
  color: var(--p2-text);
  border-color: var(--p2-line);
  background: var(--p2-surface-2);
}
html.pcui-preview body.ui-p2-system :is(input, textarea)::placeholder { color: var(--p2-muted); }
html.pcui-preview body.ui-p2-system :is(input, select, textarea):focus {
  border-color: var(--p2-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--p2-blue) 18%, transparent);
}

/* Shared sidebar and top navigation */
html.pcui-preview body.ui-p2-system > aside,
html.pcui-preview body.ui-p2-system > .sidebar {
  color: var(--p2-text);
  background: color-mix(in srgb, var(--p2-surface) 94%, transparent);
  border-color: var(--p2-line);
  box-shadow: 8px 0 28px rgba(17, 43, 84, .05);
}
html.pcui-preview body.ui-p2-system > aside :is(.brand, .nav, nav a, .legend, .side-note) {
  border-color: var(--p2-line);
}
html.pcui-preview body.ui-p2-system > aside :is(.nav, nav a) { color: var(--p2-muted); }
html.pcui-preview body.ui-p2-system > aside :is(.nav, nav a):hover {
  color: var(--p2-text);
  background: var(--p2-surface-2);
}
html.pcui-preview body.ui-p2-system > aside :is(.nav.active, nav a.active) {
  color: var(--p2-blue-deep);
  background: var(--p2-blue-soft);
}
html.pcui-preview body.ui-p2-system > aside :is(.legend, .side-note) { background: var(--p2-surface-2); }

html.pcui-preview body.ui-p2-system :is(
  main > header,
  .workflow-header,
  .commerce-header,
  .app-header,
  .topbar,
  .mobile-head,
  .public-head .head-inner,
  .portal-head .portal-head-inner
) {
  color: var(--p2-text);
  border: 1px solid var(--p2-line);
  background: color-mix(in srgb, var(--p2-surface) 94%, transparent);
  box-shadow: var(--p2-shadow-soft);
}

html.pcui-preview body.ui-p2-system :is(
  .header-actions,
  .head-actions,
  .commerce-user,
  .top-actions,
  .portal-actions,
  .project-hero-actions
) {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

html.pcui-preview body.ui-p2-system :is(
  .header-actions,
  .head-actions,
  .commerce-user,
  .top-actions,
  .portal-actions
) > :is(button, a, .user-chip, span:not(.notification-badge)) {
  box-sizing: border-box;
  min-height: 44px;
  height: 44px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

html.pcui-preview body.ui-p2-system :is(
  .header-actions,
  .head-actions,
  .commerce-user,
  .top-actions,
  .portal-actions
) > :is(button, a, .user-chip) {
  color: var(--p2-blue-deep);
  border: 1px solid var(--p2-line);
  border-radius: 12px;
  background: var(--p2-surface);
  box-shadow: none;
}

html.pcui-preview body.ui-p2-system :is(
  .header-actions,
  .head-actions,
  .commerce-user,
  .top-actions,
  .portal-actions
) > :is(button, a):not(.primary, .workflow-create, .new-button, .submit-main):hover {
  color: var(--p2-blue-deep);
  border-color: var(--p2-blue);
  background: var(--p2-blue-soft);
  transform: translateY(-1px);
}

html.pcui-preview body.ui-p2-system :is(
  button,
  .btn,
  .mini-button,
  .portal-home-button,
  .logout-button,
  .ghost,
  .secondary,
  .text-button
) {
  border-color: var(--p2-line);
  border-radius: 11px;
}

html.pcui-preview body.ui-p2-system :is(
  .logout-button,
  .ghost,
  .secondary,
  .mini-button,
  .portal-home-button
) {
  color: var(--p2-blue-deep);
  background: var(--p2-surface);
}

html.pcui-preview body.ui-p2-system :is(.primary, .workflow-create, .new-button, .submit-main) {
  color: #fff;
  background: linear-gradient(135deg, #2865dc, #417bf1);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(44, 103, 224, .2);
}
html.pcui-preview body.ui-p2-system :is(button,a):is(.primary,.workflow-create,.new-button,.submit-main),
html.pcui-preview body.ui-p2-system :is(button,a):is(.primary,.workflow-create,.new-button,.submit-main) :is(span,b,strong,small){color:#fff!important}

html.pcui-preview body.ui-p2-system .pc-theme-toggle {
  min-height: 44px;
  height: 44px;
  padding: 0 12px;
  gap: 7px;
  color: var(--p2-blue-deep);
  background: var(--p2-surface);
  border: 1px solid var(--p2-line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
html.pcui-preview body.ui-p2-system .pc-theme-toggle span { font-size: 18px; line-height: 1; }
html.pcui-preview body.ui-p2-system .pc-theme-toggle b {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

/* Compact overview, statistics and filters */
html.pcui-preview body.ui-p2-system :is(
  .project-hero,
  .workflow-hero,
  .commerce-hero,
  .campaign-hero,
  .hero,
  .action-card,
  .intro-card,
  .portal-hero
) {
  color: #fff;
  border: 1px solid color-mix(in srgb, var(--p2-blue) 30%, transparent);
  border-radius: var(--p2-radius);
  background: linear-gradient(135deg, #1d4fae, #4d82ef);
  box-shadow: var(--p2-shadow);
}
html.pcui-preview[data-pc-theme="navy"] body.ui-p2-system :is(
  .project-hero,
  .workflow-hero,
  .commerce-hero,
  .campaign-hero,
  .hero,
  .action-card,
  .intro-card,
  .portal-hero
) { background: linear-gradient(135deg, #102b59, #214e9d); }
html.pcui-preview body.ui-p2-system :is(
  .project-hero,
  .workflow-hero,
  .commerce-hero,
  .campaign-hero,
  .hero,
  .action-card,
  .intro-card,
  .portal-hero
) :is(h1, h2, h3, p, small, span, strong, b, em) { color: inherit; }

html.pcui-preview body.ui-p2-system :is(
  .stats,
  .workflow-stats,
  .quick-stats,
  .analysis-metrics,
  .change-summary
) { gap: 10px; }
html.pcui-preview body.ui-p2-system :is(
  .stats,
  .workflow-stats,
  .quick-stats,
  .analysis-metrics,
  .change-summary
) > * {
  color: var(--p2-text);
  border-color: var(--p2-line);
  background: var(--p2-surface);
  box-shadow: var(--p2-shadow-soft);
}

html.pcui-preview body.ui-p2-system :is(
  .toolbar,
  .video-toolbar,
  .workflow-toolbar,
  .store-toolbar,
  .proof-toolbar,
  .campaign-toolbar,
  .orders-head,
  .schedule-toolbar,
  .campaign-tabs
) {
  color: var(--p2-text);
  border-color: var(--p2-line);
  background: var(--p2-surface);
  box-shadow: var(--p2-shadow-soft);
}

/* Shared content surfaces */
html.pcui-preview body.ui-p2-system :is(
  .stalled,
  .orders,
  .table-wrap,
  .channel-overview,
  .channel-chart-card,
  .channel-summaries > *,
  .workflow-board,
  .store-directory-panel,
  .store-list > *,
  .campaign-view,
  .annual-board > *,
  .campaign-list > *,
  .comparison-panel,
  .analysis-columns > section,
  .skill-launch,
  .commerce-grid > article,
  .flow-section,
  .skill-flow > article,
  .guard-section,
  .future-section,
  .panel,
  .legacy-card,
  .form-card,
  .request-step,
  .my-orders > *,
  .selected-store,
  .store-results,
  .material-block,
  .submit-panel,
  .portal-guide,
  .service-card
) {
  color: var(--p2-text);
  border-color: var(--p2-line);
  background: var(--p2-surface);
  box-shadow: var(--p2-shadow-soft);
}

html.pcui-preview body.ui-p2-system :is(table, th, td) { border-color: var(--p2-line); }
html.pcui-preview body.ui-p2-system :is(thead, .store-list-head) {
  color: var(--p2-muted);
  background: var(--p2-surface-2);
}
html.pcui-preview body.ui-p2-system tbody tr:nth-child(even) { background: var(--p2-surface-2); }
html.pcui-preview body.ui-p2-system tbody tr:hover { background: var(--p2-blue-soft); }

/* New-store construction: replace legacy green fixed colors with P2 tokens. */
html.pcui-preview body.page-planned {
  --ink: var(--p2-text);
  --muted: var(--p2-muted);
  --line: var(--p2-line);
  --canvas: var(--p2-bg-soft);
  --brand: var(--p2-blue);
  --brand-strong: var(--p2-blue-deep);
  --brand-soft: var(--p2-blue-soft);
}

html.pcui-preview body.page-planned :is(
  .workbench,
  .project-workspace,
  .kpi,
  .project-item.active,
  .panel,
  .change-kpi,
  .gantt td,
  .modal form,
  .modal-actions
) {
  color: var(--p2-text);
  border-color: var(--p2-line);
  background: var(--p2-surface);
}

html.pcui-preview body.page-planned :is(
  .project-sidebar,
  .sidebar-head button,
  .project-item:hover,
  .health-row,
  .activity-empty,
  .attachment-empty,
  .change-empty,
  .change-row.header,
  .attachment-item,
  .mobile-phase > header,
  .mobile-task,
  .gantt .phase-total td
) {
  color: var(--p2-text);
  border-color: var(--p2-line);
  background: var(--p2-surface-2);
}

html.pcui-preview body.page-planned :is(
  .project-search,
  .project-filters select,
  .form-grid input,
  .form-grid select,
  .form-grid textarea,
  .stage .node
) {
  color: var(--p2-text);
  border-color: var(--p2-line);
  background: var(--p2-surface);
}

/* The search shell owns the border; its nested input must stay transparent. */
html.pcui-preview body.page-planned .project-search {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  padding: 0 10px;
}
html.pcui-preview body.page-planned .project-search input,
html.pcui-preview body.page-planned .project-search input:focus {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: 38px;
  padding: 0 3px;
  color: var(--p2-text);
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}
html.pcui-preview body.page-planned .project-search > span {
  flex: 0 0 auto;
  width: auto;
  color: var(--p2-muted);
  background: transparent;
}

html.pcui-preview body.page-planned :is(
  .kpi span,
  .kpi small,
  .sidebar-head span,
  .project-search span,
  .project-item p,
  .project-item footer,
  .project-list-empty,
  .empty-project p,
  .section-heading .muted,
  .stage small,
  .project-tabs button,
  .fact span,
  .health-row span,
  .phase-row span,
  .activity-item p,
  .activity-item small,
  .schedule-toolbar p,
  .legend span,
  .schedule-tip,
  .change-kpi span,
  .change-row.header,
  .change-row small,
  .attachment-item small,
  .form-grid label
) { color: var(--p2-muted); }

html.pcui-preview body.page-planned .project-item:hover { background: var(--p2-surface-3); }
html.pcui-preview body.page-planned .project-item.active { border-color: var(--p2-blue); }
html.pcui-preview body.page-planned .project-tabs button.active,
html.pcui-preview body.page-planned .text-btn { color: var(--p2-blue-deep); }
html.pcui-preview body.page-planned .project-tabs button.active::after { background: var(--p2-blue); }
html.pcui-preview body.page-planned .project-tabs button span { background: var(--p2-surface-3); }

html.pcui-preview body.page-planned .stage::before { background: var(--p2-line); }
html.pcui-preview body.page-planned .stage .node {
  color: var(--p2-muted);
  border-color: var(--p2-line);
}
html.pcui-preview body.page-planned .stage.done .node {
  color: #fff;
  background: var(--p2-blue);
  border-color: var(--p2-blue);
}
html.pcui-preview body.page-planned .stage.current .node {
  color: var(--p2-blue-deep);
  border-color: var(--p2-blue);
  box-shadow: 0 0 0 5px var(--p2-blue-soft);
}

html.pcui-preview body.page-planned :is(.gantt th, .gantt td) { border-color: var(--p2-line); }
html.pcui-preview body.page-planned .gantt thead th,
html.pcui-preview body.page-planned .gantt thead :is(.sticky-1, .sticky-2, .sticky-3) {
  color: var(--p2-muted);
  background: var(--p2-surface-2);
}
html.pcui-preview body.page-planned .gantt .phase-cell {
  color: var(--p2-blue-deep);
  background: var(--p2-blue-soft);
}

/* The blue project summary needs its own light-on-blue type hierarchy. */
html.pcui-preview body.page-planned .project-hero .project-code-line {
  color: rgba(255, 255, 255, .78);
}
html.pcui-preview body.page-planned .project-hero .project-title-block h2 { color: #fff; }
html.pcui-preview body.page-planned .project-hero .project-title-block p {
  color: rgba(255, 255, 255, .9);
}
html.pcui-preview body.page-planned .project-hero .tag.neutral {
  color: #315c70;
  background: #eff8fb;
}
html.pcui-preview body.page-planned .project-hero .tag.risk-low {
  color: #17664f;
  background: #e8f8f1;
}
html.pcui-preview body.page-planned .project-hero .tag.risk-mid {
  color: #845300;
  background: #fff1c7;
}
html.pcui-preview body.page-planned .project-hero .tag.risk-high {
  color: #a52630;
  background: #ffe2e5;
}
html.pcui-preview body.page-planned .project-hero .project-progress-card {
  color: #fff;
  border-color: rgba(255, 255, 255, .28);
  background: rgba(5, 31, 83, .24);
  backdrop-filter: blur(8px);
}
html.pcui-preview body.page-planned .project-hero .project-progress-card :is(span, strong, small) {
  color: #fff;
}
html.pcui-preview body.page-planned .project-hero .project-progress-card small {
  color: rgba(255, 255, 255, .78);
}
html.pcui-preview body.page-planned .project-hero .progress-track {
  background: rgba(255, 255, 255, .22);
}
html.pcui-preview body.page-planned .project-hero .progress-track i {
  background: linear-gradient(90deg, #55dfb2, #b9ffe9);
}

html.pcui-preview body.ui-p2-system :is(
  .choice-row label span,
  .store-results p,
  .material-store-results,
  .material-store-results > *,
  .photo-box,
  .banner-row,
  .selected-store,
  .material-selected-store,
  .loading,
  .analysis-empty,
  .template-empty,
  .upload-zone,
  .prompt-box,
  .proof-notice
) {
  color: var(--p2-text);
  border-color: var(--p2-line);
  background: var(--p2-surface-2);
}
html.pcui-preview body.ui-p2-system .choice-row input:checked + span {
  color: var(--p2-blue-deep);
  border-color: var(--p2-blue);
  background: var(--p2-blue-soft);
}
html.pcui-preview body.ui-p2-system :is(.choice-row label span, .photo-box, .store-results p) :is(small, em) {
  color: var(--p2-muted);
}

html.pcui-preview body.ui-p2-system :is(.campaign-tabs button, .tab-button, [role="tab"]) {
  color: var(--p2-muted);
  background: transparent;
}
html.pcui-preview body.ui-p2-system :is(.campaign-tabs button.active, .tab-button.active, [role="tab"][aria-selected="true"]) {
  color: var(--p2-blue-deep);
  background: var(--p2-blue-soft);
}

/* Dialogs stay inside the viewport and keep rounded right corners. */
html.pcui-preview body.ui-p2-system dialog {
  width: min(920px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  color: var(--p2-text);
  border: 1px solid var(--p2-line);
  border-radius: 20px;
  background: var(--p2-surface);
  box-shadow: 0 28px 80px rgba(4, 15, 35, .32);
  overflow: hidden;
}
html.pcui-preview body.ui-p2-system dialog > :is(form, div:first-child) {
  max-height: calc(100dvh - 34px);
  overflow: auto;
  scrollbar-gutter: stable;
}
html.pcui-preview body.ui-p2-system dialog::backdrop { background: rgba(3, 14, 30, .58); }
html.pcui-preview body.ui-p2-system :is(.dialog-head, .modal-head, .sheet-head) {
  color: var(--p2-text);
  border-color: var(--p2-line);
  background: var(--p2-surface);
}
html.pcui-preview body.ui-p2-system :is(.actions, .modal-actions, .sheet-actions) {
  border-color: var(--p2-line);
  background: var(--p2-surface);
}

/* Page-specific compaction */
@media (min-width: 901px) {
  html.pcui-preview body.ui-p2-system > main,
  html.pcui-preview body.ui-p2-system > main.page-shell {
    max-width: 1720px;
    min-width: 0;
    padding: 20px 24px 44px;
  }

  html.pcui-preview body.ui-p2-system :is(
    main > header,
    .workflow-header,
    .commerce-header,
    .app-header,
    .topbar,
    .portal-head .portal-head-inner
  ) {
    min-height: 62px;
    margin-bottom: 12px;
    padding: 10px 13px 10px 16px;
    border-radius: 16px;
  }

  html.pcui-preview body.ui-p2-system :is(
    .project-hero,
    .workflow-hero,
    .commerce-hero,
    .campaign-hero,
    .hero,
    .action-card,
    .intro-card,
    .portal-hero
  ) {
    min-height: 0;
    margin-bottom: 12px;
    padding: 18px 22px;
  }
  html.pcui-preview body.ui-p2-system :is(.workflow-hero, .commerce-hero, .campaign-hero, .hero) h2 {
    margin-block: 3px 6px;
    font-size: clamp(22px, 2vw, 30px);
  }

  html.pcui-preview body.ui-p2-system :is(
    .stats,
    .workflow-stats,
    .quick-stats,
    .analysis-metrics,
    .change-summary
  ) > * { min-height: 76px; padding: 13px 16px; border-radius: 14px; }

  html.pcui-preview body.ui-p2-system :is(
    .toolbar,
    .video-toolbar,
    .workflow-toolbar,
    .store-toolbar,
    .proof-toolbar,
    .campaign-toolbar,
    .orders-head,
    .schedule-toolbar
  ) {
    min-height: 54px;
    margin-block: 10px;
    padding: 8px 10px;
    border: 1px solid var(--p2-line);
    border-radius: 14px;
  }

  html.pcui-preview body.page-video .channel-overview {
    grid-template-columns: minmax(280px, .75fr) minmax(0, 1.25fr);
    margin-block: 10px;
    padding: 14px;
    border-radius: 16px;
  }
  html.pcui-preview body.page-video .channel-chart-card { box-shadow: none; }

  html.pcui-preview body.page-ecommerce :is(.skill-launch, .flow-section, .guard-section) { padding: 18px 20px; }
  html.pcui-preview body.page-ecommerce .commerce-grid { gap: 12px; }
  html.pcui-preview body.page-ecommerce .skill-flow { gap: 10px; }

  html.pcui-preview body.page-planned .project-hero { padding: 16px 18px; }
  html.pcui-preview body.page-planned .construction-app { gap: 11px; }
  html.pcui-preview body.page-planned .app-header {
    align-items: center;
    min-height: 0;
    padding-block: 7px;
  }
  html.pcui-preview body.page-planned .header-copy { min-width: 0; }
  html.pcui-preview body.page-planned .title-line { gap: 0; }
  html.pcui-preview body.page-planned .title-line h1 { margin-top: 1px; }
  html.pcui-preview body.page-planned .header-copy > p {
    margin-top: 3px;
    line-height: 1.35;
  }
  html.pcui-preview body.page-planned .back-to-engineering {
    color: var(--p2-blue-deep);
    background: var(--p2-surface);
    text-decoration: none;
  }

  html.pcui-preview body.page-store-intake main { max-width: 1180px; }
  html.pcui-preview body.page-store-intake .form-card { padding: 20px; border-radius: 16px; }

  html.pcui-preview body.page-design-ai {
    display: grid;
    grid-template-columns: 216px minmax(0, 1fr);
  }
  html.pcui-preview body.page-design-ai > main { width: auto; margin: 0; }
}

@media (max-width: 1100px) {
  html.pcui-preview body.ui-p2-system :is(.header-actions, .head-actions, .commerce-user, .top-actions, .portal-actions) { gap: 6px; }
  html.pcui-preview body.ui-p2-system :is(.header-actions, .head-actions, .commerce-user, .top-actions, .portal-actions) > :is(button, a, .user-chip, span:not(.notification-badge)) {
    min-height: 40px;
    padding-inline: 9px;
    font-size: 13px;
  }
  html.pcui-preview body.ui-p2-system .pc-theme-toggle { min-height: 40px; padding-inline: 9px; }
  html.pcui-preview body.ui-p2-system :is(.header-actions, .head-actions, .commerce-user, .top-actions, .portal-actions) .user-chip { max-width: 138px; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 900px) {
  html.pcui-preview body.ui-p2-system { display: block; min-width: 0; }
  html.pcui-preview body.ui-p2-system > aside,
  html.pcui-preview body.ui-p2-system > .sidebar { display: none; }
  html.pcui-preview body.ui-p2-system > main,
  html.pcui-preview body.ui-p2-system > main.page-shell { width: auto; max-width: none; padding: 10px 12px 30px; }

  html.pcui-preview body.ui-p2-system :is(main > header, .workflow-header, .commerce-header, .app-header, .topbar, .mobile-head) {
    min-height: 0;
    margin: 0 0 10px;
    padding: 10px;
    border-radius: 14px;
    gap: 8px;
  }

  html.pcui-preview body.ui-p2-system :is(main > header, .workflow-header, .commerce-header, .app-header, .topbar) {
    align-items: flex-start;
    flex-direction: column;
  }
  html.pcui-preview body.ui-p2-system :is(.header-actions, .head-actions, .commerce-user, .top-actions, .portal-actions) {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }
  html.pcui-preview body.ui-p2-system :is(.header-actions, .head-actions, .commerce-user, .top-actions, .portal-actions)::-webkit-scrollbar { display: none; }
  html.pcui-preview body.ui-p2-system .pc-theme-toggle { width: 40px; min-width: 40px; padding: 0; }
  html.pcui-preview body.ui-p2-system .pc-theme-toggle b { display: none; }

  html.pcui-preview body.ui-p2-system :is(.project-hero, .workflow-hero, .commerce-hero, .campaign-hero, .hero, .action-card, .intro-card, .portal-hero) {
    min-height: 0;
    margin-bottom: 10px;
    padding: 16px;
    border-radius: 16px;
  }
  html.pcui-preview body.ui-p2-system :is(.workflow-owner, .hero-owner, .hero-visual) { display: none; }

  html.pcui-preview body.ui-p2-system :is(.stats, .workflow-stats, .quick-stats, .analysis-metrics, .change-summary) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  html.pcui-preview body.ui-p2-system :is(.stats, .workflow-stats, .quick-stats, .analysis-metrics, .change-summary) > * {
    min-width: 0;
    padding: 11px;
    border-radius: 12px;
  }

  html.pcui-preview body.ui-p2-system :is(.toolbar, .video-toolbar, .workflow-toolbar, .store-toolbar, .proof-toolbar, .campaign-toolbar, .orders-head, .schedule-toolbar) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 9px;
    border: 1px solid var(--p2-line);
    border-radius: 13px;
  }
  html.pcui-preview body.ui-p2-system :is(.toolbar, .video-toolbar, .workflow-toolbar, .store-toolbar, .proof-toolbar, .campaign-toolbar) > * { width: 100%; min-width: 0; }

  html.pcui-preview body.page-video .channel-overview { display: block; padding: 10px; }
  html.pcui-preview body.page-video .channel-chart-card { margin-bottom: 10px; }
  html.pcui-preview body.page-video .table-wrap { overflow-x: auto; }
  html.pcui-preview body.page-video table { min-width: 980px; }

  html.pcui-preview body.page-ecommerce :is(.commerce-grid, .skill-flow) { grid-template-columns: 1fr; }
  html.pcui-preview body.page-ecommerce :is(.skill-launch, .flow-section, .guard-section) { padding: 16px; }

  html.pcui-preview body.page-store-intake .public-head { padding: 8px; }
  html.pcui-preview body.page-store-intake .public-head .head-inner { border-radius: 14px; }
  html.pcui-preview body.page-store-intake main { padding-inline: 12px; }

  html.pcui-preview body.ui-p2-system dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 18px;
  }
  html.pcui-preview body.ui-p2-system dialog > :is(form, div:first-child) { max-height: calc(100dvh - 18px); }
}

@media (max-width: 420px) {
  html.pcui-preview body.ui-p2-system > main,
  html.pcui-preview body.ui-p2-system > main.page-shell { padding-inline: 8px; }
  html.pcui-preview body.ui-p2-system :is(.stats, .workflow-stats, .quick-stats, .analysis-metrics, .change-summary) { grid-template-columns: 1fr 1fr; }
  html.pcui-preview body.ui-p2-system :is(.header-actions, .head-actions, .commerce-user, .top-actions, .portal-actions) > :is(button, a, .user-chip, span:not(.notification-badge)) { font-size: 12px; }
}

/* Planned-page message count follows the workbench badge: red surface, white text. */
html.pcui-preview body.v15-ui.page-planned .header-actions > .global-notice-button.global-header-entry b {
  color: #fff !important;
  background: #ef4444 !important;
}

/* Planned-page typography scale: title / section / body / caption stay consistent. */
html.pcui-preview body.v15-ui.page-planned {
  --planned-font-caption: 12px;
  --planned-font-small: 13px;
  --planned-font-body: 14px;
  --planned-font-card: 15px;
  --planned-font-section: 18px;
  font-size: var(--planned-font-body);
  line-height: 1.55;
}

html.pcui-preview body.v15-ui.page-planned .app-header .eyebrow,
html.pcui-preview body.v15-ui.page-planned .section-heading .eyebrow {
  font-size: var(--planned-font-caption);
}
html.pcui-preview body.v15-ui.page-planned .app-header h1 {
  font-size: clamp(26px, 2vw, 30px);
  line-height: 1.25;
}
html.pcui-preview body.v15-ui.page-planned .header-copy > p {
  font-size: var(--planned-font-small);
}
html.pcui-preview body.v15-ui.page-planned :is(.header-actions, .project-hero-actions, .modal-actions) > :is(button, a),
html.pcui-preview body.v15-ui.page-planned :is(.btn, .icon-btn) {
  font-size: var(--planned-font-body);
}

html.pcui-preview body.v15-ui.page-planned .kpi span { font-size: var(--planned-font-small); }
html.pcui-preview body.v15-ui.page-planned .kpi strong { font-size: 27px; }
html.pcui-preview body.v15-ui.page-planned .kpi small { font-size: var(--planned-font-caption); }

html.pcui-preview body.v15-ui.page-planned .sidebar-head strong { font-size: 16px; }
html.pcui-preview body.v15-ui.page-planned .sidebar-head span,
html.pcui-preview body.v15-ui.page-planned .project-item footer,
html.pcui-preview body.v15-ui.page-planned .project-list-empty {
  font-size: var(--planned-font-caption);
}
html.pcui-preview body.v15-ui.page-planned :is(.project-search input, .project-filters select) {
  font-size: var(--planned-font-body);
}
html.pcui-preview body.v15-ui.page-planned .project-item h3 {
  font-size: var(--planned-font-card);
  line-height: 1.45;
}
html.pcui-preview body.v15-ui.page-planned .project-item p { font-size: var(--planned-font-small); }

html.pcui-preview body.v15-ui.page-planned .project-code-line,
html.pcui-preview body.v15-ui.page-planned .project-hero .tag {
  font-size: var(--planned-font-caption);
}
html.pcui-preview body.v15-ui.page-planned .project-title-block h2 {
  font-size: clamp(24px, 2vw, 28px);
  line-height: 1.3;
}
html.pcui-preview body.v15-ui.page-planned .project-title-block p {
  font-size: var(--planned-font-body);
}
html.pcui-preview body.v15-ui.page-planned .project-progress-card span,
html.pcui-preview body.v15-ui.page-planned .project-progress-card small {
  font-size: var(--planned-font-caption);
}
html.pcui-preview body.v15-ui.page-planned .project-progress-card strong { font-size: 24px; }

html.pcui-preview body.v15-ui.page-planned .section-heading h3,
html.pcui-preview body.v15-ui.page-planned .schedule-toolbar h3 {
  font-size: var(--planned-font-section);
  line-height: 1.35;
}
html.pcui-preview body.v15-ui.page-planned .section-heading .muted,
html.pcui-preview body.v15-ui.page-planned .schedule-toolbar p {
  font-size: var(--planned-font-small);
}
html.pcui-preview body.v15-ui.page-planned .stage .node { font-size: var(--planned-font-caption); }
html.pcui-preview body.v15-ui.page-planned .stage strong { font-size: var(--planned-font-small); }
html.pcui-preview body.v15-ui.page-planned .stage small { font-size: var(--planned-font-caption); }

html.pcui-preview body.v15-ui.page-planned .project-tabs button {
  font-size: var(--planned-font-body);
  line-height: 1.4;
}
html.pcui-preview body.v15-ui.page-planned .project-tabs button span { font-size: 11px; }
html.pcui-preview body.v15-ui.page-planned .panel-title h3 { font-size: 16px; }
html.pcui-preview body.v15-ui.page-planned .panel-title p,
html.pcui-preview body.v15-ui.page-planned .text-btn { font-size: var(--planned-font-small); }

html.pcui-preview body.v15-ui.page-planned .fact span { font-size: var(--planned-font-caption); }
html.pcui-preview body.v15-ui.page-planned .fact strong { font-size: var(--planned-font-body); }
html.pcui-preview body.v15-ui.page-planned .health-row strong,
html.pcui-preview body.v15-ui.page-planned .phase-row strong,
html.pcui-preview body.v15-ui.page-planned .activity-item strong {
  font-size: var(--planned-font-small);
}
html.pcui-preview body.v15-ui.page-planned :is(
  .health-row span,
  .phase-row span,
  .activity-item p,
  .activity-item small,
  .activity-empty,
  .attachment-empty,
  .change-empty,
  .schedule-tip,
  .legend span
) { font-size: var(--planned-font-caption); }

html.pcui-preview body.v15-ui.page-planned .gantt { font-size: var(--planned-font-caption); }
html.pcui-preview body.v15-ui.page-planned .gantt :is(.phase-cell, .task-cell) { font-size: var(--planned-font-small); }
html.pcui-preview body.v15-ui.page-planned .gantt .status-cell { font-size: var(--planned-font-caption); }
html.pcui-preview body.v15-ui.page-planned .change-kpi span,
html.pcui-preview body.v15-ui.page-planned .change-row,
html.pcui-preview body.v15-ui.page-planned .attachment-item small {
  font-size: var(--planned-font-caption);
}
html.pcui-preview body.v15-ui.page-planned .change-kpi strong { font-size: 22px; }
html.pcui-preview body.v15-ui.page-planned .change-row strong,
html.pcui-preview body.v15-ui.page-planned .attachment-item strong { font-size: var(--planned-font-small); }

html.pcui-preview body.v15-ui.page-planned .modal-head h2 { font-size: 22px; }
html.pcui-preview body.v15-ui.page-planned .form-section h3 { font-size: var(--planned-font-card); }
html.pcui-preview body.v15-ui.page-planned .form-grid label { font-size: var(--planned-font-small); }
html.pcui-preview body.v15-ui.page-planned .form-grid :is(input, select, textarea) {
  font-size: var(--planned-font-body);
}

/* New-store project hero: keep the three actions inside the progress block. */
html.pcui-preview body.v15-ui.page-planned .project-hero {
  grid-template-columns: minmax(230px, .8fr) minmax(500px, 1.45fr);
  gap: 12px;
  padding: 12px 16px !important;
}

html.pcui-preview body.v15-ui.page-planned .project-progress-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 9px 11px;
}

html.pcui-preview body.v15-ui.page-planned .project-progress-card > .project-progress-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

html.pcui-preview body.v15-ui.page-planned .project-progress-head > span { white-space: nowrap; }

html.pcui-preview body.v15-ui.page-planned .project-progress-head > strong {
  min-width: 48px;
  text-align: right;
  line-height: 1;
}

html.pcui-preview body.v15-ui.page-planned .project-hero-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

html.pcui-preview body.v15-ui.page-planned .project-hero-actions::-webkit-scrollbar { display: none; }

html.pcui-preview body.v15-ui.page-planned .project-hero-actions .btn {
  flex: 0 0 auto;
  min-height: 34px !important;
  height: 34px !important;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 12px;
}

html.pcui-preview body.v15-ui.page-planned .project-progress-card .progress-track {
  height: 6px;
  margin: 0;
}

html.pcui-preview body.v15-ui.page-planned .project-progress-card > small {
  line-height: 1.25;
}

@media (max-width: 1150px) {
  html.pcui-preview body.v15-ui.page-planned .project-hero {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  html.pcui-preview body.v15-ui.page-planned .project-hero {
    gap: 9px;
    padding: 11px 12px !important;
  }

  html.pcui-preview body.v15-ui.page-planned .project-progress-card > .project-progress-head {
    grid-template-columns: auto auto;
    gap: 7px;
  }

  html.pcui-preview body.v15-ui.page-planned .project-hero-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    order: 3;
    width: 100%;
  }

  html.pcui-preview body.v15-ui.page-planned .project-hero-actions .btn {
    width: 100%;
    min-width: 0;
    padding-inline: 6px;
    font-size: 11px;
  }

  html.pcui-preview body.v15-ui.page-planned .project-progress-head > strong {
    justify-self: end;
  }
}

@media (max-width: 900px) {
  html.pcui-preview body.v15-ui.page-planned {
    --planned-font-caption: 11px;
    --planned-font-small: 12px;
    --planned-font-body: 13px;
    --planned-font-card: 14px;
    --planned-font-section: 17px;
  }
  html.pcui-preview body.v15-ui.page-planned .app-header h1 { font-size: 24px; }
  html.pcui-preview body.v15-ui.page-planned .project-title-block h2 { font-size: 23px; }
  html.pcui-preview body.v15-ui.page-planned .kpi strong { font-size: 24px; }
  html.pcui-preview body.v15-ui.page-planned .project-progress-card strong { font-size: 22px; }
}

/* Engineering stalled list: keep every row readable on the deep-navy theme. */
html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-engineering .repair-overview #stalledList {
  border-color: #29466d;
  background: #0b1b34;
  scrollbar-color: #607899 #0b1b34;
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-engineering .repair-overview .stalled-head {
  color: #b8c7dc;
  border-bottom: 1px solid #355279;
  background: #172d4b;
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-engineering .repair-overview .stalled-row {
  color: #f3f7ff;
  border-top-color: #29466d;
  background: #102441;
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-engineering .repair-overview .stalled-row:hover {
  background: #193554;
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-engineering .repair-overview .stalled-row b {
  color: #f8fbff;
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-engineering .repair-overview .stalled-row span {
  color: #b8c7dc;
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-engineering .repair-overview .stalled-row .rank {
  color: #8fa6c4;
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-engineering .repair-overview .stalled-row .stall-status {
  color: #7dd3fc !important;
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-engineering .repair-overview .stalled-row .stall-priority.is-urgent {
  color: #fda4af !important;
}

/* Engineering repair-category tags: avoid light-theme pills on navy table rows. */
html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-engineering .pc-repair-row .repair-category .chip {
  color: #dbeafe;
  border: 1px solid #3d6491;
  background: #1a385f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-engineering .pc-repair-row:hover .repair-category .chip {
  color: #eff6ff;
  border-color: #5682b5;
  background: #234a78;
}

/* Shared desktop-list typography: align engineering work orders with the task table. */
@media (min-width: 901px) {
  html.pcui-preview body.v15-ui.page-engineering .pc-repair-table-head {
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
  }

  html.pcui-preview body.v15-ui.page-engineering .pc-repair-row > .repair-cell {
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.45;
  }

  html.pcui-preview body.v15-ui.page-engineering .pc-repair-row .repair-store b,
  html.pcui-preview body.v15-ui.page-engineering .pc-repair-row .repair-problem {
    font-size: 14px;
    line-height: 1.45;
  }

  html.pcui-preview body.v15-ui.page-engineering .pc-repair-row .repair-store b { font-weight: 700; }
  html.pcui-preview body.v15-ui.page-engineering .pc-repair-row .repair-problem { font-weight: 400; }

  html.pcui-preview body.v15-ui.page-engineering .pc-repair-row :is(.repair-code, .repair-requester, .repair-date, .repair-open) {
    font-size: 13px;
    line-height: 1.4;
  }

  html.pcui-preview body.v15-ui.page-engineering .pc-repair-row :is(.repair-category .chip, .repair-status .status) {
    font-size: 13px;
    line-height: 1.2;
  }
}

/* Construction Gantt: fill the whole scheduled cell instead of relying on tiny diamond markers. */
html.pcui-preview body.v15-ui.page-planned .gantt td.slot {
  background: var(--p2-surface) !important;
  transition: filter .15s ease, box-shadow .15s ease;
}

html.pcui-preview body.v15-ui.page-planned .gantt td.slot.planned {
  background: #bfdbfe !important;
  box-shadow: inset 0 2px 0 #60a5fa, inset 0 -2px 0 #60a5fa;
}

html.pcui-preview body.v15-ui.page-planned .gantt td.slot.doing {
  background: #fcd34d !important;
  box-shadow: inset 0 2px 0 #f59e0b, inset 0 -2px 0 #f59e0b;
}

html.pcui-preview body.v15-ui.page-planned .gantt td.slot.done {
  background: #6ee7b7 !important;
  box-shadow: inset 0 2px 0 #10b981, inset 0 -2px 0 #10b981;
}

html.pcui-preview body.v15-ui.page-planned .gantt td.slot.delay {
  background: #fda4af !important;
  box-shadow: inset 0 2px 0 #ef4444, inset 0 -2px 0 #ef4444;
}

html.pcui-preview body.v15-ui.page-planned .gantt td.slot:is(.planned, .doing, .done, .delay):hover {
  filter: brightness(.92) saturate(1.12);
}

html.pcui-preview body.v15-ui.page-planned .gantt td.slot.key {
  outline: 2px solid #f97316;
  outline-offset: -3px;
}

html.pcui-preview body.v15-ui.page-planned .gantt td.slot.key::after { display: none; }

html.pcui-preview body.v15-ui.page-planned .legend i.planned { background: #60a5fa; }
html.pcui-preview body.v15-ui.page-planned .legend i.doing { background: #f59e0b; }
html.pcui-preview body.v15-ui.page-planned .legend i.done { background: #10b981; }
html.pcui-preview body.v15-ui.page-planned .legend i.delayed { background: #ef4444; }

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-planned .gantt td.slot {
  background: #102441 !important;
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-planned .gantt td.slot.planned {
  background: #2563eb !important;
  box-shadow: inset 0 2px 0 #60a5fa, inset 0 -2px 0 #60a5fa;
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-planned .gantt td.slot.doing {
  background: #d97706 !important;
  box-shadow: inset 0 2px 0 #fbbf24, inset 0 -2px 0 #fbbf24;
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-planned .gantt td.slot.done {
  background: #059669 !important;
  box-shadow: inset 0 2px 0 #34d399, inset 0 -2px 0 #34d399;
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-planned .gantt td.slot.delay {
  background: #dc2626 !important;
  box-shadow: inset 0 2px 0 #fb7185, inset 0 -2px 0 #fb7185;
}

/* Project list keeps wheel/touch scrolling but does not show the native arrow scrollbar control. */
html.pcui-preview body.v15-ui.page-planned .project-list {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

html.pcui-preview body.v15-ui.page-planned .project-list::-webkit-scrollbar,
html.pcui-preview body.v15-ui.page-planned .project-list::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

/* Engineering repair table: keep long status labels on one line. */
@media (min-width: 1261px) {
  html.pcui-preview body.v15-ui.page-engineering .pc-repair-table-head,
  html.pcui-preview body.v15-ui.page-engineering .pc-repair-row {
    grid-template-columns: 132px minmax(130px, .85fr) minmax(220px, 1.55fr) minmax(140px, 1fr) 112px 92px 104px 66px;
  }
}

@media (min-width: 1021px) and (max-width: 1260px) {
  html.pcui-preview body.v15-ui.page-engineering .pc-repair-table-head,
  html.pcui-preview body.v15-ui.page-engineering .pc-repair-row {
    grid-template-columns: 124px 132px minmax(210px, 1fr) 112px 104px 62px;
  }
}

@media (min-width: 901px) and (max-width: 1020px) {
  html.pcui-preview body.v15-ui.page-engineering .pc-repair-table-head,
  html.pcui-preview body.v15-ui.page-engineering .pc-repair-row {
    grid-template-columns: 116px 124px minmax(190px, 1fr) 112px 58px;
  }
}

@media (min-width: 901px) {
  html.pcui-preview body.v15-ui.page-engineering .pc-repair-row .repair-status {
    overflow: visible;
    white-space: nowrap;
  }

  html.pcui-preview body.v15-ui.page-engineering .pc-repair-row .repair-status .status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
  }
}

/* Video header: separate account controls from data actions. */
html.pcui-preview body.v15-ui.page-video > main > .video-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
}

html.pcui-preview body.v15-ui.page-video .video-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

html.pcui-preview body.v15-ui.page-video .video-header-top > div:first-child {
  min-width: 0;
}

html.pcui-preview body.v15-ui.page-video .video-header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid var(--p2-line);
}

html.pcui-preview body.v15-ui.page-video .video-header-tools > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  height: 42px;
  margin: 0;
  padding: 0 15px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

html.pcui-preview body.v15-ui.page-video .video-header-tools > :is(#uploadVideo, #newVideo) {
  color: #fff;
  border-color: var(--pc-blue, #336fe8);
  background: var(--pc-blue, #336fe8);
  box-shadow: 0 8px 18px rgba(51, 111, 232, .2);
}

html.pcui-preview body.v15-ui.page-video .video-header-tools > :is(#uploadVideo, #newVideo):hover {
  color: #fff;
  border-color: var(--pc-blue-deep, #2456b8);
  background: var(--pc-blue-deep, #2456b8);
  transform: translateY(-1px);
}

html.pcui-preview body.v15-ui.page-video .video-header-tools > #uploadVideo[hidden] {
  display: none;
}

html.pcui-preview body.v15-ui.page-video .video-header-tools .planned-button > span {
  color: var(--p2-muted);
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 1120px) {
  html.pcui-preview body.v15-ui.page-video .video-header-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  html.pcui-preview body.v15-ui.page-video .video-header-top > .header-actions,
  html.pcui-preview body.v15-ui.page-video .video-header-tools {
    justify-content: flex-start;
  }

  html.pcui-preview body.v15-ui.page-video .video-header-tools {
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  html.pcui-preview body.v15-ui.page-video .video-header-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html.pcui-preview body.v15-ui.page-video .video-header-tools > button {
    width: 100%;
    min-width: 0;
    padding-inline: 9px;
    font-size: 12px;
  }
}

/* Video summary: keep the all-platform total as the visual centre. */
html.pcui-preview body.v15-ui.page-video #videoStats .video-total-stat {
  align-content: center;
  justify-items: center;
  text-align: center;
  border-color: color-mix(in srgb, var(--p2-blue) 42%, var(--p2-line));
  background: linear-gradient(145deg, color-mix(in srgb, var(--p2-blue-soft) 72%, var(--p2-surface)), var(--p2-surface));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--p2-blue) 14%, transparent);
}

html.pcui-preview body.v15-ui.page-video #videoStats .video-total-stat b {
  color: var(--p2-blue-deep);
  font-size: clamp(22px, 2.25vw, 38px);
  line-height: 1.05;
}

html.pcui-preview body.v15-ui.page-video #videoStats .video-total-stat span {
  color: var(--p2-blue-deep);
  font-weight: 700;
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-video #videoStats .video-total-stat {
  border-color: #4f7ff0;
  background: linear-gradient(145deg, #173868, #102441);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .24);
}

html.pcui-preview[data-pc-theme="navy"] body.v15-ui.page-video #videoStats .video-total-stat :is(b, span) {
  color: #dbeafe;
}

/* Compact channel summary: replace ambiguous progress bars with ranked rows. */
html.pcui-preview body.v15-ui.page-video .channel-overview {
  grid-template-columns: minmax(280px, .62fr) minmax(0, 1.38fr);
  gap: 10px;
  padding: 10px !important;
}

html.pcui-preview body.v15-ui.page-video :is(.channel-chart-card, .channel-overview > div:last-child) {
  padding: 12px;
}

html.pcui-preview body.v15-ui.page-video .donut-wrap {
  gap: 14px;
  margin-top: 10px;
}

html.pcui-preview body.v15-ui.page-video .donut {
  flex-basis: 122px;
  height: 122px;
}

html.pcui-preview body.v15-ui.page-video .donut::after {
  width: 74px;
  height: 74px;
}

html.pcui-preview body.v15-ui.page-video .donut b {
  font-size: 15px;
}

html.pcui-preview body.v15-ui.page-video .chart-legend {
  gap: 6px;
  min-width: 116px;
}

html.pcui-preview body.v15-ui.page-video .chart-legend > div {
  grid-template-columns: 9px 46px auto;
  gap: 4px;
}

html.pcui-preview body.v15-ui.page-video .channel-summaries {
  gap: 8px;
  margin-top: 8px;
}

html.pcui-preview body.v15-ui.page-video .channel-card {
  padding: 10px;
}

html.pcui-preview body.v15-ui.page-video .account-ranking {
  gap: 0;
  max-height: 128px;
  margin-top: 7px;
}

html.pcui-preview body.v15-ui.page-video .account-row {
  grid-template-columns: 20px minmax(0, 1fr) auto auto;
  gap: 6px;
  min-height: 32px;
  padding: 5px 0;
  border-top: 1px solid color-mix(in srgb, var(--p2-line) 72%, transparent);
  font-size: 11px;
}

html.pcui-preview body.v15-ui.page-video .account-row > em {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--p2-muted);
  background: var(--p2-surface-2);
  border-radius: 6px;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
}

html.pcui-preview body.v15-ui.page-video .account-row > span {
  min-width: 0;
}

html.pcui-preview body.v15-ui.page-video .account-row > b,
html.pcui-preview body.v15-ui.page-video .account-row > small {
  white-space: nowrap;
}

html.pcui-preview body.v15-ui.page-video .account-row > small {
  grid-column: auto;
  margin: 0;
  color: var(--p2-muted);
  text-align: right;
}

@media (max-width: 1180px) and (min-width: 901px) {
  html.pcui-preview body.v15-ui.page-video .channel-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  html.pcui-preview body.v15-ui.page-video .channel-summaries {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
