/* VTI Supplier Portal – no external fonts or CDNs (strict CSP). */
:root {
  --brand: #0b4f8a;
  --brand-dark: #083a66;
  --brand-soft: #e8f0f8;
  --accent: #e0662b;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6b7c;
  --line: #dce2ea;
  --ok: #1e7b45;
  --ok-bg: #e6f4ec;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --info: #0b4f8a;
  --info-bg: #e8f0f8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
code { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: .9em; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.main { flex: 1; padding-top: 24px; padding-bottom: 48px; }
.skip-link { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 10; }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small, small { font-size: .85rem; }
.pre { white-space: pre-wrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
.eyebrow a { color: inherit; }

/* Top bar */
.topbar { background: var(--brand); color: #fff; box-shadow: var(--shadow); }
.topbar-inner { display: flex; align-items: center; gap: 24px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark { background: #fff; color: var(--brand); font-weight: 800; border-radius: 8px; padding: 6px 9px; letter-spacing: .04em; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text small { opacity: .8; font-size: .75rem; }
.mainnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.mainnav a { color: #fff; text-decoration: none; padding: 8px 12px; border-radius: 6px; opacity: .9; }
.mainnav a:hover { background: rgba(255, 255, 255, .12); opacity: 1; color: #fff; }
.usermenu { display: flex; align-items: center; gap: 12px; }
.user-link { color: #fff; text-decoration: none; display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.user-link small { opacity: .75; }
.user-link:hover { color: #fff; text-decoration: underline; }
.usermenu .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .45); }
.usermenu .btn-ghost:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.footer { border-top: 1px solid var(--line); padding: 16px 0; color: var(--muted); font-size: .8rem; background: var(--surface); }

/* Cards & layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-error { border-left: 4px solid var(--danger); }
.card-warn { border-left: 4px solid #e0a000; }
.card-ok { border-left: 4px solid var(--ok); }
.card-accent { border-top: 4px solid var(--brand); }
.narrow { max-width: 520px; margin: 24px auto; }
.narrow-wide { max-width: 860px; margin: 0 auto; }
.center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.layout-detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.spaced { margin-top: 16px; }
@media (max-width: 960px) { .layout-detail { grid-template-columns: 1fr; } }

/* Auth pages */
.auth-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; max-width: 1000px; margin: 32px auto; }
.auth-intro h1 { font-size: 2.1rem; }
.auth-card { padding: 28px; }
.checklist { padding: 0; list-style: none; }
.checklist li { padding-left: 28px; position: relative; margin-bottom: 8px; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
@media (max-width: 800px) { .auth-layout { grid-template-columns: 1fr; gap: 16px; } }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 12px; }
.qr { background: #fff; padding: 10px; display: inline-block; border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; }
.secret { background: var(--brand-soft); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.codes code { display: block; background: var(--bg); border: 1px dashed var(--line); padding: 8px; text-align: center; font-size: 1rem; letter-spacing: .05em; }
.otp { font-size: 1.4rem; letter-spacing: .3em; text-align: center; }
.meter { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.meter span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s; }
.meter span[data-score="3"] { background: #e0a000; }
.meter span[data-score="4"], .meter span[data-score="5"] { background: var(--ok); }

/* Forms */
.form fieldset.card { padding-top: 8px; }
legend { font-weight: 700; font-size: 1.05rem; padding: 0 6px; margin-left: -6px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.card { border: 1px solid var(--line); }
fieldset.plain { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 18px; }
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.field-wide { grid-column: 1 / -1; }
label { font-weight: 600; font-size: .9rem; }
.req { color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=search], input:not([type]), select, textarea {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid #b9c3cf; border-radius: 7px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(11, 79, 138, .25); border-color: var(--brand); }
input[readonly], input:disabled, select:disabled { background: #f0f2f5; color: var(--muted); }
.has-error input, .has-error select { border-color: var(--danger); background: #fffafa; }
.error-text { color: var(--danger); font-size: .85rem; margin: 0; }
.help { color: var(--muted); font-size: .82rem; margin: 0; }
.radio-row { display: flex; gap: 22px; padding: 6px 0; }
.radio, .checkbox { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.radio input, .checkbox input { margin-top: 4px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .pair { grid-template-columns: 1fr; } }
.sticky-actions { position: sticky; bottom: 0; background: rgba(244, 246, 249, .95); padding: 12px 0; display: flex; gap: 12px; border-top: 1px solid var(--line); }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; min-width: 200px; }
.inline-actions { display: flex; gap: 6px; }
.inline-actions select { width: auto; padding: 5px 8px; }
.upload-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.note-form { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; }
.search { display: flex; gap: 8px; margin-bottom: 14px; max-width: 560px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 7px; border: 1px solid #b9c3cf; background: #fff; color: var(--text); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--bg); color: var(--text); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 11px; font-size: .85rem; }
.btn-block { width: 100%; margin-top: 4px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Alerts & badges */
.alert { border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid transparent; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-success { background: var(--ok-bg); border-color: #b7dfc6; color: #134e2c; }
.alert-info { background: var(--info-bg); border-color: #c4d7ea; color: #0a3a66; }
.alert-warn { background: var(--warn-bg); border-color: #f0d9a0; color: #5e3e00; }
.alert-error { background: var(--danger-bg); border-color: #f5c2bd; color: #7a1a12; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-neutral { background: #eef1f5; color: var(--muted); }

/* Dashboard */
.step-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); position: relative; }
.step-card:hover { border-color: var(--brand); color: var(--text); }
.step-card .step-no { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--warn-bg); color: var(--warn); margin-bottom: 6px; }
.step-card.done .step-no { background: var(--ok-bg); color: var(--ok); }
.step-card span:last-child { color: var(--muted); font-size: .9rem; }
.issues { margin: 0; padding-left: 20px; }
.issues li { margin-bottom: 4px; color: var(--danger); }
.issues.warn li { color: var(--warn); }
.notes { list-style: none; padding: 0; margin: 0; }
.notes li { padding: 6px 0 6px 24px; position: relative; border-bottom: 1px solid var(--line); }
.notes li::before { position: absolute; left: 0; font-weight: 700; }
.note-ok::before { content: "✓"; color: var(--ok); }
.note-warning::before { content: "!"; color: var(--warn); }
.note-info::before { content: "i"; color: var(--info); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--line); padding: 0 0 12px 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline li.internal::before { background: var(--muted); }
.timeline time { color: var(--muted); font-size: .8rem; display: block; }
.timeline p { margin: 4px 0 0; }

/* Documents */
.doc { padding: 16px 20px; }
.doc-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.doc-head h2 { margin-bottom: 2px; }
.doc-missing { border-left: 4px solid #e0a000; }
.doc-ok { border-left: 4px solid var(--ok); }

/* Tables & key/value */
.table-wrap { overflow-x: auto; padding: 0; }
.card.table-wrap { padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfc; }
tr.muted td { color: var(--muted); }
.hash { color: var(--muted); }
.kv { display: grid; grid-template-columns: minmax(140px, 40%) 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; word-break: break-word; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--text); font-size: .85rem; }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip .count { opacity: .7; margin-left: 4px; }
.prose h2 { margin-top: 1.2rem; }

@media print {
  .topbar, .footer, .row-actions { display: none; }
  .card { box-shadow: none; border: 0; }
}

/* Language switch, required fields, self-registration (v1.1) */
.topbar-spacer { flex: 1; }
.langswitch { display: flex; gap: 2px; background: rgba(255, 255, 255, .12); border-radius: 999px; padding: 3px; }
.langswitch a { color: #fff; text-decoration: none; font-size: .75rem; font-weight: 700; letter-spacing: .06em; padding: 4px 10px; border-radius: 999px; opacity: .8; }
.langswitch a:hover { opacity: 1; color: #fff; background: rgba(255, 255, 255, .14); }
.langswitch a.active { background: #fff; color: var(--brand); opacity: 1; }
.req { color: var(--danger); font-weight: 700; margin-left: 2px; }
.required-note { font-size: .82rem; color: var(--muted); margin: 0 0 14px; }
.required-note::first-letter { text-transform: uppercase; }
.field-legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; }
.footer a { color: var(--muted); }
.lead { font-size: 1.05rem; color: var(--muted); }
.auth-stack { display: flex; flex-direction: column; gap: 0; }
.auth-card-secondary { background: var(--brand-soft); border-color: #cfdcec; box-shadow: none; }
.auth-card-secondary h2 { margin-bottom: .4rem; }
.auth-card-secondary .btn { margin: 6px 0 10px; background: var(--surface); }
.steps-inline { margin: 18px 0 8px; padding-left: 18px; }
.steps-inline li { margin-bottom: 4px; }
.checkbox span { display: inline; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 720px) { .langswitch { order: 3; } .topbar-inner { padding-top: 8px; padding-bottom: 8px; } }
