/* ClipToPsd — port fiel do protótipo de design (ClipToPsd.dc.html).
   Tokens: IBM Plex Sans/Mono, acento azul oklch(0.52 0.13 245), fundo #f4f6f7. */

:root {
  --bg: #f4f6f7;
  --card: #ffffff;
  --border: #e2e5e8;
  --border-soft: #eef1f3;
  --border-btn: #d5dade;
  --wash: #f7f8f9;
  --text: #191c1f;
  --text-2: #3a4147;
  --muted: #667077;
  --faint: #98a1a8;
  --faint-2: #b6bdc3;
  --accent: oklch(0.52 0.13 245);
  --accent-dark: oklch(0.46 0.13 245);
  --accent-wash: oklch(0.975 0.012 245);
  --green-dot: oklch(0.6 0.14 150);
  --green-text: oklch(0.45 0.12 150);
  --green-chip-text: oklch(0.42 0.11 150);
  --green-bg: oklch(0.95 0.04 150);
  --red-text: oklch(0.5 0.17 25);
  --red-bg: oklch(0.96 0.02 25);
  --red-wash: oklch(0.975 0.01 25);
  --red-wash-border: oklch(0.9 0.03 25);
  --red-mono: oklch(0.42 0.13 25);
  --amber-bg: oklch(0.97 0.02 85);
  --amber-border: oklch(0.88 0.05 85);
  --amber-text: oklch(0.5 0.11 75);
  --amber-text-2: oklch(0.45 0.11 75);
  --sans: 'IBM Plex Sans', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  font-family: var(--sans);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
::selection { background: oklch(0.9 0.05 245); }
a { color: var(--accent); }
a:hover { color: oklch(0.44 0.13 245); }
button { font-family: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- topo ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--border); }
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 58px;
  padding: 0 24px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.3px; }
.brand-tag { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.topnav { display: flex; gap: 18px; height: 100%; }
.nav-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 0 2px;
  cursor: pointer;
}
.nav-btn.active { color: var(--text); border-bottom-color: var(--accent); }
.topbar-spacer { flex: 1; }
.chip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
}
.chip-btn { cursor: pointer; }
.chip-btn:hover { background: var(--border-soft); }

/* ---------- layout ---------- */
.content { max-width: 960px; margin: 0 auto; padding: 44px 24px 60px; width: 100%; flex: 1; }
.convert-col { max-width: 680px; margin: 0 auto; }
.history-col { max-width: 820px; margin: 0 auto; }
.footer {
  text-align: center;
  padding: 0 24px 36px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint-2);
}

.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.card-center { text-align: center; }

.spinner {
  display: inline-block;
  width: 26px;
  height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 20px; height: 20px; border-width: 2.5px; }
.spinner-xs { width: 14px; height: 14px; border-width: 2px; }

.file-chip {
  display: inline-flex;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  max-width: 100%;
}
.file-chip .sep { color: var(--faint-2); }
.file-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge-round {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 700;
}
.badge-ok { background: var(--green-bg); color: var(--green-text); }
.badge-fail { background: var(--red-bg); color: var(--red-text); }

/* ---------- botões ---------- */
.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { background: #c3cad0; cursor: not-allowed; }
.btn-secondary {
  background: var(--card);
  border: 1px solid var(--border-btn);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
}
.btn-secondary:hover { background: var(--bg); }
.btn-ghost {
  background: none;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--faint);
  cursor: pointer;
}
.btn-ghost:hover { color: var(--muted); }
.btn-link {
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.btn-link:hover { color: oklch(0.44 0.13 245); }

/* ---------- dropzone ---------- */
.dropzone {
  display: block;
  width: 100%;
  background: var(--card);
  border: 1.5px dashed #c3cad0;
  border-radius: 12px;
  padding: 76px 32px;
  text-align: center;
  cursor: pointer;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: oklch(0.995 0.003 245); }
.dropzone-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
}
.dropzone-title { display: block; margin-top: 20px; font-size: 19px; font-weight: 600; }
.dropzone-sub { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); }
.dropzone-note { display: block; margin-top: 24px; font-size: 12px; color: var(--faint); font-family: var(--mono); }
.idle-error {
  margin-top: 14px;
  background: var(--red-wash);
  border: 1px solid var(--red-wash-border);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 13px;
  color: var(--red-mono);
}

/* ---------- analisando ---------- */
.analyzing-card { padding: 70px 32px; }
.analyzing-title { margin-top: 20px; font-size: 19px; font-weight: 600; }
.analyzing-sub { margin-top: 8px; font-size: 14px; color: var(--muted); }
.analyzing-chip { margin-top: 20px; }
.analyzing-progress { margin-top: 12px; font-family: var(--mono); font-size: 12px; color: var(--faint); }

/* ---------- veredito ---------- */
.verdict-card { padding: 28px; }
.verdict-head { display: flex; align-items: center; gap: 12px; }
.verdict-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green-dot); flex: none; }
.verdict-dot.warn { background: oklch(0.75 0.13 85); }
.verdict-title { font-size: 18px; font-weight: 700; flex: 1; }
.facts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 24px;
  padding: 18px;
  background: var(--wash);
  border-radius: 9px;
}
.fact-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.fact-value { margin-top: 5px; font-size: 16px; font-weight: 600; font-family: var(--mono); }
.fact-value.small { font-size: 14px; font-weight: 500; padding-top: 2px; }

.verdict-files { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.vfile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--wash);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  padding: 11px 14px;
}
.vfile.bad { background: var(--red-wash); border-color: var(--red-wash-border); }
.vfile-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.vfile-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.vfile-meta { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.vfile-reason { margin-top: 4px; font-size: 12.5px; color: var(--red-mono); line-height: 1.45; }
.vfile-main { flex: 1; min-width: 0; }

.verdict-warnnote {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-radius: 8px;
  padding: 10px 13px;
}
.verdict-warnnote span { font-size: 13px; color: var(--amber-text-2); font-weight: 500; flex: 1; }

.section-label {
  margin-top: 22px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.format-row { display: flex; gap: 10px; margin-top: 9px; }
.format-btn {
  flex: 1;
  text-align: start;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 13px 15px;
  cursor: pointer;
}
.format-btn.selected { background: var(--accent-wash); border-color: var(--accent); }
.format-btn:disabled { cursor: not-allowed; opacity: 0.6; }
.format-name { font-size: 15px; font-weight: 700; }
.format-note { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.format-btn:disabled .format-note { color: oklch(0.5 0.15 25); }

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--wash);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
}
.consent-row input { margin-top: 2px; accent-color: var(--accent); }

.verdict-foot { display: flex; align-items: center; gap: 14px; margin-top: 24px; }
.limit-line { flex: 1; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.limit-blocked { flex: 1; font-size: 13px; color: oklch(0.55 0.12 75); font-weight: 500; }

/* ---------- incompatível (pré-falha) ---------- */
.prefail-card { padding: 44px 32px; }
.prefail-title { margin-top: 16px; font-size: 19px; font-weight: 700; }
.prefail-chip { margin-top: 14px; }
.prefail-reason {
  margin: 18px auto 0;
  max-width: 460px;
  text-align: start;
  background: var(--red-wash);
  border: 1px solid var(--red-wash-border);
  border-radius: 8px;
  padding: 13px 15px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--red-mono);
}
.prefail-reason + .prefail-reason { margin-top: 8px; }
.prefail-sub { margin-top: 14px; font-size: 13px; color: var(--muted); }
.prefail-btn { margin-top: 22px; }

/* ---------- upload ---------- */
.upload-card { padding: 32px; }
.upload-head { display: flex; align-items: baseline; gap: 12px; }
.upload-title { font-size: 18px; font-weight: 700; flex: 1; }
.upload-pct { font-family: var(--mono); font-size: 22px; font-weight: 600; color: var(--accent); }
.progress-track { margin-top: 16px; height: 8px; background: #eceff1; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; width: 0; transition: width 0.15s linear; }
.upload-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}
.upload-meta .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-note { margin-top: 18px; font-size: 13px; color: var(--faint); }
.upload-actions { display: flex; gap: 12px; margin-top: 20px; align-items: center; }

/* ---------- fila ---------- */
.queued-card { padding: 60px 32px; }
.queued-title { margin-top: 18px; font-size: 19px; font-weight: 700; }
.queued-pos { margin-top: 8px; font-family: var(--mono); font-size: 14px; color: var(--accent); font-weight: 500; }
.queued-sub { margin-top: 8px; font-size: 13.5px; color: var(--muted); }

/* ---------- convertendo ---------- */
.proc-card { padding: 32px; }
.proc-head { display: flex; align-items: center; gap: 12px; }
.proc-title { font-size: 18px; font-weight: 700; }
.proc-file { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: auto; }
.proc-steps { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.proc-step { display: flex; align-items: center; gap: 12px; font-size: 14.5px; }
.proc-step .icon { width: 20px; text-align: center; font-weight: 700; }
.proc-step.pend .icon { color: var(--faint-2); }
.proc-step.pend .label { color: var(--faint); }
.proc-step.active .icon { color: var(--accent); }
.proc-step.active .label { font-weight: 600; }
.proc-step.done .icon { color: oklch(0.5 0.12 150); }
.proc-files { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.proc-frow { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.proc-frow .icon { width: 20px; text-align: center; font-weight: 700; flex: none; }
.proc-frow .fname {
  font-family: var(--mono);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proc-frow .fstate { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.proc-frow.ok .icon { color: oklch(0.5 0.12 150); }
.proc-frow.warn .icon { color: var(--amber-text); }
.proc-frow.bad .icon { color: var(--red-text); }
.proc-frow.pend .icon { color: var(--faint-2); }
.retry-chip {
  margin-top: 18px;
  display: inline-block;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-radius: 7px;
  padding: 8px 13px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--amber-text);
}

/* ---------- concluído ---------- */
.done-card { padding: 40px 32px; }
.done-title { margin-top: 14px; font-size: 20px; font-weight: 700; }
.warn-banner {
  margin: 18px auto 0;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-radius: 8px;
  padding: 11px 14px;
}
.warn-banner span { font-size: 13.5px; color: var(--amber-text-2); font-weight: 600; flex: 1; text-align: start; }
.btn-amber {
  background: none;
  border: 1px solid oklch(0.8 0.07 85);
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--amber-text-2);
  cursor: pointer;
  white-space: nowrap;
}
.btn-amber:hover { background: oklch(0.94 0.03 85); }
.result-box {
  margin: 22px auto 0;
  max-width: 440px;
  background: var(--wash);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  text-align: start;
}
.result-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-2);
}
.result-line .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-line .size { color: var(--faint); flex: none; }
.result-dl {
  margin-top: 14px;
  width: 100%;
  padding: 12px;
  font-size: 15px;
  text-align: center;
}
.result-expiry {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--faint);
  font-family: var(--mono);
  line-height: 1.5;
  text-align: center;
}
.result-fail {
  margin: 12px auto 0;
  max-width: 440px;
  background: var(--red-wash);
  border: 1px solid var(--red-wash-border);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: start;
}
.result-fail .fname { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.result-fail .reason { margin-top: 6px; font-size: 12.5px; color: var(--red-mono); line-height: 1.5; }
.done-another { margin-top: 20px; }

/* ---------- falhou ---------- */
.failed-card { padding: 40px 32px; }
.failed-title { margin-top: 14px; font-size: 20px; font-weight: 700; }
.failed-sub { margin-top: 8px; font-size: 14px; color: var(--muted); }
.failed-reason {
  margin: 18px auto 0;
  max-width: 460px;
  background: var(--red-wash);
  border: 1px solid var(--red-wash-border);
  border-radius: 8px;
  padding: 12px 15px;
  font-size: 13px;
  color: var(--red-mono);
  line-height: 1.5;
  text-align: start;
}
.retain-line {
  margin: 14px auto 0;
  max-width: 460px;
  background: var(--wash);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 15px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}
.failed-actions { display: flex; justify-content: center; gap: 12px; margin-top: 24px; }
.failed-another { margin-top: 16px; }

/* ---------- histórico ---------- */
.history-title { font-size: 22px; font-weight: 700; }
.history-note { margin-top: 6px; font-size: 13px; color: var(--faint); }
.history-table { margin-top: 20px; overflow: hidden; }
.history-header, .history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 120px 90px 170px;
  gap: 12px;
  align-items: center;
  padding: 14px 20px;
}
.history-header {
  padding: 12px 20px;
  background: var(--wash);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.history-row { border-bottom: 1px solid var(--border-soft); }
.history-row:last-child { border-bottom: none; }
.history-row .fname {
  font-family: var(--mono);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-row .fdate { font-size: 13px; color: var(--muted); }
.history-row .fout { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.history-row .factions { display: flex; gap: 8px; justify-content: flex-end; }
.history-empty { padding: 34px 20px; text-align: center; font-size: 13.5px; color: var(--faint); }
.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 20px;
  padding: 3px 10px;
}
.pill.done { color: var(--green-chip-text); background: var(--green-bg); }
.pill.warn { color: oklch(0.48 0.11 75); background: oklch(0.96 0.03 85); }
.pill.fail { color: oklch(0.48 0.16 25); background: var(--red-bg); }
.pill.gray { color: var(--faint); background: var(--border-soft); }
.pill.busy { color: var(--accent-dark); background: var(--accent-wash); }
.btn-mini {
  background: var(--card);
  border: 1px solid var(--border-btn);
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: oklch(0.48 0.13 245);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-mini:hover { background: oklch(0.98 0.008 245); }
.btn-mini.plain { color: var(--muted); border-color: var(--border); }
.btn-mini.plain:hover { background: var(--bg); }

/* ---------- modal de relatório ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 20, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 24px;
}
.modal-panel {
  width: 560px;
  max-width: 100%;
  max-height: 84vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 12px;
  padding: 26px;
  box-shadow: 0 20px 50px rgba(15, 18, 20, 0.25);
}
.modal-head { display: flex; align-items: baseline; gap: 12px; }
.modal-title { font-size: 17px; font-weight: 700; flex: 1; }
.modal-meta { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.report-file-label {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.report-items { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.report-item {
  display: flex;
  gap: 10px;
  background: oklch(0.98 0.012 85);
  border: 1px solid oklch(0.9 0.04 85);
  border-radius: 8px;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
}
.report-item .mark { color: var(--amber-text); font-weight: 700; flex: none; }
.report-item.info { background: var(--wash); border-color: var(--border); }
.report-item.info .mark { color: var(--faint); font-weight: 600; }
.report-item .count { color: var(--faint); font-family: var(--mono); font-size: 12px; white-space: nowrap; margin-left: auto; }
.report-error {
  margin-top: 10px;
  background: #1d2126;
  border-radius: 8px;
  padding: 15px 17px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  color: #e88;
  white-space: pre-wrap;
  word-break: break-word;
}
.report-note { margin-top: 12px; font-size: 12.5px; color: var(--faint); }
.modal-foot { display: flex; justify-content: flex-end; margin-top: 20px; }

/* ---------- responsivo ---------- */
@media (max-width: 720px) {
  .topbar-inner { gap: 14px; padding: 0 16px; }
  .brand-tag { display: none; }
  .content { padding: 28px 16px 48px; }
  .facts-grid { grid-template-columns: repeat(2, 1fr); }
  .history-header { display: none; }
  .history-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 6px;
    padding: 14px 16px;
  }
  .history-row .fdate, .history-row .fout { font-size: 12px; }
  .history-row .factions { grid-column: 1 / -1; justify-content: flex-start; }
  .format-row { flex-direction: column; }
  .verdict-foot { flex-wrap: wrap; }
  .limit-line, .limit-blocked { flex-basis: 100%; }
}
