/* ==========================================================================
   Access portal (Operate): login, recovery, logout confirmation, company choice.
   Needs brand/tokens.css + brand/atoms.css (+ brand/animations.css).
   One task per screen, the chart behind it as quiet context.
   ========================================================================== */
body.au-body { color-scheme: dark; min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; position: relative; overflow-x: hidden; isolation: isolate; }
body.au-body::before { content: ""; position: fixed; inset: 0; z-index: -2;
  background: radial-gradient(110% 80% at -10% 30%, rgba(201,168,76,.10), transparent 50%), radial-gradient(80% 80% at 80% 60%, rgba(18,48,90,.65), transparent 70%), var(--dv-sea); }

/* The chart beside the form: the Landing's, still. No names or readings, nothing to operate. */
.au-chart { position: fixed; z-index: -1; right: var(--dv-gutter); top: 50%; width: min(92svh, calc(100vw - 2 * var(--dv-gutter) - clamp(0px, 9vw, 240px) - clamp(380px, 26vw, 520px) - 40px)); transform: translateY(-50%); pointer-events: none; }
.au-chart .cv-name, .au-chart .cv-mod, .au-chart .cv-grat text, .au-chart .cv-scale, .au-chart .cv-hub text { display: none; }

.au-top { display: flex; align-items: center; justify-content: space-between; padding: 20px var(--dv-gutter); }
.au-brand { display: inline-flex; align-items: center; color: var(--dv-ink); text-decoration: none; font-weight: 700; letter-spacing: -.025em; }
.au-brand:hover { color: var(--dv-ink); }
.au-back { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; color: var(--dv-ink-2); text-decoration: none; padding: 0 4px; }
.au-back:hover { color: var(--dv-ink); text-decoration: underline; }

.au-main { display: flex; align-items: center; justify-content: flex-start; padding: 24px var(--dv-gutter) 40px; }
.au-panel { position: relative; width: 100%; max-width: clamp(380px, 26vw, 520px); margin-left: clamp(0px, 9vw, 240px); padding: clamp(24px, 2vw, 44px);
  border-radius: var(--dv-r-lg); background: rgba(11, 26, 46, .94); border: 1px solid rgba(201,168,76,.40); box-shadow: var(--dv-shadow-2); }
.au-panel::before { content: ""; position: absolute; inset: 5px; border: 1px solid var(--dv-line); border-radius: 7px; pointer-events: none; }
.au-panel > * { position: relative; }
@supports not selector(::view-transition) { .dv-motion .au-panel { animation: dv-rise var(--dv-slow) var(--dv-ease-out) backwards; } }

.au-panel h1 { font-size: var(--dv-t-28); line-height: 1.15; font-weight: 650; letter-spacing: -.025em; }
.au-sub { margin-top: 8px; font-size: 15px; color: var(--dv-ink-2); }
.au-form { margin-top: 24px; display: flex; flex-direction: column; gap: 16px; }
.au-forgot { align-self: flex-end; margin: -10px 0 -6px; }
.au-forgot a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; border-bottom: 0; text-decoration: underline; text-underline-offset: 4px; }
.au-caps { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--dv-warn); }
.au-caps[hidden] { display: none; }
.au-caps svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.au-form .dv-btn { margin-top: 4px; }
.au-alt { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--dv-line); font-size: 14px; color: var(--dv-ink-3); }
.au-alt a { white-space: nowrap; }
.au-actions { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }

/* Password field with show/hide */
.dv-pw { position: relative; display: block; }
.dv-pw input { padding-right: 48px; }
.dv-pw-toggle { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: var(--dv-r);
  background: transparent; color: var(--dv-ink-3); cursor: pointer; display: grid; place-items: center; }
.dv-pw-toggle:hover { color: var(--dv-ink); }
.dv-pw-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Notices: error / success / info — icon + text, never colour alone */
.au-notice { display: flex; gap: 10px; align-items: flex-start; margin-top: 20px; padding: 12px 14px; border-radius: var(--dv-r);
  font-size: 14px; line-height: 1.45; border: 1px solid; }
.au-notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.au-notice--err { color: var(--dv-err); background: var(--dv-err-bg); border-color: rgba(255,138,138,.3); }
.au-notice--ok  { color: var(--dv-ok);  background: var(--dv-ok-bg);  border-color: rgba(95,211,155,.3); }
.au-notice--info { color: var(--dv-contour); background: rgba(127,179,213,.08); border-color: var(--dv-line-2); }
.au-notice p { color: var(--dv-ink); }
.au-notice:focus { outline: none; }

/* Status screens (sent / logged out / invalid link) */
.au-state-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 18px;
  background: rgba(201,168,76,.10); border: 1px solid rgba(201,168,76,.30); color: var(--dv-gold); }
.au-state-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.au-state-icon--ok { color: var(--dv-ok); background: rgba(95,211,155,.08); border-color: rgba(95,211,155,.3); }
.au-email { font-family: var(--dv-mono); color: var(--dv-ink); word-break: break-all; }

/* Password rules (live) */
.au-rules { display: flex; flex-direction: column; gap: 6px; margin-top: -4px; font-size: 13px; color: var(--dv-ink-3); }
.au-rules li { display: flex; align-items: center; gap: 8px; }
.au-rules li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--dv-ink-3); flex: none; transition: background-color var(--dv-fast), border-color var(--dv-fast); }
.au-rules li.is-ok { color: var(--dv-ink-2); }
.au-rules li.is-ok::before { background: var(--dv-ok); border-color: var(--dv-ok); }

/* Company choice */
.au-companies { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.au-company { width: 100%; display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; text-align: left;
  padding: 12px 14px; border-radius: var(--dv-r); border: 1px solid var(--dv-line-2); background: var(--dv-sea); color: var(--dv-ink); cursor: pointer;
  transition: border-color var(--dv-fast), background-color var(--dv-fast), transform var(--dv-fast) var(--dv-ease-std); }
.au-company:hover { border-color: rgba(201,168,76,.55); background: var(--dv-abyss); }
.au-company:active { transform: scale(.99); }
.au-company-mark { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; background: var(--dv-shoal); color: var(--dv-gold); font-weight: 700; }
.au-company-name { display: block; font-weight: 600; font-size: 15px; }
.au-company-role { display: block; font-size: 13px; color: var(--dv-ink-3); }
.au-plan { font: 500 11px/1 var(--dv-font); padding: 5px 8px; border-radius: 4px; color: var(--dv-gold-hi); background: rgba(201,168,76,.12); }

.au-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px var(--dv-gutter) 24px; font-size: 12px; color: var(--dv-ink-3); }
.au-foot p { display: flex; align-items: center; gap: 8px; }
.au-foot svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 2200px) {
  body.au-body { font-size: 18px; }
  .au-panel h1 { font-size: 34px; }
  .au-sub, .au-alt { font-size: 17px; }
  .dv-btn { min-height: 52px; font-size: 16px; }
  .dv-field input { min-height: 52px; font-size: 17px; }
  .dv-field label { font-size: 15px; }
}
@media (max-height: 640px) { .au-main { align-items: flex-start; } }
@media (max-width: 900px) {
  .au-main { justify-content: center; }
  .au-panel { margin-left: 0; }
  /* a band of the chart above the form */
  .au-chart { position: relative; z-index: 0; right: auto; top: auto; transform: none; order: 1; width: auto; display: flex; justify-content: center; padding: 0 var(--dv-gutter); }
  .au-chart .cv-chart { --cv-k: 2; }
  .au-chart .cv-stage { width: min(100%, clamp(110px, 15svh, 220px)); }
  .au-top { order: 0; } .au-main { order: 2; padding-top: 16px; align-items: flex-start; } .au-foot { order: 3; }
  body.au-body { grid-template-rows: auto auto 1fr auto; }
}
@media (max-width: 900px) and (max-height: 640px) {
  .au-chart { display: none; }
  body.au-body { grid-template-rows: auto 1fr auto; }
}
@media (max-width: 576px) {
  .au-panel { padding: 22px 20px; }
  .au-alt { margin-top: 16px; padding-top: 14px; } .au-alt a { display: inline-block; }
  .au-main { padding-bottom: 16px; } .au-foot { padding: 8px var(--dv-gutter) 16px; }
  .au-panel h1 { font-size: var(--dv-t-24); }
  .dv-field input { font-size: 16px; }
}
