/*
 * PC UI preview 2026-08-23
 * Activated only with ?pcui=1 and only above 900px.
 * The production routes keep their existing layout without the query flag.
 */

@media (min-width: 901px) {
  html.pcui-preview {
    --pc-bg: #f2f5fb;
    --pc-surface: #fff;
    --pc-ink: #17345c;
    --pc-muted: #6f7f98;
    --pc-line: #dde5f1;
    --pc-blue: #3976f6;
    --pc-shadow: 0 8px 28px rgba(23, 52, 92, .07);
    --pc-shadow-hover: 0 14px 34px rgba(23, 52, 92, .12);
  }

  html.pcui-preview body.v15-ui {
    grid-template-columns: 232px minmax(0, 1fr);
    color: var(--pc-ink);
    background:
      radial-gradient(circle at 92% 3%, rgba(57, 118, 246, .09), transparent 26rem),
      var(--pc-bg);
  }

  html.pcui-preview body.v15-ui > aside {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    overflow-y: auto;
    padding: 24px 17px;
    gap: 22px;
    box-shadow: 10px 0 32px rgba(14, 40, 78, .08);
  }

  html.pcui-preview body.v15-ui > main {
    width: 100%;
    max-width: 1760px;
    min-width: 0;
    padding: 28px 34px 56px;
    overflow: visible;
  }

  /* Authenticated workbenches should use the available desktop canvas. Public
     submission pages intentionally do not carry .page-internal. */
  html.pcui-preview body.v15-ui.page-internal > main {
    max-width: none;
  }

  html.pcui-preview body.v15-ui > main > header,
  html.pcui-preview body.v15-ui .workflow-header {
    min-height: 54px;
    margin-bottom: 14px;
  }

  html.pcui-preview body.v15-ui > main > header h1,
  html.pcui-preview body.v15-ui .workflow-header h1 {
    font-size: 27px;
    letter-spacing: -.02em;
  }

  html.pcui-preview body.v15-ui :is(button, input, select, textarea) {
    transition: border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
  }

  html.pcui-preview body.v15-ui :is(.primary, .secondary, .logout-button, .notification-button, .text-button, .workflow-card-foot button) {
    min-height: 38px;
    border-radius: 10px;
  }

  html.pcui-preview body.v15-ui::after {
    content: "PC UI 预览";
    position: fixed;
    z-index: 60;
    right: 18px;
    bottom: 16px;
    padding: 7px 11px;
    color: #fff;
    background: rgba(23, 52, 92, .86);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(23, 52, 92, .18);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    pointer-events: none;
    backdrop-filter: blur(10px);
  }

  /* Workbench: keep the overview visual, but remove unnecessary vertical bulk. */
  html.pcui-preview body.page-workbench .workspace-intro {
    min-height: 0;
    padding: 22px 24px;
    border: 0;
    border-radius: 20px;
    box-shadow: var(--pc-shadow);
  }

  html.pcui-preview body.page-workbench .workspace-copy h2 {
    margin: 8px 0 5px;
    font-size: clamp(24px, 2vw, 32px);
  }

  html.pcui-preview body.page-workbench .personal-summary {
    gap: 8px;
  }

  html.pcui-preview body.page-workbench .personal-metric {
    min-height: 68px;
    padding: 12px 14px;
    border-radius: 14px;
  }

  html.pcui-preview body.page-workbench .pulse-panel,
  html.pcui-preview body.page-workbench .module-panel,
  html.pcui-preview body.page-workbench .line-panel {
    border-color: var(--pc-line);
    border-radius: 18px;
    box-shadow: 0 4px 18px rgba(23, 52, 92, .045);
  }

  html.pcui-preview body.page-workbench .pulse-panel {
    padding: 20px;
  }

  html.pcui-preview body.page-workbench .pulse-heading {
    margin-bottom: 14px;
  }

  html.pcui-preview body.page-workbench .pulse-card {
    border-radius: 15px;
    box-shadow: none;
  }

  html.pcui-preview body.page-workbench .task-section-heading {
    margin: 26px 0 12px;
  }

  html.pcui-preview body.page-workbench .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 12px;
  }

  html.pcui-preview body.page-workbench .stat {
    min-height: 72px;
    padding: 12px 15px;
    border-radius: 14px;
    box-shadow: none;
  }

  html.pcui-preview body.page-workbench .stat b {
    font-size: 24px;
    line-height: 1;
  }

  html.pcui-preview body.page-workbench .line-panel {
    padding: 14px 16px;
  }

  html.pcui-preview body.page-workbench .line-buttons {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 1px 1px 5px;
    scrollbar-width: thin;
  }

  html.pcui-preview body.page-workbench .line-button {
    flex: 0 0 176px;
    min-height: 58px;
    padding: 9px 11px;
    border-radius: 12px;
  }

  html.pcui-preview body.page-workbench .line-button:first-child {
    flex-basis: 148px;
  }

  html.pcui-preview body.page-workbench .line-button small {
    margin-top: 3px;
    font-size: 12px;
  }

  html.pcui-preview body.page-workbench .toolbar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 150px 168px auto auto auto;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
    padding: 12px;
    border: 1px solid var(--pc-line);
    border-radius: 15px;
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 4px 16px rgba(23, 52, 92, .04);
    backdrop-filter: blur(10px);
  }

  html.pcui-preview body.page-workbench .toolbar :is(input, select, button, .sla-toggle) {
    min-width: 0;
    min-height: 40px;
  }

  html.pcui-preview body.page-workbench .toolbar .sla-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
  }

  /* Compact hanging rows: category is shown by the business-line color rail. */
  html.pcui-preview body.page-workbench .task-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  html.pcui-preview body.page-workbench .task {
    --pc-row-accent: #8ca0bf;
    display: grid;
    grid-template-columns: minmax(260px, 1.15fr) minmax(330px, 1.7fr) auto;
    align-items: center;
    gap: 16px;
    min-height: 76px;
    padding: 11px 13px 11px 16px;
    border: 1px solid var(--pc-line);
    border-left: 5px solid var(--pc-row-accent);
    border-top-width: 1px !important;
    border-radius: 14px;
    background: var(--pc-surface);
    box-shadow: 0 3px 13px rgba(23, 52, 92, .045);
  }

  html.pcui-preview body.page-workbench .task.business-01 { --pc-row-accent: #3976f6; }
  html.pcui-preview body.page-workbench .task.business-02 { --pc-row-accent: #8b5cf6; }
  html.pcui-preview body.page-workbench .task.business-03 { --pc-row-accent: #f59e0b; }
  html.pcui-preview body.page-workbench .task.business-04 { --pc-row-accent: #ec4899; }
  html.pcui-preview body.page-workbench .task.business-05 { --pc-row-accent: #06a9c4; }
  html.pcui-preview body.page-workbench .task.business-06 { --pc-row-accent: #10b981; }

  html.pcui-preview body.page-workbench .task:hover {
    border-color: color-mix(in srgb, var(--pc-row-accent) 38%, var(--pc-line));
    border-left-color: var(--pc-row-accent);
    box-shadow: var(--pc-shadow-hover);
    transform: translateX(3px);
  }

  html.pcui-preview body.page-workbench .task-head {
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  html.pcui-preview body.page-workbench .task-code {
    margin: 0 0 3px;
    font-size: 12px;
  }

  html.pcui-preview body.page-workbench .task .title {
    display: block;
    overflow: hidden;
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.pcui-preview body.page-workbench .task .edit-hint {
    display: none;
  }

  html.pcui-preview body.page-workbench .task .meta {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
    gap: 6px;
  }

  html.pcui-preview body.page-workbench .task .tag {
    flex: 0 1 auto;
    max-width: 180px;
    overflow: hidden;
    padding: 5px 8px;
    border-radius: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.pcui-preview body.page-workbench .task .owner-tag {
    max-width: 150px;
  }

  html.pcui-preview body.page-workbench .task .quick {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 7px;
    margin: 0;
    padding: 0;
  }

  html.pcui-preview body.page-workbench .task .quick button {
    min-width: 68px;
    min-height: 36px;
    padding: 6px 10px;
    white-space: nowrap;
  }

  html.pcui-preview body.page-workbench .task-select {
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
  }

  html.pcui-preview body.page-workbench.select-mode .task .quick,
  html.pcui-preview body.page-workbench.planning-mode .task .quick {
    padding-right: 34px;
  }

  /* Pagination is one stable toolbar on desktop; no wrapped labels or drifting buttons. */
  html.pcui-preview body.page-workbench .pagination {
    display: grid;
    grid-template-columns: auto minmax(240px, auto) auto auto;
    justify-content: end;
    align-items: center;
    gap: 8px;
    min-height: 62px;
    margin-top: 10px;
    padding: 10px 0;
  }

  html.pcui-preview body.page-workbench .pagination > * {
    min-width: 0;
    margin: 0;
  }

  html.pcui-preview body.page-workbench .pagination > span {
    padding: 0 10px;
    text-align: center;
    white-space: nowrap;
  }

  html.pcui-preview body.page-workbench .pagination button {
    min-width: 86px;
    min-height: 38px;
    padding: 7px 13px;
    border-radius: 10px;
  }

  html.pcui-preview body.page-workbench .pagination label {
    display: inline-flex;
    grid-template-columns: none;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
  }

  html.pcui-preview body.page-workbench .pagination :is(input, select) {
    min-height: 36px;
  }

  /* Designer system: same card language, but a denser desktop operations list. */
  html.pcui-preview body.page-design .workflow-main {
    background: transparent;
  }

  html.pcui-preview body.page-design .workflow-hero {
    grid-template-columns: minmax(0, 1.7fr) minmax(260px, .7fr);
    min-height: 142px;
    margin: 14px 0;
    padding: 20px 22px;
    border-radius: 19px;
    background:
      radial-gradient(circle at 90% 20%, rgba(236, 72, 153, .38), transparent 20rem),
      linear-gradient(128deg, #17345f, #315c9b);
    box-shadow: var(--pc-shadow);
  }

  html.pcui-preview body.page-design .workflow-hero h2 {
    margin: 10px 0 5px;
    font-size: 25px;
  }

  html.pcui-preview body.page-design .workflow-stats {
    gap: 9px;
    margin: 12px 0;
  }

  html.pcui-preview body.page-design .workflow-stat {
    min-height: 70px;
    padding: 11px 14px;
    border-top-width: 1px;
    border-left: 4px solid var(--workflow);
    border-radius: 13px;
    box-shadow: none;
  }

  html.pcui-preview body.page-design .workflow-stat b {
    font-size: 23px;
    line-height: 1;
  }

  html.pcui-preview body.page-design .workflow-toolbar {
    position: sticky;
    top: 10px;
    z-index: 8;
    grid-template-columns: 150px 168px 168px minmax(260px, 1fr) auto;
    gap: 8px;
    margin: 12px 0;
    padding: 11px;
    border: 1px solid var(--pc-line);
    border-radius: 15px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 7px 22px rgba(23, 52, 92, .07);
    backdrop-filter: blur(12px);
  }

  html.pcui-preview body.page-design .workflow-board {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding-bottom: 32px;
  }

  html.pcui-preview body.page-design .workflow-card {
    display: grid;
    grid-template-columns: minmax(240px, 1.05fr) minmax(210px, .9fr) minmax(300px, 1.3fr) minmax(120px, auto);
    align-items: center;
    gap: 16px;
    min-height: 84px;
    padding: 12px 13px 12px 16px;
    border: 1px solid var(--pc-line);
    border-top-width: 1px;
    border-left: 5px solid var(--workflow);
    border-radius: 14px;
    box-shadow: 0 3px 13px rgba(23, 52, 92, .045);
  }

  html.pcui-preview body.page-design .workflow-card:hover {
    border-color: color-mix(in srgb, var(--workflow) 36%, var(--pc-line));
    border-left-color: var(--workflow);
    box-shadow: var(--pc-shadow-hover);
    transform: translateX(3px);
  }

  html.pcui-preview body.page-design .workflow-card-head {
    min-width: 0;
  }

  html.pcui-preview body.page-design .workflow-card-head > div {
    min-width: 0;
  }

  html.pcui-preview body.page-design .workflow-card h3 {
    display: block;
    overflow: hidden;
    margin-top: 3px;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.pcui-preview body.page-design .workflow-card-copy {
    display: -webkit-box;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    color: #61718a;
    font-size: 12px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  html.pcui-preview body.page-design .workflow-tags {
    display: flex;
    flex-wrap: wrap;
    max-height: 52px;
    overflow: hidden;
    gap: 5px;
  }

  html.pcui-preview body.page-design .workflow-tag {
    max-width: 155px;
    padding: 5px 7px;
    font-size: 12px;
  }

  html.pcui-preview body.page-design .workflow-card-foot {
    display: grid;
    justify-items: end;
    gap: 5px;
    padding: 0;
    border: 0;
  }

  html.pcui-preview body.page-design .workflow-card-foot small {
    max-width: 150px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.pcui-preview body.page-design .workflow-card-foot button {
    min-width: 92px;
    min-height: 36px;
    padding: 6px 11px;
    font-weight: 800;
  }

  html.pcui-preview body.page-design .list-pagination[hidden] {
    display: none !important;
  }

  html.pcui-preview body.page-design .list-pagination:not([hidden]) {
    display: grid;
    grid-template-columns: auto minmax(220px, auto) auto auto auto;
    justify-content: end;
    align-items: center;
    gap: 8px;
    min-height: 60px;
    padding: 10px 0;
  }

  html.pcui-preview body.page-design .list-pagination :is(button, input, select) {
    min-height: 38px;
    border-radius: 10px;
  }

  html.pcui-preview body.page-design .list-pagination :is(.page-summary, label) {
    white-space: nowrap;
  }

  @media (max-width: 1260px) {
    html.pcui-preview body.page-workbench .toolbar {
      grid-template-columns: minmax(240px, 1fr) 140px 160px repeat(3, auto);
    }

    html.pcui-preview body.page-workbench .task {
      grid-template-columns: minmax(220px, 1fr) minmax(250px, 1.35fr) auto;
      gap: 11px;
    }

    html.pcui-preview body.page-workbench .task .meta :is(.project-tag, .line-tag) {
      display: none;
    }

    html.pcui-preview body.page-design .workflow-card {
      grid-template-columns: minmax(220px, 1fr) minmax(190px, .8fr) minmax(230px, 1fr) auto;
      gap: 11px;
    }

    html.pcui-preview body.page-design .workflow-tag:nth-child(2),
    html.pcui-preview body.page-design .workflow-tag:nth-child(3) {
      display: none;
    }
  }

  @media (max-width: 1100px) {
    html.pcui-preview body.v15-ui {
      grid-template-columns: 210px minmax(0, 1fr);
    }

    html.pcui-preview body.v15-ui > main {
      padding-inline: 24px;
    }

    html.pcui-preview body.page-workbench .toolbar {
      grid-template-columns: minmax(220px, 1fr) 140px 160px;
    }

    html.pcui-preview body.page-workbench .toolbar > :nth-child(n+4) {
      width: 100%;
    }

    html.pcui-preview body.page-workbench .task {
      grid-template-columns: minmax(230px, 1fr) auto;
      min-height: 92px;
    }

    html.pcui-preview body.page-workbench .task .meta {
      grid-column: 1 / -1;
      grid-row: 2;
    }

    html.pcui-preview body.page-workbench .task .quick {
      grid-column: 2;
      grid-row: 1;
    }

    html.pcui-preview body.page-design .workflow-toolbar {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    html.pcui-preview body.page-design .workflow-toolbar input {
      grid-column: 1 / 3;
    }

    html.pcui-preview body.page-design .workflow-toolbar > span {
      grid-column: 3;
    }

    html.pcui-preview body.page-design .workflow-card {
      grid-template-columns: minmax(230px, 1fr) minmax(220px, 1fr) auto;
      min-height: 104px;
    }

    html.pcui-preview body.page-design .workflow-tags {
      grid-column: 1 / 3;
      grid-row: 2;
    }

    html.pcui-preview body.page-design .workflow-card-foot {
      grid-column: 3;
      grid-row: 1 / 3;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  html.pcui-preview body.v15-ui *,
  html.pcui-preview body.v15-ui *::before,
  html.pcui-preview body.v15-ui *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
