@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('../fonts/atkinson-hyperlegible-next-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('../fonts/atkinson-hyperlegible-next-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('../fonts/atkinson-hyperlegible-next-latin-ext-700-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('../fonts/atkinson-hyperlegible-next-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Tokens. Dark is the identity the plan chose (the cx-apps.site navy and cyan);
   light is the same structure on warm paper. Every colour, radius and shadow in
   the app comes from here; no hex value is written into a component. */
:root {
  --app-bg: #04091a;
  --app-surface: #0a152c;
  --app-surface-2: #0d1c39;
  --app-border: rgba(120, 170, 255, 0.18);
  --app-border-strong: rgba(120, 170, 255, 0.34);
  --app-text: #e9f2ff;
  --app-muted: #93a7c6;
  --app-subtle: #6b82a6;
  --app-accent: #3fd0ff;
  --app-accent-ink: #041221;
  --app-good: #77dfc9;
  --app-bad: #ff8b7a;
  --app-warn: #e3b04a;
  --app-radius: 14px;
  --app-radius-sm: 10px;
  --app-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 40px -28px rgba(0, 0, 0, 0.65);
  --app-font: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --app-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}

[data-app-mode='light'] {
  --app-bg: #f9f8f5;
  --app-surface: #ffffff;
  --app-surface-2: #f2f0ea;
  --app-border: #e6e3dc;
  --app-border-strong: #d3cfc4;
  --app-text: #17181b;
  --app-muted: #5d6068;
  --app-subtle: #8b8e95;
  --app-accent: #3a6ff0;
  --app-accent-ink: #ffffff;
  --app-good: #1f9d6a;
  --app-bad: #c9382f;
  --app-warn: #9a6413;
  --app-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 18px 40px -28px rgba(0, 0, 0, 0.3);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--app-bg);
  color: var(--app-text);
  font: 16px/1.55 var(--app-font);
  overflow-x: hidden;
}

h1, h2, h3, h4 { letter-spacing: -0.015em; }
a { color: var(--app-accent); }

:focus-visible {
  outline: 2px solid var(--app-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 14px 18px 72px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- top bar ---------------------------------------------------------- */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 0 16px;
}
/* The header carries the name and the mark, nothing else. The mark keeps its
   own width/height ratio (it is wider than tall), so it is sized by height. */
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--app-text); text-decoration: none; font-weight: 700; font-size: 18px;
  letter-spacing: -0.01em; min-height: 44px;
}
.brand .mark { height: 40px; flex: none; display: block; }
.brand .mark img { height: 40px; width: auto; display: block; }

.modebtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--app-border); border-radius: 999px;
  background: var(--app-surface); color: var(--app-muted);
  font: 500 13px var(--app-font); cursor: pointer;
}
.modebtn:hover { border-color: var(--app-border-strong); color: var(--app-text); }
.modebtn svg { width: 18px; height: 18px; }
/* Only icons: the sun in dark mode (tap for light), the moon in light mode. */
.modebtn .ic-moon { display: none; }
html[data-app-mode='light'] .modebtn .ic-sun { display: none; }
html[data-app-mode='light'] .modebtn .ic-moon { display: block; }

/* ---- hero ------------------------------------------------------------- */
.hero { padding: 8px 0 22px; }
.hero h1 { font-size: clamp(28px, 6vw, 40px); line-height: 1.1; margin: 0 0 10px; }
.hero p { margin: 0; color: var(--app-muted); font-size: 16.5px; max-width: 58ch; }
.promise {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 7px 12px;
  border: 1px solid color-mix(in srgb, var(--app-good) 40%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--app-good) 12%, transparent);
  color: var(--app-good); font-size: 13px; font-weight: 500;
}
.promise svg { width: 15px; height: 15px; flex: none; }

/* ---- home tiles ------------------------------------------------------- */
.tiles { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .tiles { grid-template-columns: 1fr 1fr; } }
@media (min-width: 920px) { .tiles { grid-template-columns: repeat(3, 1fr); } }

.tile {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 14px; min-height: 96px;
  border: 1px solid var(--app-border); border-radius: var(--app-radius);
  background: var(--app-surface); color: var(--app-text); text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.tile:hover, .tile:focus-visible {
  border-color: color-mix(in srgb, var(--app-accent) 55%, var(--app-border));
  background: color-mix(in srgb, var(--app-accent) 6%, var(--app-surface));
}
.tile .ic {
  width: 56px; height: 56px; border-radius: 14px; flex: none;
  display: block; overflow: hidden;
}
.tile .ic img { width: 56px; height: 56px; display: block; }
.tile b { display: block; font-size: 15.5px; line-height: 1.25; }
.tile small { display: block; color: var(--app-muted); font-size: 13px; line-height: 1.4; margin-top: 3px; }
.tile .go { margin-left: auto; color: var(--app-subtle); font-size: 18px; line-height: 1; padding-top: 4px; }
.home-note { margin-top: 20px; }

/* ---- tool page -------------------------------------------------------- */
.back {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px; margin: 0 0 4px -2px;
  color: var(--app-muted); text-decoration: none; font-size: 13.5px;
}
.back:hover { color: var(--app-text); }
.toolhead h1 { font-size: clamp(24px, 5.4vw, 32px); margin: 0 0 8px; line-height: 1.15; }
.toolhead p { margin: 0; color: var(--app-muted); max-width: 60ch; }

.panel {
  margin-top: 18px; padding: 16px;
  border: 1px solid var(--app-border); border-radius: var(--app-radius);
  background: var(--app-surface); box-shadow: var(--app-shadow);
}
.panel + .panel { margin-top: 14px; }
.panel h2 { margin: 0 0 4px; font-size: 17px; }
.panel .hint { margin: 0 0 12px; color: var(--app-muted); font-size: 13.5px; }

.steps {
  display: flex; align-items: center; gap: 8px; margin: 0 0 14px;
  color: var(--app-subtle); font: 500 11px var(--app-mono);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.steps b { color: var(--app-accent); font-weight: 700; }

/* ---- controls --------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px; padding: 12px 18px; width: 100%; max-width: 460px;
  border: 0; border-radius: 12px;
  background: var(--app-accent); color: var(--app-accent-ink);
  font: 700 15px var(--app-font); letter-spacing: -0.01em;
  cursor: pointer; text-decoration: none;
  transition: filter 0.15s, opacity 0.15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--app-text); border: 1px solid var(--app-border); }
.btn.ghost:hover { border-color: var(--app-border-strong); filter: none; }
.btn.small {
  width: auto; min-height: 44px; padding: 10px 14px; font-size: 13.5px; font-weight: 600;
  background: transparent; color: var(--app-text); border: 1px solid var(--app-border);
}
.btn.small:hover { border-color: var(--app-border-strong); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 10px 15px;
  border: 1px solid var(--app-border); border-radius: 999px;
  background: var(--app-surface-2); color: var(--app-muted);
  font: 500 14px var(--app-font); cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip[aria-pressed='true'], .chip.on {
  background: color-mix(in srgb, var(--app-accent) 18%, transparent);
  border-color: var(--app-accent); color: var(--app-accent); font-weight: 700;
}

.drop {
  display: grid; place-items: center; gap: 6px;
  padding: 26px 16px; min-height: 124px;
  border: 1.5px dashed color-mix(in srgb, var(--app-muted) 60%, transparent);
  border-radius: var(--app-radius);
  background: color-mix(in srgb, var(--app-surface-2) 60%, transparent);
  color: var(--app-muted); text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop strong { color: var(--app-text); font-size: 15.5px; }
.drop span { font-size: 13px; }
.drop svg { width: 26px; height: 26px; color: var(--app-accent); }
.drop:hover, .drop.over {
  border-color: var(--app-accent);
  background: color-mix(in srgb, var(--app-accent) 8%, transparent);
}
.drop input[type='file'] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.field { display: grid; gap: 6px; margin: 14px 0 0; }
.field label { font-size: 13.5px; color: var(--app-muted); font-weight: 500; }
.field input[type='text'], .field input[type='number'], .field select {
  min-height: 46px; padding: 10px 12px;
  border: 1px solid var(--app-border); border-radius: var(--app-radius-sm);
  background: var(--app-surface-2); color: var(--app-text);
  font: 15px var(--app-font);
}
.field input[type='range'] { width: 100%; min-height: 44px; accent-color: var(--app-accent); }
.field .val { font: 600 13px var(--app-mono); color: var(--app-accent); }
.search {
  width: 100%; min-height: 44px; margin: 10px 0 4px; padding: 9px 12px;
  border: 1px solid var(--app-border); border-radius: var(--app-radius-sm);
  background: var(--app-surface-2); color: var(--app-text);
  font: 14px var(--app-font);
}
.search::placeholder { color: var(--app-subtle); }

/* ---- image thumbs ----------------------------------------------------- */
.thumbs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin: 14px 0 0;
}
@media (min-width: 700px) { .thumbs { grid-template-columns: repeat(6, 1fr); } }
.th {
  position: relative; aspect-ratio: 1; padding: 0; overflow: hidden;
  border: 0; border-radius: 9px; cursor: pointer;
  background: color-mix(in srgb, var(--app-muted) 26%, var(--app-surface));
}
.th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.th .ph { display: grid; place-items: center; width: 100%; height: 100%; font: 700 10px var(--app-mono); color: var(--app-muted); }
.th[aria-pressed='true'] { outline: 2px solid var(--app-accent); outline-offset: 1px; }
.th[aria-pressed='true']::after {
  content: '✓'; position: absolute; top: 3px; right: 3px;
  width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--app-accent); color: var(--app-accent-ink);
  font: 700 10px/1 var(--app-font);
}
.th:not([aria-pressed='true']) img { opacity: 0.45; }

/* ---- progress --------------------------------------------------------- */
.prog { height: 8px; border-radius: 5px; overflow: hidden; background: var(--app-surface-2); margin: 12px 0; }
.prog i {
  display: block; height: 100%; width: calc(var(--v, 0) * 100%);
  background: var(--app-accent); border-radius: 5px;
  transition: width 0.25s ease;
}

.rows { display: grid; gap: 0; margin-top: 6px; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  padding: 9px 0; border-top: 1px solid var(--app-border); font-size: 13.5px;
}
.row > * { min-width: 0; }
.row:first-child { border-top: 0; }
.row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { font: 500 12px var(--app-mono); color: var(--app-muted); white-space: nowrap; }
.row .state { font-size: 12px; color: var(--app-subtle); white-space: nowrap; }
.row .state.done { color: var(--app-good); }
.row .state.busy { color: var(--app-accent); }
.row .state.fail { color: var(--app-bad); }
.row .acts { display: flex; gap: 6px; }
.row .acts button {
  min-height: 44px; min-width: 44px; padding: 0 11px;
  border: 1px solid var(--app-border); border-radius: 8px;
  background: transparent; color: var(--app-text); font: 600 12px var(--app-font); cursor: pointer;
}
.row .acts button:hover { border-color: var(--app-accent); color: var(--app-accent); }
/* File rows (a name, a size and up to three buttons): on a phone the buttons
   move to their own line under the name instead of pushing it off the edge. */
@media (max-width: 440px) {
  .row.filerow { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .row.filerow .acts { grid-column: 1 / -1; justify-content: flex-end; }
  .row.filerow .meta { text-align: right; }
}
.roll { max-height: 260px; overflow-y: auto; overscroll-behavior: contain; }

/* ---- notes and states ------------------------------------------------- */
.note {
  display: flex; gap: 8px; align-items: flex-start;
  margin-top: 14px; padding: 10px 12px;
  border-radius: var(--app-radius-sm);
  background: color-mix(in srgb, var(--app-good) 13%, transparent);
  color: var(--app-good); font-size: 13px; line-height: 1.4;
}
.note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.note.neutral { background: color-mix(in srgb, var(--app-muted) 13%, transparent); color: var(--app-muted); }
.note.warn { background: color-mix(in srgb, var(--app-warn) 15%, transparent); color: var(--app-warn); }
.note.bad { background: color-mix(in srgb, var(--app-bad) 14%, transparent); color: var(--app-bad); }

.big { font: 700 30px/1 var(--app-mono); letter-spacing: -0.03em; }
.big small { font-size: 13px; color: var(--app-muted); font-weight: 500; letter-spacing: 0; }
.badge {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--app-good) 16%, transparent);
  color: var(--app-good); font: 700 13px var(--app-mono);
}
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--app-accent) 30%, transparent);
  border-top-color: var(--app-accent);
  animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- reorderable pages (photo -> PDF, PDF tools) ---------------------- */
.pages { display: grid; gap: 8px; margin-top: 14px; }
.pitem {
  display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px; border: 1px solid var(--app-border); border-radius: var(--app-radius-sm);
  background: var(--app-surface-2);
}
/* the middle column holds the name over the size, and may shrink to nothing */
.pitem > :nth-child(2) { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
/* on a phone the four action buttons get their own line under the name,
   so nothing is pushed off the right edge */
@media (max-width: 440px) {
  .pitem {
    grid-template-columns: 54px minmax(0, 1fr);
    grid-template-areas: 'pic text' 'acts acts';
    row-gap: 8px;
  }
  .pitem > :nth-child(1) { grid-area: pic; }
  .pitem > :nth-child(2) { grid-area: text; }
  .pitem .pacts { grid-area: acts; justify-content: flex-end; }
}
.pitem.dragging { opacity: 0.5; }
.pitem.over { border-color: var(--app-accent); }
.pitem img { width: 54px; height: 54px; object-fit: cover; border-radius: 7px; background: var(--app-bg); display: block; }
.pitem .thumb-mono {
  width: 54px; height: 54px; border-radius: 7px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--app-accent) 14%, transparent);
  color: var(--app-accent); font: 700 10px var(--app-mono);
}
.pitem .pname { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitem .psub { font: 500 11px var(--app-mono); color: var(--app-muted); }
.pitem .pacts { display: flex; gap: 4px; }
.pitem .pacts button {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--app-border); border-radius: 9px;
  background: var(--app-surface); color: var(--app-text); cursor: pointer; font-size: 15px;
}
.pitem .pacts button:hover { border-color: var(--app-accent); color: var(--app-accent); }
.pitem .grip { color: var(--app-subtle); cursor: grab; }

/* ---- misc ------------------------------------------------------------- */
.mono { font-family: var(--app-mono); }
.muted { color: var(--app-muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.tabs { display: flex; gap: 8px; margin: 14px 0 4px; }
footer.site {
  margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--app-border);
  color: var(--app-subtle); font-size: 12.5px; line-height: 1.6;
}
footer.site a { color: var(--app-muted); }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
