/* Telectron KYC Portal — one stylesheet for portal + admin. Logical properties keep RTL working. */
:root {
  --brand: #0f766e;
  --brand-soft: color-mix(in srgb, var(--brand) 9%, white);
  --brand-line: color-mix(in srgb, var(--brand) 30%, white);
  --paper: #f3f6f5;
  --surface: #ffffff;
  --ink: #16212a;
  --ink-2: #33414c;
  --muted: #5a6670;
  --line: #dbe2e0;
  --line-2: #e9eeec;
  --amber: #9a5a06;
  --amber-bg: #fff6e6;
  --amber-line: #f2d39b;
  --red: #b42318;
  --red-bg: #fef2f1;
  --red-line: #f5c2bd;
  --green: #157f3d;
  --green-bg: #edf8f1;
  --radius: 10px;
  --radius-sm: 7px;
  --font: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}
[dir="rtl"] { --font: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, "Segoe UI", Tahoma, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--paper); }
body.admin { font-size: 15px; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }
code, pre, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mono-soft, .mono-inline { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); outline-offset: 2px; border-radius: 4px; }
[hidden], .is-hidden { display: none !important; }

/* ---------- type ---------- */
.h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 600; margin: 0 0 .35rem; letter-spacing: -.01em; }
.h2 { font-size: 1.4rem; line-height: 1.25; font-weight: 600; margin: 0 0 .5rem; }
.h3 { font-size: 1.15rem; line-height: 1.3; font-weight: 600; margin: 0 0 .6rem; }
.h4 { font-size: 1rem; line-height: 1.35; font-weight: 600; margin: 0 0 .6rem; }
.h4.sub { margin-top: 1.25rem; }
.lead { font-size: 1.05rem; color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--red); }
.text-warn { color: var(--amber); }
p { margin: 0 0 .9rem; }
p:last-child { margin-bottom: 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2; padding: .7rem 1.15rem; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s; }
.btn-sm { padding: .45rem .8rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 85%, black); }
.btn-primary:disabled { background: color-mix(in srgb, var(--brand) 35%, white); cursor: not-allowed; }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--brand); border-color: transparent; }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-warn { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.btn-warn:hover { border-color: var(--amber); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-quiet { background: transparent; color: var(--red); border-color: var(--red-line); }
.btn-danger-quiet:hover { background: var(--red-bg); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.link-btn.danger { color: var(--red); }

/* ---------- forms ---------- */
.label { display: block; font-weight: 500; font-size: .92rem; margin-bottom: .35rem; color: var(--ink); }
.req { color: var(--red); font-weight: 600; }
.opt { color: var(--muted); font-weight: 400; font-size: .85rem; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=password], input[type=search], input[type=number], input:not([type]), select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .62rem .75rem; min-height: 2.75rem;
}
textarea { min-height: auto; resize: vertical; }
select { appearance: auto; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 25%, white); outline-offset: 0; }
input:disabled, textarea:disabled { background: var(--line-2); }
.hint { font-size: .85rem; color: var(--muted); margin: .35rem 0 0; }
.error-text { display: block; font-size: .85rem; color: var(--red); margin: .35rem 0 0; font-weight: 500; }
.flag-note { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--amber); background: var(--amber-bg); border: 1px solid var(--amber-line); border-radius: 999px; padding: .05rem .55rem; margin: .4rem 0 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1rem; }
.form-grid > * { grid-column: 1 / -1; }
.form-grid > .half { grid-column: auto; }
.field.has-error input, .field.has-error select { border-color: var(--red); background: var(--red-bg); }
.field.is-flagged { padding: .75rem; margin: -.75rem; border-radius: var(--radius-sm); background: var(--amber-bg); }
.stack { display: grid; gap: 1rem; }
.stack.tight { gap: .55rem; margin-top: .75rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; margin-top: .2rem; accent-color: var(--brand); flex: none; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: block; padding: .6rem 1.4rem; font-weight: 500; }
.segmented label + label span { border-inline-start: 1px solid var(--line); }
.segmented input:checked + span { background: var(--brand); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); outline-offset: -3px; }

.entity-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.entity-choice { position: relative; display: block; cursor: pointer; }
.entity-choice input { position: absolute; opacity: 0; }
.entity-body { display: block; height: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .8rem .9rem; background: var(--surface); }
.entity-body strong { display: block; font-weight: 600; margin-bottom: .2rem; }
.entity-body span { display: block; font-size: .83rem; color: var(--muted); line-height: 1.4; }
.entity-choice input:checked + .entity-body { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-soft); }
.entity-choice input:focus-visible + .entity-body { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); outline-offset: 2px; }

.phone { display: grid; grid-template-columns: minmax(7.5rem, 38%) 1fr; gap: .4rem; }
.derived { display: block; padding: .62rem .75rem; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--ink-2); font-family: var(--mono); }

/* ---------- flash ---------- */
.flash { border-radius: var(--radius-sm); padding: .8rem 1rem; margin: 0 0 1rem; border: 1px solid; font-size: .95rem; }
.flash-success { background: var(--green-bg); border-color: #bfe3cc; color: #0f5a2c; }
.flash-error { background: var(--red-bg); border-color: var(--red-line); color: #8a1c13; }
.flash-info { background: var(--brand-soft); border-color: var(--brand-line); color: var(--ink); }
.copy-field { margin-top: .5rem; font-family: var(--mono); font-size: .85rem; }

/* ---------- portal chrome ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: .8rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-logo { height: 36px; width: auto; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 700; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-weight: 600; }
.brand-text span { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; flex: none; }
.lang-switch { font-weight: 600; text-decoration: none; padding: .35rem .6rem; border-radius: 6px; }
.lang-switch:hover { background: var(--brand-soft); }
.page { max-width: 1120px; margin: 0 auto; padding: 2rem 1rem 3rem; }
.foot { max-width: 1120px; margin: 0 auto; padding: 0 1rem 2rem; color: var(--muted); font-size: .82rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 480px; margin-inline: auto; }
.card.center { text-align: center; }
.narrow-left { max-width: 560px; }

/* verify */
.otp-form { display: grid; gap: .9rem; margin: 1.25rem 0 1rem; }
.otp-input { font-family: var(--mono) !important; font-size: 1.6rem !important; letter-spacing: .5em; text-align: center; padding: .7rem !important; }
.resend { margin-bottom: .75rem; }

.icon-badge { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 1rem; display: grid; place-items: center; background: var(--brand-soft); position: relative; }
.icon-badge::after { content: ""; width: 18px; height: 18px; border: 3px solid var(--brand); }
.icon-check::after { width: 10px; height: 18px; border-top: 0; border-inline-start: 0; transform: rotate(45deg) translate(-2px, -2px); }
[dir="rtl"] .icon-check::after { transform: rotate(-45deg) translate(2px, -2px); }
.icon-alert { background: var(--amber-bg); }
.icon-alert::after { border: 0; width: 4px; height: 20px; background: var(--amber); border-radius: 2px; box-shadow: 0 0 0 0 transparent; }
.icon-clock::after, .icon-lock::after { border-radius: 50%; }
.status-head { display: flex; gap: 1rem; align-items: flex-start; }
.status-head .icon-badge { margin: 0; flex: none; }
.status-rejected .icon-badge { background: var(--red-bg); }

/* notice */
.notice { max-width: 760px; margin-inline: auto; }
.notice-subject { font-weight: 600; color: var(--ink-2); padding-inline-start: .9rem; border-inline-start: 3px solid var(--brand); margin: 1rem 0 1.25rem; }
.need-list { list-style: none; counter-reset: need; padding: 0; margin: 0 0 1.25rem; display: grid; gap: .5rem; }
.need-list li { counter-increment: need; display: grid; grid-template-columns: 2rem 9.5rem 1fr; gap: .5rem; align-items: baseline; padding: .6rem 0; border-bottom: 1px solid var(--line-2); }
.need-list li::before { content: counter(need); font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }
.need-list span { color: var(--ink-2); }
.callout { background: var(--brand-soft); border-radius: var(--radius-sm); padding: .8rem 1rem; font-weight: 500; }
.notice-accept { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); display: grid; gap: 1rem; justify-items: start; }

/* ---------- wizard ---------- */
.wizard { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1.75rem; align-items: start; }
.rail { position: sticky; top: 1rem; }
.rail-head { display: flex; flex-wrap: wrap; gap: .4rem .75rem; align-items: center; margin-bottom: .25rem; }
.ref { font-family: var(--mono); font-size: .85rem; font-weight: 500; background: var(--surface); border: 1px solid var(--line); padding: .15rem .5rem; border-radius: 6px; }
.due { font-size: .85rem; color: var(--muted); }
.due.is-overdue { color: var(--red); font-weight: 600; }
.rail-progress { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; }

.stepper { list-style: none; margin: 0 0 1.5rem; padding: 0; position: relative; }
.stepper li { position: relative; }
.stepper li:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: 15px; top: 34px; bottom: -4px; width: 2px; background: var(--line); }
.stepper li.done:not(:last-child)::after { background: var(--brand-line); }
.stepper a, .stepper button { display: flex; gap: .8rem; align-items: flex-start; width: 100%; text-align: start; padding: .45rem 0 .9rem; background: none; border: 0; font: inherit; color: var(--ink-2); text-decoration: none; cursor: pointer; }
.stepper .dot { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: .9rem; background: var(--surface); border: 2px solid var(--line); color: var(--muted); position: relative; z-index: 1; font-variant-numeric: tabular-nums; }
.stepper .step-text { display: flex; flex-direction: column; padding-top: .25rem; }
.stepper .step-text strong { font-weight: 500; }
.stepper small { font-size: .78rem; color: var(--muted); }
.stepper li.done .dot { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.stepper li.warn .dot, .stepper li.flagged .dot { border-color: var(--amber); color: var(--amber); background: var(--amber-bg); }
.stepper li.warn small, .stepper li.flagged small { color: var(--amber); font-weight: 500; }
.stepper li.current .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.stepper li.current .step-text strong { font-weight: 600; color: var(--ink); }
.stepper a:hover strong, .stepper button:hover strong { text-decoration: underline; text-underline-offset: 3px; }

.requester { border-top: 1px solid var(--line); padding-top: 1rem; font-size: .9rem; }
.requester-title { font-size: .8rem; color: var(--muted); margin: 0 0 .25rem; }
.requester-name { font-weight: 600; margin-bottom: .3rem; }
.mini-dl { margin: .5rem 0 1rem; display: grid; gap: .15rem; }
.mini-dl div { display: flex; justify-content: space-between; gap: .5rem; }
.mini-dl dt { color: var(--muted); font-size: .8rem; }
.mini-dl dd { margin: 0; font-size: .82rem; }
.plain-list { list-style: none; padding: 0; margin: 0 0 .75rem; }
.plain-list li { padding: .15rem 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.75rem 2rem 1.5rem; min-width: 0; }
.panel-head { margin-bottom: 1rem; }
.required-note { font-size: .85rem; color: var(--muted); padding-bottom: 1.1rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line-2); }
.returned-banner { background: var(--amber-bg); border: 1px solid var(--amber-line); border-inline-start: 4px solid var(--amber); border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin-bottom: 1.5rem; }
.returned-banner strong { color: var(--amber); }
.returned-banner p { margin: .35rem 0 0; }

.group { border-top: 1px solid var(--line-2); padding-top: 1.25rem; }
.group:first-of-type { border-top: 0; padding-top: 0; }
.group-title { font-weight: 600; font-size: 1.02rem; margin-bottom: .15rem; }
.group-desc { font-size: .87rem; color: var(--muted); margin-bottom: .9rem; }

/* The e-invoicing address card: TRN → TIN → Peppol, filled as you type */
.einvoice-card { border: 1px solid var(--brand-line); background: linear-gradient(90deg, var(--brand-soft), var(--surface) 70%); border-radius: var(--radius); padding: 1rem 1.15rem; display: grid; gap: .3rem; }
[dir="rtl"] .einvoice-card { background: linear-gradient(270deg, var(--brand-soft), var(--surface) 70%); }
.ei-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.ei-label { font-size: .82rem; color: var(--muted); }
.ei-val { font-size: .95rem; color: var(--ink-2); }
.ei-arrow { height: 1px; background: var(--brand-line); margin: .25rem 0; }
.ei-main { padding-top: .35rem; }
.ei-main .ei-label { color: var(--brand); font-weight: 600; }
.ei-main .ei-val { font-size: 1.35rem; font-weight: 600; color: var(--ink); letter-spacing: .02em; }
.einvoice-card .hint { margin-top: .3rem; }

.uploads { border-top: 1px solid var(--line-2); padding-top: 1.4rem; margin-top: .25rem; }
.upload-slot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: .7rem; }
.upload-slot.has-file { border-color: var(--brand-line); }
.upload-slot.has-error { border-color: var(--red-line); background: var(--red-bg); }
.upload-slot.is-flagged { border-color: var(--amber-line); background: var(--amber-bg); }
.slot-info { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.file-line { font-size: .88rem; overflow-wrap: anywhere; }
.slot-actions { display: flex; align-items: center; gap: .9rem; flex: none; }
.file-pick { position: relative; display: inline-block; cursor: pointer; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-pick input:focus-visible + .btn { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); outline-offset: 2px; }
.file-pick .btn.is-picked { border-color: var(--brand); color: var(--brand); }
.upload-other { margin-top: 1.4rem; }
.other-row { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line-2); font-size: .9rem; }
.other-add { display: grid; grid-template-columns: 1fr auto; gap: .6rem; margin-top: .7rem; align-items: center; }

.form-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--line-2); }
.form-actions .spacer { flex: 1; }

.review-block { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem 1.15rem; margin-bottom: .9rem; }
.review-block.plain { border: 0; padding: 0; margin-bottom: 1.25rem; }
.review-block.has-error { border-color: var(--red-line); }
.review-block header { display: flex; justify-content: space-between; align-items: baseline; }
.review-dl { margin: 0; display: grid; }
.review-dl > div { display: grid; grid-template-columns: minmax(10rem, 38%) 1fr; gap: 1rem; padding: .5rem 0; border-top: 1px solid var(--line-2); }
.review-dl > div:first-child { border-top: 0; }
.review-dl dt { color: var(--muted); font-size: .9rem; }
.review-dl dd { margin: 0; overflow-wrap: anywhere; }
.review-dl > div.has-error dd { color: var(--red); }
.review-dl > div.is-flagged { background: var(--amber-bg); margin-inline: -.6rem; padding-inline: .6rem; border-radius: 6px; }
[dir="rtl"] .review-dl dd[dir="ltr"] { text-align: right; }
.declaration { margin-top: 1.5rem; padding: 1.25rem; background: var(--paper); border-radius: var(--radius-sm); display: grid; gap: 1rem; }
.declaration .form-actions { border-top: 0; margin-top: 0; padding-top: 0; }

/* ---------- plain pages (login/install/errors) ---------- */
.plain-wrap { max-width: 520px; margin: 0 auto; padding: 3rem 1rem; }
.plain-brand { display: flex; align-items: center; gap: .6rem; justify-content: center; margin-bottom: 1.5rem; font-size: 1.05rem; }
.plain .card.narrow { max-width: none; }
.err-code { font-size: 2.5rem; font-weight: 600; color: var(--brand); margin: 0; font-variant-numeric: tabular-nums; }
.checks { list-style: none; padding: 0; margin: 0 0 1.25rem; font-size: .9rem; }
.checks li { padding: .3rem 0 .3rem 1.6rem; position: relative; }
.checks li::before { position: absolute; left: 0; font-weight: 700; }
.checks li.ok::before { content: "✓"; color: var(--green); }
.checks li.bad::before { content: "✕"; color: var(--red); }
.checks li.bad { color: var(--red); }

/* ---------- admin ---------- */
.admin-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: #15232b; color: #c9d4d8; padding: 1.1rem .8rem; display: flex; flex-direction: column; gap: 1.5rem; position: sticky; top: 0; height: 100vh; }
.side a { color: inherit; text-decoration: none; }
.side-brand { display: flex; gap: .65rem; align-items: center; padding: .25rem .4rem; }
.side-brand strong { display: block; color: #fff; font-weight: 600; line-height: 1.2; }
.side-brand small { font-size: .78rem; color: #8ea0a8; }
.side-nav { display: grid; gap: .15rem; }
.side-nav a { display: flex; justify-content: space-between; align-items: center; padding: .55rem .7rem; border-radius: 7px; font-weight: 500; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.active { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 3px 0 0 var(--brand-line); }
.count { background: var(--brand); color: #fff; font-size: .75rem; font-weight: 600; border-radius: 999px; padding: .05rem .5rem; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: .9rem .4rem 0; display: grid; gap: .4rem; }
.side-foot a { display: flex; flex-direction: column; font-weight: 500; color: #fff; }
.side-foot small { color: #8ea0a8; font-weight: 400; }
.side-foot .link-btn { color: #8ea0a8; font-size: .85rem; }
.admin-main { padding: 1.75rem 2rem 3rem; min-width: 0; max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.head-actions { display: flex; gap: .5rem; }
.crumbs { font-size: .85rem; margin-bottom: .25rem; }
.meta-line { display: flex; flex-wrap: wrap; gap: .4rem .75rem; align-items: center; margin: .25rem 0 0; }

.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.badge-invited { color: #475467; background: #f2f4f7; border-color: #e1e5ea; }
.badge-in_progress { color: #175cd3; background: #eff5ff; border-color: #c6d9fb; }
.badge-submitted { color: #6d28d9; background: #f5f0ff; border-color: #dccbfb; }
.badge-under_review { color: #6d28d9; background: #f5f0ff; border-color: #dccbfb; }
.badge-returned { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.badge-approved { color: var(--green); background: var(--green-bg); border-color: #bfe3cc; }
.badge-rejected { color: var(--red); background: var(--red-bg); border-color: var(--red-line); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.kpi:hover { border-color: var(--muted); }
.kpi-n { font-size: 2rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-l { font-size: .88rem; color: var(--muted); }
.kpi-us { border-color: #dccbfb; }
.kpi-us .kpi-n { color: #6d28d9; }
.kpi-warn { border-color: var(--red-line); background: var(--red-bg); }
.kpi-warn .kpi-n { color: var(--red); }
.kpi-ok .kpi-n { color: var(--green); }

.pipeline { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--line-2); }
.pipe { display: block; min-width: 6px; }
.pipe-invited { background: #b8c1cc; }
.pipe-in_progress { background: #5b8def; }
.pipe-submitted { background: #9b6cf0; }
.pipe-under_review { background: #6d28d9; }
.pipe-returned { background: #e0a43a; }
.pipe-approved { background: #2f9e5b; }
.pipe-rejected { background: #d9534f; }
.pipe-legend { list-style: none; padding: 0; margin: .9rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; font-size: .87rem; }
.pipe-legend a { color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; }
.pipe-legend a:hover { color: var(--ink); text-decoration: underline; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.two-col > .card { margin-bottom: 1.25rem; }
.empty { text-align: center; padding: 2.5rem 1.5rem; }
.empty .btn { margin-top: .5rem; }

.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: start; font-weight: 600; font-size: .82rem; color: var(--muted); padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: #fafbfb; }
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcfc; }
.table.compact td { padding: .55rem .25rem; }
.card > .table.compact td:first-child { padding-inline-start: 0; }
.details-cell { max-width: 360px; overflow-wrap: anywhere; }

.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .9rem 1rem; }
.filters input[type=search], .filters input[name=ref] { flex: 1 1 260px; width: auto; }
.filters select { width: auto; flex: 0 1 auto; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }

.activity { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.activity li { display: grid; grid-template-columns: 9.5rem 1fr; gap: .75rem; padding: .45rem 0; border-top: 1px solid var(--line-2); }
.activity li:first-child { border-top: 0; }
.act-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
.detail-side { position: sticky; top: 1rem; }
.detail-side .card { padding: 1.15rem; }
.decision { border-color: var(--brand-line); }
.decision .btn { margin-top: .1rem; }
.side-dl { margin: 0 0 .75rem; display: grid; gap: .35rem; font-size: .88rem; }
.side-dl div { display: grid; grid-template-columns: 7.5rem 1fr; gap: .5rem; }
.side-dl.wide div { grid-template-columns: 10rem 1fr; }
.side-dl dt { color: var(--muted); }
.side-dl dd { margin: 0; overflow-wrap: anywhere; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .6rem; }
.num-sm { width: 4.5rem !important; min-height: 2.2rem !important; padding: .3rem .5rem !important; }
.notes { list-style: none; padding: 0; margin: .75rem 0 0; display: grid; gap: .6rem; }
.notes li { border-top: 1px solid var(--line-2); padding-top: .6rem; font-size: .9rem; }
.notes p { margin: 0 0 .2rem; }
details.card summary { cursor: pointer; margin: 0; list-style-position: inside; }
details.card[open] summary { margin-bottom: .6rem; }
.danger-zone summary { color: var(--red); }
.flag-pick { display: inline-flex; gap: .4rem; align-items: center; cursor: pointer; }
.flag-pick input { accent-color: var(--amber); width: 1rem; height: 1rem; }
.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li { display: grid; grid-template-columns: 13rem 1fr auto; gap: .75rem; align-items: baseline; padding: .55rem 0; border-top: 1px solid var(--line-2); font-size: .92rem; }
.doc-list li.is-flagged { background: var(--amber-bg); }
.doc-type { color: var(--muted); }
.doc-file { overflow-wrap: anywhere; }
.inline-details summary { list-style: none; }
.inline-details[open] { min-width: 260px; }
.code-sample { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem; font-size: .82rem; overflow-x: auto; }
.color-row { display: flex; gap: .5rem; }
.color-row input[type=color] { width: 3rem; height: 2.75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px; background: var(--surface); }
.logo-preview { height: 40px; vertical-align: middle; margin-inline-end: .75rem; }
.test-row { display: flex; gap: .6rem; flex-wrap: wrap; margin: .5rem 0 1.25rem; }
.test-result { white-space: pre-wrap; padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .85rem; }
.test-result.ok { background: var(--green-bg); color: #0f5a2c; }
.test-result.bad { background: var(--red-bg); color: #8a1c13; }
.drive-finder { border-top: 1px solid var(--line-2); padding-top: 1.1rem; display: grid; gap: .6rem; justify-items: start; }
.drive-finder .form-grid { width: 100%; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .wizard { grid-template-columns: 1fr; gap: 1rem; }
  .rail { position: static; }
  .stepper { display: flex; overflow-x: auto; gap: .25rem; margin-bottom: .5rem; padding-bottom: .25rem; }
  .stepper li { flex: 1 0 auto; }
  .stepper li:not(:last-child)::after { display: none; }
  .stepper a, .stepper button { flex-direction: column; align-items: center; text-align: center; padding: .25rem .4rem; gap: .3rem; }
  .stepper .step-text { padding-top: 0; font-size: .8rem; }
  .stepper small { display: none; }
  .requester { display: none; }
  .panel { padding: 1.25rem 1rem; }
  .admin-shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
  .side-nav { display: flex; flex-wrap: wrap; }
  .side-foot { margin: 0; border: 0; padding: 0; display: flex; align-items: center; gap: 1rem; }
  .admin-main { padding: 1.25rem 1rem 2.5rem; }
  .detail-grid, .two-col { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid > .half { grid-column: 1 / -1; }
  .entity-choices { grid-template-columns: 1fr; }
  .need-list li { grid-template-columns: 1.5rem 1fr; }
  .need-list li span { grid-column: 2; }
  .review-dl > div { grid-template-columns: 1fr; gap: .1rem; }
  .upload-slot { flex-direction: column; align-items: stretch; }
  .other-add { grid-template-columns: 1fr; }
  .brand-text span { display: none; }
  .form-actions .btn { flex: 1 1 auto; }
  .form-actions .spacer { display: none; }
  .doc-list li { grid-template-columns: 1fr; gap: .1rem; }
  .activity li { grid-template-columns: 1fr; gap: 0; }
  .h1 { font-size: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.review-dl > .dl-group { display: block; font-weight: 600; font-size: .9rem; color: var(--ink); padding: .9rem 0 .2rem; border-top: 0; }
.review-dl > .dl-group:first-child { padding-top: 0; }
.review-dl > .dl-group + div { border-top: 0; }
