/*
 * PunchOut tester: a workspace laid out like the /cms admin panel (navy brand corner and sidebar, white top
 * bar, cards on a soft blue-grey page), using the public site's own brand:
 *   colours  the admin panel's tokens, which are the website's (#4D6BC0 → #1C99E6 button gradient, navy, #404040 text)
 *   type     general/type.css: Manrope for headings, labels and buttons, IBM Plex Sans for reading; 400/500/600 only,
 *            sentence-case labels, no tracking
 *
 * Advanced-only fields carry .adv-only and show when body has .view-advanced.
 */

:root {
    --brand-1: #4D6BC0;
    --brand-1-dark: #3F5AA8;
    --brand-2: #1C99E6;
    --brand-light: #8FD8FF;
    --brand-grad: linear-gradient(90deg, #4D6BC0 0.51%, #1C99E6 99.49%);
    --brand-grad-dark: linear-gradient(90deg, #3F5AA8 0.51%, #1688CF 99.49%);
    --navy: #0F1B2D;
    --navy-2: #182840;
    --text: #404040;
    --text-strong: #0F1B2D;
    --muted: #6A6C6E;
    --line: #CDD6E4;
    --line-soft: #E3E7EE;
    --bg: #F6F9FD;
    --bg-card: #FFFFFF;
    --bg-soft: #EEF4FB;
    --danger: #C62828;
    --danger-bg: #FDECEA;
    --ok: #1B7F3B;
    --ok-bg: #E7F6EC;
    --warn: #A15C00;
    --warn-bg: #FFF4E0;
    --focus: #1C99E6;
    --radius: 12px;
    --nav-h: 60px;
    --side-w: 264px;
    --shadow: 0 1px 2px rgba(15, 27, 45, .06);
    --shadow-lg: 0 16px 40px rgba(15, 27, 45, .18);
    --font-display: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-text: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body { margin: 0; color: var(--text); background: var(--bg); font-family: var(--font-text); font-size: 15px; line-height: 1.55; min-height: 100vh; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { color: var(--text-strong); margin: 0; font-family: var(--font-display); font-weight: 600; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--brand-1); }
a:hover { color: var(--brand-1-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: var(--font-code); font-size: .875em; background: var(--bg-soft); border-radius: 4px; padding: 1px 5px; overflow-wrap: anywhere; color: var(--text-strong); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ shell */

/* Top bar: the page's title and "How it works"; the brand sits in the sidebar's corner on wide screens */
.nav { position: fixed; inset: 0 0 auto var(--side-w); height: var(--nav-h); background: #FFFFFF; border-bottom: 1px solid var(--line-soft); z-index: 100; display: flex; align-items: center; gap: 16px; padding: 0 32px; }
.nav-title { font-size: 18px; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nav-action { flex: none; margin-left: auto; }
.nav-title + .nav-action { margin-left: 0; }

.brand { position: fixed; top: 0; left: 0; width: var(--side-w); height: var(--nav-h); z-index: 101; display: flex; align-items: center; gap: 8px; padding: 0 16px; background: var(--navy); border-bottom: 1px solid var(--navy-2); text-decoration: none; overflow: hidden; }
.brand-icon { width: 32px; height: 32px; display: block; flex: none; }
.brand-text { display: grid; gap: 1px; min-width: 0; line-height: 1.2; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: #FFFFFF; white-space: nowrap; }
.brand-by { font-size: 11.5px; color: #9FB0C9; white-space: nowrap; }

.icon-btn { background: none; border: 0; padding: 8px; border-radius: 8px; cursor: pointer; line-height: 0; color: var(--text-strong); }
.icon-btn:hover { background: var(--bg-soft); }
.menu-btn { display: none; }

.side {
    position: fixed; top: var(--nav-h); bottom: 0; left: 0; width: var(--side-w);
    display: flex; flex-direction: column;
    background-color: var(--navy);
    background-image: radial-gradient(120% 70% at 50% 0%, rgba(15, 27, 45, 0) 40%, rgba(15, 27, 45, .9) 100%), linear-gradient(rgba(140, 170, 230, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(140, 170, 230, .09) 1px, transparent 1px), linear-gradient(160deg, #0F1B2D 0%, #16294A 100%);
    background-size: 100% 100%, 40px 40px, 40px 40px, 100% 100%;
    padding: 12px 12px 16px; overflow-y: auto; z-index: 90;
    color: #C9D4E6; font-size: 14px;
}
.side-top { display: none; }
.side-label { margin: 16px 12px 6px; font-family: var(--font-display); font-size: 12px; font-weight: 600; color: #7F90AB; }
.side-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side .link { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #C9D4E6; font-family: var(--font-display); font-weight: 600; text-decoration: none; transition: background .15s, color .15s; }
.side .link:hover { background: var(--navy-2); color: #FFFFFF; }
.side .link.active { background: var(--navy-2); color: #FFFFFF; }
.side .link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-light); }
.side .link.active svg { color: var(--brand-light); }
.side .link svg { width: 20px; height: 20px; flex: none; fill: currentColor; }

/* saved configs: every row inset 12px, like the tester links above */
.side-configs { display: flex; flex-direction: column; gap: 8px; flex: 1 0 auto; }
.side-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 16px 0 2px; padding: 0 4px 0 12px; }
.side-label-row .side-label { margin: 0; }
.side-action { background: none; border: 0; padding: 4px 8px; color: var(--brand-light); font-family: var(--font-display); font-weight: 600; font-size: 13px; cursor: pointer; border-radius: 6px; }
.side-action:hover { background: var(--navy-2); }
.side-action-danger { color: #F2A6A6; align-self: flex-start; margin-left: 4px; }
.config-form { display: grid; gap: 8px; padding: 10px; background: var(--navy-2); border-radius: 10px; }
.config-form input { width: 100%; background: #FFFFFF; color: var(--text-strong); border: 1px solid transparent; border-radius: 8px; padding: 7px 10px; font-size: 14px; }
.config-form-actions { display: flex; gap: 6px; }
.config-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.config-list:empty { display: none; }
.config-item { border-radius: 10px; }
.config-item.is-active { background: var(--navy-2); }
.config-row { position: relative; display: flex; align-items: center; }
.config-name { flex: 1 1 auto; min-width: 0; display: grid; gap: 1px; text-align: left; background: none; border: 0; border-radius: 10px; padding: 8px 40px 8px 12px; color: #C9D4E6; cursor: pointer; }
.config-name:hover { background: var(--navy-2); color: #FFFFFF; }
.config-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.config-meta { font-size: 12px; color: #7F90AB; }
.config-item.is-active .config-title { color: #FFFFFF; font-weight: 500; }
/* ⋯ shows on hover or focus, and always on the loaded row, an open menu, and touch screens */
.config-more { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: #C9D4E6; cursor: pointer; opacity: 0; }
.config-more svg { width: 18px; height: 18px; fill: currentColor; }
.config-more:hover, .config-more[aria-expanded="true"] { background: rgba(143, 216, 255, .14); color: #FFFFFF; }
.config-item:hover .config-more, .config-more:focus-visible, .config-item.is-active .config-more, .config-item.menu-open .config-more { opacity: 1; }
@media (hover: none) { .config-more { opacity: 1; } }
.config-rename { width: 100%; margin: 2px 0; background: #FFFFFF; color: var(--text-strong); border: 1px solid var(--brand-2); border-radius: 8px; padding: 7px 10px; font-size: 14px; }
.config-menu { position: fixed; z-index: 160; width: 200px; padding: 4px; display: grid; gap: 2px; background: #FFFFFF; border: 1px solid var(--line-soft); border-radius: 12px; box-shadow: var(--shadow-lg); }
.config-menu > button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; border-radius: 7px; padding: 8px 10px; font-size: 14px; color: var(--text-strong); cursor: pointer; }
.config-menu > button:hover, .config-menu > button:focus-visible { background: var(--bg-soft); }
.config-menu > button.danger { color: var(--danger); }
.config-menu > button.danger:hover { background: var(--danger-bg); }
.config-icon { display: grid; place-items: center; }
.config-icon svg { width: 16px; height: 16px; fill: currentColor; }
.config-confirm { padding: 6px 8px 2px; font-size: 13px; color: var(--text-strong); line-height: 1.4; overflow-wrap: break-word; }
.config-confirm-actions { display: flex; gap: 6px; padding: 6px 8px 6px; }
.config-confirm-actions button { border: 1px solid var(--line); background: #FFFFFF; border-radius: 8px; padding: 5px 12px; font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--text-strong); cursor: pointer; }
.config-confirm-actions .config-confirm-delete { background: var(--danger); border-color: var(--danger); color: #FFFFFF; }
.config-actions { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 8px 10px 12px; }
.config-actions:has(> button[hidden]:only-child) { display: none; }
.config-actions button { background: rgba(143, 216, 255, .08); border: 0; padding: 3px 9px; border-radius: 999px; color: var(--brand-light); font-size: 12px; font-family: var(--font-display); font-weight: 600; cursor: pointer; }
.config-actions button:hover { background: rgba(143, 216, 255, .18); }
.side-empty { margin: 0; padding: 12px; border: 1px dashed rgba(143, 216, 255, .25); border-radius: 10px; font-size: 13px; color: #9FB0C9; line-height: 1.45; }
.side-status { margin: 0 12px; font-size: 13px; color: #9BE3B3; }
.side-status:empty { display: none; }
.side-status.is-error { color: #F2A6A6; }
/* Pinned to the bottom of the sidebar: the section grows to fill it, this takes the leftover space above */
.side-privacy { display: grid; gap: 8px; margin-top: auto; padding: 12px 12px 0; border-top: 1px solid rgba(143, 170, 230, .14); }
.side-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 12.5px; color: #9FB0C9; line-height: 1.45; }
.side-note svg { width: 14px; height: 14px; flex: none; margin-top: 2px; fill: currentColor; }
.side-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: #C9D4E6; cursor: pointer; line-height: 1.4; }
.side-check input { margin: 2px 0 0; accent-color: var(--brand-2); flex: none; }
.side-privacy .side-action-danger { justify-self: start; margin-left: -8px; }

.side-links { margin-bottom: 24px; }
.side-configs { margin-bottom: 0; }

.scrim { display: none; position: fixed; inset: 0; background: rgba(15, 27, 45, .45); z-index: 110; }

.main { margin-left: var(--side-w); padding: calc(var(--nav-h) + 28px) 32px 32px; min-height: 100vh; display: flex; flex-direction: column; gap: 20px; min-width: 0; overflow-x: clip; }

@media (max-width: 900px) {
    .menu-btn { display: inline-block; margin-right: 4px; }
    .nav { left: 0; padding: 0 12px; gap: 8px; }
    /* With the mode toggle the bar takes a second row, so it scrolls in the page flow instead of being fixed */
    .nav:has(.mode-bar) { position: sticky; top: 0; height: auto; min-height: var(--nav-h); flex-wrap: wrap; padding: 8px 12px; }
    .nav:has(.mode-bar) .mode-bar { order: 3; width: 100%; margin-left: 0; }
    body:has(.nav .mode-bar) .main { padding-top: 16px; }
    .nav:has(.nav-title) .brand { display: none; }
    .nav-title { font-size: 16px; }
    .brand { position: static; width: auto; height: auto; background: none; border: 0; padding: 0; overflow: visible; margin-right: auto; }
    .brand-name { color: var(--text-strong); }
    .brand-by { color: var(--muted); }
    .side { top: 0; z-index: 120; transform: translateX(-100%); transition: transform .2s; width: min(88vw, 320px); }
    .side.open { transform: none; box-shadow: var(--shadow-lg); }
    .side-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 4px 12px; color: #FFFFFF; font-family: var(--font-display); font-weight: 600; }
    .side-top .icon-btn { color: #C9D4E6; }
    .side-top .icon-btn:hover { background: var(--navy-2); }
    .scrim.open { display: block; }
    .main { margin-left: 0; padding: calc(var(--nav-h) + 16px) 16px 24px; }
}

/* ------------------------------------------------------------------ page head */

.page-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.page-head-text { display: grid; gap: 6px; max-width: 70ch; }
.page-head h1 { font-size: clamp(1.5rem, 1.3rem + .8vw, 1.875rem); line-height: 1.2; letter-spacing: -.015em; }
.page-lead { color: var(--muted); font-size: 15px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: #FFFFFF; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 7px; cursor: pointer; font-family: var(--font-display); font-weight: 600; font-size: 14px; transition: background-color .2s, color .2s, box-shadow .2s; }
.seg button[aria-pressed="true"] { background: var(--bg-soft); color: var(--text-strong); }

/* ------------------------------------------------------------------ buttons */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; font-family: var(--font-display); font-weight: 600; font-size: 14px; border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .15s; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--brand-grad); color: #FFFFFF; }
.btn-primary:hover:not(:disabled) { background: var(--brand-grad-dark); color: #FFFFFF; }
.btn-secondary { background: #FFFFFF; color: var(--text-strong); border-color: var(--line); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-soft); border-color: var(--brand-1); color: var(--text-strong); }
.btn-ghost-dark { background: transparent; color: #C9D4E6; }
.btn-ghost-dark:hover { background: rgba(255, 255, 255, .06); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-link { background: none; border: 0; padding: 4px 8px; color: var(--brand-1); font-family: var(--font-display); font-weight: 600; font-size: 13px; cursor: pointer; border-radius: 6px; justify-self: start; align-self: flex-start; }
.btn-link:hover { background: var(--bg-soft); }
.icon-text-btn { background: none; border: 1px solid var(--line-soft); padding: 5px 9px; border-radius: 8px; color: var(--muted); font-family: var(--font-display); font-weight: 600; font-size: 12px; cursor: pointer; }
.icon-text-btn:hover { border-color: var(--danger); color: var(--danger); }

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

.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }

.panel { background: var(--bg-card); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.panel-title { font-size: 16px; }
.panel-body { padding: 20px; display: grid; gap: 20px; }
.panel-foot { position: sticky; bottom: 0; padding: 14px 20px; border-top: 1px solid var(--line-soft); background: #FFFFFF; border-radius: 0 0 var(--radius) var(--radius); display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.send-note { font-size: 13px; color: var(--muted); flex: 1 1 220px; }

body:not(.view-advanced) .adv-only { display: none !important; }

/* fields */
.group { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; min-width: 0; }
.panel-body > .group, [data-fields] > .group + .group { padding-top: 18px; border-top: 1px solid var(--line-soft); }
[data-fields] { display: grid; gap: 18px; }
legend { padding: 0; margin-bottom: 4px; font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--text-strong); float: left; width: 100%; }
legend + * { clear: both; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 14px 16px; }
.field-grid:empty { display: none; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field > label { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--text-strong); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.field-name { font-weight: 400; font-size: 11px; color: var(--muted); background: none; padding: 0; }
.field-inline { grid-template-columns: auto auto; justify-content: start; align-items: center; gap: 10px; }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.45; }

input[type="text"], input[type="url"], input[type="password"], select, textarea {
    width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; background: #FFFFFF; color: var(--text-strong); font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #8A94A6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(28, 153, 230, .18); }
.field-inline select { width: auto; }
.input-group { display: flex; min-width: 0; }
.input-group input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-addon { border: 1px solid var(--line); border-left: 0; background: var(--bg-soft); border-radius: 0 8px 8px 0; padding: 0 12px; font-family: var(--font-display); font-weight: 600; font-size: 12px; color: var(--text-strong); cursor: pointer; }
.input-addon:hover { background: #E2ECF8; }

/* key = value rows (Basic) */
.block-label { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--text-strong); }
.basic-only { display: grid; gap: 10px; }
body.view-advanced .basic-only { display: none !important; }
.vars { display: grid; gap: 8px; }
.var-row { display: grid; grid-template-columns: minmax(0, 0.9fr) auto minmax(0, 1.3fr) 28px; gap: 8px; align-items: center; }
.var-key { font-family: var(--font-code); font-size: 13px !important; background: var(--bg) !important; }
.var-eq { color: var(--muted); font-family: var(--font-display); font-weight: 600; }
.var-remove { width: 28px; height: 28px; border-radius: 8px; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.var-remove:hover { background: var(--danger-bg); color: var(--danger); }
.vars-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
[data-vars] { display: grid; gap: 12px; }
.vars-actions .btn-link { margin-right: -8px; }
.vars:empty { display: none; }
.btn-link-muted { color: var(--muted); }
@media (max-width: 560px) {
    .var-row { grid-template-columns: minmax(0, 1fr) 28px; }
    .var-key { grid-column: 1 / -1; }
    .var-eq { display: none; }
}

/* cXML editor (Advanced) */
.editor-block { display: grid; gap: 10px; min-width: 0; }
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.editor-tools { display: flex; gap: 4px; flex-wrap: wrap; }
[data-editor] { min-width: 0; }
[data-editor] .cm-editor { max-height: 70vh; }

/* send options on one line */
.send-options { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.send-options .field-inline { display: inline-flex; align-items: center; gap: 8px; }
.send-options select { width: auto; padding: 7px 10px; }

.choice { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.choice input { margin-top: 4px; accent-color: var(--brand-1); flex: none; }
.choice strong { font-family: var(--font-display); font-weight: 600; color: var(--text-strong); }
.choice-sm { font-size: 13px; align-items: center; }
.choice-sm input { margin-top: 0; }

textarea.code, pre.code { font-family: var(--font-code); font-size: 12.5px; line-height: 1.6; tab-size: 2; }
textarea.code { resize: vertical; white-space: pre; overflow: auto; }
pre.code { margin: 0; background: #F8FAFD; border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px 14px; overflow: auto; white-space: pre; color: var(--text-strong); }

/* tables: order lines and cart items */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 10px; background: #FFFFFF; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-family: var(--font-display); font-weight: 600; font-size: 12.5px; color: var(--text-strong); background: var(--bg); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; color: var(--text-strong); border-top: 1px solid var(--line); border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.pre-line { white-space: pre-line; min-width: 220px; }
td code { white-space: nowrap; overflow-wrap: normal; }
.table td:nth-child(5) { min-width: 180px; }
.lines td { padding: 6px; }
.lines input { width: auto; min-width: 4.5em; padding: 7px 9px; font-size: 13.5px; }
.lines-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.lines-total { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 500; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.lines-total label { font-weight: 600; font-size: 13px; }
.lines-total input { width: 4.5em; }

/* ------------------------------------------------------------------ the reply under the form, and reports */

.result-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.result .panel-body { gap: 14px; }
/* The page heading and the form share one width, so Basic/Advanced lines up with the form's right edge */
.page-head, .workspace-stacked { max-width: 1200px; }

.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.pane-title, .section-title { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--text-strong); }
.section-title { margin-top: 6px; }
.pane-tools { display: flex; align-items: center; gap: 8px; }

.empty { margin: auto; max-width: 40ch; text-align: center; color: var(--muted); padding: 32px 8px; }
.empty::before { content: ""; display: block; width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%; background: var(--bg-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='%234D6BC0'%3E%3Cpath d='M6 2h9l5 5v15H6zm8 1.5V8h4.5z'/%3E%3C/svg%3E") center no-repeat; }
.loading { color: var(--muted); }

.verdict { font-family: var(--font-display); font-weight: 600; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.verdict-ok { background: var(--ok-bg); color: var(--ok); }
.verdict-warn { background: var(--warn-bg); color: var(--warn); }
.verdict-error { background: var(--danger-bg); color: var(--danger); }
.verdict-info { background: var(--bg-soft); color: var(--text-strong); }

.pairs { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 14px; }
.pairs dt { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--text-strong); }
.pairs dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .pairs { grid-template-columns: minmax(0, 1fr); } .pairs dd { margin-bottom: 6px; } }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: var(--bg); font-size: 14px; }
.check-text { min-width: 0; overflow-wrap: anywhere; }
.check-text code { font-size: 11.5px; margin-left: 2px; }
.badge { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-family: var(--font-display); font-weight: 600; font-size: 12px; margin-top: 1px; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-error { background: var(--danger-bg); color: var(--danger); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-info { background: var(--bg-soft); color: var(--brand-1); }

.alert { padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-info { background: var(--bg-soft); color: var(--text-strong); }
.raw { display: grid; gap: 8px; }
.raw pre.code { max-height: 420px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ------------------------------------------------------------------ cart report page */

.report-standalone { display: grid; gap: 20px; }
.report-standalone .panel-body { gap: 14px; }

/* ------------------------------------------------------------------ guide and footer */

/* Pop-ups anchored to their button (common.js, "tips"): "How it works" as a dropdown card, the ⓘ as a tooltip */
.pop { position: fixed; z-index: 150; width: min(440px, calc(100vw - 24px)); max-height: calc(100vh - var(--nav-h) - 24px); overflow-y: auto; background: #FFFFFF; border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow-lg); color: var(--text); }
.pop-tip { width: min(300px, calc(100vw - 24px)); background: var(--navy); border-color: var(--navy-2); color: #C9D4E6; overflow: visible; }
.pop-tip::before { content: ""; position: absolute; top: -6px; left: calc(var(--arrow-x, 50%) - 6px); width: 12px; height: 12px; background: var(--navy); transform: rotate(45deg); border-radius: 2px; }
.tip-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line-soft); }
.tip-head h2 { font-size: 15px; }
.tip-body { padding: 14px 18px 18px; display: grid; gap: 10px; font-size: 14px; line-height: 1.55; }
.tip-body ol, .tip-body ul { margin: 0; padding-left: 1.25rem; display: grid; gap: 8px; }
.pop-tip .tip-head { padding: 12px 14px 0; border: 0; }
.pop-tip .tip-head h2 { color: #FFFFFF; font-size: 14px; }
.pop-tip .tip-body { padding: 6px 14px 14px; font-size: 13px; gap: 6px; }
.pop-tip strong { color: #FFFFFF; }
.tip-btn { color: var(--muted); }
.tip-btn:hover { color: var(--brand-1); }
.foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------------ demo supplier pages */

body.demo-page { padding: 32px 16px; background: #FFFFFF; }
.demo-shop { max-width: 560px; margin: 0 auto; display: grid; gap: 16px; }
.demo-shop h1 { font-size: 22px; }
.demo-flag { justify-self: start; font-family: var(--font-display); font-weight: 600; font-size: 12px; color: var(--warn); background: var(--warn-bg); border-radius: 999px; padding: 3px 12px; }
.demo-products { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line-soft); border-radius: 12px; }
.demo-products li { display: grid; gap: 2px; padding: 12px 16px; }
.demo-products li + li { border-top: 1px solid var(--line-soft); }
.demo-product-name { font-family: var(--font-display); font-weight: 600; color: var(--text-strong); }
.demo-product-meta { font-size: 13px; color: var(--muted); }
.demo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-note { font-size: 13px; color: var(--muted); }

/* "What was sent", folded under the reply */
details.sent { border-top: 1px solid var(--line-soft); padding-top: 12px; }
details.sent summary { cursor: pointer; font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--brand-1); }
details.sent[open] summary { margin-bottom: 10px; }

/* side sheet: the cXML that will be sent, or was sent */
.sheet { position: fixed; inset: 0; z-index: 200; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(15, 27, 45, .35); opacity: 0; transition: opacity .18s; }
.sheet-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); background: #FFFFFF; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .18s ease-out; }
.sheet.is-open .sheet-scrim { opacity: 1; }
.sheet.is-open .sheet-panel { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line-soft); }
.sheet-title { font-size: 16px; }
.sheet-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 20px; border-bottom: 1px solid var(--line-soft); }
.sheet-code { flex: 1 1 auto; margin: 16px 20px 20px; max-height: none; }
body.sheet-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .sheet-scrim, .sheet-panel { transition: none; } }

/* Dropdowns: our own arrow, with room for it, so it lines up with the text instead of hugging the border */
select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%230F1B2D' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
    cursor: pointer;
}
.sheet-code { min-height: 0; min-width: 0; overflow: auto; }

/* ------------------------------------------------------------------ form cards */

/* The tester form as a column of cards: Supplier URL, Credentials, Session… then one wide send button */
.workspace-stacked { max-width: 1040px; width: 100%; margin-inline: auto; }
.mode-bar { display: flex; align-items: center; gap: 4px; flex: none; }
.mode-bar .seg button { padding: 6px 14px; }
.nav-title + .mode-bar { margin-left: auto; }
.mode-bar + .nav-action { margin-left: 8px; }
/* The selected mode is tinted and outlined, not filled: filled gradient buttons are kept for actions (Send, Talk to us) */
.mode-bar .seg button[aria-pressed="true"] { background: var(--bg-soft); color: var(--brand-1); box-shadow: inset 0 0 0 1px #BFD0EE; }
.mode-bar .seg button:not([aria-pressed="true"]):hover { color: var(--text-strong); }
.request-stack { display: grid; gap: 20px; min-width: 0; }
.card { background: var(--bg-card); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 24px; background: var(--bg); border-bottom: 1px solid var(--line-soft); border-radius: var(--radius) var(--radius) 0 0; }
.card-head svg { width: 18px; height: 18px; flex: none; fill: var(--brand-1); }
.card-title { font-size: 15px; }
.card-body { padding: 20px 24px 24px; display: grid; gap: 18px; min-width: 0; }
.card-body .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.field-wide { grid-column: 1 / -1; }
.send-bar { display: grid; gap: 12px; }
.send-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.send-actions .btn-block { flex: 1 1 220px; width: auto; }
.btn-tall { padding: 14px 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; padding: 14px 18px; font-size: 15px; border-radius: 12px; }
.send-waiting { font-family: var(--font-display); font-weight: 600; color: var(--text-strong); }
@media (max-width: 640px) {
    .card-head { padding: 12px 16px; }
    .card-body { padding: 16px; }
    .card-body .field-grid { grid-template-columns: minmax(0, 1fr); }
    .send-actions > .btn { flex: 1 1 100%; }
}

/* Text box with a dropdown of usual values (PT.combo) */
.combo { position: relative; }
.combo input { padding-right: 40px; }
.combo-toggle { position: absolute; top: 1px; right: 1px; bottom: 1px; width: 38px; border: 0; border-radius: 0 7px 7px 0; cursor: pointer; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%230F1B2D' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 12px 8px; }
.combo-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: #FFFFFF; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); }
.combo-list li { padding: 8px 12px; border-radius: 7px; cursor: pointer; }
.combo-list li:hover, .combo-list li.is-active { background: var(--bg-soft); color: var(--text-strong); }

/* "Remember these settings" above the send button */
.save-on-send { display: grid; gap: 4px; }
.save-on-send .hint { padding-left: 26px; }
.save-status { padding-left: 26px; font-size: 13px; color: var(--ok); }
.save-status:empty { display: none; }
.send-countdown { font-family: var(--font-display); font-weight: 600; color: var(--text-strong); }

/* The one ad: a slim strip above the form, as wide as the form column */
.promo { max-width: 1040px; width: 100%; margin-inline: auto; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 16px; background: var(--bg-soft); border: 1px solid #D6E3F5; border-radius: var(--radius); }
.promo-icon { width: 20px; height: 20px; flex: none; fill: var(--brand-1); }
.promo-text { flex: 1 1 auto; font-size: 14px; line-height: 1.45; color: var(--text); }
.promo-text strong { font-family: var(--font-display); font-weight: 600; color: var(--text-strong); }
.promo .btn { flex: none; }
@media (max-width: 640px) {
    .promo { flex-wrap: wrap; align-items: flex-start; }
    .promo-text { flex-basis: calc(100% - 34px); }
    .promo-text span { display: block; margin-top: 2px; }
    .promo .btn { margin-left: 34px; }
}

/* Show / Hide on a secret (PT.reveal) */
.reveal { position: relative; min-width: 0; }
.reveal.is-secret input { padding-right: 42px; }
.reveal-toggle { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 34px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.reveal-toggle:hover { background: var(--bg-soft); color: var(--text-strong); }
.reveal-toggle svg { width: 18px; height: 18px; fill: currentColor; }

/* A page in its own tab (send.ejs): a white top bar with the brand in it, no sidebar */
body.is-bare .nav { left: 0; }
body.is-bare .brand { position: static; width: auto; height: auto; padding: 0; background: none; border: 0; overflow: visible; }
body.is-bare .brand-name { color: var(--text-strong); }
body.is-bare .brand-by { color: var(--muted); }
body.is-bare .nav-title { padding-left: 16px; margin-left: 4px; border-left: 1px solid var(--line-soft); }
body.is-bare .main { margin-left: 0; }
@media (max-width: 900px) { body.is-bare .nav .brand { display: flex; } }

/* ------------------------------------------------------------------ motion
 * Small and quick: things fade or slide a few pixels into place, nothing loops except a spinner while waiting,
 * and all of it is off for people who ask their device to reduce motion.
 */
@keyframes pt-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pt-drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes pt-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pt-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: no-preference) {
    /* Page load: the banner and the form cards rise in one after another */
    .main > .promo, .request-stack > *, .report-standalone > *, .page-head { animation: pt-rise .35s ease-out both; }
    .request-stack > :nth-child(2) { animation-delay: .04s; }
    .request-stack > :nth-child(3) { animation-delay: .08s; }
    .request-stack > :nth-child(4) { animation-delay: .12s; }
    .request-stack > :nth-child(n+5) { animation-delay: .16s; }

    /* Pop-ups, menus and lists drop in */
    .pop:not([hidden]), .config-menu, .combo-list:not([hidden]) { animation: pt-drop .16s ease-out; }
    dialog.tip[open] { animation: pt-fade .16s ease-out; }

    /* New rows, results and status lines */
    .var-row, .config-item { animation: pt-fade .2s ease-out; }
    .panel.result:not([hidden]) { animation: pt-rise .25s ease-out; }
    .checks .check { animation: pt-rise .25s ease-out both; }
    .checks .check:nth-child(2) { animation-delay: .05s; }
    .checks .check:nth-child(3) { animation-delay: .1s; }
    .checks .check:nth-child(4) { animation-delay: .15s; }
    .checks .check:nth-child(n+5) { animation-delay: .2s; }
    .is-flash { animation: pt-drop .25s ease-out; }

    /* Buttons press in slightly; the main one lifts on hover */
    .btn:active:not(:disabled) { transform: translateY(1px); }
    .btn-primary:hover:not(:disabled) { box-shadow: 0 6px 16px rgba(28, 153, 230, .28); }
}

/* A spinner while something is on its way: the send tab, and a Send button that is waiting */
.send-waiting::before, .btn[data-send]:disabled::before, .btn[data-validate]:disabled::before { content: ""; display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; vertical-align: -2px; animation: pt-spin .7s linear infinite; }
.send-waiting::before { margin-right: 10px; color: var(--brand-2); }
@media (prefers-reduced-motion: reduce) {
    .send-waiting::before, .btn[data-send]:disabled::before { animation-duration: 2s; }
}

/* Links inside the banner text: brand blue, underlined only on hover */
.promo-text a { color: var(--brand-1); text-decoration: none; font-weight: 500; }
.promo-text a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ cXML validator: paste left, result right */
.workspace.validator { max-width: 1400px; width: 100%; margin-inline: auto; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.validator-head { padding: 10px 12px 10px 20px; }
.validator-head .card-title { margin-right: auto; }
.validator-tools { display: flex; align-items: center; gap: 4px; }
.validator-tools select { width: auto; padding: 6px 10px; font-size: 13px; }
.validator-type { font-size: 13px; color: var(--muted); }
.validator-editor { padding: 12px; }
.validator-editor .cm-editor, .validator-editor textarea { border-radius: 8px; }
.validator-note { padding: 0 20px 14px; font-size: 12.5px; color: var(--muted); }
.validator-output { position: sticky; top: calc(var(--nav-h) + 20px); max-height: calc(100vh - var(--nav-h) - 40px); display: flex; flex-direction: column; }
.validator-result { padding: 16px 20px 20px; display: grid; gap: 12px; overflow-y: auto; transition: opacity .15s; }
.validator-result.is-checking { opacity: .55; }
.validator-empty { color: var(--muted); font-size: 14px; padding: 24px 0; text-align: center; }
@media (max-width: 1100px) {
    .workspace.validator { grid-template-columns: minmax(0, 1fr); }
    .validator-output { position: static; max-height: none; }
}
/* The editor and the result fill the window's height, so no space is left empty below them */
@media (min-width: 1101px) {
    .validator-editor .cm-editor { height: calc(100vh - var(--nav-h) - 220px); min-height: 420px; }
    .validator-output { min-height: calc(100vh - var(--nav-h) - 128px); }
}
/* The banner lines up with the wider validator layout */
body.page-validator .promo { max-width: 1400px; }
.validator-tools select { max-width: 200px; }

/* Checks that point at a line (the cXML validator): the whole row jumps the editor there */
.checks li { list-style: none; }
.check-jump { width: 100%; text-align: left; border: 0; font: inherit; color: inherit; cursor: pointer; transition: background .15s, box-shadow .15s; }
.check-jump:hover, .check-jump:focus-visible { background: var(--bg-soft); box-shadow: inset 0 0 0 1px #C7D6F0; }
.check-line { margin-left: auto; flex: none; align-self: center; font-family: var(--font-display); font-weight: 600; font-size: 12px; color: var(--brand-1); white-space: nowrap; }
.check-jump:hover .check-line::after { content: " →"; }
.validator-hint { font-size: 12.5px; color: var(--muted); margin-top: -4px; }
