/* DOCX Compare - same palette as the desktop app */
:root {
  --bg: #F5F6FB; --card: #FFFFFF; --border: #E6E9F2; --text: #0B1220;
  --muted: #667085; --primary: #4F46E5; --primary-hover: #4338CA;
  --primary-light: #EEF2FF; --success: #10B981; --success-light: #ECFDF5;
  --danger: #EF4444; --dark: #111827;
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.4 var(--font); color: var(--text); background: var(--bg);
       display: flex; flex-direction: column; }
button { font: inherit; }
[hidden] { display: none !important; }

/* ---- status bar ---- */
.statusbar { display: flex; align-items: center; gap: 6px; padding: 7px 24px; background: #fff;
             border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.statusbar .dot { color: var(--success); font-size: 10px; }
.statusbar .word-note { margin-left: auto; color: #B45309; }
.statusbar .hints { margin-left: 18px; }

.body { flex: 1; padding: 12px 24px 10px; overflow: auto; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 4px;
        margin-bottom: 12px; padding: 14px 20px 16px; }
.section-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.section-title h2 { font-size: 17px; margin: 0; }
.section-title span { font-size: 12px; color: var(--muted); }
.val-target { line-height: 32px; white-space: nowrap; font-size: 12px; color: var(--primary);
              overflow: hidden; text-overflow: ellipsis; min-width: 0; margin-left: 6px; }
/* which document the checks run on: A, B or both */
.valsel { display: flex; align-items: center; gap: 6px; margin: 8px 0 0 98px; min-width: 0; }
.valsel-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-right: 2px; }
.valsel .tag { flex: 0 0 auto; }
.divider { height: 1px; background: var(--border); margin: 12px 0 10px; }

/* ---- drop zones ---- */
.zones { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.zone { position: relative; height: 120px; border: 2px dashed #CBD5E1; border-radius: 14px;
        background: #FAFBFD; cursor: pointer; display: flex; align-items: center;
        padding: 18px 16px 0 22px; outline: none; transition: background .12s, border-color .12s; }
.zone:hover, .zone.hover, .zone:focus-visible { border-color: var(--primary); background: var(--primary-light); }
.zone.done { border: 2px solid var(--success); background: var(--success-light); }
.zone .zlabel { position: absolute; left: 22px; top: 12px; font-size: 11px; font-weight: 700;
                letter-spacing: .02em; color: var(--muted); }
.zone .zicon { flex: none; width: 46px; height: 50px; margin-right: 18px; }
.zone .ztext { min-width: 0; }
.zone .zname { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone .zsub { font-size: 12px; color: var(--muted); }
.zone .zremove { position: absolute; right: 16px; top: 12px; border: 0; border-radius: 11px;
                 background: #FEE2E2; color: var(--danger); font-size: 11px; font-weight: 700;
                 padding: 3px 12px; cursor: pointer; }
.zone.busy { cursor: progress; }
.swap { width: 40px; height: 40px; border-radius: 20px; border: 1px solid var(--border);
        background: #fff; font-size: 18px; font-weight: 700; cursor: pointer; color: var(--text); }
.swap:hover { background: var(--primary-light); border-color: #C7D2FE; color: var(--primary-hover); }

/* ---- buttons / chips ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
       border-radius: 11px; border: 1px solid var(--border); padding: 0 16px; height: 38px;
       font-weight: 700; cursor: pointer; text-decoration: none; color: var(--text);
       background: #fff; white-space: nowrap; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.secondary:hover { background: var(--primary-light); border-color: #C7D2FE; color: var(--primary-hover); }
.btn:disabled, .btn.disabled { background: #E5E7EB; border-color: #E5E7EB; color: #9CA3AF;
       cursor: default; pointer-events: none; }
.btn.large { height: 46px; min-width: 220px; border-radius: 12px; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.chip { border: 1px solid transparent; border-radius: 4px; font-weight: 700; font-size: 12px;
        padding: 4px 10px; cursor: pointer; margin-right: 6px; user-select: none; }
.chip.off { background: #F3F4F6 !important; color: #9CA3AF !important; border-color: #E5E7EB !important; }
.chip:disabled { cursor: default; opacity: .55; }
.actions { display: flex; align-items: flex-start; gap: 20px; }
.actions-left { flex: 1; min-width: 0; }
/* tags stay on one line: padding, gaps and font shrink with the row's width */
.tagrow { display: flex; align-items: flex-start; gap: 10px; container-type: inline-size; }
.tagrow-label { flex: 0 0 88px; line-height: 32px; font-size: 16px; font-weight: 700; color: #334155; }
.tags { flex: 1; min-width: 0; display: flex; flex-wrap: nowrap; align-items: center;
        gap: clamp(4px, 1.1cqi, 10px); }
#sideChips { display: contents; }
.tag { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; height: 32px;
       padding: 0 clamp(5px, 1.35cqi, 12px);
       border: 1.5px solid; border-radius: 6px; font-size: clamp(11px, 1.48cqi, 13px); font-weight: 700;
       cursor: pointer; user-select: none; white-space: nowrap; }
.tag:hover:not(:disabled) { filter: brightness(.97); }
.tag-check { font-size: 14px; font-weight: 600; }
.tag.off { background: #F3F4F6 !important; color: #9CA3AF !important; border-color: #D1D5DB !important; }
.tag:disabled { opacity: .45; cursor: default; }
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.progress div { width: 30%; height: 100%; background: var(--primary); border-radius: 3px;
                animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

/* ---- toast / dialog ---- */
.toast { position: fixed; right: 24px; bottom: 46px; background: var(--dark); color: #fff;
         border-left: 4px solid var(--success); padding: 10px 14px; z-index: 50;
         box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.dialog-back { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 60;
               display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: #fff; border-radius: 8px; max-width: 520px; width: 100%; padding: 20px 22px 16px;
          box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dialog h3 { margin: 0 0 8px; font-size: 16px; }
.dialog p { margin: 0 0 18px; color: #344054; white-space: pre-wrap; word-break: break-word; }
.dialog-btns { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- validation window ---- */
.vwin-back { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 30;
             display: flex; align-items: center; justify-content: center; padding: 24px; }
.vwin { background: var(--bg); width: min(1040px, 100%); height: min(640px, 100%);
        display: flex; flex-direction: column; border-radius: 6px; overflow: hidden;
        box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.vwin-head { background: #fff; border-bottom: 1px solid var(--border); padding: 14px 24px 12px;
             display: flex; align-items: center; gap: 14px; }
.vwin-head h2 { margin: 0; font-size: 19px; }
.vwin-head .vname { font-size: 12px; color: var(--muted); flex: 1; min-width: 0;
                    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vwin-band { display: flex; align-items: center; gap: 8px; padding: 14px 24px 8px; flex-wrap: wrap; }
.pill { font-weight: 700; padding: 4px 10px; }
.pill.err { background: #FEE2E2; color: #B91C1C; }
.pill.warn { background: #FEF3C7; color: #B45309; }
.pill.ok { background: #D1FAE5; color: #047857; }
.vwin-summary { font-size: 12px; color: var(--muted); margin-left: 4px; white-space: pre-wrap; }
.vwin-card { flex: 1; min-height: 0; margin: 0 24px 20px; background: #fff;
             border: 1px solid var(--border); overflow: auto; position: relative; }
.vtable { width: 100%; border-collapse: collapse; }
.vtable th { position: sticky; top: 0; background: #F8FAFC; color: var(--muted); font-size: 12px;
             text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.vtable td { padding: 6px 10px; vertical-align: top; border-bottom: 1px solid #F1F5F9; }
.vtable tr { cursor: default; }
.vtable tr.sel td { background: #E0E7FF !important; color: var(--text) !important; }
.vtable tr.Error td { color: #B91C1C; background: #FEF2F2; }
.vtable tr.Warning td { color: #B45309; background: #FFFBEB; }
.vtable tr.Info td { color: #475569; background: #F8FAFC; }
.vempty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
          color: var(--muted); }

/* ---- side-by-side viewer ---- */
.vw { position: fixed; inset: 0; z-index: 35; background: #525659; display: flex;
      flex-direction: column; }
.vw-top { background: #fff; display: flex; align-items: center; gap: 14px; padding: 12px 24px 10px; }
.vw-top h1 { margin: 0; font-size: 20px; }
.vw-count { font-size: 12px; color: var(--muted); white-space: pre; }
.vw-nav { margin-left: auto; display: flex; align-items: center; background: #F1F5F9;
          border: 1px solid var(--border); padding: 4px; }
.vw-pos { min-width: 90px; text-align: center; font-weight: 700; }
.vw-heads { display: grid; background: #F8FAFC; border-top: 1px solid var(--border);
            border-bottom: 1px solid var(--border); }
.vw-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 24px; min-width: 0; }
.vw-tag { font-size: 11px; font-weight: 700; padding: 3px 8px; white-space: pre; }
.vw-fname { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-pages { font-size: 12px; color: var(--muted); white-space: nowrap; }
.vw-ctl { background: #fff; display: flex; align-items: center; gap: 16px; padding: 8px 24px;
          border-bottom: 1px solid var(--border); }
.vw-legend { display: flex; align-items: center; flex-wrap: wrap; row-gap: 4px; }
.vw-legend .chip-sep { width: 1px; background: var(--border); }
.vw-legend .show { font-size: 11px; font-weight: 700; color: var(--muted); margin-right: 8px; }
.vw-desc { flex: 1; text-align: center; font-size: 12px; color: var(--muted); min-width: 0;
           overflow: hidden; text-overflow: ellipsis; white-space: pre; }
.vw-desc.hint { color: #B45309; }
.vw-zoom { display: flex; align-items: center; gap: 4px; }
.vw-zoom .btn { height: 32px; padding: 0 10px; }
.vw-zlbl { min-width: 48px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.vw-plbl { margin-left: 10px; font-size: 12px; font-weight: 700; color: var(--muted); min-width: 56px; }
.vw-body { flex: 1; overflow: auto; position: relative; }
.vw-cols { display: flex; min-height: 100%; }
.vw-col { flex: 1 1 0; min-width: 0; }
.vw-split { flex: none; width: 3px; background: #2d2f31; }
.pg { position: relative; background: #fff; outline: 1px solid #999;
      box-shadow: 4px 4px 0 #3a3d40; margin: 0 auto; }
.pg img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pg svg { position: absolute; inset: 0; overflow: visible; }
.pg-num { text-align: center; color: #ddd; font-size: 11px; padding-top: 4px; }
.pg-wrap { padding-top: 20px; }
.mk { cursor: pointer; }
.fm { pointer-events: none; font-family: var(--font); }
.tip { position: fixed; z-index: 40; background: #fff; border: 1px solid #111827; max-width: 800px;
       box-shadow: 0 8px 30px rgba(0, 0, 0, .35); pointer-events: none; }
.tip-labels { font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px 12px 4px;
              white-space: pre-wrap; }
.tip-detail { font-size: 12px; padding: 0 12px 6px; }
.tip-row { display: flex; gap: 8px; padding: 0 12px 6px; }
.tip-tag { width: 96px; flex: none; font-size: 11px; font-weight: 700; padding-top: 8px; }
.tip-text { flex: 1; background: #F9FAFB; padding: 6px 8px; font-size: 18px; line-height: 1.35;
            max-height: calc(7 * 1.35em + 12px); overflow: hidden; white-space: pre-wrap;
            word-break: break-word; width: 620px; }
.tip-text .del { color: #B91C1C; background: #FEE2E2; text-decoration: line-through; font-weight: 700; }
.tip-text .ins { color: #15803D; background: #DCFCE7; text-decoration: underline; font-weight: 700; }
.tip-text .muted { color: #9CA3AF; font-style: italic; font-size: 16px; }
.tip-text .small { font-size: 28px; font-weight: 700; }
