
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --brand: #123a5c;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --soft: #f8fafc;
  --good-bg: #e7f6ee;
  --good: #166534;
  --warn-bg: #fff7e6;
  --warn: #92400e;
  --warn-border: #f5d49a;
  --bad: #b91c1c;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  font-family: Arial, sans-serif;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

/* Site-wide header chrome. Keep this identical across pages. */
.app-header {
  background: var(--brand);
  color: #e6eefb;
  padding: 14px 0;
  margin-bottom: 32px;
}
.app-header .wrap { padding-bottom: 0; max-width: 980px; }
.brand-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { font-weight: bold; font-size: 1.05rem; }
.brand a { color: #e6eefb; text-decoration: none; }
.brand a:hover { text-decoration: underline; }
.brand span { opacity: .75; font-weight: normal; }

h1 { margin: 0 0 4px; color: var(--text); }
.subtitle { color: var(--muted); margin: 0 0 24px; }
h2 { font-size: 1.1rem; margin: 0 0 14px; color: var(--text); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 20px;
}

.notice {
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  background: var(--card);
}
.notice.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.notice code { background: rgba(0,0,0,.05); padding: 1px 5px; border-radius: 4px; font-size: .88em; }

/* Drop zone */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  background: var(--soft);
  transition: border-color .15s, background .15s;
}
.dropzone.over { border-color: var(--primary); background: #eff4ff; }
.dropzone.disabled { opacity: .6; }
.drop-icon { width: 44px; height: 44px; color: var(--primary); margin: 0 auto 8px; display: block; }
.dropzone h2 { margin: 0 0 4px; }
.dropzone p { margin: 0 0 18px; color: var(--muted); font-size: 0.92rem; }
.buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.phone-note { margin: 16px 0 0; font-size: 0.85rem; color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px;
  font-size: 0.95rem; font-weight: bold; font-family: inherit;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--brand); border-color: #cbd5e1; }
.btn.secondary:hover { background: var(--soft); border-color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; padding: 13px 18px; font-size: 1rem; }
.btn:focus-visible, select:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Settings */
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 8px; }
.field label { display: block; font-weight: bold; margin-bottom: 6px; font-size: 0.92rem; }
select {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem; font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
.hint { margin: 6px 0 16px; font-size: 0.82rem; color: var(--muted); }
.engine-note { margin: 10px 0 0; font-size: 0.82rem; color: var(--muted); text-align: center; }

/* Status */
.status-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.status-stage { font-weight: bold; }
.status-detail { color: var(--muted); font-size: 0.88rem; margin-top: 2px; overflow-wrap: anywhere; }
.bar { height: 10px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin-top: 12px; position: relative; }
.bar-fill { height: 100%; width: 0; background: var(--primary); border-radius: 99px; transition: width .25s ease; }
.bar.indeterminate .bar-fill { width: 30%; position: absolute; left: -30%; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { 0% { left: -30%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .bar.indeterminate .bar-fill { animation: none; left: 0; width: 100%; opacity: .35; }
}

/* File list */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.list-head h2 { margin: 0; }
.list-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.file-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; border-top: 1px solid var(--border); }
.file-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.file-info { min-width: 0; }
.file-name { font-size: 0.94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 0.8rem; color: var(--muted); }
.file-side { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; flex-shrink: 0; max-width: 60%; }
.badge { font-size: 0.75rem; font-weight: bold; padding: 3px 9px; border-radius: 99px; background: var(--soft); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-probing, .badge-working { background: #eff4ff; color: var(--primary-dark); border-color: #c7d7fe; }
.badge-failed { background: #fef2f2; color: var(--bad); border-color: #fecaca; }
.badge-skipped, .badge-stopped { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.status-failed .file-meta { color: var(--bad); }
.icon-btn { border: none; background: none; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.icon-btn:hover { background: var(--soft); color: var(--text); }

/* Data warning dialog */
dialog {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  max-width: 420px;
  width: calc(100% - 32px);
  color: var(--text);
  box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}
dialog::backdrop { background: rgba(15, 23, 42, .45); }
dialog h2 { margin-bottom: 8px; }
dialog p { margin: 0 0 18px; color: var(--muted); font-size: 0.94rem; }
dialog .buttons { justify-content: flex-end; }

.privacy { font-size: 0.85rem; color: var(--muted); }
.privacy h2 { font-size: 0.95rem; margin-bottom: 6px; }
.privacy p { margin: 0 0 8px; }
.privacy a { color: var(--primary); }

@media (max-width: 600px) {
  .card { padding: 18px; }
  .settings { grid-template-columns: 1fr; gap: 14px; }
  .dropzone { padding: 24px 14px; }
  .buttons .btn { flex: 1 1 100%; }
  dialog .buttons .btn { flex: 1 1 auto; }
}
  

/* ---------- Additions for the Audio & Video Tools set ---------- */
.brand a + span, .brand span + a { margin: 0 2px; }
.brand .crumb { opacity: 1; font-weight: bold; }

.tool-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tool-table th, .tool-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tool-table thead th {
  color: var(--muted); font-weight: bold; font-size: 0.76rem; text-transform: uppercase;
  letter-spacing: 0.02em; border-bottom: 2px solid var(--border); padding-top: 0;
}
.tool-table td:first-child { width: 28%; }
.tool-table td:last-child { width: 34%; }
.tool-table a.tool-name { color: var(--primary); font-weight: bold; text-decoration: none; font-size: 1rem; }
.tool-table a.tool-name:hover { text-decoration: underline; }
.tool-table tbody tr:last-child td { border-bottom: none; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-head svg { width: 22px; height: 22px; color: var(--primary); flex-shrink: 0; }
.section-head h2 { margin: 0; }

.q { display: inline-block; font-size: 0.74rem; font-weight: bold; padding: 2px 8px; border-radius: 99px; margin: 0 4px 4px 0; white-space: nowrap; }
.q-good { background: var(--good-bg); color: var(--good); }
.q-some { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.q-note { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 2px; }

.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; margin: 4px 0 14px; cursor: pointer; }
.checkbox input { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; }
.checkbox small { display: block; color: var(--muted); font-size: 0.82rem; }

/* Trimmer */
.preview { width: 100%; max-height: 420px; background: #0f172a; border-radius: 10px; display: block; }
.trim-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.time-row { display: flex; gap: 8px; }
.time-row input {
  flex: 1; min-width: 0; padding: 10px 12px; font-size: 1rem; font-family: inherit;
  border: 1px solid var(--border); border-radius: 8px; color: var(--text);
}
.time-row input:focus { outline: 2px solid var(--primary); outline-offset: -2px; }
.time-row input.invalid { border-color: var(--bad); }
.trim-summary { margin-top: 12px; font-size: 0.9rem; color: var(--muted); }
.trim-summary strong { color: var(--text); }
.file-chip { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.file-chip .file-name { font-weight: bold; }

/* Joiner order controls */
.order-btns { display: flex; gap: 2px; }
.problems { margin: 0 0 14px; padding: 12px 16px 12px 32px; background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn); border-radius: 10px; font-size: 0.9rem; }
.problems:empty { display: none; }

@media (max-width: 600px) {
  .tool-table thead { display: none; }
  .tool-table, .tool-table tbody, .tool-table tr, .tool-table td { display: block; width: 100% !important; }
  .tool-table tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  .tool-table tbody tr:last-child { border-bottom: none; }
  .tool-table td { border: none; padding: 3px 0; }
  .trim-grid { grid-template-columns: 1fr; }
  .file-side { max-width: 100%; }
  .file-row { flex-wrap: wrap; }
}
