:root {
  color-scheme: light;
  --ink: #172a3a;
  --muted: #73808b;
  --line: #dce2e7;
  --paper: #ffffff;
  --canvas: #f4f6f8;
  --blue: #1268a8;
  --blue-deep: #064f83;
  --blue-pale: #e8f2f9;
  --teal: #0d817c;
  --coral: #c55542;
  --green: #257452;
  --shadow: 0 10px 32px rgba(23, 42, 58, .07);
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button { font: inherit; }

.topbar {
  height: 58px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px 0 22px; background: var(--paper); border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(23, 42, 58, .035); position: relative; z-index: 2;
}
.topbar::after { content: ''; height: 2px; position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(90deg, var(--blue) 0 72%, var(--teal)); }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px 7px 7px 2px; background: var(--blue); color: white; font: 800 15px 'Manrope', sans-serif; letter-spacing: 0; }
.brand-name { font: 700 15px 'Manrope', sans-serif; letter-spacing: 0; }
.brand-version { color: var(--muted); border-left: 1px solid var(--line); padding-left: 11px; font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; color: #687684; font-size: 12px; }
.connection-dot, .status-light { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px #dff1ef; }

.app-shell { display: flex; min-height: calc(100vh - 58px); }
.rail { width: 64px; flex: 0 0 64px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 13px 0; gap: 9px; }
.rail-toggle, .rail-item { border: 0; background: transparent; color: #6d7985; cursor: pointer; display: grid; place-items: center; }
.rail-toggle { width: 40px; height: 35px; font-size: 17px; margin-bottom: 5px; }
.rail-item { width: 40px; height: 42px; border-radius: 5px; transition: background .18s ease, color .18s ease, transform .18s ease; }
.rail-item:hover { background: var(--blue-pale); color: var(--blue); transform: translateY(-1px); }
.rail-item.active { background: var(--blue); color: #fff; box-shadow: 0 5px 12px #1268a82b; }
.rail-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail-spacer { flex: 1; }
.rail-footer { color: #8a969f; font: 700 10px 'Manrope', sans-serif; padding-bottom: 8px; }

.main-area { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.page-heading { padding: 24px 34px 16px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; animation: rise .35s ease both; }
.eyebrow { color: var(--blue); font-size: 10px; font-weight: 700; letter-spacing: 1.15px; }
.crumb-slash { color: #a4afb7; margin: 0 5px; }
h1 { margin: 6px 0 0; color: var(--ink); font: 700 25px 'Manrope', 'Segoe UI', sans-serif; letter-spacing: 0; }
.heading-meta { display: flex; flex-direction: column; gap: 3px; text-align: right; color: var(--ink); font-size: 12px; }
.meta-label { color: #85919a; font-size: 9px; letter-spacing: 1px; font-weight: 700; }

.primary-tabs { display: flex; align-items: stretch; padding: 0 34px; min-height: 46px; background: #e5e9ed; border-top: 1px solid #dce1e5; }
.primary-tab { appearance: none; position: relative; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #354653; padding: 0 17px; cursor: pointer; font-size: 12px; font-weight: 600; }
.primary-tab.selected { color: var(--blue-deep); border-bottom-color: var(--blue); }
.primary-tab:disabled { opacity: .7; cursor: default; }
.library-bar { min-height: 44px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--line); }
.library-tabs { display: flex; align-items: center; gap: 5px; }
.library-tab { appearance: none; border: 0; background: transparent; color: #83909b; padding: 6px 10px; font-size: 11px; cursor: pointer; }
.library-tab.active { color: #fff; background: #7892a2; border-radius: 4px; font-weight: 700; }
.library-tab:disabled { cursor: default; opacity: .8; }
.quiet-label { color: #9aa4ac; font-size: 9px; font-weight: 700; letter-spacing: .9px; }

.workspace { flex: 1; min-height: 0; padding: 23px 34px 14px; background: #fff; animation: rise .45s .05s ease both; }
.workspace-toolbar, .results-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-title { display: flex; align-items: center; gap: 10px; }
.title-rule { width: 3px; height: 17px; border-radius: 2px; background: var(--teal); }
h2 { margin: 0; font: 700 14px 'Manrope', sans-serif; letter-spacing: 0; }
.file-note { color: #88949c; font-size: 11px; }
.drop-zone { min-height: 112px; margin-top: 15px; padding: 18px 21px; display: flex; align-items: center; gap: 17px; border: 1px dashed #9cabb5; border-radius: 5px; background: linear-gradient(105deg, #f7fafc, #fbfcfd 68%, #f1f8f7); transition: border-color .18s ease, background .18s ease, transform .18s ease; cursor: pointer; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--blue); background: #eff7fc; transform: translateY(-1px); }
.upload-icon { width: 43px; height: 43px; flex: 0 0 43px; display: grid; place-items: center; border-radius: 50%; color: var(--blue); background: #e4f0f8; }
.upload-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drop-copy { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.drop-copy strong { font-size: 13px; }
.drop-copy span { color: var(--muted); font-size: 11px; }
.button { min-height: 36px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; border: 1px solid #cbd4db; border-radius: 4px; color: #344958; background: #fff; font-size: 11px; font-weight: 700; cursor: pointer; transition: background .18s ease, border .18s ease, transform .18s ease; }
.button:hover:not(:disabled) { background: #f3f7fa; border-color: #8ba1b0; transform: translateY(-1px); }
.button:disabled { opacity: .48; cursor: not-allowed; }
.spinner { width: 13px; height: 13px; border: 2px solid #ffffff66; border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.button-primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.button-primary:hover:not(:disabled) { border-color: var(--blue-deep); background: var(--blue-deep); }
.run-row { min-height: 58px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.run-hint { display: flex; align-items: center; gap: 8px; color: #78858f; font-size: 11px; }
.run-row .button-primary { grid-column: 2; grid-row: 1; justify-self: center; }
.hint-mark { width: 16px; height: 16px; display: grid; place-items: center; border: 1px solid #a8b6bf; color: #74828b; border-radius: 50%; font: 700 10px Georgia, serif; }

.results { margin-top: 21px; animation: rise .32s ease both; }
.result-actions { display: flex; gap: 7px; }
.result-actions .button { min-height: 31px; padding: 0 10px; font-size: 10px; }
.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 14px 0 15px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafbfc; }
.summary-cell { min-width: 0; padding: 10px 14px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.summary-cell:last-child { border-right: 0; }
.summary-label { color: #85919a; font-size: 9px; font-weight: 700; letter-spacing: .8px; }
.summary-cell strong { font: 700 15px 'Manrope', sans-serif; }
.summary-cell strong.pass { color: var(--green); }
.summary-cell strong.fail { color: var(--coral); }
.result-tabs { display: flex; gap: 19px; border-bottom: 1px solid var(--line); }
.result-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; color: #77848e; padding: 10px 1px 9px; font-size: 11px; cursor: pointer; }
.result-tab.active { color: var(--blue-deep); border-bottom-color: var(--blue); font-weight: 700; }
.result-panel { min-height: 140px; padding-top: 13px; }
.empty-results { padding: 24px 12px; color: #72808a; text-align: center; font-size: 12px; }
.table-wrap { overflow: auto; max-height: 320px; border: 1px solid var(--line); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 11px; }
th { padding: 10px 11px; background: #f1f4f6; color: #435360; text-align: left; font-size: 10px; font-weight: 700; }
td { padding: 10px 11px; border-top: 1px solid #e7ebee; color: #344653; }
tr:nth-child(even) td { background: #fbfcfd; }
.cell-error { color: var(--coral); font-weight: 700; }
#xml-output { max-height: 340px; margin: 0; padding: 14px; overflow: auto; border: 1px solid var(--line); border-radius: 4px; background: #f8fafb; color: #2b485b; font: 11px/1.55 'Cascadia Code', Consolas, monospace; }
#report-preview { width: 100%; height: 340px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.statusbar { min-height: 34px; padding: 0 19px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); color: #66747f; background: #f8f9fa; font-size: 10px; }
.status-light { width: 7px; height: 7px; box-shadow: none; }
.status-right { margin-left: auto; color: #909ba3; }
.status-separator { margin: 0 5px; }
.toast { position: fixed; z-index: 5; right: 20px; bottom: 48px; max-width: min(420px, calc(100vw - 40px)); padding: 12px 16px; border-radius: 4px; color: #fff; background: #293f4f; box-shadow: var(--shadow); font-size: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: #a73f35; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 760px) {
  .topbar { height: 52px; padding: 0 14px; }
  .brand-name { font-size: 13px; }
  .brand-version, .topbar-right { display: none; }
  .app-shell { min-height: calc(100vh - 52px); }
  .rail { width: 48px; flex-basis: 48px; }
  .rail-item { width: 36px; }
  .page-heading { padding: 18px 16px 13px; align-items: flex-start; }
  h1 { font-size: 21px; }
  .heading-meta { display: none; }
  .primary-tabs { padding: 0 10px; overflow-x: auto; }
  .primary-tab { padding: 0 12px; white-space: nowrap; }
  .library-bar { padding: 0 12px; }
  .quiet-label { display: none; }
  .workspace { padding: 16px 13px 12px; }
  .drop-zone { flex-wrap: wrap; gap: 12px; padding: 14px; }
  .drop-copy { min-width: calc(100% - 70px); }
  .drop-zone > .button { margin-left: 55px; }
  .run-row { grid-template-columns: 1fr; align-items: start; row-gap: 12px; padding: 12px 0; }
  .run-hint { grid-column: 1; grid-row: 1; }
  .run-row .button-primary { grid-column: 1; grid-row: 2; justify-self: center; }
  .results-head { align-items: flex-start; flex-direction: column; }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-cell:nth-child(2) { border-right: 0; }
  .summary-cell:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .status-right { display: none; }
}
