/* MoxuFiles: 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; }
code { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- 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 { flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
#app { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* --- unsupported browser + start ------------------------------------------ */

.unsupported { padding: 32px; border: 1px solid var(--line); border-left: 3px solid var(--pro); border-radius: var(--r-lg); background: var(--surface); max-width: 720px; margin: 40px auto; }
.unsupported h1 { margin: 0 0 12px; font-size: 20px; letter-spacing: -0.01em; }
.unsupported p { margin: 0 0 10px; color: var(--text-dim); }

.start { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 64px 24px; border: 1.5px dashed var(--line-bright); border-radius: var(--r-xl); background: var(--bg-deep); }
.start__icon { width: 52px; height: 52px; margin-bottom: 6px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line-bright); display: grid; place-items: center; color: var(--accent); }
.start__icon svg { width: 24px; height: 24px; }
.start__title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.start__sub { margin: 0 0 12px; color: var(--text-dim); max-width: 46ch; }
.start__hint { margin: 10px 0 0; color: var(--text-faint); font-size: 12px; }

/* --- 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; overflow-wrap: anywhere; }
.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--big { height: 44px; padding: 0 28px; font-size: 14px; }
.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); }
.linkbtn { color: var(--text-faint); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--text); }

.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, .hint { font-size: 11.5px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-faint); margin: 0; }
.field__error { color: var(--danger); font-size: 12px; }
.input, .select, .textarea { 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; }
.textarea { height: auto; padding: 9px 11px; font-family: var(--font-mono); font-size: 12.5px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-bright); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); }
.input--tiny { width: 76px; height: 32px; 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; }
.select--small { height: 32px; font-size: 12.5px; width: auto; }
.row { display: flex; align-items: center; gap: 8px; }
.row > .input, .row > .select { flex: 1; min-width: 0; }
.arrow { color: var(--text-faint); }
.mini { display: inline-flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 12.5px; }
.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; }
.tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.tokens button { padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-dim); font-family: var(--font-mono); font-size: 11.5px; }
.tokens button:hover { color: var(--text); border-color: var(--accent); background: var(--accent-wash); }
.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: 12.5px; }

/* --- workspace ------------------------------------------------------------- */

.workspace { display: flex; flex-direction: column; gap: 14px; }
.folderbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.folderbar__info { flex: 1 1 220px; min-width: 0; }
.folderbar__name { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.folderbar__meta { color: var(--text-faint); font-size: 12px; }
.folderbar__opts { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.folderbar__buttons { display: flex; gap: 8px; }

.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filterbar__label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.filterbar .input { max-width: 230px; height: 34px; }

.tabs { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--bg-deep); align-self: flex-start; flex-wrap: wrap; }
.tab { padding: 7px 16px; border-radius: 7px; font-weight: 600; color: var(--text-faint); }
.tab:hover { color: var(--text-dim); }
.tab[aria-selected="true"] { color: var(--text); background: var(--surface-2); border: 1px solid var(--line-bright); padding: 6px 15px; }

.cols { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.panel__body { padding: 16px; }
.opts { display: flex; flex-direction: column; gap: 18px; }

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

.preview { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.preview__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.summary { color: var(--text-dim); font-size: 13px; }
.summary strong { color: var(--text); }
.summary .bad { color: var(--danger); font-weight: 600; }

.rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); max-height: 520px; overflow: auto; }
.rows:empty::before { content: "Nothing to show yet."; display: block; padding: 28px; text-align: center; color: var(--text-faint); }
.frow { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.frow:last-child { border-bottom: 0; }
.frow__old, .frow__new { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.frow__old { color: var(--text-faint); }
.frow__new { font-weight: 600; }
.frow__arrow { color: var(--text-faint); text-align: center; }
.frow__dir { color: var(--text-faint); font-weight: 400; }
.frow__note { grid-column: 1 / -1; font-size: 12px; color: var(--text-faint); padding-left: 2px; }
.frow--same .frow__new { color: var(--text-faint); font-weight: 400; }
.frow--conflict, .frow--invalid { background: rgba(255, 95, 86, 0.06); }
.frow--conflict .frow__note, .frow--invalid .frow__note { color: var(--danger); }
.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-faint); white-space: nowrap; }
.pill--change { color: var(--ok); border-color: rgba(53, 208, 127, 0.4); }
.pill--bad { color: var(--danger); border-color: rgba(255, 95, 86, 0.5); }
.rows__more { padding: 10px 14px; text-align: center; color: var(--text-faint); font-style: italic; font-size: 12.5px; }

/* duplicate groups */
.dgroup { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.dgroup:last-child { border-bottom: 0; }
.dgroup__head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-dim); margin-bottom: 8px; }
.dgroup__head strong { color: var(--text); }
.dfile { display: flex; align-items: flex-start; gap: 10px; padding: 3px 0; font-size: 13px; }
.dfile input { accent-color: var(--accent); margin-top: 3px; width: 15px; height: 15px; flex-shrink: 0; }
.dfile__path { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dfile__meta { color: var(--text-faint); font-size: 12px; white-space: nowrap; }
.dfile--keep .dfile__path::after { content: "  keep"; color: var(--ok); font-size: 11px; font-weight: 600; }

.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; }
.actionbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.actionbar__buttons { display: flex; gap: 8px; margin-left: auto; }
.status { margin: 0; font-size: 13px; color: var(--text-dim); flex: 1 1 260px; }
.status:empty { display: none; }
.status.is-ok { color: var(--ok); }
.savelog { margin-top: -2px; }
.undofile { margin-top: -4px; }
.footnote { color: var(--text-faint); font-size: 12px; margin: 0; max-width: 80ch; }

/* --- confirm dialog -------------------------------------------------------- */

.modal { border: 1px solid var(--line-bright); border-radius: var(--r-lg); background: var(--surface); color: var(--text); padding: 0; max-width: 440px; width: calc(100% - 32px); }
.modal::backdrop { background: rgba(6, 8, 10, 0.7); }
.modal__box { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.modal__title { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.modal__text { margin: 0; color: var(--text-dim); }
.modal__buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; }
  .page { padding: 14px; }
  .bar .brand__sub { display: none; }
  .start { padding: 40px 16px; }
  .frow { grid-template-columns: minmax(0, 1fr) auto; }
  .frow__arrow { display: none; }
  .frow__new { grid-column: 1; }
}
