/* ZenithAI accounts (PLAN-2026-09-25-user-onboarding-phase1): password sign-in, setup links, first admin, the admin
   Users screen and the user detail window. Used only when the server runs [auth] provider = ZenithAI; every class
   starts with "za-" so nothing here touches the rest of the app. Built on the app's own tokens (style.css). */

/* ── sign-in card additions ─────────────────────────────────────────────────────────────────────────────────────── */
.za-step { display: inline-block; margin-bottom: 10px; padding: 3px 9px; border-radius: 999px; font-size: .7rem;
  font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--info); background: var(--badge-blue-bg); }
.za-step.za-warn { color: var(--warn-fg); background: rgba(210, 153, 34, .12); }
.za-label-row { display: flex; justify-content: space-between; align-items: baseline; }
.za-show { background: none; border: 0; padding: 0; font: inherit; font-size: .75rem; font-weight: 600; color: var(--link); cursor: pointer; }
.za-rules { list-style: none; margin: -4px 0 0; padding: 0; display: grid; gap: 6px; font-size: .8rem; color: var(--text-muted); }
.za-rules li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; }
.za-rules li::before { content: ""; flex: 0 0 14px; height: 14px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--border-strong); }
.za-rules li.ok { color: var(--text); }
.za-rules li.ok::before { border-color: var(--success); background: var(--success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.3 7 10.7l4.6-5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat; }
.za-rules li.bad { color: var(--toast-text); }
.za-rules li.bad::before { border-color: var(--toast-text); }
.zl-panel .login-btn:disabled.za-wait { cursor: progress; }
.za-ok { color: var(--badge-green-text); font-size: .85rem; background: var(--badge-green-bg); border: 1px solid rgba(34, 197, 94, .35); border-radius: 8px; padding: 10px 12px; }
[data-theme="light"] .za-ok { color: #15803d; }

/* Full-page setup screen (invite / reset link), shown over everything until finished */
.za-setup { position: fixed; inset: 0; z-index: 400; overflow-y: auto; background: var(--bg); }
.za-setup .zl-shell { min-height: 100%; }

/* ── admin: Users ───────────────────────────────────────────────────────────────────────────────────────────────── */
.za-card { max-width: none; }
.za-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.za-head h3 { margin: 0 0 4px; }
.za-head .settings-hint { max-width: 640px; margin: 0; }
.za-actions { display: flex; gap: 8px; }
.za-primary { color: #fff; background: linear-gradient(180deg, #4f6df0, #3550d8); border-color: #2f49c9; font-weight: 600; }
.za-primary:hover { filter: brightness(1.07); }
.za-primary:disabled { opacity: .5; cursor: not-allowed; }
.za-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 14px 0 10px; }
.za-search { flex: 1 1 240px; min-width: 180px; height: 32px; padding: 0 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: .82rem; }
.za-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.za-chip { font: inherit; font-size: .76rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); cursor: pointer; }
.za-chip b { font-weight: 600; margin-left: 3px; }
.za-chip.is-on { color: var(--text); border-color: var(--border-strong); background: var(--bg-hover); }
.za-archived { margin-left: auto; display: flex; gap: 6px; align-items: center; font-size: .8rem; color: var(--text-muted); cursor: pointer; }
.za-table td { vertical-align: middle; }
.za-table tr.za-row { cursor: pointer; }
.za-table tr.za-row:hover td { background: var(--bg-hover); }
.za-table tr.za-row:focus-visible { outline: 2px solid #4f6df0; outline-offset: -2px; }
.za-table tr.is-archived td { opacity: .6; }
.za-name { font-weight: 600; white-space: nowrap; }
.za-sub { display: block; font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.za-muted { color: var(--text-muted); }
.za-num { text-align: right; font-variant-numeric: tabular-nums; }
.za-when { white-space: nowrap; }
.za-orgs { display: flex; flex-wrap: wrap; gap: 4px; }
.za-org { padding: 2px 8px; border-radius: 6px; font-size: .74rem; background: var(--docchip-bg); color: var(--info); border: 1px solid var(--docchip-border); white-space: nowrap; }
.za-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.za-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.za-st-active { color: var(--badge-green-text); background: var(--badge-green-bg); }
.za-st-invited { color: var(--info); background: var(--badge-blue-bg); }
.za-st-suspended { color: var(--warn-fg); background: rgba(210, 153, 34, .12); }
.za-st-archived { color: var(--text-muted); background: var(--bg-hover); }
[data-theme="light"] .za-st-active { color: #15803d; }

/* ── dialogs ────────────────────────────────────────────────────────────────────────────────────────────────────── */
.za-backdrop { position: fixed; inset: 0; z-index: 380; background: var(--shadow-overlay); backdrop-filter: blur(2px); }
.za-modal { position: fixed; z-index: 390; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px); overflow: auto; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 24px 64px var(--shadow-strong); }
.za-modal.za-wide { width: min(860px, calc(100vw - 32px)); }
.za-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.za-modal-head h3 { margin: 0; font-size: 1.05rem; }
.za-x { background: none; border: 0; color: var(--text-muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.za-form { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 20px; }
.za-form .login-field em { font-style: normal; color: var(--text-muted); font-weight: 400; }
.za-form select { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: .95rem; }
.za-form select.za-placeholder { color: var(--text-muted); }
.za-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.za-grid2 > .login-field { min-width: 0; }
.za-grid2 .login-field input { width: 100%; min-width: 0; box-sizing: border-box; }
.za-help { font-size: .74rem; color: var(--text-muted); line-height: 1.45; margin: 0; }
.za-note { padding: 8px 10px; border-radius: 8px; background: var(--badge-blue-bg); color: var(--text); }
.za-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.za-foot .btn { padding: 8px 14px; font-size: .85rem; }
.za-lead { margin: 0; font-size: .88rem; line-height: 1.55; }
.za-linkbox { display: flex; gap: 8px; align-items: stretch; }
.za-linkbox code { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); font-size: .8rem; }
.za-warn-text { margin: 0; font-size: .78rem; color: var(--warn-fg); }
.za-csv { display: block; width: 100%; box-sizing: border-box; min-height: 170px; resize: vertical; padding: 10px 12px; border-radius: 10px; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); font: .8rem/1.5 ui-monospace, Consolas, monospace; }
#zaCsv1:not([hidden]) { display: flex; flex-direction: column; gap: 10px; }   /* csv-template-1: the import dialog's first step */
.za-csv-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.za-csv-tools .btn { padding: 8px 14px; font-size: .85rem; }
#zaCsv1 .za-help code { overflow-wrap: anywhere; }
.za-res-ok { color: var(--badge-green-text); }
.za-res-bad { color: var(--toast-text); }
[data-theme="light"] .za-res-ok { color: #15803d; }
.za-toast { position: fixed; z-index: 420; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px;
  background: var(--bg-elevated); border: 1px solid var(--border-strong); box-shadow: 0 10px 30px var(--shadow-drawer); font-size: .85rem; }

/* ── user detail window ─────────────────────────────────────────────────────────────────────────────────────────── */
.za-user { position: fixed; z-index: 390; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(1080px, calc(100vw - 32px));
  height: min(760px, calc(100dvh - 32px)); display: flex; flex-direction: column; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: 0 28px 80px var(--shadow-strong); overflow: hidden; }
.za-user-head { flex: 0 0 auto; display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.za-avatar { flex: 0 0 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(160deg, #4f6df0, #16265a); }
.za-title { flex: 1; min-width: 0; }
.za-title h3 { margin: 0; font-size: 1.1rem; }
.za-title-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: .8rem; color: var(--text-muted); }
.za-user-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-left: auto; }
.za-user-actions .za-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.za-user-actions .btn { padding: 8px 12px; font-size: .82rem; }
.za-guard { margin: 0; font-size: .76rem; color: var(--text-muted); max-width: 380px; text-align: right; }
.btn.za-danger { color: var(--toast-text); border-color: var(--toast-border); }
.btn.za-danger:hover { background: var(--toast-bg); }
.za-user-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px 22px 24px; }
.za-tiles { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.za-tile { padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); min-width: 0; }
.za-tile b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; line-height: 1.25; overflow-wrap: anywhere; }
.za-tile span { display: block; margin-top: 4px; font-size: .72rem; color: var(--text-muted); line-height: 1.35; }
.za-tile.za-alert b { color: var(--toast-text); }
.za-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; margin-top: 8px; }
.za-cols > div { min-width: 0; }
.za-sec { padding: 14px 0; border-bottom: 1px solid var(--border); }
.za-sec:last-child { border-bottom: 0; }
.za-sec h4 { margin: 0 0 10px; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.za-kv { display: grid; grid-template-columns: 130px 1fr; gap: 7px 12px; font-size: .84rem; margin: 0; }
.za-kv dt { color: var(--text-muted); }
.za-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.za-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .8rem; }
.za-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); }
.za-list .za-l { min-width: 0; overflow-wrap: anywhere; }
.za-list .za-r { color: var(--text-muted); white-space: nowrap; }
.za-list code { font-size: .76rem; }
.za-fail { color: var(--toast-text); }
.za-kind { font-size: .68rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text-muted); margin-left: 6px; }
.za-timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); display: grid; gap: 10px; font-size: .8rem; }
.za-timeline li { position: relative; }
.za-timeline li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg-elevated); border: 2px solid var(--border-strong); }
.za-timeline time { display: block; font-size: .72rem; color: var(--text-muted); }
.za-empty { font-size: .8rem; color: var(--text-muted); margin: 0; }

@media (max-width: 980px) { .za-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .za-grid2, .za-cols { grid-template-columns: 1fr; }
  .za-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .za-archived { margin-left: 0; }
  .za-user-actions { width: 100%; align-items: stretch; margin-left: 0; }
  .za-guard { text-align: left; max-width: none; }
}

/* ── licence (PLAN-2026-10-05-licensing) ────────────────────────────────────────────────────────────────────────── */
.za-lic-banner { position: sticky; top: 0; z-index: 350; padding: 8px 16px; font-size: .84rem; line-height: 1.45; text-align: center; border-bottom: 1px solid var(--border); }
.za-lic-banner a { color: inherit; font-weight: 600; }
.za-lic-bad { color: #fff; background: #b42318; }
.za-lic-warn { color: var(--warn-fg); background: rgba(210, 153, 34, .14); }
.za-lic-wall { z-index: 9600; }                     /* above the onboarding wizard (9000) */
.za-lic-backdrop { z-index: 9400; }
#zaLicModal { z-index: 9500; }
.za-lic-table { border-collapse: collapse; margin: 12px 0; font-size: .86rem; }
.za-lic-table th { text-align: left; font-weight: 500; color: var(--text-muted); padding: 5px 24px 5px 0; vertical-align: top; white-space: nowrap; }
.za-lic-table td { padding: 5px 0; }
.za-serial { font-size: .9em; padding: 2px 6px; border-radius: 6px; background: var(--bg-hover); letter-spacing: .03em; }
.za-lic-state { padding: 2px 8px; border-radius: 6px; font-size: .78rem; font-weight: 600; }
.za-lic-trial, .za-lic-awaiting_activation { color: var(--info); background: var(--badge-blue-bg); }
.za-lic-valid { color: var(--badge-green-text); background: var(--badge-green-bg); }
.za-lic-expired, .za-lic-invalid { color: #fff; background: #b42318; }
#zaLicForm { padding: 12px 0 0; max-width: 640px; }
#zaLicForm textarea { width: 100%; box-sizing: border-box; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: .8rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; word-break: break-all; }
