/* 1080p / 小高度屏：进一步压缩 AI 助手卡片高度 (排除手机端) */
@media (max-height: 980px) and (min-width: 761px) {
  .workbench {
    --hero-padding-top: 20px;
    --hero-padding-bottom: 20px;
    --hero-title-size: 28px;
    --hero-copy-gap: 5px;
    --hero-title-bottom-gap: 14px;
    --composer-min-height: 108px;
    --composer-textarea-height: 48px;
    --composer-padding-block: 10px;
    --quick-prompts-gap-top: 8px;
    --capability-row-height: 96px;
    gap: 9px;
  }

  .assistant-hero {
    --assistant-art-width: min(560px, 42vw);
    padding: var(--hero-padding-top) 18px var(--hero-padding-bottom) 44px;
  }

  .assistant-copy p {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 0;
  }

  .assistant-composer textarea {
    font-size: 15px;
  }

  .composer-icon-button,
  .composer-related-button,
  .composer-send-button {
    height: 32px;
  }

  .composer-send-button {
    width: 50px;
  }
}

/* 2K 宽屏但内容区仍偏高时，略收紧（避免 hero 独占过多纵向空间） */
@media (min-width: 1920px) and (max-height: 1100px) {
  .workbench {
    --hero-padding-top: 22px;
    --hero-padding-bottom: 22px;
    --hero-title-size: 29px;
    --composer-min-height: 114px;
    --composer-textarea-height: 50px;
    --capability-row-height: 100px;
  }
}

@media (max-width: 1440px) {
  .workbench {
    grid-template-rows: auto var(--capability-row-height) minmax(0, 1fr);
    gap: 10px;
  }

  .assistant-hero {
    --assistant-art-width: min(620px, 44vw);
    --assistant-art-x: 48px;
    --assistant-art-y: -10px;
    padding: var(--hero-padding-top) 18px var(--hero-padding-bottom) 44px;
  }

  .assistant-copy {
    width: min(1040px, 92%);
  }

  .assistant-copy h1 {
    font-size: 33px;
  }

  .capability-grid--privileged {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .capability-grid--standard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .capability-card {
    padding: 17px 12px 17px 22px;
  }

  .capability-copy {
    padding-left: 14px;
  }

  .workbench-content-grid {
    grid-template-columns: minmax(300px, 0.92fr) minmax(480px, 1.34fr) minmax(270px, 0.76fr);
    gap: 14px;
  }

  .workbench-card {
    padding: 10px 12px;
  }

  .progress-row {
    grid-template-columns: minmax(126px, 0.9fr) minmax(270px, 1.35fr) minmax(86px, auto);
    gap: 12px;
  }
}

@media (max-width: 1180px) {
  .workbench {
    height: auto;
    min-height: 100%;
    grid-template-rows: auto auto auto;
    gap: 12px;
  }

  .assistant-hero {
    --assistant-art-width: min(540px, 50vw);
    --assistant-art-x: 36px;
    --assistant-art-y: -8px;
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.6) 56%, rgba(255, 255, 255, 0.22) 100%),
      linear-gradient(135deg, rgba(255, 255, 255, 0.7) 0%, color-mix(in srgb, var(--workbench-primary-soft) 40%, rgba(255, 255, 255, 0.5)) 58%, color-mix(in srgb, var(--workbench-secondary) 15%, rgba(255, 255, 255, 0.1)) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .assistant-copy {
    width: min(820px, 92%);
  }

  .capability-grid--privileged {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .capability-grid--standard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench-content-grid {
    grid-template-columns: 1fr;
  }

  .side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .workbench {
    height: auto;
    grid-template-rows: none;
    gap: 14px;
    overflow: visible;
  }

  .assistant-hero {
    min-height: auto;
    --assistant-art-width: min(380px, 78vw);
    --assistant-art-x: 12px;
    --assistant-art-y: -6px;
    padding: 24px 18px 24px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.7) 100%),
      color-mix(in srgb, var(--workbench-primary-soft) 22%, rgba(255, 255, 255, 0.5));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .assistant-copy {
    width: 100%;
  }

  .assistant-copy h1 {
    max-width: 320px;
    font-size: 28px;
  }

  .assistant-composer {
    padding: 14px;
  }

  .composer-toolbar {
    gap: 8px;
    flex-wrap: wrap;
  }

  .composer-count {
    order: 4;
    width: 100%;
    margin-left: 0;
  }

  .composer-send-button {
    margin-left: auto;
  }

  .capability-grid,
  .capability-grid--privileged,
  .capability-grid--standard,
  .side-column {
    grid-template-columns: 1fr;
  }

  .todo-row,
  .progress-row {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .todo-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .todo-meta,
  .progress-result {
    justify-items: start;
  }

  .todo-meta {
    grid-column: 2;
  }

  .progress-steps {
    width: 100%;
  }
}

/* 针对低高度视口（如低于 840px，包含大部分笔记本 768px 高度），解除 height: 100% 限制，让内容流式高度，防止纵向元素被过度压扁 (排除手机端) */
@media (max-height: 840px) and (min-width: 761px) {
  .workbench {
    height: auto;
    min-height: 100%;
    grid-template-rows: auto var(--capability-row-height) auto;
  }
}

/* 手机端/窄屏自适应优化 (560px 以下) */
@media (max-width: 560px) {
  /* 常用提问横向滑动展示，避免折行过多撑爆高度 */
  .quick-prompts {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    gap: 8px;
    padding-bottom: 2px;
  }

  .quick-prompts span {
    display: none; /* 隐藏“常用提问：”前缀，以最大化利用横向空间 */
  }

  .quick-prompts button {
    flex-shrink: 0;
    padding: 0 10px;
    min-height: 26px;
    font-size: 12px;
  }

  /* 隐藏常用提问横滑条的原生滚动条，保持精致视觉 */
  .quick-prompts::-webkit-scrollbar {
    display: none;
  }

  .assistant-hero {
    --assistant-art-width: min(280px, 70vw);
    padding: 20px 14px 20px;
  }
}

/* 手机端/窄屏自适应优化 (480px 以下) */
@media (max-width: 480px) {
  /* 输入框更小巧 */
  .assistant-composer {
    padding: 10px 12px;
    min-height: 94px;
  }

  .assistant-composer textarea {
    font-size: 14px;
    height: 42px;
    min-height: 42px;
  }

  .composer-toolbar {
    gap: 6px;
  }

  .composer-icon-button,
  .composer-related-button,
  .composer-send-button {
    height: 30px;
    font-size: 13px;
  }

  .composer-icon-button {
    width: 30px;
  }

  .composer-related-button {
    padding: 0 10px;
    gap: 4px;
  }

  .composer-send-button {
    width: 46px;
  }

  /* 限制上传的附件文件芯片的最大宽度，防止溢出 */
  .assistant-file-chip {
    max-width: 110px;
  }

  /* AI 财务助手卡片尺寸更精致 */
  .capability-card {
    padding: 12px 10px 12px 14px;
    gap: 8px;
  }

  .capability-icon {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }

  .capability-copy {
    padding-left: 6px;
    gap: 2px;
  }

  .capability-copy strong {
    font-size: 13px;
  }

  .capability-copy small {
    font-size: 11px;
  }

  /* 我的待办列表项更精致 */
  .todo-row {
    padding: 5px 0;
    gap: 6px;
  }

  .todo-copy strong {
    font-size: 12.5px;
  }

  .todo-copy small {
    font-size: 11px;
  }

  .todo-status {
    font-size: 11px;
    min-height: 18px;
    padding: 0 5px;
  }

  .todo-meta small {
    font-size: 10.5px;
  }

  /* 重点优化：费用进度行的网格区域（Grid Area）双行重构 */
  .progress-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "identity result"
      "steps steps";
    gap: 8px;
    padding: 10px 0;
    align-items: center;
  }

  .progress-identity {
    grid-area: identity;
    width: 100%;
  }

  .progress-identity strong {
    font-size: 12.5px;
  }

  .progress-identity small {
    font-size: 11px;
  }

  .progress-result {
    grid-area: result;
    width: 100%;
    justify-items: end; /* 金额和状态右对齐 */
    gap: 2px;
  }

  .progress-result strong {
    font-size: 12.5px;
  }

  .progress-status {
    font-size: 11px;
    min-height: 18px;
    padding: 0 5px;
  }

  .progress-steps {
    grid-area: steps;
    width: 100%;
    margin-top: 4px;
  }

  /* 缩小步骤图图标与连线 */
  .progress-step i {
    width: 14px;
    height: 14px;
    font-size: 10px;
  }

  .progress-step small {
    font-size: 9px;
  }

  .progress-step::before {
    top: 7px;
  }

  /* 侧边分析栏优化 */
  .side-panel {
    padding: 8px 10px;
    gap: 4px;
  }

  .insight-metric-row,
  .insight-profile-card {
    padding: 6px 8px;
    gap: 6px;
  }

  .insight-metric-label,
  .insight-profile-label {
    font-size: 11.5px;
  }

  .insight-metric-value,
  .insight-profile-value {
    font-size: 13.5px;
  }
}
