/* MoxuPDF — product styles. Colour, type and geometry come from
   ../shared/moxu-tokens.css; only layout and components live here. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; display: flex; flex-direction: column;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

/* --- top bar -------------------------------------------------------------- */

.bar { height: var(--bar-h); padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line-soft); }
.brand { display: flex; align-items: center; gap: 11px; }
.brand__mark { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-bright); display: grid; place-items: center; color: var(--accent); }
.brand__mark svg { width: 16px; height: 16px; }
.brand__name { font-size: 14px; font-weight: 600; letter-spacing: -0.015em; }
.brand__name em { font-style: normal; color: var(--accent); }
.brand__sub { font-size: 11px; color: var(--text-faint); }
.privacy-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-dim); font-size: 11.5px; font-weight: 600; }
.privacy-pill svg { width: 13px; height: 13px; color: var(--ok); }

/* --- page ----------------------------------------------------------------- */

.page { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; padding: 64px 24px; cursor: pointer;
  border: 1.5px dashed var(--line-bright); border-radius: var(--r-xl); background: var(--bg-deep);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-wash); }
.drop__icon { width: 48px; height: 48px; margin-bottom: 8px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-bright); display: grid; place-items: center; color: var(--accent); }
.drop__icon svg { width: 22px; height: 22px; }
.drop__title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.drop__sub { color: var(--text-dim); font-size: 13px; }
.link { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 3px; }
.page.has-pages .drop { padding: 16px 24px; flex-direction: row; gap: 12px; }
.page.has-pages .drop__icon { width: 34px; height: 34px; margin: 0; }
.page.has-pages .drop__icon svg { width: 17px; height: 17px; }
.page.has-pages .drop__title { font-size: 14px; }

/* --- messages ------------------------------------------------------------- */

.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.issues:empty { display: none; }
.issue { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; border: 1px solid var(--line); border-left: 3px solid var(--danger); border-radius: var(--r-md); background: var(--surface); }
.issue__text { flex: 1; min-width: 0; }
.issue__title { font-weight: 600; overflow-wrap: anywhere; }
.issue__why { color: var(--text-dim); font-size: 12.5px; }
.issue button { width: 26px; height: 26px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--text-faint); flex-shrink: 0; }
.issue button:hover { color: var(--text); background: var(--surface-2); }
.issue svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- buttons + inputs ----------------------------------------------------- */

.btn { height: 34px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid transparent; font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 7px; transition: background 0.15s var(--ease), border-color 0.15s var(--ease), opacity 0.15s; white-space: nowrap; }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent-deep); color: #04121e; height: 38px; padding: 0 20px; }
.btn--primary:hover:not(:disabled) { background: var(--accent-bright); }
.btn--ghost { color: var(--text-dim); border-color: var(--line); }
.btn--ghost:hover:not(:disabled) { color: var(--text); border-color: var(--line-bright); background: var(--surface); }
.btn--confirm { color: var(--danger); border-color: var(--danger); }

.field { display: flex; flex-direction: column; gap: 7px; }
.field__label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.input { width: 100%; height: 38px; padding: 0 11px; background: var(--bg-deep); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-md); font: inherit; }
.input:hover { border-color: var(--line-bright); }
.input:focus { outline: none; border-color: var(--accent); }
.input--tiny { width: 64px; height: 30px; text-align: center; padding: 0 6px; }
.unit { position: relative; }
.unit .input { padding-right: 40px; }
.unit i { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; color: var(--text-faint); pointer-events: none; }

/* --- studio --------------------------------------------------------------- */

.studio { display: flex; flex-direction: column; gap: 14px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.toolbar__group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.count { color: var(--text-dim); font-size: 13px; margin-right: 6px; }
.count strong { color: var(--text); }
.sel-count { color: var(--accent-bright); font-size: 13px; font-weight: 600; margin-right: 4px; }
.sel-count:empty { display: none; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }

.card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; transition: border-color 0.15s var(--ease); }
.card:hover { border-color: var(--line-bright); }
.card[draggable="true"] { cursor: grab; }
.card.is-selected { border-color: var(--accent); background: var(--accent-wash); }
.card.is-dragging { opacity: 0.35; }
.card.drop-before { box-shadow: inset 4px 0 0 var(--accent); }
.card.drop-after { box-shadow: inset -4px 0 0 var(--accent); }

.card__thumb { position: relative; aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; padding: 10px; background: var(--bg-deep); cursor: pointer; }
/* Absolutely positioned so a tall page can't stretch its card taller than the others. */
.card__thumb canvas { position: absolute; inset: 10px; margin: auto; max-width: calc(100% - 20px); max-height: calc(100% - 20px); background: #fff; box-shadow: var(--shadow-sm); pointer-events: none; }
.card__thumb canvas[hidden] { display: none; }
.card__thumb .loading { position: absolute; color: var(--text-faint); font-size: 11px; }
.card__check { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line-bright); background: var(--surface); display: grid; place-items: center; color: transparent; padding: 0; }
.card__check svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.card.is-selected .card__check { background: var(--accent); border-color: var(--accent); color: #04121e; }

.card__tools { position: absolute; left: 6px; right: 6px; bottom: 6px; display: flex; justify-content: center; gap: 2px; padding: 3px; border-radius: var(--r-md); background: var(--surface-3); border: 1px solid var(--line-bright); opacity: 0; transform: translateY(4px); transition: opacity 0.15s var(--ease), transform 0.15s var(--ease); }
.card:hover .card__tools, .card:focus-within .card__tools { opacity: 1; transform: none; }
@media (hover: none) { .card__tools { opacity: 1; transform: none; } }
.tool { width: 27px; height: 27px; border-radius: 6px; display: grid; place-items: center; color: var(--text-dim); }
.tool:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.tool:disabled { opacity: 0.3; cursor: not-allowed; }
.tool--delete:hover:not(:disabled) { color: var(--danger); }
.tool svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.card__label { padding: 7px 10px 8px; font-size: 12px; min-width: 0; }
.card__num { font-weight: 600; }
.card__src { color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }

/* --- export --------------------------------------------------------------- */

.export { display: flex; flex-direction: column; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); position: sticky; bottom: 12px; }
.export__row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.export__row .field { flex: 1 1 220px; max-width: 360px; }
.export__buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.export__row--split { align-items: center; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.split__label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.split__every { display: inline-flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; }
.progress { height: 3px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }
.status { margin: 0; font-size: 13px; color: var(--text-dim); min-height: 1.4em; }
.status:empty { display: none; }
.status.is-ok { color: var(--ok); }

.footnote { color: var(--text-faint); font-size: 12px; margin: 0; max-width: 70ch; }

@media (max-width: 640px) {
  .page { padding: 14px; }
  .drop { padding: 40px 16px; }
  .bar .brand__sub { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .export { position: static; }
}
.sprite { position: absolute; }
