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

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
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;
}
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 + drop zone ----------------------------------------------------- */

.page { flex: 1; width: 100%; max-width: 1400px; 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-data .drop { padding: 14px 24px; flex-direction: row; gap: 12px; }
.page.has-data .drop__icon { width: 34px; height: 34px; margin: 0; }
.page.has-data .drop__icon svg { width: 17px; height: 17px; }
.page.has-data .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; font-size: 18px; line-height: 1; }
.issue button:hover { color: var(--text); background: var(--surface-2); }

/* --- controls ------------------------------------------------------------- */

.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: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; min-width: 0; }
.field__label { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.field__hint { font-size: 11.5px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-faint); }
.input, .select { 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, .select:hover { border-color: var(--line-bright); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); }
.input--tiny { width: 84px; height: 30px; text-align: center; padding: 0 6px; }
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a1ac' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; background-size: 16px; }
.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; }
.check { display: flex; align-items: flex-start; gap: 8px; color: var(--text-dim); font-size: 12.5px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 2px 0 0; flex-shrink: 0; }

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

.studio { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.panel { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.panel__head { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); font-weight: 600; }
.panel__sub { font-weight: 400; color: var(--text-faint); font-size: 12px; margin-left: 6px; }
.panel__body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.hint { margin: 0; color: var(--text-faint); font-size: 12.5px; }
.note { margin: 0; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--bg-deep); color: var(--text-dim); font-size: 12px; }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chip { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-deep); min-width: 0; }
.chip__text { flex: 1; min-width: 0; }
.chip__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip__meta { font-size: 11.5px; color: var(--text-faint); }
.chip button { width: 24px; height: 24px; border-radius: var(--r-sm); color: var(--text-faint); font-size: 17px; line-height: 1; flex-shrink: 0; }
.chip button:hover { color: var(--text); background: var(--surface-2); }

/* --- steps ---------------------------------------------------------------- */

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: step; }
.steps:empty { display: none; }
.step { counter-increment: step; display: flex; gap: 10px; align-items: flex-start; padding: 10px 8px 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-deep); }
.step::before { content: counter(step); flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; background: var(--surface-3); color: var(--text-dim); font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.step__text { flex: 1; min-width: 0; }
.step__title { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.step__note { font-size: 12px; color: var(--ok); }
.step__note span { color: var(--text-faint); }
.step.has-error { border-color: var(--danger); }
.step.has-error .step__note { color: var(--danger); }
.step button { width: 26px; height: 26px; border-radius: var(--r-sm); color: var(--text-faint); font-size: 17px; line-height: 1; flex-shrink: 0; }
.step button:hover { color: var(--text); background: var(--surface-2); }

.adder__label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.adder__group { margin-bottom: 10px; }
.adder__group-name { font-size: 11.5px; color: var(--text-faint); margin-bottom: 5px; }
.adder__buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.chipbtn { padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-dim); font-size: 12.5px; font-weight: 600; }
.chipbtn:hover { color: var(--text); border-color: var(--accent); background: var(--accent-wash); }

.stepform { display: flex; flex-direction: column; gap: 14px; padding: 14px; border: 1px solid var(--accent); border-radius: var(--r-md); background: var(--bg-deep); }
.stepform__title { font-weight: 600; }
.stepform__help { margin: -8px 0 0; color: var(--text-dim); font-size: 12.5px; }
.picklist { display: flex; flex-direction: column; gap: 6px; max-height: 190px; overflow: auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.picklist__tools { display: flex; gap: 12px; margin-bottom: 2px; }
.picklist__tools button { color: var(--accent-bright); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.stepform__error { margin: 0; color: var(--danger); font-size: 12.5px; }
.stepform__error:empty { display: none; }
.stepform__buttons { display: flex; gap: 8px; }

/* --- preview -------------------------------------------------------------- */

.summary { color: var(--text-dim); font-size: 13px; }
.summary strong { color: var(--text); }
.tablewrap { max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.preview { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 12.5px; }
.preview th, .preview td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); font-weight: 600; border-bottom: 1px solid var(--line-bright); }
.preview th .badge { display: block; font-weight: 400; font-size: 11px; color: var(--pro); }
.preview td.rownum, .preview th.rownum { color: var(--text-faint); text-align: right; width: 1%; font-family: var(--font-mono); font-size: 11px; }
.preview tr:hover td { background: var(--surface-2); }
.preview .blank { color: var(--text-faint); font-style: italic; }
.preview__more td { text-align: center; color: var(--text-faint); font-style: italic; white-space: normal; }

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

.export { display: flex; flex-direction: column; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.export__row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.export__row .field { flex: 1 1 170px; }
.export__row .field--name { flex-basis: 240px; }
.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; }
.status { margin: 0; font-size: 13px; color: var(--text-dim); }
.status:empty { display: none; }
.status.is-ok { color: var(--ok); }

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

@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; }
  .page { padding: 14px; }
  .drop { padding: 40px 16px; }
  .bar .brand__sub { display: none; }
}

/* --- Pro: unlock strip and recipes ---------------------------------------- */
.bar__right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.pro-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--pro); color: var(--pro); font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; vertical-align: 1px; }
.recipe-save { display: flex; gap: 8px; margin: 10px 0; }
.recipes { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.recipes:empty { display: none; }
.recipe { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-deep); }
.recipe__text { flex: 1; min-width: 0; }
.recipe__name { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
.recipe__meta { font-size: 12px; color: var(--text-faint); }
.recipe__del { width: 28px; height: 28px; border-radius: var(--r-sm); border: 0; background: none; color: var(--text-faint); font-size: 18px; cursor: pointer; }
.recipe__del:hover { color: var(--danger); }
.recipe-tools { display: flex; gap: 8px; }
@media (max-width: 640px) { .bar { height: auto; padding: 10px 14px; flex-wrap: wrap; } .bar__right { justify-content: flex-start; } }
