/* Desktop layout for 1280x1024, 1920x1080, and 2560x1600. */

/* ---- 1280x1024 and similar mid-width desktops ---- */
@media (min-width: 1181px) and (max-width: 1360px) {
  body.ops-body .shell.ops-app[data-sidebar-mode="full"] {
    grid-template-columns: 200px minmax(0, 1fr) !important;
  }

  body.ops-body .shell.ops-app[data-sidebar-mode="full"] .brand-name {
    font-size: 15px !important;
    white-space: nowrap;
  }

  body.ops-body #opsMain.content,
  body.ops-body .ops-content-scroll {
    padding: 16px 16px 20px !important;
  }

  body.ops-body .ops-topbar {
    padding-left: 14px !important;
    padding-right: 14px !important;
    flex-wrap: nowrap !important;
    min-height: 56px !important;
  }

  body.ops-body #currentUserLabel {
    display: inline-block;
    max-width: 5.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.ops-body .kpi-card.metric,
  body.ops-body .metric {
    padding: 16px 16px 14px !important;
  }
}

/* 2026-09-29: 1280x1024 (and other <=1440 desktops) keep the same
   side-by-side form as 1920/2560 for 品类对比 / 提成租金 / 销售客车流趋势 / 租户销售.
   Narrow work areas still stack via @container ops-content (max-width: 980px). */
@media (min-width: 901px) and (max-width: 1440px) {
  body.ops-body .budget-main {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.ops-body .ranking-panel table,
  body.ops-body .period-panel table {
    min-width: 0 !important;
  }

  body.ops-body .ranking-panel td,
  body.ops-body .period-panel td {
    white-space: normal !important;
  }
}

/* 2560x1600: use the full work area. Cap only on extreme ultrawide. */
@media (min-width: 2500px) and (max-width: 2999px) {
  body.ops-body #opsMain.content,
  body.ops-body .ops-content-scroll {
    padding: 28px 36px 32px !important;
  }
}

@media (min-width: 3000px) {
  body.ops-body #opsMain > [data-view].is-view-active:not(.floor-panel):not(.tool-embed-panel),
  body.ops-body #opsMain > section > [data-view].is-view-active:not(.floor-panel):not(.tool-embed-panel) {
    width: 100%;
    max-width: 2400px !important;
    margin-inline: auto !important;
  }
}

/* Floor plan: keep aspect ratio and fit the remaining viewport. */
@media (min-width: 1181px) {
  body.ops-body.ops-view-floor #floorStage.floor-stage {
    width: min(100%, calc((100dvh - 224px) * (var(--floor-ar, 2 / 1)))) !important;
    height: auto !important;
    max-height: none !important;
    align-self: center !important;
    margin-inline: auto !important;
  }
}

/* ---- Embedded tools: queries use iframe width (parent minus sidebar) ---- */
@media (max-width: 1360px) {
  .info-card-row {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px 12px !important;
  }

  .info-card-row .info-card:nth-child(3) strong {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  .info-card-row .info-card:nth-child(n + 7) {
    grid-column: auto !important;
  }

  .filter-matrix {
    flex-wrap: wrap !important;
    overflow: visible !important;
    row-gap: 6px !important;
  }

  .content-grid {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px) !important;
    grid-template-rows: 1fr !important;
  }

  .contract-vault {
    order: 0 !important;
    max-height: none !important;
  }

  .commission-table,
  .sheet-table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    font-size: 12px !important;
  }

  .sheet-table-wrap {
    overflow-x: auto !important;
    max-width: 100% !important;
  }

  .sheet-table th:first-child,
  .sheet-table td:first-child,
  .sheet-table th small,
  .sheet-table td small {
    white-space: normal !important;
  }

  .commission-table th,
  .commission-table td,
  .sheet-table th,
  .sheet-table td {
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    white-space: normal !important;
    padding: 8px 6px !important;
  }

  .commission-table td:first-child,
  .commission-table th:first-child,
  .sheet-table td:first-child,
  .sheet-table th:first-child {
    min-width: 0 !important;
    width: 38% !important;
  }

  .sheet-table th:nth-child(2),
  .sheet-table td:nth-child(2),
  .sheet-table th:nth-child(3),
  .sheet-table td:nth-child(3) {
    width: 31% !important;
    min-width: 0 !important;
  }

  .rent-table-wrap,
  .sheet-box {
    overflow-x: auto !important;
    max-width: 100% !important;
  }

  .cr-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .layout-app {
    max-width: none !important;
    padding: 12px !important;
  }

  .editor-grid {
    grid-template-columns: minmax(0, 1fr) 260px !important;
  }
}

@media (max-width: 1100px) {
  .info-card-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .info-card-row .info-card:nth-child(3) {
    grid-column: auto !important;
  }
}

/* Login: keep split pane readable on 4:3 and ultrawide. */
@media (min-width: 1181px) and (max-width: 1360px) {
  .login-form-pane {
    padding: 28px 32px !important;
  }

  .login-story,
  .login-story-tech {
    padding: 32px 36px !important;
  }
}

@media (min-width: 2500px) {
  .login-card {
    max-width: 440px !important;
  }

  .login-copy {
    max-width: 520px;
  }

  .login-form-pane {
    padding: 40px 64px !important;
  }
}
