/* v1.10.9 — forced external-AI block isolation, dense mobile import/review, adaptive state bottom sheet */

/* ---------- Import + review density ---------- */
.import-page .top,
.import-review-page .review-top{min-height:54px!important}
.import-page .settings-shell{gap:10px!important}
.import-page .settings-section,
.import-review-page .review-paper{margin-bottom:10px!important}
.import-page .settings-section.import-pane{padding:15px 16px!important}
.import-page .settings-section.import-pane h2,
.import-review-page .review-paper h2{margin-bottom:8px!important}
.import-page .section-kicker,
.import-review-page .section-kicker{margin-bottom:3px!important}
.import-page .field{gap:5px!important;margin-bottom:11px!important}
.import-page .field label{font-size:11px!important;line-height:1.35!important}
.import-page input,
.import-page select,
.import-page button{min-height:44px}
.import-page textarea{line-height:1.55!important}
.import-page .wide-primary{min-height:46px!important}

/* External-AI return is visually two physical documents after paste. */
.external-split-preview{position:relative}
.external-split-preview::before{
  content:"已按起止标记强制拆分";
  display:block;
  margin:0 2px -2px;
  color:#8b765f;
  font-size:10px;
  letter-spacing:.08em;
}
.external-output-card{position:relative;overflow:visible!important}
.external-output-card+.external-output-card{margin-top:20px!important}
.external-output-card+.external-output-card::before{
  content:"";
  position:absolute;
  left:18%;right:18%;top:-16px;
  border-top:1px dashed rgba(135,101,72,.27);
}
.external-output-card.is-result::after,
.external-output-card.is-source::after{
  position:absolute;right:10px;top:-8px;padding:2px 7px;border-radius:999px;
  background:#f6ead7;border:1px solid rgba(137,99,64,.18);color:#8c735c;
  font-size:8px;letter-spacing:.08em;
}
.external-output-card.is-result::after{content:"独立单元 01"}
.external-output-card.is-source::after{content:"独立单元 02"}

/* Compact group header: title | owner | count on one line. */
.compact-group-head{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:8px!important;align-items:center!important}
.mechanic-group-summary{display:grid;grid-template-columns:minmax(0,1fr) 82px auto;gap:7px;align-items:center;min-width:0}
.mechanic-group-summary input,
.mechanic-group-summary select{min-width:0!important;width:100%!important;margin:0!important}
.group-count{white-space:nowrap;padding:5px 8px;border-radius:999px;background:rgba(148,108,74,.08);color:#8d7764;font-size:10px;line-height:1}
.group-remove-icon{min-width:44px!important;min-height:44px!important;padding:0 9px!important;border-radius:999px!important;font-size:11px!important}
.import-review-page .review-shell{display:grid!important;gap:10px!important}
.import-review-page .review-paper{padding:13px 14px!important}
.import-review-page .section-title-line{margin-bottom:7px!important;gap:8px!important}
.import-review-page .section-title-line h2{font-size:18px!important;line-height:1.3!important}
.import-review-page .section-help{margin:4px 0 10px!important;font-size:10.5px!important;line-height:1.48!important}
.import-review-page .mechanic-grid{gap:8px!important}
.import-review-page .mechanic-group-card{padding:10px!important;margin:0!important}
.import-review-page .mechanic-group-head{padding:0 0 8px!important;margin-bottom:8px!important}
.import-review-page .mechanic-editor{padding:9px 10px!important}
.import-review-page .mechanic-editor-head{display:grid!important;grid-template-columns:auto minmax(0,1fr) auto!important;gap:7px!important;align-items:center!important;padding-bottom:6px!important;margin-bottom:7px!important}
.import-review-page .mechanic-editor-head strong{font-size:11px!important}
.import-review-page .mechanic-origin{font-size:9px!important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.import-review-page .mechanic-editor-head .text-danger{min-width:44px!important;min-height:44px!important;margin:-7px -5px -7px 0!important;padding:0 8px!important}
.import-review-page .mechanic-row{gap:7px!important;margin-top:7px!important}
.import-review-page .mechanic-row.triple{grid-template-columns:repeat(3,minmax(0,1fr))!important}
.import-review-page .mechanic-editor label{gap:3px!important;font-size:9.5px!important;line-height:1.25!important}
.import-review-page .mechanic-editor input,
.import-review-page .mechanic-editor select{min-width:0!important;width:100%!important;min-height:44px!important;padding:8px!important;font-size:12px!important}
.import-review-page .mechanic-editor textarea{min-height:58px!important;padding:9px!important;font-size:11.5px!important;line-height:1.45!important}
.import-review-page .mechanic-add-actions{gap:6px!important;margin-top:8px!important}
.import-review-page .mechanic-add-actions button{min-height:44px!important;padding:8px!important;font-size:10.5px!important}
.import-review-page .initial-quick-values{margin-top:4px!important;gap:3px!important}
.import-review-page .initial-quick-values button{min-height:28px!important;padding:3px!important;font-size:9px!important}
.import-review-page .large-rule-field{margin-top:10px!important}
.import-review-page .large-rule-field textarea{min-height:76px!important}
.import-review-page .review-sticky-actions{gap:8px!important}
.import-review-page .review-sticky-actions button{min-height:48px!important}

/* ---------- Adaptive status detail sheet ---------- */
.state-metric-modal{align-items:flex-end!important;justify-content:center!important;padding:0!important}
.state-metric-modal .modal-card{
  width:min(100%,620px)!important;
  max-height:min(62dvh,680px)!important;
  min-height:40dvh;
  margin:0 auto!important;
  padding:22px 16px calc(14px + env(safe-area-inset-bottom))!important;
  border-radius:24px 24px 0 0!important;
  background:linear-gradient(180deg,#fffaf2,#f2e3cf)!important;
  box-shadow:0 -18px 60px rgba(47,29,16,.24),inset 0 1px rgba(255,255,255,.72)!important;
  overscroll-behavior:contain;
}
.state-metric-modal .modal-card::before{
  content:""!important;position:absolute!important;left:50%!important;top:8px!important;right:auto!important;bottom:auto!important;
  width:42px!important;height:4px!important;transform:translateX(-50%)!important;border:0!important;border-radius:999px!important;background:rgba(105,82,63,.22)!important;
}
.state-metric-modal .modal-card::after{display:none!important}
.state-metric-modal .modal-head{position:sticky!important;top:-22px!important;z-index:5!important;margin:0 -2px 10px!important;padding:6px 4px 10px!important;background:linear-gradient(180deg,#fffaf2 82%,rgba(255,250,242,0))!important}
.state-metric-modal .modal-head::before{content:"STATUS DETAIL"!important;margin-bottom:4px!important}
.state-metric-modal .modal-head h2{font-size:19px!important;line-height:1.25!important}
.state-metric-modal .modal-close{min-width:54px!important;min-height:40px!important}
.state-metric-sheet{display:grid;gap:10px;min-height:0}
.state-metric-hero{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:3px 12px;padding:12px 14px;border:1px solid rgba(142,103,69,.17);border-radius:14px;background:rgba(255,252,246,.78);box-shadow:inset 4px 0 rgba(139,99,60,.14)}
.state-metric-hero small{grid-column:1;color:#8d7864;font-size:10px;letter-spacing:.08em}
.state-metric-hero strong{grid-column:2;grid-row:1/3;color:#88564a;font-size:28px;line-height:1;font-weight:700}
.state-metric-hero em{grid-column:1;color:#5f4d3f;font-size:12px;line-height:1.45;font-style:normal;overflow-wrap:anywhere}
.state-metric-content{display:grid;gap:8px;min-height:0}
.state-metric-section{display:grid;grid-template-columns:84px minmax(0,1fr);gap:10px;padding:10px 12px;border:1px solid rgba(143,104,70,.13);border-radius:12px;background:rgba(255,251,244,.64)}
.state-metric-label{display:flex;align-items:center;gap:7px;align-self:start}
.state-metric-label span{display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:#ead5b7;color:#8a6649;font:8px/1 Georgia,serif}
.state-metric-label strong{font-size:11px;color:#806b58;white-space:nowrap}
.state-metric-section p{margin:0;color:#4f4339;font-size:12.5px;line-height:1.65;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}
.state-metric-section.is-rule{grid-template-columns:84px minmax(0,1fr);max-height:none}
.state-metric-sheet-actions{position:sticky;bottom:-14px;padding-top:5px;background:linear-gradient(180deg,rgba(242,227,207,0),rgba(242,227,207,.97) 46%)}
.state-metric-sheet-actions button{width:100%;min-height:44px!important}
.state-metric-modal .is-sheet-dragging{will-change:transform}

body[data-resolved-theme="dark"] .state-metric-modal .modal-card{background:linear-gradient(180deg,#3b352e,#2e2924)!important}
body[data-resolved-theme="dark"] .state-metric-modal .modal-head{background:linear-gradient(180deg,#3b352e 82%,rgba(59,53,46,0))!important}
body[data-resolved-theme="dark"] .state-metric-hero,
body[data-resolved-theme="dark"] .state-metric-section{background:rgba(64,56,48,.76);border-color:rgba(215,178,140,.12)}
body[data-resolved-theme="dark"] .state-metric-section p{color:#eadaca}

@media(max-width:700px){
  .import-page .top{min-height:50px!important;padding:4px 8px!important}
  .import-page .settings-shell{padding:7px max(8px,env(safe-area-inset-left)) calc(82px + env(safe-area-inset-bottom))!important}
  .import-page .import-archive-hero{min-height:104px!important;margin:0 0 8px!important;padding:14px 70px 12px 14px!important;border-radius:12px!important}
  .import-page .import-archive-copy .section-kicker{font-size:7px!important}
  .import-page .import-archive-copy h1{font-size:18px!important;line-height:1.25!important;margin:3px 0!important}
  .import-page .import-archive-copy p{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:10.5px!important;line-height:1.4!important}
  .import-page .import-archive-meta{display:none!important}
  .import-page .import-decor-letter{width:68px!important;right:2px!important;opacity:.72!important}
  .import-page .import-decor-quill{display:none!important}
  .import-page .settings-section.import-method-card{padding:10px!important;margin-bottom:8px!important}
  .import-page .import-method-card>.section-kicker,
  .import-page .import-method-card>h2{display:none!important}
  .import-page .import-methods{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:6px!important}
  .import-page .import-method{min-height:48px!important;padding:8px 5px!important;border-radius:10px!important;display:grid;place-items:center;text-align:center}
  .import-page .import-method::before,
  .import-page .import-method::after{display:none!important}
  .import-page .import-method strong{font-size:11px!important;line-height:1.25!important}
  .import-page .import-method small{display:none!important}
  .import-page .settings-section.import-pane{padding:11px 12px!important;border-radius:13px!important}
  .import-page .settings-section.import-pane>h2{font-size:18px!important;margin:2px 0 8px!important}
  .import-page .section-intro{margin:0 0 8px!important;font-size:10.5px!important;line-height:1.45!important}
  .import-page .field{margin-bottom:8px!important}
  .import-page .script-input{min-height:176px!important;font-size:13px!important}
  .import-page #script{min-height:210px!important}
  .import-page #packageText,
  .import-page #packageSource{min-height:150px!important}
  .import-page .file-field{padding:9px!important}
  .import-page .cover-upload-row{gap:9px!important}
  .import-page .cover-preview{width:68px!important;height:88px!important}
  .external-copy-card,.external-source-card,.external-return-card,
  .external-split-preview>article,.external-result-review{margin-top:8px!important;padding:9px!important}
  .external-copy-head{margin-bottom:6px!important}
  .external-copy-head strong{font-size:12.5px!important}
  .external-copy-head small{font-size:9.5px!important;line-height:1.35!important}
  .external-copy-card textarea{min-height:128px!important}
  .external-source-card textarea{min-height:108px!important}
  .external-return-card textarea{min-height:132px!important}
  .external-split-preview pre{max-height:220px!important;padding:10px!important;font-size:11.5px!important;line-height:1.55!important}

  .import-review-page .review-top{min-height:50px!important;padding:4px 8px!important}
  .import-review-page .review-tabs{min-height:44px!important}
  .import-review-page .review-tabs button{min-height:44px!important;padding:6px 4px!important;font-size:10px!important;line-height:1.2!important}
  .import-review-page .review-shell{padding:8px max(8px,env(safe-area-inset-left)) calc(82px + env(safe-area-inset-bottom))!important;gap:8px!important}
  .import-review-page .review-paper{padding:10px!important;border-radius:13px!important;margin:0!important}
  .import-review-page .recommendation-card-compact{grid-template-columns:minmax(0,1fr) auto!important;gap:7px!important}
  .import-review-page .recommendation-card-compact h2{font-size:16px!important;margin:1px 0 2px!important}
  .import-review-page .recommendation-card-compact p{font-size:9.5px!important;line-height:1.35!important;-webkit-line-clamp:1!important}
  .import-review-page .compact-deep-analysis{width:auto!important;min-width:94px!important;min-height:44px!important;padding:6px 8px!important}
  .import-review-page .compact-deep-analysis b{font-size:11px!important}
  .import-review-page .compact-deep-analysis small{display:none!important}
  .import-review-page .review-collapsible-head{min-height:50px!important;padding:8px 10px!important}
  .import-review-page .review-collapsible-head>span{display:flex!important;align-items:center!important;gap:6px!important;flex-wrap:wrap}
  .import-review-page .review-collapsible-head small,
  .import-review-page .review-collapsible-head strong,
  .import-review-page .review-collapsible-head em{grid-column:auto!important}
  .import-review-page .review-collapsible-head strong{font-size:13px!important}
  .import-review-page .review-collapsible-head em{margin-left:auto;font-size:9px!important}
  .import-review-page .section-title-line h2{font-size:16px!important}
  .import-review-page .section-title-line .mini-action{min-height:44px!important;padding:6px 9px!important;font-size:10px!important}
  .import-review-page .section-help{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin:2px 0 7px!important;font-size:9.5px!important}
  .import-review-page .mechanic-group-card{padding:8px!important;border-radius:11px!important}
  .mechanic-group-summary{grid-template-columns:minmax(0,1fr) 67px auto!important;gap:5px!important}
  .mechanic-group-summary input,
  .mechanic-group-summary select{min-height:44px!important;padding:7px 6px!important;font-size:11px!important}
  .group-count{padding:4px 6px!important;font-size:8.5px!important}
  .group-remove-icon{font-size:0!important;width:44px!important;padding:0!important}
  .group-remove-icon::before{content:"×";font-size:18px!important;line-height:1}
  .import-review-page .mechanic-row{grid-template-columns:minmax(0,1.4fr) minmax(0,.9fr)!important}
  .import-review-page .mechanic-row.triple{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .import-review-page .initial-quick-values{display:none!important}
  .import-review-page .mechanic-editor textarea{min-height:52px!important}
  .import-review-page .mechanic-add-actions{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .import-review-page .mechanic-add-actions button{font-size:9px!important;line-height:1.25!important}
  .import-review-page .review-sticky-actions{padding:7px max(8px,env(safe-area-inset-left)) max(7px,env(safe-area-inset-bottom))!important}
  .import-review-page .review-sticky-actions button{min-height:46px!important}
  .import-review-page .review-sticky-actions button span{font-size:11.5px!important}
  .import-review-page .review-sticky-actions button small{display:none!important}

  .state-metric-modal .modal-card{width:100%!important;min-height:44dvh!important;max-height:60dvh!important;padding:22px 12px calc(12px + env(safe-area-inset-bottom))!important}
  .state-metric-modal .modal-head{top:-22px!important}
  .state-metric-hero{padding:10px 12px!important}
  .state-metric-hero strong{font-size:25px!important}
  .state-metric-section{grid-template-columns:72px minmax(0,1fr)!important;gap:8px!important;padding:9px 10px!important}
  .state-metric-label{gap:5px!important}
  .state-metric-label strong{font-size:10px!important}
  .state-metric-section p{font-size:12px!important;line-height:1.6!important}
}

@media(max-width:360px){
  .mechanic-group-summary{grid-template-columns:minmax(0,1fr) 60px!important}
  .mechanic-group-summary .group-count{grid-column:1/-1;justify-self:start}
  .import-review-page .mechanic-row.triple{gap:4px!important}
  .import-review-page .mechanic-editor input,
  .import-review-page .mechanic-editor select{padding-inline:5px!important;font-size:11px!important}
}

/* v1.10.9 density correction: override older mobile one-column review rules. */
.import-review-page #review-section-mechanics>.section-title-line{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:center!important;
}
.import-review-page #review-section-mechanics>.section-title-line>.mini-action{
  width:auto!important;
  min-width:96px!important;
  justify-self:end!important;
}
.import-review-page .mechanic-group-head>.mechanic-group-summary{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 82px auto!important;
  gap:7px!important;
  align-items:center!important;
}
@media(max-width:700px){
  .import-review-page .mechanic-group-head>.mechanic-group-summary{
    grid-template-columns:minmax(0,1fr) 67px auto!important;
    gap:5px!important;
  }
}
@media(max-width:360px){
  .import-review-page .mechanic-group-head>.mechanic-group-summary{
    grid-template-columns:minmax(0,1fr) 60px!important;
  }
  .import-review-page .mechanic-group-head>.mechanic-group-summary .group-count{
    grid-column:1/-1!important;
    justify-self:start!important;
  }
}
