/* 扩展工具：复杂功能在宽屏双栏、窄屏单栏。 */
[hidden] { display: none !important; }

input[type="email"], input[type="password"], input[type="url"] {
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid #cbd4e2;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
}

main { width: min(1320px, 100%); }

.tool-workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.tool-sidebar {
  position: sticky;
  top: 16px;
  max-height: 680px;
  padding: 18px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 12px 32px rgba(35, 51, 82, .07);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #c8d1df transparent;
}

.sidebar-title { padding: 0 8px 12px; border-bottom: 1px solid #edf0f4; }
.sidebar-title strong, .sidebar-title small { display: block; }
.sidebar-title strong { font-size: 15px; }
.sidebar-title small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.tool-search-label { margin: 12px 5px 0; }
.tool-search-label span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tool-search-label input {
  width: 100%;
  margin: 0;
  padding: 8px 9px;
  border: 1px solid #d8deea;
  border-radius: 9px;
  font-size: 11px;
  background: #f8faff;
}
.tool-search-empty { margin: 12px 7px 0; color: #8a5360; font-size: 11px; line-height: 1.5; }
.sidebar-group { padding-top: 14px; }
.sidebar-group-title { margin: 0 8px 6px; color: #8993a4; font-size: 10px; font-weight: 850; letter-spacing: .08em; }
.sidebar-group button {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 9px;
  color: #465267;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}
.sidebar-group button:hover { color: var(--brand); background: #f2f5ff; }
.sidebar-group button.active { color: #fff; background: var(--brand); box-shadow: 0 7px 16px rgba(39, 88, 232, .2); }

.tool-stage { min-width: 0; }
.tool-stage .tool-section { padding: 12px 0 0; }
.tool-stage .tool-grid, .tool-stage .data-grid { grid-template-columns: minmax(0, 1fr); }
.tool-stage .tool-card { width: 100%; max-width: 920px; margin: 0 auto; }
.tool-stage .section-heading { max-width: 920px; margin: 0 auto 18px; }
.tool-stage .section-heading h2 { font-size: clamp(23px, 3vw, 30px); }
.tool-stage .trust-section { max-width: 920px; margin: 28px auto 0; }
.trust-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.trust-heading .eyebrow { margin-bottom: 4px; }
.trust-heading h2 { margin: 0; }
.trust-heading h2:before { display: none; }
.trust-heading>a { flex: 0 0 auto; min-height: 40px; display: inline-flex; align-items: center; color: var(--brand); font-size: 12px; font-weight: 800; text-decoration: none; }
.trust-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trust-grid article { display: flex; align-items: start; gap: 13px; padding: 18px; border: 1px solid #dfe6ef; border-radius: 14px; background: #fbfcfe; }
.trust-grid .local-processing-card { border-color: #cce7dc; background: #f3fbf7; }
.trust-icon { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #fff; background: #1b8664; font-size: 14px; font-weight: 900; }
.telemetry-icon { color: #315de3; background: #e6edff; }
.trust-grid h3 { margin: 1px 0 6px; color: var(--ink); font-size: 15px; }
.trust-grid p { margin: 0; color: #647187; font-size: 12px; line-height: 1.7; }
.analytics-toggle { display: flex; align-items: center; gap: 9px; width: fit-content; margin: 14px 0 0; color: #263750; cursor: pointer; }
.analytics-toggle input { width: 17px; height: 17px; margin: 0; accent-color: var(--brand); }
.analytics-toggle span { font-size: 12px; font-weight: 800; }
.analytics-status { min-height: 20px; margin-top: 5px!important; color: var(--safe)!important; }
.analytics-qa-note { margin-top: 8px!important; padding: 8px 10px; border-radius: 8px; color: #785414!important; background: #fff6df; font-weight: 700; }
.limit-upgrade { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 10px; padding: 14px 15px; border: 1px solid #ead9ad; border-radius: 11px; background: #fff9e9; }
.limit-upgrade strong { display: block; margin-bottom: 3px; color: #5e430c; font-size: 12px; }
.limit-upgrade p { margin: 0; color: #78643b; font-size: 11px; line-height: 1.65; }
.limit-upgrade button { flex: 0 0 auto; min-height: 38px; padding: 8px 12px; color: #6d4d0c; background: #ffedbd; }
.limit-upgrade button:hover { background: #ffe39b; }
.product-signal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 920px;
  margin: 18px auto 0;
  padding: 24px 28px;
  border: 1px solid #d9e2f0;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff, #f2f6ff);
}
.product-signal h2 { margin-bottom: 7px; font-size: 22px; }
.product-signal p { max-width: 600px; margin-bottom: 0; color: #657187; font-size: 12px; }
.product-signal-actions { display: flex; flex-direction: column; flex: 0 0 auto; gap: 9px; }
.product-signal-actions > a { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 16px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 800; text-decoration: none; }
.feedback-dialog { width: min(560px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 28px 80px rgba(20, 33, 60, .28); }
.feedback-dialog::backdrop { background: rgba(21, 31, 50, .55); backdrop-filter: blur(3px); }
.feedback-dialog form { padding: 25px; }
.feedback-heading { display: flex; justify-content: space-between; gap: 20px; }
.feedback-heading span { color: var(--brand); font-size: 11px; font-weight: 850; }
.feedback-heading h2 { margin: 4px 0 8px; font-size: 23px; }
.dialog-close { width: 38px; min-height: 38px; padding: 0; color: #526078; background: #eef1f6; font-size: 22px; }
.mobile-tool-picker { display: none; }

.file-insight {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin: -4px 0 14px;
  padding: 12px;
  border: 1px solid #e1e6ee;
  border-radius: 11px;
  background: #fbfcfe;
}
.selected-file-list { min-width: 0; }
.selected-file-heading { margin-bottom: 6px; color: #25324a; font-size: 11px; font-weight: 850; }
.selected-file-row { display: flex; align-items: center; gap: 8px; min-height: 29px; }
.selected-file-row p {
  flex: 1;
  margin: 0;
  padding: 3px 0;
  overflow: hidden;
  color: #526078;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-order-controls { display: flex; flex: 0 0 auto; gap: 3px; }
.file-order-button { width: auto; min-height: 29px; padding: 3px 8px; border-radius: 6px; color: #506078; background: #e9eef6; font-size: 10px; }
.file-order-button:hover { color: #fff; background: var(--brand); }
.file-order-button:disabled { color: #b0b8c5; background: #f0f2f5; }
.output-summary { grid-column: 1 / -1; margin: 2px 0 0; padding: 10px 11px; border-left: 3px solid #4a70e8; border-radius: 0 8px 8px 0; color: #34435c; background: #eef3ff; font-size: 11px; line-height: 1.65; }
.download-again { display: block; width: fit-content; max-width: 100%; margin-top: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview { display: flex; flex-direction: column; align-items: end; gap: 5px; }
.file-preview img, .file-preview canvas {
  display: block;
  width: auto;
  max-width: 132px;
  height: 88px;
  object-fit: contain;
  border: 1px solid #dfe5ed;
  border-radius: 7px;
  background: #fff;
}
.file-preview small, .preview-note { color: #788397; font-size: 9px; }
.file-picker.drag-active {
  border-color: #2e6edb;
  background: #edf4ff;
  box-shadow: 0 0 0 3px rgba(46, 110, 219, .12);
}
.status.success, .status.error { margin-top: 14px; padding: 11px 13px; border-radius: 10px; }
.status.success { color: #116149; background: #e8f7f0; }
.status.error { color: #a22f25; background: #fff0ee; }
.hash-match { margin: 12px 0; padding: 11px 13px; border-radius: 9px; font-size: 12px; font-weight: 800; }
.hash-match.same { color: #116149; background: #e8f7f0; }
.hash-match.different { color: #a22f25; background: #fff0ee; }

.compact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.pdf-rotate .card-icon { color: #2463c5; background: #e9f1ff; }
.pdf-render .card-icon { color: #a95818; background: #fff0df; }
.pdf-extract .card-icon { color: #17809b; background: #e6f8fc; }
.pdf-protect .card-icon { color: #6c48c8; background: #efeaff; }
.image-edit-card, .text-extra-grid { margin-top: 18px; }
.image-edit-card .card-icon { color: #7b4fd0; background: #f0eaff; }
.image-stitch-card { margin-top: 18px !important; }
.image-stitch-card .card-icon { color: #b05425; background: #fff0e8; }
.images-to-pdf .card-icon { color: #b34d62; background: #ffecef; }
.pdf-stamp .card-icon { color: #7a4ab8; background: #f1eaff; }
.pdf-metadata .card-icon { color: #176750; background: #e5f6ef; }
.metadata-result {
  margin: 2px 0 14px;
  padding: 12px 14px;
  border: 1px solid #dce5e1;
  border-radius: 11px;
  background: #f7fbf9;
}
.metadata-result:empty { display: none; }
.metadata-result strong { display: block; margin-bottom: 5px; color: #174f40; font-size: 12px; }
.metadata-result p { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; margin: 0; padding: 4px 0; font-size: 11px; }
.metadata-result p span:first-child { color: #758178; }
.metadata-result p span:last-child { overflow-wrap: anywhere; color: #314a42; }
.boundary-note, .privacy-output-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-left: 3px solid #7c8ca3;
  border-radius: 0 8px 8px 0;
  color: #59667a;
  background: #f6f8fb;
  font-size: 11px;
  line-height: 1.7;
}
.privacy-output-note { margin: 0 0 14px; border-left-color: #258167; background: #f0faf6; }
.signature-card .card-icon { color: #174e91; background: #e8f1ff; }
.qr-reader-card .card-icon { color: #18735f; background: #e7f7f1; }
.file-hash-card .card-icon { color: #9b5b17; background: #fff1df; }

.signature-toolbar { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
#signature-canvas {
  display: block;
  width: 100%;
  height: 260px;
  border: 1.5px dashed #a7b5c9;
  border-radius: 13px;
  background-color: #fff;
  background-image: linear-gradient(to bottom, transparent 78%, #e9edf3 78%, #e9edf3 79%, transparent 79%);
  cursor: crosshair;
  touch-action: none;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding-top: 18px;
}
.checkbox-label input { margin: 0; }

.qr-card .card-icon { color: #173e8f; background: #e8efff; }
.qr-layout {
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 38px;
  align-items: center;
}
.qr-preview {
  min-height: 390px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8faff;
}
.qr-preview canvas {
  display: block;
  width: min(100%, 320px);
  height: auto;
  border: 12px solid #fff;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(30, 48, 84, .1);
}

.data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.data-card .card-icon { color: #167459; background: #e7f7f1; }
.data-card:nth-child(2) .card-icon { color: #a45a16; background: #fff0e1; }
.data-card textarea, .text-extra-grid textarea { font-family: "Cascadia Code", Consolas, monospace; }
.compare-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.diff-result {
  max-height: 420px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
  overflow: auto;
}
.diff-result:empty { display: none; }
.diff-line {
  display: grid;
  grid-template-columns: 38px 24px 1fr;
  min-height: 30px;
  border-bottom: 1px solid #eef1f5;
  font-size: 12px;
}
.diff-line:last-child { border-bottom: 0; }
.diff-line small, .diff-line span, .diff-line code { padding: 5px 8px; }
.diff-line small { color: #98a2b3; text-align: right; }
.diff-line span { font-weight: 900; text-align: center; }
.diff-line code { white-space: pre-wrap; word-break: break-word; background: transparent; }
.diff-line.added { color: #116149; background: #eaf8f2; }
.diff-line.removed { color: #9b2c2c; background: #fff0f0; }
.text-compare-card .card-icon { color: #2563b8; background: #e9f2ff; }
.replace-card .card-icon { color: #9a5a18; background: #fff1df; }

@media (max-width: 860px) {
  .qr-layout, .data-grid, .compare-inputs { grid-template-columns: 1fr; }
  .qr-preview { min-height: auto; }
  .tool-workspace { display: block; }
  .tool-sidebar { display: none; }
  .mobile-tool-picker {
    position: sticky;
    z-index: 8;
    top: 5px;
    display: block;
    margin: 0 0 18px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 8px 24px rgba(31, 49, 85, .09);
    backdrop-filter: blur(10px);
  }
  .mobile-tool-picker label { margin: 0; color: #526078; font-size: 11px; }
  .mobile-tool-picker select { margin-top: 4px; padding: 8px 10px; }
}

@media (max-width: 560px) {
  .tool-nav { max-width: 100%; overflow-x: auto; justify-content: flex-start; }
  .tool-nav a { flex: 0 0 auto; }
  .compact-grid { grid-template-columns: 1fr; }
  .qr-preview { padding: 14px; }
  .diff-line { grid-template-columns: 30px 22px 1fr; }
  .checkbox-label { padding-top: 4px; }
  .signature-toolbar { grid-template-columns: 1fr; gap: 0; }
  #signature-canvas { height: 220px; }
  .file-insight { grid-template-columns: 1fr; }
  .file-preview { align-items: start; }
  .product-signal { align-items: stretch; flex-direction: column; padding: 20px; }
  .product-signal-actions { width: 100%; }
  .trust-heading { flex-direction: column; gap: 4px; }
  .trust-heading>a { min-height: 36px; }
  .trust-grid { grid-template-columns: 1fr; }
  .trust-grid article { padding: 16px; }
  .limit-upgrade { align-items: stretch; flex-direction: column; }
  .limit-upgrade button { width: 100%; }
}
