/* ============================================================================
   app-shell.css — Workspace layout for Everything Convert tool pages (Concept A)
   ----------------------------------------------------------------------------
   A left tool rail + center work area + right result panel, matching the
   "app dashboard" look. Applied to a page by adding class="ec-app-shell" to
   <body> and loading app-shell.js (which injects the rail and right-panel cards).

   Light theme only, to stay consistent with the rest of the live site and the
   ad units. Interactive element class names (.drop-zone, .convert-btn,
   .results-section, .progress-section, .file-info, .settings-panel, .visible,
   .dragover, …) are preserved so the existing per-page conversion scripts keep
   working untouched — this file only restyles them.
   ============================================================================ */

:root {
  --as-canvas: #f5f7fc;
  --as-surface: #ffffff;
  --as-surface-2: #f4f6fc;
  --as-ink: #12152b;
  --as-muted: #5c647d;
  --as-faint: #8b92a9;
  --as-line: #e2e6f2;
  --as-line-soft: #eceff8;
  --as-brand: #4f46e5;
  --as-brand-2: #8b5cf6;
  --as-brand-ink: #3730c9;
  --as-brand-soft: #e7e9ff;
  /* Tint that fills the whole right-hand RESULT box, distinguishing it from the
     white work box on the left. */
  --as-result-box: #eef0fc;
  --as-result-line: #dfe1f6;
  --as-success: #0e9f5d;
  --as-success-soft: #e2f6ec;
  --as-danger: #dc2626;
  --as-grad: linear-gradient(120deg, #4f46e5, #8b5cf6);
  --as-grad-deep: linear-gradient(135deg, #3b2fb8 0%, #6d3fd6 55%, #8b5cf6 100%);
  --as-shadow-sm: 0 1px 2px rgba(18, 21, 43, .05), 0 8px 20px -14px rgba(40, 36, 120, .18);
  --as-shadow: 0 2px 6px rgba(18, 21, 43, .07), 0 20px 44px -22px rgba(40, 36, 120, .26);
  --as-radius: 16px;
  --as-radius-sm: 12px;
  --as-font: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Noto Sans KR', 'Malgun Gothic', sans-serif;

  /* Legacy compatibility: a few inline styles on tool pages still reference the
     old variable names. Map them onto the new palette so nothing renders bare. */
  --bg: var(--as-canvas);
  --surface: var(--as-surface);
  --surface2: var(--as-surface-2);
  --accent: var(--as-brand);
  --accent2: var(--as-brand-2);
  --text: var(--as-ink);
  --muted: var(--as-muted);
  --border: var(--as-line);
}

body.ec-app-shell {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--as-canvas);
  color: var(--as-ink);
  font-family: var(--as-font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.ec-app-shell * { box-sizing: border-box; }

/* Hide the raw <header> until tools-menu.js upgrades it to .ec-unified-header,
   so there's no flash of the un-styled markup. */
body.ec-app-shell header:not(.ec-unified-header) {
  visibility: hidden;
  min-height: 4.4rem;
}

body.ec-app-shell a { color: inherit; }

/* ── Shell (single column; the rail was removed by design) ──────────────────*/
.ec-shell { display: block; width: 100%; }
.ec-shell-main { min-width: 0; }

/* ── Work + result grid ──────────────────────────────────────────────────── */
.ec-app-shell main {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 24px clamp(18px, 3vw, 40px) 8px;
}

/* Two separate boxes (work | result) with a gap between them. */
.ec-workzone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 22px;
  align-items: start;
}

.ec-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--as-faint);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.ec-crumb a { color: var(--as-muted); text-decoration: none; }
.ec-crumb a:hover { color: var(--as-ink); }
.ec-crumb i { font-size: 9px; opacity: .6; }
.ec-crumb .ec-crumb-current { color: var(--as-ink); font-weight: 600; }

.ec-work-head { margin-bottom: 2px; }
.ec-work-head h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.ec-work-head .ec-title-accent {
  background: var(--as-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ec-work-head p { margin: 0 0 12px; color: var(--as-muted); font-size: 15px; max-width: 60ch; }

.ec-privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--as-success);
  background: var(--as-success-soft);
  border-radius: 999px;
  padding: 5px 13px;
}
.ec-privacy-chip::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--as-success);
}

/* ── Work column: its own bordered box ───────────────────────────────────── */
.ec-work-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  background: var(--as-surface);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius);
  box-shadow: var(--as-shadow-sm);
}

/* Drop zone — dashed upload target on a subtle off-white fill (no own shadow;
   the surrounding frame provides the elevation) */
.ec-app-shell .drop-zone {
  border: 2px dashed color-mix(in srgb, var(--as-brand) 42%, var(--as-line));
  border-radius: var(--as-radius);
  background: var(--as-surface-2);
  padding: clamp(2.4rem, 5vw, 3.4rem) 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.ec-app-shell .drop-zone:hover,
.ec-app-shell .drop-zone.dragover {
  border-color: var(--as-brand);
  background: var(--as-brand-soft);
}
.ec-app-shell .drop-zone.dragover { transform: scale(1.006); }

.ec-app-shell .drop-icon {
  width: 60px; height: 60px;
  margin: 0 auto 1.1rem;
  border-radius: 16px;
  background: var(--as-brand-soft);
  display: grid;
  place-items: center;
}
.ec-app-shell .drop-icon svg { width: 28px; height: 28px; stroke: var(--as-brand); fill: none; }

.ec-app-shell .drop-zone h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0 0 .35rem;
  color: var(--as-ink);
}
.ec-app-shell .drop-zone p { color: var(--as-muted); font-size: .9rem; margin: 0 0 1.1rem; }

.ec-app-shell .browse-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--as-grad);
  color: #fff;
  border: none;
  border-radius: var(--as-radius-sm);
  padding: .8rem 1.6rem;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
  clip-path: none;
  box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .55);
  transition: transform .12s ease, box-shadow .12s ease;
}
.ec-app-shell .browse-btn:hover {
  background: var(--as-grad);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -8px rgba(79, 70, 229, .6);
}
.ec-app-shell .drop-zone .ec-drop-hint {
  display: block;
  margin-top: 1rem;
  color: var(--as-faint);
  font-size: .78rem;
}
.ec-app-shell .drop-zone input[type="file"] { display: none; }

/* Settings panel */
.ec-app-shell .settings-panel {
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
  padding: 1.4rem;
}
.ec-app-shell .settings-panel { display: none; }
.ec-app-shell .settings-panel.visible { display: block; }
.ec-app-shell .settings-title {
  font-family: inherit;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--as-faint);
  margin-bottom: 1rem;
}

.ec-app-shell .conversion-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
  margin-bottom: 1.2rem;
}
.ec-app-shell .conversion-mode-card {
  position: relative;
  display: grid;
  gap: .4rem;
  padding: 1rem;
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
  background: var(--as-surface);
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}
.ec-app-shell .conversion-mode-card:hover { border-color: color-mix(in srgb, var(--as-brand) 45%, var(--as-line)); transform: translateY(-1px); }
.ec-app-shell .conversion-mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.ec-app-shell .conversion-mode-card:has(input:checked) {
  border-color: var(--as-brand);
  box-shadow: 0 12px 26px -14px rgba(79, 70, 229, .5);
  background: #fff;
}
.ec-app-shell .conversion-mode-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 800;
  color: var(--as-ink);
  font-size: .96rem;
}
.ec-app-shell .conversion-mode-pill {
  display: inline-flex;
  width: max-content;
  align-items: center;
  border-radius: 999px;
  padding: .2rem .55rem;
  background: var(--as-brand-soft);
  color: var(--as-brand-ink);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.ec-app-shell .conversion-mode-card p { color: var(--as-muted); font-size: .84rem; line-height: 1.45; margin: 0; }

.ec-app-shell .settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
}
.ec-app-shell .setting-item label {
  display: block;
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--as-faint);
  margin-bottom: .5rem;
  font-weight: 700;
}
.ec-app-shell .setting-item select,
.ec-app-shell .setting-item input[type="text"] {
  width: 100%;
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  color: var(--as-ink);
  padding: .6rem .75rem;
  font-family: inherit;
  font-size: .88rem;
  border-radius: 10px;
  outline: none;
  cursor: pointer;
}
.ec-app-shell .setting-item select:focus-visible,
.ec-app-shell .setting-item input[type="text"]:focus-visible {
  border-color: var(--as-brand);
  box-shadow: 0 0 0 3px var(--as-brand-soft);
}

/* Selected-file row */
.ec-app-shell .file-info {
  display: none;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  border-left: 3px solid var(--as-brand);
  border-radius: var(--as-radius-sm);
}
.ec-app-shell .file-info.visible { display: flex; }
.ec-app-shell .file-info-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: var(--as-brand-soft);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ec-app-shell .file-info-icon svg { stroke: var(--as-brand); }
.ec-app-shell .file-details { flex: 1; min-width: 0; }
.ec-app-shell .file-name { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ec-app-shell .file-meta { color: var(--as-faint); font-size: .8rem; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ec-app-shell .remove-file {
  background: none; border: none; color: var(--as-faint);
  cursor: pointer; font-size: .82rem; font-weight: 600; padding: 6px 10px;
  border-radius: 8px; transition: color .15s ease, background .15s ease;
}
.ec-app-shell .remove-file:hover { color: var(--as-danger); background: color-mix(in srgb, var(--as-danger) 8%, transparent); }

/* Convert button */
.ec-app-shell .convert-btn {
  width: 100%;
  padding: 1rem;
  background: var(--as-grad);
  color: #fff;
  border: none;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: normal;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  border-radius: var(--as-radius-sm);
  clip-path: none;
  box-shadow: 0 12px 28px -10px rgba(79, 70, 229, .6);
  transition: transform .12s ease, box-shadow .12s ease;
}
.ec-app-shell .convert-btn.visible { display: flex; }
.ec-app-shell .convert-btn:hover { background: var(--as-grad); transform: translateY(-1px); box-shadow: 0 16px 32px -10px rgba(79, 70, 229, .66); }
.ec-app-shell .convert-btn:active { transform: translateY(0) scale(.995); }

/* Progress */
.ec-app-shell .progress-section {
  display: none;
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
  padding: 1.2rem 1.4rem;
}
.ec-app-shell .progress-section.visible { display: block; }
.ec-app-shell .progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .6rem;
}
.ec-app-shell .progress-label { color: var(--as-muted); font-size: .84rem; font-weight: 600; }
.ec-app-shell .progress-pct { color: var(--as-brand-ink); font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; }
.ec-app-shell .progress-bar-bg { height: 8px; background: var(--as-line); border-radius: 999px; overflow: hidden; }
.ec-app-shell .progress-bar-fill {
  height: 100%;
  background: var(--as-grad);
  border-radius: 999px;
  transition: width .3s ease;
  width: 0%;
}

/* ── Right column: its own bordered box, separated from the work box by a gap ─ */
.ec-result-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  background: var(--as-surface);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius);
  box-shadow: var(--as-shadow-sm);
}

.ec-result-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--as-faint);
  padding: 0 2px;
}

/* Cards on the white half → subtle off-white fill (matches the left half) */
.ec-panel {
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
}
.ec-panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--as-faint);
  padding: 16px 18px 0;
}

/* Placeholder shown until a result exists (off-white card, matches .ec-panel) */
.ec-result-placeholder {
  padding: 34px 22px;
  text-align: center;
  color: var(--as-faint);
  background: var(--as-surface-2);
}
.ec-result-placeholder .ec-ph-ico {
  width: 54px; height: 54px;
  margin: 0 auto 12px;
  border-radius: 15px;
  background: var(--as-brand-soft);
  display: grid;
  place-items: center;
  color: var(--as-brand);
}
.ec-result-placeholder h4 { margin: 0 0 4px; font-size: 14px; color: var(--as-muted); font-weight: 700; }
.ec-result-placeholder p { margin: 0; font-size: 12.5px; line-height: 1.5; }
/* Hide the placeholder once the real result card is visible */
.ec-result-col:has(.results-section.visible) .ec-result-placeholder { display: none; }

/* Result card */
.ec-app-shell .results-section {
  display: none;
  padding: 22px;
  text-align: center;
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
}
.ec-app-shell .results-section.visible { display: block; }
.ec-app-shell .results-header { margin-bottom: 1rem; }
.ec-result-check {
  width: 52px; height: 52px;
  border-radius: 50%;
  margin: 0 auto 12px;
  background: var(--as-success-soft);
  color: var(--as-success);
  display: grid;
  place-items: center;
}
.ec-app-shell .results-title {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--as-ink);
}
.ec-app-shell .results-title span { color: var(--as-brand-ink); }

.ec-app-shell .download-word-btn {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--as-grad);
  border: none;
  color: #fff;
  padding: .85rem 1.4rem;
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  border-radius: var(--as-radius-sm);
  cursor: pointer;
  box-shadow: 0 12px 26px -10px rgba(79, 70, 229, .6);
  transition: transform .12s ease, box-shadow .12s ease;
  margin-top: 1.1rem;
}
.ec-app-shell .download-word-btn:hover { transform: translateY(-1px); box-shadow: 0 16px 30px -10px rgba(79, 70, 229, .66); }

.ec-app-shell .word-preview {
  margin-top: 1rem;
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
  background: #eef2f7;
  text-align: left;
}

/* "Expand preview" button + full-screen lightbox (injected by app-shell.js) */
.ec-preview-expand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 1rem;
  padding: 9px 16px;
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
  background: var(--as-surface);
  color: var(--as-brand-ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.ec-preview-expand:hover { border-color: var(--as-brand); background: var(--as-brand-soft); }

.ec-lightbox-back {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 32px);
  background: rgba(12, 15, 34, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.ec-lightbox {
  position: relative;
  width: min(1000px, 96vw);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  background: #eef2f7;
  border-radius: var(--as-radius);
  box-shadow: 0 30px 80px rgba(12, 15, 34, .5);
  overflow: hidden;
}
.ec-lightbox-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--as-ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(12, 15, 34, .2);
}
.ec-lightbox-close:hover { background: #fff; }
.ec-lightbox-body {
  overflow: auto;
  padding: clamp(14px, 2.5vw, 28px);
}
.ec-lightbox-body .docx-wrapper { background: #eef2f7 !important; padding: 0 !important; }
/* Galleries and single images open large inside the lightbox */
.ec-lightbox-body .images-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 0; }
.ec-lightbox-body .image-card img { aspect-ratio: auto; object-fit: contain; background: #fff; }
.ec-lightbox-img { display: block; max-width: 100%; height: auto; margin: 0 auto; background: #fff; border-radius: 10px; }

/* ── Safety: media inside the columns never overflows ────────────────────── */
.ec-work-col img, .ec-work-col canvas, .ec-work-col video,
.ec-result-col img, .ec-result-col canvas, .ec-result-col video { max-width: 100%; height: auto; }

/* ── Result image gallery (pdf-to-jpg, image tools, …) ───────────────────── */
.ec-app-shell .results-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ec-app-shell .download-all-btn {
  background: var(--as-grad);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 15px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
  box-shadow: 0 8px 18px -8px rgba(79, 70, 229, .5);
}
.ec-app-shell .images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
  margin-top: 14px;
  text-align: left;
}
.ec-app-shell .image-card {
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
  overflow: hidden;
}
.ec-app-shell .image-card img {
  width: 100%;
  display: block;
  aspect-ratio: 0.707;
  object-fit: cover;
  background: #e9edf5;
  cursor: zoom-in;
}
.ec-app-shell .image-card-footer {
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--as-line);
}
.ec-app-shell .page-label { font-size: 11px; color: var(--as-faint); text-transform: uppercase; letter-spacing: .05em; }
.ec-app-shell .dl-btn {
  background: none;
  border: none;
  color: var(--as-brand-ink);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ec-app-shell .dl-btn:hover { opacity: .7; }
.ec-app-shell .jszip-note { font-size: 12px; color: var(--as-faint); margin-top: 8px; text-align: center; }

/* ── Result summary stats + table preview (pdf-to-excel, …) ──────────────── */
.ec-app-shell .summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.ec-app-shell .summary-item {
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
  padding: 12px;
  text-align: center;
}
.ec-app-shell .summary-value { color: var(--as-brand-ink); font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.ec-app-shell .summary-label { color: var(--as-faint); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; margin-top: 2px; }

/* Tool-specific download buttons → same gradient primary look as .download-word-btn */
.ec-app-shell .download-excel-btn,
.ec-app-shell .download-result-btn {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--as-grad);
  border: none;
  color: #fff;
  padding: .85rem 1.4rem;
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  border-radius: var(--as-radius-sm);
  cursor: pointer;
  box-shadow: 0 12px 26px -10px rgba(79, 70, 229, .6);
  margin-top: 1rem;
}
.ec-app-shell .download-excel-btn:hover,
.ec-app-shell .download-result-btn:hover { transform: translateY(-1px); }

.ec-app-shell .preview-wrap {
  display: none;
  margin-top: 16px;
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
  max-height: 320px;
  overflow: auto;
  text-align: left;
}
.ec-app-shell .preview-wrap.visible { display: block; }
.ec-app-shell .preview-wrap table { border-collapse: collapse; width: 100%; min-width: 420px; font-size: .8rem; }
.ec-app-shell .preview-wrap th, .ec-app-shell .preview-wrap td { border: 1px solid var(--as-line); padding: .5rem; color: var(--as-ink); vertical-align: top; }
.ec-app-shell .preview-wrap th { position: sticky; top: 0; background: var(--as-surface); color: var(--as-brand-ink); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════════════
   "tool-card" component family — used by docx-to-pdf, excel-to-pdf, pdf-to-epub,
   ebook-converter, gif-converter, media-converter, image-converter, image-to-pdf.
   Their original inline CSS is removed on rollout, so these restyle the same
   class names in the app-shell language.
   ═══════════════════════════════════════════════════════════════════════════ */

/* The card is just a stack inside the work box — the box supplies the frame. */
.ec-app-shell .tool-card {
  display: grid;
  gap: 1rem;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

/* File inputs are always triggered by a styled button on these pages. */
.ec-app-shell .ec-work-col input[type="file"] { display: none; }

/* Mode selector buttons / tabs */
.ec-app-shell .mode-grid,
.ec-app-shell .tool-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .6rem;
}
.ec-app-shell .mode-btn,
.ec-app-shell .tool-tabs a,
.ec-app-shell .tool-tabs button {
  border: 1px solid var(--as-line);
  background: var(--as-surface-2);
  color: var(--as-muted);
  border-radius: var(--as-radius-sm);
  padding: .8rem;
  font: inherit;
  font-weight: 700;
  font-size: .9rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.ec-app-shell .mode-btn:hover,
.ec-app-shell .tool-tabs a:hover,
.ec-app-shell .tool-tabs button:hover { color: var(--as-ink); border-color: var(--as-brand); }
.ec-app-shell .mode-btn.active,
.ec-app-shell .tool-tabs .active {
  color: #fff;
  border-color: transparent;
  background: var(--as-grad);
  box-shadow: 0 8px 18px -8px rgba(79, 70, 229, .5);
}

/* These drop zones stack an icon + title + hint, so lay them out as a centred grid
   (pdf-to-word's block-level drop zone is unaffected — it has no .tool-card). */
.ec-app-shell .tool-card .drop-zone {
  display: grid;
  gap: .5rem;
  justify-items: center;
  align-content: center;
}
/* Font-awesome icon inside a drop zone (these pages use <i>, not an svg) */
.ec-app-shell .drop-zone i { color: var(--as-brand); font-size: 1.9rem; }
/* Some pages ship an empty .drop-icon placeholder — don't render a blank square. */
.ec-app-shell .drop-icon:empty { display: none; }
.ec-app-shell .drop-zone .drop-title { font-size: 1.05rem; font-weight: 700; color: var(--as-ink); }
.ec-app-shell .drop-zone .drop-subtitle,
.ec-app-shell .drop-zone .drop-hint { color: var(--as-muted); font-size: .88rem; }

/* Option rows */
.ec-app-shell .options,
.ec-app-shell .image-options,
.ec-app-shell .controls,
.ec-app-shell .option-field {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: end;
}
.ec-app-shell .tool-card label,
.ec-app-shell .options label,
.ec-app-shell .controls label {
  display: grid;
  gap: .4rem;
  color: var(--as-muted);
  font-weight: 700;
  font-size: .85rem;
}
.ec-app-shell .ec-work-col select,
.ec-app-shell .ec-work-col input[type="text"],
.ec-app-shell .ec-work-col input[type="number"] {
  width: 100%;
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  color: var(--as-ink);
  padding: .6rem .75rem;
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  border-radius: 10px;
  outline: none;
}
.ec-app-shell .check-row { display: flex; align-items: center; gap: .5rem; color: var(--as-muted); font-size: .9rem; }

/* Primary action button (their "Convert" button) */
.ec-app-shell .primary-btn {
  border: 0;
  border-radius: var(--as-radius-sm);
  padding: .95rem 1.25rem;
  background: var(--as-grad);
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 12px 26px -10px rgba(79, 70, 229, .6);
  transition: transform .12s ease;
}
.ec-app-shell .primary-btn:hover:not(:disabled) { transform: translateY(-1px); }
.ec-app-shell .primary-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* Status / message line */
.ec-app-shell .status,
.ec-app-shell .message {
  color: var(--as-muted);
  line-height: 1.6;
  min-height: 1.4rem;
  font-size: .9rem;
}

/* Selected-file list */
.ec-app-shell .file-list { display: grid; gap: .6rem; }
.ec-app-shell .file-list > * {
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
  padding: .7rem .9rem;
  font-size: .88rem;
}

/* Image preview grid (image-converter) */
.ec-app-shell .preview-list { display: none; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .85rem; }
.ec-app-shell .preview-list.visible { display: grid; }
.ec-app-shell .preview-item {
  display: grid;
  gap: .6rem;
  min-width: 0;
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
  padding: .8rem;
}
.ec-app-shell .preview-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  background: var(--as-surface);
  border: 1px solid var(--as-line);
}
.ec-app-shell .preview-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.ec-app-shell .preview-name { color: var(--as-ink); font-weight: 800; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ec-app-shell .preview-meta { color: var(--as-faint); font-size: .8rem; line-height: 1.35; }

/* Media file preview (media-converter) */
.ec-app-shell .media-preview {
  display: grid;
  gap: .5rem;
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
  padding: .9rem;
}
.ec-app-shell .media-file-name { color: var(--as-ink); font-weight: 800; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; }
.ec-app-shell .media-file-meta { color: var(--as-faint); font-size: .82rem; font-variant-numeric: tabular-nums; }
.ec-app-shell .media-note { color: var(--as-muted); font-size: .84rem; line-height: 1.5; }

/* Quality slider (image-converter) */
.ec-app-shell .quality-control { display: grid; gap: .42rem; color: var(--as-muted); font-weight: 700; font-size: .88rem; }
.ec-app-shell .quality-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.ec-app-shell .quality-head output { color: var(--as-ink); font-weight: 900; font-variant-numeric: tabular-nums; }
.ec-app-shell .quality-control input[type="range"] { width: 100%; accent-color: var(--as-brand); }
.ec-app-shell .quality-control small { color: var(--as-faint); font-weight: 600; line-height: 1.35; }

/* Cross-links: "workflows" and "next actions" */
.ec-app-shell .image-workflows,
.ec-app-shell .next-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: .7rem;
}
.ec-app-shell .image-workflow,
.ec-app-shell .next-actions-grid a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .8rem .9rem;
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
  background: var(--as-surface-2);
  color: var(--as-ink);
  text-decoration: none;
  font-weight: 700;
  font-size: .88rem;
  transition: border-color .15s ease, background .15s ease;
}
.ec-app-shell .image-workflow:hover,
.ec-app-shell .next-actions-grid a:hover { border-color: var(--as-brand); background: var(--as-brand-soft); }
.ec-app-shell .image-workflow i {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--as-grad);
  flex: 0 0 auto;
}
.ec-app-shell .next-actions-grid a i { color: var(--as-brand); }
.ec-app-shell .image-workflow strong { display: block; font-size: .9rem; line-height: 1.15; }
.ec-app-shell .image-workflow span { display: block; color: var(--as-muted); font-size: .78rem; line-height: 1.3; margin-top: .16rem; font-weight: 600; }
.ec-app-shell .next-actions { display: grid; gap: .65rem; margin-top: .35rem; padding-top: 1rem; border-top: 1px solid var(--as-line); }
.ec-app-shell .next-actions-title { color: var(--as-ink); font-size: .9rem; font-weight: 800; }

/* ── Shared completion card from usage-limit.js (showDownloadCard) ──────────
   It ships its own Bebas/uppercase + outline-button styling; restyle it here so
   every app-shell page gets the same look. Two classes beat its one-class rules. */
.ec-app-shell .ec-result-card {
  text-align: center;
  margin-top: 1.2rem;
  padding: 20px;
  background: var(--as-surface-2);
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius);
}
.ec-app-shell .ec-result-title {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.01em;
  text-transform: none;
  color: var(--as-ink);
  line-height: 1.35;
}
.ec-app-shell .ec-download-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 1rem; }
.ec-app-shell .ec-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1 1 auto;
  padding: .85rem 1.4rem;
  background: var(--as-grad);
  border: none;
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  border-radius: var(--as-radius-sm);
  cursor: pointer;
  box-shadow: 0 12px 26px -10px rgba(79, 70, 229, .6);
  transition: transform .12s ease;
}
.ec-app-shell .ec-download-btn:hover { background: var(--as-grad); color: #fff; transform: translateY(-1px); }
.ec-app-shell .ec-download-btn:disabled { opacity: .55; cursor: default; box-shadow: none; transform: none; }
.ec-app-shell .ec-download-btn-alt {
  background: var(--as-surface);
  border: 1px solid var(--as-line);
  color: var(--as-muted);
  box-shadow: none;
}
.ec-app-shell .ec-download-btn-alt:hover { background: var(--as-surface); border-color: var(--as-faint); color: var(--as-ink); }
.ec-app-shell .ec-reset-btn {
  display: block;
  margin: 1rem auto 0;
  padding: .6rem 1.3rem;
  background: var(--as-surface);
  border: 1px solid var(--as-line);
  color: var(--as-muted);
  font: inherit;
  font-size: .86rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  border-radius: var(--as-radius-sm);
  cursor: pointer;
}
.ec-app-shell .ec-reset-btn:hover { border-color: var(--as-faint); color: var(--as-ink); }
.ec-app-shell .word-preview .docx-wrapper { background: #eef2f7 !important; padding: 12px !important; }
.ec-app-shell .word-preview-hint { padding: 1rem; text-align: center; color: var(--as-muted); font-size: .88rem; }

.ec-app-shell .download-fallback {
  display: none;
  margin-top: .9rem;
  padding: .8rem 1rem;
  border: 1px solid var(--as-brand-soft);
  border-radius: var(--as-radius-sm);
  background: var(--as-brand-soft);
  color: var(--as-muted);
  font-size: .84rem;
  line-height: 1.5;
  text-align: left;
}
.ec-app-shell .download-fallback.visible { display: block; }
.ec-app-shell .download-fallback a { color: var(--as-brand-ink); font-weight: 800; text-decoration: none; }
.ec-app-shell .download-fallback a:hover { text-decoration: underline; }

.ec-app-shell .reset-area { display: none; margin-top: .8rem; }
.ec-app-shell .reset-area.visible { display: block; }
.ec-app-shell .reset-btn {
  width: 100%;
  background: var(--as-surface);
  border: 1px solid var(--as-line);
  color: var(--as-muted);
  padding: .7rem 1rem;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  border-radius: var(--as-radius-sm);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.ec-app-shell .reset-btn:hover { border-color: var(--as-faint); color: var(--as-ink); }

/* Quota card (injected by app-shell.js) */
.ec-quota-card { padding: 16px 18px 18px; }
.ec-quota-card .ec-quota-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
  color: var(--as-ink);
  margin-bottom: 9px;
  font-size: 13.5px;
}
.ec-quota-card .ec-quota-row span:first-child { color: var(--as-muted); font-weight: 600; }
.ec-quota-card .ec-quota-row b { font-variant-numeric: tabular-nums; }
.ec-quota-bar { height: 7px; background: var(--as-line); border-radius: 999px; overflow: hidden; }
.ec-quota-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--as-grad); transition: width .3s ease; }
.ec-quota-card .ec-quota-note { margin: 10px 0 0; font-size: 12px; color: var(--as-faint); line-height: 1.5; }
.ec-quota-card .ec-quota-note a { color: var(--as-brand-ink); font-weight: 700; text-decoration: none; }
.ec-quota-card .ec-quota-note a:hover { text-decoration: underline; }
.ec-quota-card.is-pro .ec-quota-bar { display: none; }

/* Related tools card (injected) */
.ec-related-card { padding: 16px 18px 18px; }
.ec-related-card .ec-related-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.ec-related-card a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--as-line);
  border-radius: var(--as-radius-sm);
  text-decoration: none;
  color: var(--as-muted);
  font-size: 13.5px;
  font-weight: 600;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.ec-related-card a:hover { border-color: color-mix(in srgb, var(--as-brand) 40%, var(--as-line)); color: var(--as-ink); background: var(--as-surface-2); }
.ec-related-card a i {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--as-brand-soft);
  color: var(--as-brand);
  display: grid;
  place-items: center;
  font-size: 12px;
  flex: none;
}

/* ── SEO sections below the workspace stay full width (styled by
   tool-page-redesign.css). Just give them breathing room + a max width. ──── */
.ec-app-shell .ec-info-grid,
.ec-app-shell .ec-seo-guide,
.ec-app-shell .ec-related,
.ec-app-shell .ec-security-band {
  width: min(100%, 1320px);
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(18px, 3vw, 40px);
  padding-right: clamp(18px, 3vw, 40px);
}
/* Breathing room between the tool boxes and the guide boxes below */
.ec-app-shell .ec-info-grid { margin-top: 48px; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.ec-app-shell .site-footer {
  width: 100%;
  margin: 3.5rem 0 0;
  padding: 2.4rem clamp(18px, 3vw, 40px) 2rem;
  border-top: 1px solid var(--as-line);
  background: var(--as-surface);
  color: var(--as-muted);
}
.ec-app-shell .footer-grid {
  width: min(100%, 1200px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  padding-bottom: 1.75rem;
}
.ec-app-shell .footer-group { display: grid; align-content: start; gap: .55rem; }
.ec-app-shell .footer-group h2 {
  display: flex; align-items: center; gap: .5rem;
  color: var(--as-ink); font-size: .92rem; font-weight: 800; margin: 0 0 .3rem;
}
.ec-app-shell .footer-group h2 i, .ec-app-shell .footer-logo i { color: var(--as-brand); }
.ec-app-shell .footer-group a, .ec-app-shell .footer-group span {
  color: var(--as-muted); text-decoration: none; font-size: .88rem; line-height: 1.35;
}
.ec-app-shell .footer-group a:hover { color: var(--as-ink); }
.ec-app-shell .footer-group span { opacity: .6; }
.ec-app-shell .footer-legal-row {
  width: min(100%, 1200px);
  margin: 0 auto;
}
.ec-app-shell .footer-bottom {
  width: min(100%, 1200px);
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; padding-top: 1.25rem; border-top: 1px solid var(--as-line);
}
.ec-app-shell .footer-logo { display: inline-flex; align-items: center; gap: .6rem; color: var(--as-ink); font-weight: 800; }
.ec-app-shell .footer-bottom p { font-size: .86rem; margin: 0; }

.ec-app-shell .language-menu { position: relative; margin-left: auto; }
.ec-app-shell .language-toggle {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid var(--as-line); background: var(--as-surface); color: var(--as-ink);
  border-radius: 10px; padding: .5rem .75rem; font: inherit; font-weight: 700; cursor: pointer;
}
.ec-app-shell .language-toggle::after { content: '▾'; color: var(--as-faint); font-size: .7rem; }
.ec-app-shell .language-dropdown {
  position: absolute; right: 0; bottom: calc(100% + .6rem); min-width: 170px;
  display: none; grid-template-columns: 1fr; gap: .2rem; padding: .45rem;
  background: var(--as-surface); border: 1px solid var(--as-line); border-radius: 12px;
  box-shadow: var(--as-shadow); z-index: 25;
}
.ec-app-shell .language-menu.open .language-dropdown { display: grid; }
.ec-app-shell .language-dropdown button {
  border: none; background: transparent; color: var(--as-muted); border-radius: 8px;
  padding: .55rem .7rem; text-align: left; font: inherit; font-weight: 600; cursor: pointer;
}
.ec-app-shell .language-dropdown button:hover,
.ec-app-shell .language-dropdown button.active { color: var(--as-ink); background: var(--as-surface-2); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  /* Stack: the result box drops below the work box (gap handles the spacing). */
  .ec-workzone { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .ec-app-shell .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .ec-app-shell main { padding: 18px 14px 8px; }
  .ec-app-shell .conversion-mode-grid { grid-template-columns: 1fr; }
  .ec-app-shell .footer-grid { grid-template-columns: 1fr; }
  .ec-app-shell .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .ec-app-shell * { transition: none !important; animation: none !important; }
}
