/* W2SJ brand tokens (w2-carrossel: brands/w2/visual/design-tokens.json + STYLE_GUIDE.md).
   Gunmetal is the primary (buttons, headings), Tomato the accent (active tab, progress, focus, marks).
   Tomato as small text uses a darker tone: #ED6C44 on light backgrounds is 2.9:1, #B94A26 is 5.2:1. */

/* Montserrat (SIL Open Font License 1.1), latin subset, variable weight 400–800, served from this app. */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(montserrat.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;
}

:root {
  --gunmetal: #2B3D5A; --tomato: #ED6C44; --tomato-text: #B94A26; --snow: #F8F9FA; --ink: #1F2937;
  --bg: var(--snow); --surface: #ffffff; --surface-2: #F1F3F5; --text: var(--ink); --muted: #5F6770; --line: #E2E5E9;
  --primary: var(--gunmetal); --primary-text: #ffffff; --accent: var(--tomato); --accent-text: var(--tomato-text);
  --link: var(--gunmetal);
  --ok: #15803D; --warn: #B45309; --bad: #B91C1C;
  --ok-bg: #DCFCE7; --warn-bg: #FEF3C7; --bad-bg: #FEE2E2; --code-bg: #F1F3F5; --accent-bg: #FDEEE8;
  --radius: 10px; --shadow: 0 1px 2px rgba(18, 25, 42, .05), 0 6px 20px rgba(18, 25, 42, .05);
  --font: 'Montserrat', system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12192A; --surface: #1A2335; --surface-2: #222D42; --text: #F8F9FA; --muted: #9AA4B2; --line: #2C374C;
    --primary: #F0805C; --primary-text: #12192A; --accent: #F0805C; --accent-text: #F0805C; --link: #F0A286;
    --ok: #4ADE80; --warn: #FBBF24; --bad: #F87171;
    --ok-bg: #12301F; --warn-bg: #33270D; --bad-bg: #3A1616; --code-bg: #10172A; --accent-bg: #3A2219;
    --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--accent-text); }
.hidden { display: none !important; }
h1, h2, h3 { color: var(--text); letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 800; margin: 0 0 6px; }
h2 { font-size: 18px; font-weight: 700; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 22px; max-width: 70ch; }
.muted { color: var(--muted); }
.eyebrow { display: block; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-text); margin: 0 0 6px; }

/* ------------------------------------------------------------ header */
header.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
header.top .brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand .mark { font-weight: 700; letter-spacing: .08em; font-size: 15px; color: var(--primary-text); background: var(--primary);
  padding: 4px 8px; border-radius: 6px; }
.brand .product { font-weight: 600; font-size: 15px; }
header.top .who { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
header.top .who a { color: var(--text); }
main { max-width: 1040px; margin: 0 auto; padding: 28px 16px 64px; }

/* ------------------------------------------------------------ cards, controls */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); margin-bottom: 20px; }
button, .btn { font: inherit; font-weight: 600; font-size: 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); padding: 9px 16px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; }
button:hover, .btn:hover { border-color: var(--muted); color: var(--text); }
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.12); color: var(--primary-text); }
button.danger { color: var(--bad); }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--link); text-decoration: underline; font-weight: 600; }
button:disabled { opacity: .5; cursor: not-allowed; filter: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=text], input[type=email], input[type=password], select { font: inherit; width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); min-height: 42px; }
input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; flex: none; }
label.field { display: block; margin-bottom: 16px; font-weight: 600; font-size: 14px; }
label.field input, label.field select { margin-top: 6px; font-weight: 400; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }

/* ------------------------------------------------------------ new conversion: two paths */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -6px 0 20px; overflow-x: auto; }
.tab { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 14px 9px;
  min-height: 0; color: var(--muted); font-weight: 600; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); border-color: transparent; border-bottom-color: var(--line); }
.tab[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); }
.tab small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.pane-intro { margin: 0 0 16px; color: var(--muted); max-width: 72ch; }

.drop { display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px;
  text-align: center; color: var(--muted); cursor: pointer; margin-bottom: 14px; background: var(--bg);
  transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-bg); color: var(--text); }
.drop strong { color: var(--text); font-weight: 700; }
.drop .formats { display: block; font-size: 13px; margin-top: 4px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.pick .drop { margin: 0; padding: 22px 14px; }
.files { font-size: 13px; color: var(--muted); margin: -4px 0 14px; overflow-wrap: anywhere; }
.notice { background: var(--accent-bg); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 0 0 14px; }

.batch { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; }
.batch-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: 8px 8px 0 0; }
.batch-head .row button { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.batch-list { list-style: none; margin: 0; padding: 0 14px; max-height: 380px; overflow-y: auto; }
.batch-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; }
.batch-list li + li { border-top: 1px solid var(--line); }
.batch-list label { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; cursor: pointer; }
.batch-list .path { overflow-wrap: anywhere; font-weight: 600; }
.batch-list .path small { color: var(--muted); display: block; font-weight: 400; }
.batch-list .result { font-size: 13px; text-align: right; max-width: 45%; overflow-wrap: anywhere; display: flex;
  gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.batch-list .result.fail { color: var(--bad); }

.meter { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.meter > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.progress { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.error { color: var(--bad); background: var(--bad-bg); border-radius: 8px; padding: 10px 12px; margin-top: 12px; }
.preview { width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; margin-top: 12px; height: 240px; background: #fff; }
.preview > div { transform-origin: 0 0; }

details.more { margin-top: 4px; }
details.more > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; color: var(--accent-text); font-weight: 700; }
details.more[open] > summary::after { content: "−"; }
details.more > summary h2 { margin: 0; }

/* ------------------------------------------------------------ tables, badges */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
td a { font-weight: 600; }
.table-wrap { overflow-x: auto; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.list-head h2 { margin: 0; }
.list-head input { max-width: 260px; min-height: 38px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

/* ------------------------------------------------------------ project page */
.stats { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.stats li { background: var(--code-bg); border-radius: 6px; padding: 2px 8px; font-size: 13px; }
.gap { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.gap header { display: flex; gap: 10px; align-items: flex-start; }
.gap .gap-title { font-weight: 600; flex: 1; }
.gap label.gap-title { cursor: pointer; }
.gaps-sub { font-size: 15px; margin: 20px 0 4px; }
.gap dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 10px 0 0 28px; font-size: 14px; }
.gap dt { color: var(--muted); }
.gap dd { margin: 0; }
details.code { margin: 10px 0 0 28px; }
details.code summary { cursor: pointer; font-size: 14px; color: var(--muted); }
pre { background: var(--code-bg); border-radius: 8px; padding: 12px; overflow: auto; max-height: 320px; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
code { font-size: .92em; }
.risk { color: var(--bad); font-size: 13px; margin: 8px 0 0 28px; font-weight: 600; }
ul.plain { padding-left: 18px; margin: 0; }
ul.plain li { margin-bottom: 6px; }

/* ------------------------------------------------------------ login */
.login { max-width: 400px; margin: 10vh auto; }
.login .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login h1 { font-size: 22px; }

@media (max-width: 640px) {
  header.top { padding: 10px 16px; }
  .brand .product { display: none; }
  .pick { grid-template-columns: 1fr; }
  .gap dl, details.code, .risk { margin-left: 0; }
  .gap dl { grid-template-columns: 1fr; }
  .batch-list li { flex-wrap: wrap; }
  .batch-list .result { max-width: none; width: 100%; justify-content: flex-start; padding-left: 26px; }
  .list-head input { max-width: none; }
}
