/* Image DPI Converter (r1) */
.tool-wrap [hidden] { display: none !important; }
.dpi-stage { padding: 16px; }
.dpi-stage .upload-zone { margin-bottom: 0; }
.upload-zone:focus-visible { outline: 3px solid #2F6BFF; outline-offset: 2px; }
.upload-zone.is-compact { display: flex; align-items: center; gap: 12px; padding: 10px 14px; text-align: left; }
.upload-zone.is-compact .upload-icon { width: 36px; height: 36px; margin: 0; flex: 0 0 auto; border-radius: 8px; }
.upload-zone.is-compact .upload-icon .ui-icon { width: 18px; height: 18px; }
.upload-zone.is-compact .upload-title { font-size: 14px; margin: 0; }
.upload-zone.is-compact .upload-subtitle { font-size: 12.5px; margin: 0; }

.dpi-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dpi-list:empty { display: none; }
.dpi-item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px; border: 1px solid rgba(17,18,23,0.10); border-radius: 10px; background: #FFFFFF; }
.dpi-item.has-error { border-color: #FCA5A5; background: #FEF2F2; }
.dpi-thumb { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(17,18,23,0.08);
  background: linear-gradient(45deg, #E5E7EB 25%, transparent 25%), linear-gradient(-45deg, #E5E7EB 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #E5E7EB 75%), linear-gradient(-45deg, transparent 75%, #E5E7EB 75%), #F8FAFC;
  background-size: 12px 12px; background-position: 0 0, 0 6px, 6px -6px, -6px 0; }
.dpi-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.dpi-body { min-width: 0; }
.dpi-name { font-weight: 750; color: #111217; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dpi-meta { font-size: 12.5px; color: #64748B; margin-top: 2px; }
.dpi-line { font-size: 13px; color: #334155; margin-top: 4px; line-height: 1.45; }
.dpi-after { color: #1D4ED8; font-weight: 650; }
.dpi-status { font-size: 12.5px; margin-top: 6px; color: #475569; display: flex; gap: 6px; align-items: flex-start; line-height: 1.45; }
.dpi-status .ui-icon { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
.dpi-status.is-ok { color: #0F766E; }
.dpi-status.is-warn { color: #B45309; }
.dpi-status.is-err { color: #B91C1C; font-weight: 600; }
.dpi-fields { margin-top: 6px; font-size: 12.5px; color: #475569; }
.dpi-fields summary { cursor: pointer; font-weight: 650; color: #334155; padding: 4px 0; }
.dpi-fields summary:focus-visible { outline: 2px solid #2F6BFF; outline-offset: 2px; border-radius: 4px; }
.dpi-fields ul { margin: 4px 0 0 18px; padding: 0; }
.dpi-fields li { margin: 2px 0; overflow-wrap: anywhere; }
.dpi-fields li.is-action { color: #0F766E; }
.dpi-fields li.is-warn { color: #B45309; }
.dpi-fields li.is-hash { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; color: #334155; }
.dpi-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 112px; }
.dpi-actions .btn { flex: 0 0 auto; width: auto; min-height: 36px; }
.dpi-icon-btn { align-self: flex-end; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid rgba(17,18,23,0.12); background: #FFFFFF; color: #475569; cursor: pointer; }
.dpi-icon-btn:hover { color: #B91C1C; border-color: #FCA5A5; }
.dpi-icon-btn .ui-icon { width: 16px; height: 16px; }
.dpi-icon-btn:focus-visible, .dpi-actions .btn:focus-visible, .calc-chip:focus-visible { outline: 2px solid #2F6BFF; outline-offset: 2px; }
.dpi-summary { margin: 0 0 6px; font-size: 13px; font-weight: 650; color: #0F766E; }
.dpi-summary:empty { display: none; }
.dpi-stage .help-note a, .dpi-calc a { color: #1D4ED8; text-decoration: underline; text-underline-offset: 3px; }

/* Settings aside (dark) */
.dpi-seg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dpi-seg button { min-height: 40px; padding: 8px 4px; }
.tool-aside button:focus-visible, .tool-aside input:focus-visible { outline: 2px solid #9DB9FF; outline-offset: 2px; }
.dpi-hints { margin: 10px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: rgba(255,255,255,0.70); line-height: 1.55; }
.dpi-hints b { color: #FFFFFF; }
.dpi-rule { margin-top: 12px; font-size: 12.5px; color: #C7D2FE; }
.tool-aside .help-note a { color: #9DB9FF; }
.tool-aside .checkbox-group label { color: rgba(255,255,255,0.88); }
.dpi-custom-wrap { margin: 12px 0 0; }
.dpi-custom-wrap input[aria-invalid="true"] { border-color: #F87171; }

/* Print size calculator */
.dpi-calc { margin-top: 10px; border-radius: 10px; }
.dpi-calc .stage-card-head { flex-wrap: wrap; }
.dpi-calc .stage-card-head h2 { font-size: 15px; text-transform: none; letter-spacing: 0; }
.calc-dpi { display: flex; align-items: center; gap: 8px; }
.calc-dpi .input-label { margin: 0; }
.calc-dpi input { width: 110px; }
.dpi-calc .input-label { color: #475569; }
.dpi-calc input, .dpi-calc select { background: #FFFFFF; border: 1px solid rgba(17,18,23,0.16); color: #111217; }
.dpi-calc input[aria-invalid="true"] { border-color: #DC2626; }
.calc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.calc-box { padding: 18px 20px; min-width: 0; }
.calc-box + .calc-box { border-left: 1px solid rgba(17,18,23,0.10); }
.calc-box h3 { margin: 0 0 12px; font-size: 15px; color: #111217; }
.calc-row3 { grid-template-columns: 1fr 1fr 92px; }
.calc-from { margin: -6px 0 8px; font-size: 12.5px; color: #64748B; min-height: 1em; overflow-wrap: anywhere; }
.calc-out { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 8px; background: #F1F5FF; border: 1px solid #DCE7FF; color: #334155; font-size: 13.5px; }
.calc-out strong { font-size: 20px; color: #111217; font-variant-numeric: tabular-nums; }
.calc-out:focus-visible { outline: 2px solid #2F6BFF; outline-offset: 2px; }
.calc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.calc-chip { min-height: 36px; padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(17,18,23,0.14); background: #FFFFFF; color: #1F2937; font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; }
.calc-chip:hover { border-color: #2F6BFF; }
.calc-chip[aria-pressed="true"] { background: #2F6BFF; border-color: #2F6BFF; color: #FFFFFF; }
.calc-compare { margin: 10px 0 0; font-size: 13px; line-height: 1.5; }
.calc-compare.is-ok { color: #0F766E; }
.calc-compare.is-warn { color: #B45309; }
.calc-link, .calc-cap { margin: 10px 0 0; font-size: 13px; color: #475569; line-height: 1.55; }
.calc-link a { font-weight: 700; }

@media (max-width: 760px) {
  .calc-grid { grid-template-columns: 1fr; }
  .calc-box + .calc-box { border-left: 0; border-top: 1px solid rgba(17,18,23,0.10); }
  .calc-box { padding: 16px; }
}
@media (max-width: 640px) {
  .dpi-stage { padding: 10px; }
  .dpi-item { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; }
  .dpi-thumb { width: 48px; height: 48px; }
  .dpi-actions { grid-column: 1 / -1; flex-direction: row; min-width: 0; }
  .dpi-actions .btn { flex: 1 1 0; min-height: 44px; }
  .dpi-icon-btn { width: 44px; height: 44px; flex: 0 0 44px; }
  .calc-row3 { grid-template-columns: 1fr 1fr; }
  .calc-row3 .input-group:last-child { grid-column: 1 / -1; }
  /* 44px tap targets on phones */
  .dpi-seg button, .calc-chip { min-height: 44px; }
  .dpi-fields summary { padding: 12px 0; line-height: 20px; }
}
