/* Majis Vendor Invoice Portal
   Brand colours taken from majis.om (visual reference, not a formal brand manual).
   Teal is used for indicators, borders and fills only; it is never used as a text colour on white
   or as a background under white text, because that pairing fails WCAG contrast. */
:root {
  --majis-blue: #003777;       /* navigation, headings, primary buttons (white text 11.6:1) */
  --majis-deep: #020288;       /* selected elements, secondary accents (white text 14:1) */
  --majis-teal: #00AF9B;       /* highlights, active indicators, chart fills */
  --majis-teal-text: #00695C;  /* teal family text on white (6.1:1) */
  --majis-aqua: #B2F0FB;       /* subtle information panels, selected backgrounds */
  --white: #FFFFFF;

  --bg: #F3F6F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --line: #D9E1EA;
  --line-strong: #BAC6D4;
  --text: #0F2138;
  --muted: #54657A;
  --aqua-soft: #E8FAFD;

  --ok: #17692F;    --ok-bg: #E2F3E7;
  --warn: #7A4F00;  --warn-bg: #FFF1D1;
  --bad: #A61B12;   --bad-bg: #FCE6E4;
  --info: #003777;  --info-bg: #E5EDF7;
  --hold: #3E4452;  --hold-bg: #E9EBF0;

  --radius: 8px;
  --shadow: 0 1px 2px rgba(15, 33, 56, .06), 0 2px 8px rgba(15, 33, 56, .05);
  --font: "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --sidebar: 244px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: var(--majis-blue); }
a:hover { color: var(--majis-deep); }
h1, h2, h3 { color: var(--majis-blue); line-height: 1.25; margin: 0; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 13px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--majis-teal); outline-offset: 2px; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--majis-blue); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .nav { padding-top: 14px; }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav .nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .7; padding: 14px 12px 4px; }
.nav a { color: #fff; text-decoration: none; padding: 8px 12px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; border-left: 3px solid transparent; }
.nav a:hover { background: rgba(255,255,255,.08); }
.nav a.active { background: var(--majis-deep); border-left-color: var(--majis-teal); font-weight: 600; }
.nav .count { background: var(--majis-aqua); color: var(--majis-blue); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 7px; }
.sidebar .foot { margin-top: auto; padding: 14px 18px; font-size: 11.5px; opacity: .75; border-top: 1px solid rgba(255,255,255,.14); }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 10px 24px; position: sticky; top: 0; z-index: 20; }
.topbar .logo img { height: 38px; width: auto; display: block; }
.wordmark { font-weight: 800; letter-spacing: .14em; color: var(--majis-blue); font-size: 20px; }
.wordmark small { display: block; font-size: 9.5px; letter-spacing: .1em; font-weight: 600; color: var(--majis-teal-text); }
.topbar .title { font-weight: 600; color: var(--majis-blue); border-left: 1px solid var(--line); padding-left: 16px; }
.topbar .spacer { flex: 1; }
.bell { position: relative; text-decoration: none; font-size: 18px; color: var(--majis-blue); padding: 4px 8px; border-radius: 6px; }
.bell:hover { background: var(--surface-2); }
.bell .dot { position: absolute; top: -2px; right: -2px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 0 5px; }
.whoami { text-align: right; line-height: 1.2; }
.whoami .name { font-weight: 600; }
.whoami .org { font-size: 12px; color: var(--muted); }
.topbar .menu-toggle { display: none; } /* phones only (see the 860px rule); beats .btn's display */

.content { padding: 22px 24px 48px; max-width: 1400px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.update-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; background: var(--majis-blue); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); display: flex; gap: 12px; align-items: center; font-weight: 600; }
.update-bar[hidden] { display: none; }
.update-bar .btn.primary { background: #fff; color: var(--majis-blue); border-color: #fff; }
.demo-banner { background: var(--majis-aqua); color: var(--majis-blue); padding: 6px 24px; font-size: 12.5px; font-weight: 600; }

/* ---------- cards and stats ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card > .card-body { padding: 16px 18px; }
.card > .card-body.flush { padding: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: inherit; display: block; border-top: 3px solid var(--majis-teal); }
a.stat:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
a.stat { cursor: pointer; }
a.stat:hover .label { color: var(--majis-blue); text-decoration: underline; }
section[id], div[id] { scroll-margin-top: 80px; }
.stat .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 700; color: var(--majis-blue); font-variant-numeric: tabular-nums; }
.stat.alert { border-top-color: var(--bad); }
.stat.alert .value { color: var(--bad); }
.stat.warn { border-top-color: #D08A00; }

.money-list { display: flex; flex-wrap: wrap; gap: 10px; }
.money-chip { background: var(--aqua-soft); border: 1px solid var(--majis-aqua); border-radius: 6px; padding: 8px 12px; }
.money-chip .ccy { font-size: 11.5px; font-weight: 700; color: var(--majis-teal-text); letter-spacing: .05em; }
.money-chip .amt { font-size: 18px; font-weight: 700; color: var(--majis-blue); font-variant-numeric: tabular-nums; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.badge-neutral { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: #F1CF84; }
.badge-danger { background: var(--bad-bg); color: var(--bad); }
.badge-success { background: var(--ok-bg); color: var(--ok); }
.badge-hold { background: var(--hold-bg); color: var(--hold); border-color: #C8CCD6; }
.badge-brand { background: #DDF5F2; color: var(--majis-teal-text); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 1px 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.tag.internal { background: #FFF6E0; border-color: #F1CF84; color: var(--warn); }
.tag.vendor { background: var(--aqua-soft); border-color: var(--majis-aqua); color: var(--majis-blue); }
.overdue { color: var(--bad); font-weight: 600; }
.soon { color: var(--warn); font-weight: 600; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFCFE; }
.table .ref { font-weight: 700; white-space: nowrap; }
.table td.mono { white-space: nowrap; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.filters .field { min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 220px; }

/* ---------- forms ---------- */
label, .label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; color: var(--text); }
.req::after { content: " *"; color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px 10px; min-height: 38px; }
textarea { min-height: 64px; resize: vertical; }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
input[type=file] { font: inherit; max-width: 100%; }
.help { font-size: 12px; color: var(--muted); margin-top: 3px; }
.errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--bad); font-size: 12.5px; font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); background: #FFFBFA; }
.field.changed { background: #FFF8E1; border-radius: 6px; box-shadow: 0 0 0 6px #FFF8E1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
fieldset.section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0; margin: 0 0 18px; }
fieldset.section > legend { float: left; width: 100%; padding: 12px 18px; font-weight: 700; color: var(--majis-blue); border-bottom: 1px solid var(--line); margin-bottom: 0; display: flex; gap: 10px; align-items: center; }
fieldset.section > legend .step { background: var(--majis-blue); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; }
fieldset.section > .section-body { clear: both; padding: 16px 18px; }
.radio-row { display: flex; gap: 14px; flex-wrap: wrap; }
.radio-row label { font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.radio-row ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row li label { font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.total-box { background: var(--aqua-soft); border: 1px solid var(--majis-aqua); border-radius: 6px; padding: 8px 12px; font-size: 20px; font-weight: 700; color: var(--majis-blue); font-variant-numeric: tabular-nums; min-height: 38px; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(243,246,249,.96); border-top: 1px solid var(--line); padding: 12px 0; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; z-index: 5; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 13.5px var(--font); border-radius: 6px; padding: 8px 14px; border: 1px solid var(--line-strong); background: #fff; color: var(--majis-blue); cursor: pointer; text-decoration: none; min-height: 36px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: var(--majis-blue); }
.btn.primary { background: var(--majis-blue); border-color: var(--majis-blue); color: #fff; }
.btn.primary:hover { background: var(--majis-deep); border-color: var(--majis-deep); }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: #fff; border-color: #E4A5A0; color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.warn { border-color: #E4C36B; color: var(--warn); }
.btn.link { border: 0; background: none; padding: 0 2px; min-height: 0; color: var(--majis-blue); text-decoration: underline; font-weight: 600; }
.btn.small { font-size: 12.5px; padding: 4px 10px; min-height: 30px; }
.btn[disabled], .btn.is-busy { opacity: .6; cursor: progress; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; }
.messages li { padding: 10px 14px; border-radius: 6px; border-left: 4px solid; font-weight: 500; }
.messages .success { background: var(--ok-bg); border-color: var(--ok); }
.messages .error { background: var(--bad-bg); border-color: var(--bad); }
.messages .info, .messages .warning { background: var(--aqua-soft); border-color: var(--majis-teal); }
.notice { border-radius: 6px; padding: 10px 14px; border-left: 4px solid var(--majis-teal); background: var(--aqua-soft); }
.notice.warn { border-color: #D08A00; background: var(--warn-bg); }
.notice.bad { border-color: var(--bad); background: var(--bad-bg); }
.notice.ok { border-color: var(--ok); background: var(--ok-bg); }

/* ---------- invoice header ---------- */
.inv-head { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; border-top: 4px solid var(--majis-blue); }
.inv-head .row1 { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.inv-head .ref { font-size: 24px; font-weight: 800; color: var(--majis-blue); letter-spacing: .01em; }
.inv-head .meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 18px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.kv .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.kv .v { font-weight: 600; }
.kv .v.big { font-size: 18px; color: var(--majis-blue); }
dl.details { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 8px 16px; margin: 0; }
dl.details dt { color: var(--muted); font-weight: 600; font-size: 12.5px; }
dl.details dd { margin: 0; }
dl.details .changed { background: #FFF1C2; border-radius: 4px; padding: 0 4px; }
.section-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; position: sticky; top: 59px; z-index: 10; background: var(--bg); padding: 6px 0; }
.section-nav a { text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--majis-blue); background: #fff; border: 1px solid var(--line); }
.section-nav a:hover { border-color: var(--majis-teal); background: var(--aqua-soft); }

.balance { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.balance > div { padding: 12px 16px; border-right: 1px solid var(--line); }
.balance > div:last-child { border-right: 0; background: var(--aqua-soft); }
.balance .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--majis-blue); }

/* ---------- actions panel ---------- */
.actions-panel { border-top: 4px solid var(--majis-teal); }
.actions-panel .btn { width: 100%; justify-content: flex-start; }
.action-group { display: flex; flex-direction: column; gap: 8px; }
.action-group + .action-group { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- route & timeline ---------- */
.route { display: flex; flex-direction: column; gap: 10px; }
.route-stage { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; border-left: 4px solid var(--line-strong); }
.route-stage.done { border-left-color: var(--ok); }
.route-stage.current { border-left-color: var(--majis-teal); background: var(--aqua-soft); }
.route-stage .approvers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 14px 28px; }
.timeline li::before { content: ""; position: absolute; left: 1px; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--majis-teal); }
.timeline li.status::before { border-color: var(--majis-blue); background: var(--majis-aqua); }
.timeline li.bad::before { border-color: var(--bad); }
.timeline .when { font-size: 12px; color: var(--muted); }
.timeline .what { font-weight: 600; }
.timeline .why { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; margin-top: 4px; white-space: pre-wrap; }

.docs { display: flex; flex-direction: column; gap: 10px; }
.doc { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.doc .name { font-weight: 600; word-break: break-word; }
.doc details { grid-column: 1 / -1; }
.comment { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.comment.internal { border-left: 4px solid #D08A00; background: #FFFCF3; }
.comment.vendor { border-left: 4px solid var(--majis-teal); }

/* ---------- bar charts ---------- */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 170px minmax(0, 1fr) 90px; gap: 10px; align-items: center; font-size: 13px; }
.bar .track { height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--majis-teal); }
.bar .fill.late { background: var(--bad); }

/* ---------- dialogs ---------- */
dialog { border: 0; border-radius: 10px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--text); }
dialog.wide { width: min(980px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 25, 60, .45); }
dialog .dlg-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; background: var(--surface-2); }
dialog .dlg-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; max-height: 70vh; overflow-y: auto; }
dialog .dlg-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
dialog .x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.preview-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background-color: #EAF6FB;
  background-image:
    radial-gradient(ellipse at 15% 110%, rgba(0,175,155,.22), transparent 55%),
    radial-gradient(ellipse at 90% -10%, rgba(0,55,119,.20), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='60' viewBox='0 0 240 60'%3E%3Cpath d='M0 30 Q30 12 60 30 T120 30 T180 30 T240 30' fill='none' stroke='%23003777' stroke-opacity='.06' stroke-width='2'/%3E%3C/svg%3E");
}
/* Full-screen photo slideshow behind the sign-in box: slow zoom-and-drift on each photo, soft cross-fades.
   5 photos x 7 s = 35 s loop. Negative delays make the first photo visible immediately. */
.login-page.has-photos { position: relative; overflow: hidden; background: #0B2A4A; }
.login-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
/* Slides are driven by portal.js: the active slide fades in and slowly zooms/drifts (Ken Burns). */
.login-bg { transition: transform .6s ease-out; }
.login-bg .slide { position: absolute; inset: -1.5%; background-size: cover; background-position: center; opacity: 0;
  transition: opacity 1.6s ease-in-out; }
.login-bg .slide.active { opacity: 1; animation-duration: 12s; animation-timing-function: ease-out; animation-fill-mode: forwards; }
.login-bg .slide.active.kb-1 { animation-name: kb-1; } .login-bg .slide.active.kb-2 { animation-name: kb-2; }
.login-bg .slide.active.kb-3 { animation-name: kb-3; } .login-bg .slide.active.kb-4 { animation-name: kb-4; }
.login-bg .slide.active.kb-5 { animation-name: kb-5; }
.login-bg .s1 { background-image: url("../img/login/01-aerial-plant.jpg"); }
.login-bg .s2 { background-image: url("../img/login/02-office-coast.jpg"); }
.login-bg .s3 { background-image: url("../img/login/03-ro-membranes.jpg"); }
.login-bg .s4 { background-image: url("../img/login/04-office-garden.jpg"); }
.login-bg .s5 { background-image: url("../img/login/05-intake-pumps.jpg"); }
.login-bg::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, rgba(0, 38, 84, .62) 0%, rgba(0, 55, 119, .38) 45%, rgba(0, 105, 92, .30) 100%); }
/* Gentle motion only (max ~6% zoom) so the photos stay sharp. */
@keyframes kb-1 { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.06) translate(-1%, -.6%); } }
@keyframes kb-2 { from { transform: scale(1.06) translate(1%, 0); } to { transform: scale(1) translate(0, 0); } }
@keyframes kb-3 { from { transform: scale(1) translate(0, .8%); } to { transform: scale(1.06) translate(0, -.8%); } }
@keyframes kb-4 { from { transform: scale(1.05) translate(-.8%, .5%); } to { transform: scale(1) translate(.5%, 0); } }
@keyframes kb-5 { from { transform: scale(1) translate(.8%, 0); } to { transform: scale(1.06) translate(-.8%, 0); } }

/* Public vendor registration page (same photo background, wide form card) */
.login-page.has-photos.public-page { place-items: start center; padding: 100px 16px 40px; }
.public-content { width: min(900px, 100%); }
.login-card.public-card { width: 100%; }
.public-card .register-form { padding: 20px 26px 26px; display: flex; flex-direction: column; gap: 14px; }
.public-card fieldset.section { margin: 0; }
.public-card .card-title { font-size: 21px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.declaration { align-items: flex-start; font-size: 13px; line-height: 1.45; }
.declaration input { margin-top: 3px; }
.register-cta { display: block; margin-top: 14px; padding: 12px 16px; border-radius: 10px; text-align: center; text-decoration: none;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .45); color: #fff;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background .2s, transform .15s; }
.register-cta:hover { background: rgba(255, 255, 255, .28); color: #fff; transform: translateY(-1px); }
.register-cta span { opacity: .9; }
.foot-link { color: #fff; font-weight: 600; }
.foot-link:hover { color: var(--majis-aqua); }

/* Photo dots */
.login-dots { position: fixed; left: clamp(8px, 3vw, 32px); bottom: 12px; z-index: 2; display: flex; gap: 0; }
/* 28px tap target around a small pill */
.login-dots button { height: 28px; min-width: 24px; padding: 0 7px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.login-dots button::before { content: ""; display: block; width: 10px; height: 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .55); box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: width .35s, background .35s; }
.login-dots button:hover::before { background: rgba(255, 255, 255, .9); }
.login-dots button.active::before { width: 28px; background: var(--majis-teal); }
.login-dots button:focus-visible { outline: 2px solid #fff; outline-offset: -2px; border-radius: 8px; }

/* Sign-in card interactions */
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes card-shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
.login-page.has-photos .login-card { animation: card-in .7s cubic-bezier(.2, .8, .2, 1) both .15s; }
.login-page.has-photos .login-card.shake { animation: card-in .7s both .15s, card-shake .5s .9s; }
/* Rotating tagline: each message fades up into place, then fades out as the next one rises. */
.login-tagline { position: relative; margin: 0; min-height: 3em; font-size: 17px; font-weight: 600; line-height: 1.45;
  color: var(--majis-blue); text-align: center; }
.login-tagline .msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-wrap: balance; opacity: 0; transform: translateY(10px); transition: opacity .7s ease, transform .7s ease; }
.login-tagline .msg.show { opacity: 1; transform: none; }
.login-tagline .msg.leave { opacity: 0; transform: translateY(-10px); }
.login-tagline .msg em { font-style: normal; color: var(--majis-teal-text); }
@media (prefers-reduced-motion: reduce) { .login-tagline .msg { transition: none; transform: none; } }
.login-card input[type=email], .login-card input[type=password], .login-card input[type=text] {
  min-height: 44px; transition: border-color .2s, box-shadow .2s; }
.login-card input:focus { border-color: var(--majis-teal); box-shadow: 0 0 0 4px rgba(0, 175, 155, .18); outline: none; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none;
  width: 34px; height: 34px; border-radius: 6px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.pw-toggle:hover { background: var(--surface-2); color: var(--majis-blue); }
.pw-toggle svg { width: 20px; height: 20px; }
.caps-warning { font-size: 12px; font-weight: 600; color: var(--warn); margin-top: 4px; }
.remember { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; margin: 0; cursor: pointer; }
.login-card .btn.primary { min-height: 44px; font-size: 15px; position: relative; transition: transform .15s, background .2s, box-shadow .2s; }
.login-card .btn.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 55, 119, .3); }
.login-card .btn.primary:active { transform: translateY(0); }
.btn .spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  animation: spin .8s linear infinite; display: none; }
.btn.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) {
  .login-page.has-photos .login-card, .login-page.has-photos .login-card.shake { animation: none; }
  .login-bg .slide.active { animation: none; }
  .login-bg { transition: none; }
}
.login-page.has-photos > .login-content { position: relative; z-index: 1; }
/* Sign-in box on the right, logo fixed top-left; stacked and centred on phones. */
.login-page.has-photos { place-items: center end; padding: 96px clamp(16px, 7vw, 120px) 32px 16px; }
.login-page.has-photos .login-foot { text-align: center; }
.login-brand { position: fixed; top: clamp(14px, 3vh, 28px); left: clamp(16px, 3vw, 40px); z-index: 2;
  display: flex; align-items: center; gap: 14px; padding: 10px 18px 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .88); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 6px 24px rgba(0, 10, 30, .25); text-decoration: none; }
.login-brand img { height: clamp(40px, 5.5vh, 56px); width: auto; display: block; }
.login-brand .brand-text { border-left: 1px solid var(--line); padding-left: 14px; line-height: 1.25; }
.login-brand .brand-text strong { display: block; color: var(--majis-blue); font-size: 14px; }
.login-brand .brand-text span { color: var(--muted); font-size: 12px; }
.login-card .top .card-title { margin-top: 0; }
@media (max-width: 720px) {
  .login-page.has-photos { place-items: center; padding: 104px 16px 24px; }
  .login-brand { left: 50%; transform: translateX(-50%); }
  .login-brand .brand-text { display: none; }
  .login-dots { display: none; }
}
.login-page.has-photos .login-card { box-shadow: 0 18px 60px rgba(0, 10, 30, .45); background: rgba(255, 255, 255, .97); }
.login-page.has-photos .login-foot { color: rgba(255, 255, 255, .92); text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.login-card { background: #fff; width: min(420px, 100%); border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 55, 119, .16); overflow: hidden; }
.login-card .top { padding: 26px 28px 18px; text-align: center; border-bottom: 4px solid var(--majis-teal); }
.login-card .top img { height: 64px; width: auto; }
.login-card .top h1 { margin-top: 14px; font-size: 19px; }
.login-card form { padding: 22px 28px 26px; display: flex; flex-direction: column; gap: 14px; }
.login-foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 50; }
  body.nav-open .sidebar { transform: none; }
  .topbar .menu-toggle { display: inline-flex; }
  .topbar .title { display: none; }
  .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .balance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  dl.details { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  dl.details dd { margin-bottom: 8px; }
  .content { padding: 16px; }
  .whoami .org { display: none; }
  .bar { grid-template-columns: 110px minmax(0, 1fr) 70px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- print ---------- */
.print-page { background: #fff; max-width: 900px; margin: 0 auto; padding: 24px; }
.print-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--majis-blue); padding-bottom: 12px; margin-bottom: 18px; }
.print-head img { height: 52px; }
@media print {
  .no-print, .sidebar, .topbar, .section-nav, .sticky-actions { display: none !important; }
  body { background: #fff; }
  .print-page { padding: 0; }
  .card { box-shadow: none; }
  a { color: inherit; text-decoration: none; }
}
