:root {
  --bg: #f3f4f7;
  --panel: #ffffff;
  --panel-2: #eef0f4;
  --viewer: #e4e6eb;
  --ink: #1b2330;
  --muted: #5d6778;
  --line: #dfe3ea;
  --accent: #6a3fb5;
  --accent-hover: #57329a;
  --accent-soft: #efe8fa;
  --ok: #157a46;
  --ok-bg: #e8f6ee;
  --warn: #8f5400;
  --warn-bg: #fff5e1;
  --bad: #b3261e;
  --bad-bg: #fdecea;
  --gold: #a86a00;
  --gold-bg: #fff4dc;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1d22;
    --panel: #23262d;
    --panel-2: #2c3039;
    --viewer: #15171b;
    --ink: #e7ebf1;
    --muted: #a3acba;
    --line: #353a45;
    --accent: #b596f0;
    --accent-hover: #c9b1f5;
    --accent-soft: #2d2442;
    --ok: #5fd39a;
    --ok-bg: #16301f;
    --warn: #f3b955;
    --warn-bg: #33270f;
    --bad: #ff8a80;
    --bad-bg: #3a1a18;
    --gold: #f0b440;
    --gold-bg: #3a2c10;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
  -webkit-user-select: none; user-select: none;
}
.xml, .results, .att-list .aname { -webkit-user-select: text; user-select: text; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 24px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 6px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }
i[data-icon] { display: inline-flex; width: 18px; height: 18px; flex: none; }
i[data-icon] svg { width: 100%; height: 100%; }

/* ---------- App bar ---------- */
.appbar {
  height: 56px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand img { width: 28px; height: 28px; }
.appbar-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer;
  white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--panel-2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #160d26; } }
.btn.gold { color: var(--gold); border-color: transparent; background: var(--gold-bg); font-weight: 600; }
.btn.big { height: 44px; padding: 0 22px; font-size: 15px; border-radius: 10px; }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 8px;
  border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); flex: none;
}
.icon-btn:hover { background: var(--panel-2); color: var(--ink); }
.icon-btn.small { width: 26px; height: 26px; }
.icon-btn.small i { width: 14px; height: 14px; }
.link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; }
.link:hover { text-decoration: underline; }
.pro-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; padding: 1px 6px; border-radius: 6px;
  background: var(--gold-bg); color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
}
.pro-tag.big { font-size: 12px; vertical-align: middle; }
body.is-pro .pro-tag { display: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; margin-top: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card-note { padding: 10px 16px 0; margin: 0; }

/* ---------- Views ---------- */
main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; overflow: auto; }

/* Home */
.home { max-width: 860px; margin: 0 auto; padding: 36px 24px 48px; display: flex; flex-direction: column; gap: 20px; }
.drop {
  text-align: center; padding: 40px 32px 30px; border-radius: 18px;
  border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--panel);
}
.drop-art img { width: 84px; height: 84px; }
.drop h1 { margin: 14px 0 6px; }
.lead { color: var(--muted); font-size: 15px; margin-bottom: 20px; max-width: 640px; margin-left: auto; margin-right: auto; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 10px; }
.feature-row { list-style: none; padding: 0; margin: 22px 0 6px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.feature-row li { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: 13px; }
.feature-row li i { color: var(--accent); }
.privacy { display: inline-flex; align-items: center; gap: 8px; color: var(--ok); font-size: 13px; margin-top: 16px; }
.recent-list { list-style: none; margin: 0; padding: 6px; }
.recent-list li { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.recent-list li:hover { background: var(--panel-2); }
.recent-list li.static { cursor: default; }
.recent-list li.static:hover { background: none; }
.recent-list .ext { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; text-transform: uppercase; flex: none; }
.recent-list .rbody { min-width: 0; flex: 1; }
.recent-list .rname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-list .rpath { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Document ---------- */
#viewDoc { display: flex; flex-direction: column; overflow: hidden; }
.doc-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--panel); }
.doc-title { flex: 1; min-width: 0; }
.doc-title .name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-title .meta { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-select { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.view-select select, .lang-select { height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 0 8px; font: inherit; max-width: 240px; }
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tabs { flex: none; display: flex; gap: 2px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border: none; border-bottom: 2px solid transparent; background: none; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab i { width: 16px; height: 16px; }
.tab .count { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.notice { flex: none; display: flex; align-items: center; gap: 10px; padding: 7px 16px; background: var(--accent-soft); color: var(--ink); font-size: 13px; border-bottom: 1px solid var(--line); }
.notice.warn { background: var(--warn-bg); }
.notice > i { color: var(--accent); }
.notice.warn > i { color: var(--warn); }
.notice span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.notice code { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; background: color-mix(in srgb, var(--panel) 70%, transparent); padding: 1px 5px; border-radius: 4px; -webkit-user-select: all; user-select: all; }
.doc-body { flex: 1; min-height: 0; display: flex; }
.pane { flex: 1; min-width: 0; min-height: 0; background: var(--viewer); position: relative; }
.pane.scroll { overflow: auto; }
#frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.sidebar { width: 260px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); min-height: 0; }
.sidebar-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.form-list { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; }
.form-list li { padding: 7px 9px; border-radius: 7px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.form-list li:hover { background: var(--panel-2); }
.form-list li.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.form-list li .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.form-list li .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--line); }
.form-list li .dot.ok { background: var(--ok); }
.form-list li .dot.data { background: var(--gold); }
.form-list li .dot.bad { background: var(--bad); }
.attachments { max-width: 860px; margin: 0 auto; padding: 24px; }
.att-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.att-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.att-list .ext { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; text-transform: uppercase; flex: none; overflow: hidden; }
.att-list .abody { flex: 1; min-width: 0; }
.att-list .aname { font-weight: 600; overflow-wrap: anywhere; }
.att-list .ameta { color: var(--muted); font-size: 12.5px; }
.xml { margin: 0; padding: 18px 22px; font: 12.5px/1.55 "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); background: var(--panel); min-height: 100%; tab-size: 2; }
.xml .t { color: #7b2fb8; }
.xml .a { color: #9a5b00; }
.xml .v { color: #19734a; }
.xml .c { color: var(--muted); font-style: italic; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .xml .t { color: #c9a2f7; } :root:not([data-theme="light"]) .xml .a { color: #f3b955; } :root:not([data-theme="light"]) .xml .v { color: #74d6a4; } }
.empty { min-height: 100%; display: grid; place-items: center; padding: 24px; text-align: center; }
.empty .box { max-width: 540px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px 32px; box-shadow: var(--shadow); }
.empty .box > i { width: 44px; height: 44px; color: var(--warn); }
.empty h2 { margin: 10px 0 4px; font-size: 19px; }
.empty #errorFile { word-break: break-all; font-size: 12.5px; }

/* ---------- Batch ---------- */
.batch { max-width: 900px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.batch-head { display: flex; gap: 12px; align-items: flex-start; }
.batch-head h1 { font-size: 22px; }
.step { display: flex; gap: 14px; padding: 16px; }
.step-n { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.step-body { flex: 1; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.path { align-self: stretch; padding: 9px 12px; border-radius: 8px; background: var(--panel-2); font-family: "Cascadia Mono", Consolas, monospace; font-size: 12.5px; word-break: break-all; }
.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.progress { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin: 16px 16px 8px; }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress-row { display: flex; justify-content: space-between; gap: 12px; padding: 0 16px 14px; color: var(--muted); font-size: 13px; }
.progress-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-wrap { max-height: 420px; overflow: auto; }
table.results { width: 100%; border-collapse: collapse; font-size: 13px; }
.results th { position: sticky; top: 0; background: var(--panel); text-align: left; padding: 8px 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.results td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; word-break: break-all; }
.results td.ok { color: var(--ok); white-space: nowrap; }
.results td.warn { color: var(--warn); white-space: nowrap; }
.results td.bad { color: var(--bad); white-space: nowrap; }
.results td.r { text-align: right; white-space: nowrap; }

/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; background: rgba(10, 14, 22, .45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-card { position: relative; width: min(560px, 100%); max-height: 100%; overflow: auto; background: var(--panel); border-radius: 16px; padding: 26px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-card .close { position: absolute; top: 12px; right: 12px; }
.modal-card.pro { text-align: center; }
.modal-card.pro h2 { font-size: 24px; margin-bottom: 4px; }
.modal-card h2 { font-size: 20px; }
.pro-badge { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 16px; display: grid; place-items: center; background: var(--gold-bg); color: var(--gold); }
.pro-badge i { width: 28px; height: 28px; }
.pro-list { list-style: none; padding: 0; margin: 18px 0; text-align: left; }
.pro-list li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pro-list li:last-child { border-bottom: 0; }
.pro-list li > i { color: var(--accent); margin-top: 2px; }
.pro-list b { display: block; }
.pro-list span { color: var(--muted); font-size: 13px; }
.fine { color: var(--muted); font-size: 12px; margin-top: 10px; }
.pro-active { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 10px; background: var(--ok-bg); color: var(--ok); font-weight: 600; }
/* Pro bought on the website: sign-in with e-mail + code (shown only where the host supports it) */
body:not(.web-licence) .web-licence-only { display: none; }
#proAccount, .web-licence-only { text-align: center; }
.modal-card.login { max-width: 420px; }
.modal-card.login h2 { margin: 0 0 6px; font-size: 20px; }
.modal-card.login form, .modal-card.login [data-step] { display: grid; gap: 12px; margin-top: 8px; }
.field { width: 100%; padding: 11px 12px; font: inherit; font-size: 16px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.field:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); border-color: var(--accent); }
.field.code { font: 600 26px/1.2 Consolas, "Cascadia Mono", monospace; letter-spacing: 8px; text-align: center; }
.login-msg { min-height: 1.4em; margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.login-msg.error { color: var(--bad); }
.info-head { display: flex; gap: 14px; align-items: center; margin-bottom: 4px; }
.info-head img { width: 48px; height: 48px; }

/* ---------- Misc ---------- */
.busy { position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; justify-items: center; gap: 14px; background: color-mix(in srgb, var(--bg) 70%, transparent); font-weight: 600; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.drop-overlay { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 18%, transparent); border: 3px dashed var(--accent); }
.drop-overlay > div { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 34px; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); font-weight: 600; pointer-events: none; }
.drop-overlay i { width: 36px; height: 36px; color: var(--accent); }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 12px; max-width: 460px; padding: 11px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); font-size: 13.5px; animation: pop .18s ease-out; }
.toast.error { background: var(--bad); color: #fff; }
.toast.warn { background: #7a4a00; color: #fff; }
.toast.success { background: var(--ok); color: #fff; }
.toast .link { color: inherit; text-decoration: underline; font-weight: 600; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1100px) {
  .doc-actions .btn span:not(.pro-tag) { display: none; }
  .doc-actions .btn { padding: 0 10px; }
  .sidebar { width: 210px; }
}
@media (max-width: 720px) {
  .appbar { height: 50px; padding: 0 10px; }
  .brand { font-size: 15px; }
  .brand img { width: 24px; height: 24px; }
  .appbar-actions .btn span { display: none; }
  .appbar-actions .btn { padding: 0 10px; }
  .home { padding: 16px 12px 28px; gap: 14px; }
  .drop { padding: 26px 16px 22px; }
  .drop-art img { width: 64px; height: 64px; }
  .drop h1 { font-size: 21px; }
  .lead { font-size: 14px; }
  .feature-row li { font-size: 12px; padding: 6px 10px; }
  .doc-head { flex-wrap: wrap; gap: 6px; padding: 6px 8px; }
  .doc-title { flex: 1 1 calc(100% - 100px); }
  .view-select { order: 3; flex: 1 1 100%; }
  .view-select select { flex: 1; max-width: none; }
  .tabs { padding: 0 4px; }
  .tab { padding: 0 9px; }
  .tab span:not(.count) { display: none; }
  .tab[data-tab="xml"] span { display: inline; }
  .notice { padding: 6px 10px; font-size: 12px; }
  .sidebar { position: absolute; z-index: 5; inset: 0 auto 0 0; width: 78%; max-width: 300px; box-shadow: var(--shadow); }
  .sidebar.collapsed { display: none; }
  .attachments { padding: 14px 10px; }
  .toasts { left: 10px; right: 10px; bottom: 10px; align-items: stretch; }
  .modal { padding: 10px; }
  .modal-card { padding: 20px 18px; }
  .empty .box { padding: 22px 18px; }
}
