/* ============================================================
   boss-pdf · executive office, premium, with personality
   ============================================================ */

:root {
  /* warm midnight base — leather & wood undertones */
  --bg: #0a0c12;
  --bg-warm: #0d0f17;
  --surface: #14161f;
  --surface-2: #181b25;
  --surface-3: #1f222e;
  --line: #2a2d3b;
  --line-2: #353a4a;
  --line-soft: #1f2230;

  /* warm cream */
  --text: #f4ecdb;
  --text-2: #d3cab8;
  --text-3: #a39d8e;
  --muted: #7a7585;

  /* aged gold — not bright yellow */
  --gold: #c9a15a;
  --gold-2: #e3bf72;
  --gold-3: #a17d3d;
  --gold-soft: rgba(201, 161, 90, 0.14);
  --gold-ink: #1a1308;

  --ok: #5fdfb0;
  --bad: #ef6f6f;
  --signal-red: #c95044;

  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.55), 0 2px 0 rgba(255, 255, 255, 0.02) inset;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --serif: "Fraunces", "Playfair Display", Georgia, serif;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: var(--sans);
  font-feature-settings: "ss01";
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 8% -8%, rgba(201, 161, 90, 0.12), transparent 60%),
    radial-gradient(900px 700px at 110% 110%, rgba(60, 40, 130, 0.08), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

button { font-family: inherit; }

::selection { background: rgba(201, 161, 90, 0.4); color: var(--text); }

/* ============================================================
   header
   ============================================================ */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 40px; right: 40px; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 161, 90, 0.4), transparent);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }

.title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.6px;
}
.title .dot { color: var(--gold); margin: 0 1px; font-style: italic; }

.subtitle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 11.5px;
  margin-top: 4px;
  letter-spacing: 0.1px;
  font-style: italic;
  font-family: var(--serif);
  font-weight: 500;
}
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* logo block: a small B with a tiny gold crown above */
.logo {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 11px;
  background:
    linear-gradient(160deg, var(--gold-2), var(--gold) 50%, var(--gold-3));
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 800;
  color: var(--gold-ink);
  font-size: 20px;
  letter-spacing: -1px;
  box-shadow:
    0 8px 22px rgba(201, 161, 90, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}
.logo-letter { line-height: 1; transform: translateY(-1px); }
.logo-crown {
  position: absolute;
  top: -6px; left: 50%;
  transform: translateX(-50%);
  width: 16px; height: 9px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold-3));
  clip-path: polygon(0 100%, 0 35%, 18% 60%, 30% 0, 50% 50%, 70% 0, 82% 60%, 100% 35%, 100% 100%);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

.header-right { display: flex; align-items: center; gap: 14px; }
.header-tag {
  color: var(--text-3);
  font-size: 12px;
  font-style: italic;
  font-family: var(--serif);
}
.header-link {
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.header-link:hover {
  color: var(--gold);
  border-color: rgba(201, 161, 90, 0.45);
}

/* user chip */
.user-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  max-width: 280px;
}
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--gold-2), var(--gold-3));
  color: var(--gold-ink);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-weight: 800;
  font-size: 13px;
  overflow: hidden;
  flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-avatar.lg { width: 44px; height: 44px; font-size: 18px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.user-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px;
}
.user-title {
  font-size: 11px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px;
  font-style: italic; font-family: var(--serif);
}
.user-logout {
  background: transparent; border: 1px solid var(--line);
  color: var(--text-3); border-radius: 50%;
  width: 26px; height: 26px;
  cursor: pointer; font-size: 13px;
  display: grid; place-items: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.user-logout:hover { color: var(--bad); border-color: var(--bad); background: rgba(239,111,111,0.08); }

@media (max-width: 760px) {
  .topbar { padding: 16px 22px; }
  .topbar::after { left: 22px; right: 22px; }
  .header-tag { display: none; }
}

/* ============================================================
   layout
   ============================================================ */

main {
  max-width: 940px;
  margin: 40px auto 80px;
  padding: 0 32px;
}

@media (max-width: 760px) {
  main { padding: 0 22px; margin-top: 28px; }
}

/* ============================================================
   dropzone — the boss's desk
   ============================================================ */

.dropzone {
  position: relative;
  border: 1.5px dashed rgba(201, 161, 90, 0.35);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(700px 320px at 50% 0%, rgba(201, 161, 90, 0.10), transparent 70%),
    linear-gradient(180deg, var(--surface), var(--bg-warm));
  padding: 96px 32px 108px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s, background 0.25s;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.dropzone::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.012), transparent 25%),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.008), transparent 30%);
  pointer-events: none;
}

/* a tilted "CONFIDENTIAL" stamp — decorative boss flourish */
.dz-stamp {
  position: absolute;
  top: 28px; right: 30px;
  font-family: var(--serif);
  font-weight: 700;
  font-style: italic;
  font-size: 11px;
  letter-spacing: 4px;
  color: rgba(201, 80, 68, 0.5);
  border: 1.5px solid rgba(201, 80, 68, 0.45);
  padding: 5px 12px 4px;
  border-radius: 4px;
  transform: rotate(8deg);
  text-transform: uppercase;
  pointer-events: none;
}

.dropzone:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}
.dropzone.drag {
  border-color: var(--gold);
  border-style: solid;
  background:
    radial-gradient(700px 320px at 50% 0%, rgba(201, 161, 90, 0.18), transparent 70%),
    linear-gradient(180deg, var(--surface), var(--bg-warm));
  transform: scale(1.005);
}

.dz-inner { position: relative; z-index: 1; }

.kicker {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--gold);
  font-weight: 600;
  margin: 0 0 14px;
  text-transform: uppercase;
}

.dz-inner h1 {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1.0;
  color: var(--text);
}
.dz-inner h1 em {
  display: block;
  font-style: italic;
  font-weight: 700;
  color: var(--gold);
  margin-top: 4px;
  letter-spacing: -2.4px;
}

.dz-inner .sub {
  color: var(--text-2);
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  font-family: var(--serif);
  font-weight: 500;
  font-style: italic;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-style: italic;
  font-weight: 700;
  color: var(--gold);
  cursor: pointer;
  border-bottom: 1.5px solid rgba(201, 161, 90, 0.5);
  transition: color 0.15s, border-color 0.15s;
}
.link-btn:hover { color: var(--gold-2); border-color: var(--gold-2); }

@media (max-width: 760px) {
  .dropzone { padding: 64px 22px 72px; }
  .dz-inner h1 { font-size: 42px; letter-spacing: -1.2px; }
  .dz-stamp { top: 16px; right: 16px; font-size: 10px; }
}

/* ============================================================
   cards
   ============================================================ */

.card {
  position: relative;
  margin-top: 22px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 30px 32px;
  box-shadow: var(--shadow-md);
}
.card::before {
  content: "";
  position: absolute;
  left: 32px; right: 32px; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 161, 90, 0.5), transparent);
}
.hidden { display: none !important; }

.filebar {
  display: flex; flex-wrap: wrap;
  justify-content: space-between; align-items: baseline;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line-soft);
}
.memo {
  font-family: var(--serif);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--gold);
  text-transform: uppercase;
  font-style: italic;
}
.fname { font-weight: 600; word-break: break-all; flex: 1; min-width: 0; font-size: 14px; }
.fsize {
  color: var(--text-3); font-size: 13px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.boss-line {
  margin: 4px 0 8px;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
  color: var(--text);
}
.boss-sub {
  color: var(--text-2);
  margin: 0 0 24px;
  font-size: 14.5px;
  font-style: italic;
  font-family: var(--serif);
  font-weight: 500;
}

/* ============================================================
   tool chooser
   ============================================================ */

.tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}
.tool-card {
  position: relative;
  text-align: left;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px 26px 24px;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.18s, border-color 0.18s, background 0.18s, box-shadow 0.18s;
  font: inherit;
  font-size: 15px;
  overflow: hidden;
}
.tool-card::after {
  content: "→";
  position: absolute;
  top: 26px; right: 26px;
  color: var(--text-3);
  font-size: 20px;
  transition: color 0.18s, transform 0.18s;
}
.tool-card:hover {
  border-color: var(--gold);
  background:
    radial-gradient(280px 120px at 100% 0%, rgba(201, 161, 90, 0.10), transparent 70%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}
.tool-card:hover::after { color: var(--gold); transform: translateX(4px); }

.tool-emoji {
  font-size: 30px;
  margin-bottom: 12px;
  line-height: 1;
  display: block;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
}
.tool-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.5px;
}
.tool-desc {
  color: var(--text-2);
  font-size: 13.5px;
  margin-top: 6px;
  line-height: 1.55;
}

@media (max-width: 600px) {
  .tools { grid-template-columns: 1fr; }
}

/* ============================================================
   page toolbar (used in converter & splitter)
   ============================================================ */

.page-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  margin-bottom: 16px;
}
.toolbar-divider {
  width: 1px; height: 22px;
  background: var(--line-2);
  margin: 0 4px;
}
.toolbar-label {
  color: var(--text-3);
  font-size: 12.5px;
  font-style: italic;
  font-family: var(--serif);
  margin-right: 2px;
}
.range-mini {
  width: 64px;
  background: var(--bg-warm);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13.5px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.range-mini:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.range-arrow {
  color: var(--muted);
  font-size: 14px;
  font-family: var(--serif);
  font-weight: 600;
}

#convSummary.warn { color: var(--bad); font-style: normal; }
.hint {
  color: var(--text-3);
  font-size: 12.5px;
  margin: 8px 0 0;
  font-style: italic;
  font-family: var(--serif);
}

/* ============================================================
   section list (splitter — each row = one output PDF)
   ============================================================ */

.section-list {
  display: flex; flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.section-row {
  --sec-color: var(--gold);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--sec-color);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.18s, background 0.18s, transform 0.12s;
}
.section-row:hover {
  border-color: var(--line-2);
  border-left-color: var(--sec-color);
  background: var(--surface-3);
}

.section-marker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}
.section-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--sec-color);
  box-shadow: 0 0 10px var(--sec-color);
}
.section-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
}

.section-range {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  flex-wrap: wrap;
}
.section-range .field-label {
  color: var(--text-3);
  font-size: 13px;
  font-style: italic;
  font-family: var(--serif);
}
.section-range input[type="number"] {
  width: 72px;
  background: var(--bg-warm);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.section-range input[type="number"]:focus {
  outline: none;
  border-color: var(--sec-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sec-color) 22%, transparent);
}
.section-range .range-arrow {
  color: var(--muted);
  font-size: 16px;
}

.section-count {
  color: var(--text-3);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-style: italic;
  font-family: var(--serif);
}
.section-count.bad { color: var(--bad); font-style: normal; }

.section-remove {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-3);
  border-radius: 8px;
  width: 30px; height: 30px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  font-family: inherit;
  transition: all 0.12s;
}
.section-remove:hover {
  border-color: var(--bad);
  color: var(--bad);
}
.section-remove:disabled {
  opacity: 0.35; cursor: not-allowed;
}

/* ============================================================
   thumbnail grid + page tiles (preview only, not interactive)
   ============================================================ */

.preview-block {
  margin-top: 18px;
}
.preview-header {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px;
  margin-bottom: 10px;
}
.preview-label {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 0.3px;
}
.preview-hint {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  font-family: var(--serif);
}

.thumbgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  background: var(--bg-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  max-height: 480px;
  overflow-y: auto;
  margin-bottom: 18px;
}
.thumbgrid::-webkit-scrollbar { width: 10px; }
.thumbgrid::-webkit-scrollbar-track { background: transparent; }
.thumbgrid::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 6px; border: 2px solid var(--bg-warm);
}
.thumbgrid::-webkit-scrollbar-thumb:hover { background: var(--gold); }

.thumbs-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 36px 12px;
  color: var(--muted);
  font-style: italic;
  font-family: var(--serif);
}
.thumbs-empty.err { color: var(--bad); font-style: normal; font-family: var(--sans); }

.page-tile {
  --tile-color: transparent;
  position: relative;
  cursor: pointer;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 6px 6px 8px;
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
  display: flex; flex-direction: column; gap: 6px;
  font-family: inherit; color: inherit;
  text-align: center;
}
.page-tile:hover {
  border-color: rgba(201, 161, 90, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
}
.page-tile.selected {
  border-color: var(--tile-color, var(--gold));
  box-shadow:
    0 0 0 2px var(--tile-color, var(--gold)),
    0 8px 22px rgba(0, 0, 0, 0.45);
  background: var(--surface-3);
}

.page-tile .thumb {
  width: 100%;
  aspect-ratio: 0.77;
  background: #f4f1e8;
  border-radius: 5px;
  overflow: hidden;
  display: grid; place-items: center;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.page-tile .thumb canvas { display: block; max-width: 100%; max-height: 100%; }
.thumb-skel {
  width: 100%; height: 100%;
  background: linear-gradient(110deg, #ece7da 30%, #fbf6e9 50%, #ece7da 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.page-tile .page-num {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
}
.page-tile.selected .page-num { color: var(--tile-color, var(--gold)); }

.section-tag {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  color: #0a0c12;
  letter-spacing: 0.4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   buttons
   ============================================================ */

.row-actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 8px; align-items: center;
}
.primary, .ghost {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.1px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s, background 0.18s, color 0.18s, box-shadow 0.18s, border-color 0.18s;
  font-family: inherit;
}
.primary {
  background:
    linear-gradient(180deg, var(--gold-2), var(--gold) 65%, var(--gold-3));
  color: var(--gold-ink);
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow:
    0 6px 18px rgba(201, 161, 90, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}
.primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 12px 28px rgba(201, 161, 90, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}
.primary:active { transform: translateY(0); }

.ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--line);
}
.ghost:hover {
  background: var(--surface-2);
  border-color: rgba(201, 161, 90, 0.45);
  color: var(--text);
}
.ghost.small {
  padding: 7px 13px;
  font-size: 12.5px;
  border-radius: 8px;
}

/* ============================================================
   progress
   ============================================================ */

.progress {
  height: 8px;
  background: var(--bg-warm);
  border-radius: 999px;
  margin: 18px 0 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-3), var(--gold), var(--gold-2));
  transition: width 0.25s ease;
}
.bar.indeterminate {
  width: 40% !important;
  animation: slide 1.4s infinite ease-in-out;
}
@keyframes slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}
.msg {
  color: var(--text-2);
  margin: 6px 0 0;
  font-size: 14px;
  font-style: italic;
  font-family: var(--serif);
}

/* ============================================================
   results / errors
   ============================================================ */

.ok {
  color: var(--ok);
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 17px;
  font-family: var(--serif);
  letter-spacing: -0.2px;
}
.bad {
  color: var(--bad);
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 17px;
  font-family: var(--serif);
  letter-spacing: -0.2px;
}

.splitlist {
  display: flex; flex-direction: column; gap: 10px;
  margin: 18px 0 20px;
}
.split-item {
  --tile-color: var(--gold);
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--tile-color);
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color 0.18s, background 0.18s;
}
.split-item:hover {
  border-color: var(--line-2);
  border-left-color: var(--tile-color);
  background: var(--surface-3);
}
.split-item .label {
  flex: 1; min-width: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
}
.split-item .pages {
  color: var(--text-3);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  font-style: italic;
  font-family: var(--serif);
}
.split-item .actions { display: flex; gap: 8px; }
.split-item button, .split-item a {
  font-size: 12.5px; padding: 7px 13px; border-radius: 8px;
  font-weight: 700; cursor: pointer; text-decoration: none;
  font-family: inherit;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-2);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.split-item a.dl {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: var(--gold-ink);
  border-color: transparent;
}
.split-item button.toxlsx:hover { color: var(--gold); border-color: var(--gold); }

footer {
  text-align: center;
  color: var(--muted);
  padding: 24px 16px 36px;
  font-size: 12px;
  border-top: 1px solid var(--line-soft);
  margin-top: 80px;
  font-style: italic;
  font-family: var(--serif);
  letter-spacing: 0.3px;
}

/* ============================================================
   engine badge + OCR preview iframe (result screen)
   ============================================================ */

/* ============================================================
   Force OCR toggle (converter screen)
   ============================================================ */

.force-ocr-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 0 0 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.force-ocr-toggle:hover {
  border-color: rgba(201, 161, 90, 0.4);
}
.force-ocr-toggle input[type="checkbox"] {
  accent-color: var(--gold);
  margin-top: 3px;
  cursor: pointer;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.force-ocr-toggle .toggle-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.force-ocr-toggle .toggle-text strong {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.2px;
}
.force-ocr-toggle .toggle-text small {
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.55;
  font-style: italic;
  font-family: var(--serif);
}
.force-ocr-toggle .toggle-text code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--bg-warm);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 4px;
  font-style: normal;
  color: var(--text-2);
}
.force-ocr-toggle:has(input:checked) {
  border-color: var(--gold);
  border-left-color: var(--gold);
  background: rgba(201, 161, 90, 0.06);
}
.force-ocr-toggle:has(input:checked) .toggle-text strong {
  color: var(--gold);
}

.engine-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  margin: 4px 0 18px;
}
.engine-label {
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 700;
}
.engine-badge {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--gold);
  letter-spacing: 0.2px;
}
.engine-badge.ocr {
  color: var(--gold);
}
.engine-badge.native {
  color: var(--ok);
}

/* ============================================================
   login page
   ============================================================ */

.login-wrap {
  max-width: 520px;
  margin: 80px auto 60px;
  padding: 0 32px;
}
.login-card { padding: 36px 36px 32px; }
.login-card .boss-line { font-size: 30px; }
.login-card .field {
  display: flex; flex-direction: column;
  gap: 6px; margin-bottom: 16px;
}
.login-card .field-label {
  color: var(--text-3);
  font-size: 12.5px;
  letter-spacing: 0.2px;
  font-family: var(--serif);
  font-style: italic;
}
.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  background: var(--bg-warm);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  font-size: 14.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.login-err {
  background: rgba(239, 111, 111, 0.10);
  border: 1px solid rgba(239, 111, 111, 0.45);
  color: var(--bad);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ============================================================
   usage dashboard
   ============================================================ */

.usage-main {
  max-width: 1200px;
  margin: 30px auto 80px;
  padding: 0 32px;
}
.usage-main .card { margin-top: 22px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.stat-tile {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  padding: 14px 16px;
}
.stat-num {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 24px;
  color: var(--text);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-top: 2px;
}

.users-list {
  display: flex; flex-direction: column; gap: 10px;
}
.user-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.user-card[open] { background: var(--surface-3); border-color: var(--line-2); }
.user-card summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
}
.user-card summary::-webkit-details-marker { display: none; }
.user-card summary:hover { background: var(--surface-3); }

.user-summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
}
.user-summary-meta { min-width: 0; }
.user-summary-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.2px;
  color: var(--text);
}
.user-summary-title {
  font-style: italic;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--text-3);
}
.user-summary-sub {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 2px;
  font-style: italic;
  font-family: var(--serif);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-summary-stats {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  justify-content: flex-end;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.user-summary-stats b {
  color: var(--gold);
  font-weight: 700;
  font-family: var(--serif);
  margin-right: 2px;
}

.user-rows {
  border-top: 1px solid var(--line-soft);
  padding: 6px 4px 10px;
  overflow-x: auto;
}
.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.usage-table th, .usage-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.usage-table th {
  color: var(--text-3);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.usage-table td.num, .usage-table th.num { text-align: right; }
.usage-table tr:hover td { background: rgba(201, 161, 90, 0.04); }
.usage-table .file-cell {
  max-width: 240px;
  overflow: hidden; text-overflow: ellipsis;
}

.op-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--text-2);
  background: var(--bg-warm);
}
.op-pill.op-convert {
  color: var(--gold);
  border-color: rgba(201, 161, 90, 0.45);
  background: rgba(201, 161, 90, 0.08);
}
.op-pill.op-split {
  color: var(--ok);
  border-color: rgba(95, 223, 176, 0.4);
  background: rgba(95, 223, 176, 0.06);
}
.ocr-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-ink);
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
}

.ghost.small.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201, 161, 90, 0.08);
}

@media (max-width: 760px) {
  .user-summary { grid-template-columns: auto 1fr; }
  .user-summary-stats { grid-column: 1 / -1; justify-content: flex-start; }
  .usage-main { padding: 0 18px; }
}

