@charset "UTF-8";
/* --- portal shell : sticky left menu + content, echoing the doc-page 3-column layout --- */
.portal-shell {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-5) 64px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-6);
  align-items: start;
}

.portal-menu {
  position: sticky;
  top: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  background: var(--surface);
  border: 1px solid rgba(151, 59, 252, 0.18);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.portal-menu-title {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-text);
  margin: 0 0 var(--space-3) var(--space-2);
}

.portal-menu a {
  display: block;
  font-size: var(--fs-md);
  color: var(--muted);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid transparent;
  border-radius: 2px;
}

.portal-menu a:hover {
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.03);
}

.portal-menu a.active {
  color: var(--text-strong);
  font-weight: 700;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-left-color: var(--accent);
}

.portal-menu-soon {
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-sm);
  font-style: italic;
  color: var(--muted);
  opacity: 0.6;
}

.portal-main {
  min-width: 0;
}

.portal-main h1 {
  font-family: var(--font-mono);
  font-size: var(--fs-h4);
  color: var(--text-strong);
  margin: 0 0 var(--space-5);
}

@media (max-width: 760px) {
  .portal-shell {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  .portal-menu {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .portal-menu-title {
    width: 100%;
    margin-bottom: var(--space-2);
  }
}
/* --- portal sections --- */
.account-section {
  margin-top: var(--space-6);
}

.account-section h3 {
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  color: var(--text-strong);
  margin: 0 0 var(--space-3);
}

.account-alert {
  border: 1px solid var(--border);
  border-left: 3px solid var(--anno);
  background: var(--surface-dim);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 var(--space-4);
}

.account-alert--warning {
  border-left-color: var(--anno);
}

.account-alert--error {
  border-left-color: #e08a8a;
  color: #e0a0a0;
}

.account-alert--success {
  border-left-color: var(--success);
  color: color-mix(in srgb, var(--success) 80%, white);
}

.account-alert a {
  color: var(--accent-muted);
}

.account-admin-note {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text);
  margin: 0 0 var(--space-4);
}

.account-admin-badge {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.08em;
  color: var(--accent-contrast);
  background: #b3524f;
  padding: 2px 7px;
  border-radius: 4px;
}

/* The "viewing as administrator" note, shown once under the portal side menu (compact, stacked to fit the column). */
.portal-admin-note {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.account-address {
  line-height: 1.6;
  color: var(--text);
}

/* --- account information: the address (left) and the shareable-permalink panel (right) --- */
.account-info-columns {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5) var(--space-6);
  align-items: flex-start;
  justify-content: space-between;
}

.account-info-columns > .account-info-main {
  flex: 1 1 16rem;
}

/* The permalink-management panel: a bordered card pinned to the right of the account information. */
.account-permalink-panel {
  flex: 0 1 20rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.account-permalink-title {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-strong);
}

.account-permalink-desc {
  font-size: var(--fs-sm);
  line-height: 1.5;
  margin: 0;
}

.account-permalink-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* Rotate is offered to everyone but disabled for non-administrators; the wrapper carries the "why" tooltip so it still
   shows on hover of the (pointer-events:none) disabled button. */
.account-permalink-rotate {
  display: inline-flex;
}

.account-permalink-actions .btn-sm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* --- generic portal table (support benefits, contacts) --- */
.account-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.account-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-strong);
}

.account-table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

.account-table .num {
  text-align: right;
}

.account-table .mono {
  font-family: var(--font-mono);
  color: var(--text-strong);
}

.account-table tr.highlight td {
  background: color-mix(in srgb, var(--accent-muted) 14%, transparent);
}

.account-entitlement-col {
  width: 120px;
}

/* --- subscriptions list --- a CSS subgrid, not a table: the description must span the product columns AND sit directly
   under the product line while the (potentially taller) actions column stays a top-aligned sibling. A table cannot do
   this — a rowspanned actions cell that is taller than the product row makes the browser stretch the product row and
   push the description far below it. Here the left block (product line + description) and the actions are siblings in one
   grid row, both top-aligned; subgrid keeps the product columns aligned to the header. */
.account-subs {
  display: grid;
  /* Subscription (first) column widened 50% (1fr -> 1.5fr) to fit long subscription numbers. */
  grid-template-columns: 1.5fr 1.2fr 0.6fr 1fr 0.9fr minmax(280px, 2fr);
  font-size: var(--fs-sm);
}

.account-subs.no-actions {
  grid-template-columns: 1.5fr 1.2fr 0.6fr 1fr 0.9fr;
}

.account-subs-head {
  display: grid;
  grid-column: 1/-1;
  grid-template-columns: subgrid;
  gap: 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-strong);
}

.account-subs-head span {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.account-subs-head .num {
  text-align: right;
}

.account-sub {
  display: grid;
  grid-column: 1/-1;
  grid-template-columns: subgrid;
  align-items: start;
  gap: 0 var(--space-3);
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.account-sub.highlight {
  background: color-mix(in srgb, var(--accent-muted) 14%, transparent);
}

/* the left block: the product line (placed into the shared columns) + a full-width description directly beneath it */
.account-sub-left {
  grid-column: 1/6;
  display: grid;
  grid-template-columns: subgrid;
  grid-auto-rows: min-content;
  gap: 0 var(--space-3);
}

.no-actions .account-sub-left {
  grid-column: 1/-1;
}

.account-sub-line {
  display: contents;
}

.account-sub-line > span {
  color: var(--text);
  font-size: var(--fs-md);
}

.account-sub-line .mono {
  font-family: var(--font-mono);
  color: var(--text-strong);
}

.account-sub-line .num {
  text-align: right;
}

.account-actions {
  grid-column: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.account-action-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* subscription-action links (renew / add users / upgrade / get quote) — teal, pipe-separated, not boxed */
.account-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--teal);
  cursor: pointer;
  text-decoration: none;
}

.account-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Expand/collapse toggle for the non-renewable history: teal link led by a small square + / − sign. */
.account-toggle {
  display: inline-flex;
  align-items: center;
}

.account-toggle-sign {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05em;
  height: 1.05em;
  margin-right: 6px;
  border: 1px solid var(--teal);
  border-radius: 2px;
  font-size: 0.85em;
  line-height: 1;
  padding-top: 1px;
}

.account-sep {
  color: var(--border-strong);
  user-select: none;
}

.account-desc {
  grid-column: 1/-1;
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: var(--fs-sm);
}

.account-state {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  white-space: nowrap;
}

.account-state--active {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 55%, transparent);
  background: color-mix(in srgb, var(--success) 14%, transparent);
}

.account-state--grace {
  color: var(--anno);
  border-color: color-mix(in srgb, var(--anno) 55%, transparent);
  background: color-mix(in srgb, var(--anno) 14%, transparent);
}

.account-state--expired,
.account-state--cancelled {
  color: #d98b8b;
  border-color: color-mix(in srgb, #d98b8b 45%, transparent);
  background: color-mix(in srgb, #d98b8b 12%, transparent);
}

/* Invoice status chips (built on the .account-state base): paid = green, awaiting = amber, cancelled = red;
   draft / unknown fall back to the neutral base chip. */
.invoice-status--paid {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 55%, transparent);
  background: color-mix(in srgb, var(--success) 14%, transparent);
}

.invoice-status--awaiting {
  color: var(--anno);
  border-color: color-mix(in srgb, var(--anno) 55%, transparent);
  background: color-mix(in srgb, var(--anno) 14%, transparent);
}

.invoice-status--cancelled {
  color: #d98b8b;
  border-color: color-mix(in srgb, #d98b8b 45%, transparent);
  background: color-mix(in srgb, #d98b8b 12%, transparent);
}

.account-key {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

.account-key-label {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.account-key-value {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--accent-text);
  word-break: break-all;
  background: var(--surface-dim);
  border: 1px solid var(--border);
  padding: 3px 7px;
}

.account-global-upgrade {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: var(--space-3) 0;
}

.account-amendment {
  white-space: pre-line;
  color: var(--text);
  line-height: 1.5;
  margin: 0 0 var(--space-3);
}

/* --- contacts table --- */
/* Fixed column widths: Name / Email / Roles / Actions = 28% / 28% / 28% / 16%. When the Actions column is absent
   (a non-privileged viewer), the three remaining columns share the freed width proportionally. */
.account-contacts {
  table-layout: fixed;
}

.account-contacts th:nth-child(1),
.account-contacts td:nth-child(1) {
  width: 28%;
}

.account-contacts th:nth-child(2),
.account-contacts td:nth-child(2) {
  width: 28%;
}

.account-contacts th:nth-child(3),
.account-contacts td:nth-child(3) {
  width: 28%;
}

.account-contacts th:nth-child(4),
.account-contacts td:nth-child(4) {
  width: 16%;
}

.account-contacts td {
  overflow-wrap: anywhere;
}

.account-contacts-actions {
  white-space: nowrap;
}

.account-contacts-add {
  margin-top: var(--space-4);
}

/* --- contact add / edit form --- */
.contact-form {
  max-width: 640px;
}

.contact-roles {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.contact-roles legend {
  padding: 0 var(--space-2);
}

.contact-role {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text);
  cursor: pointer;
}

.contact-role input {
  margin: 0;
}

.contact-role--implicit {
  color: var(--muted);
  cursor: default;
}

.contact-role span b {
  color: var(--text-strong);
  font-weight: 600;
}

.contact-form-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* --- source-code access (git-user management) --- */
.source-terms {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.source-agreement {
  align-items: flex-start;
  margin: var(--space-4) 0;
}

.source-comment {
  max-width: 640px;
  margin-bottom: var(--space-2);
}

.source-comment textarea {
  resize: vertical;
}

.source-cred-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-4);
  margin: 0 0 var(--space-4);
  font-size: var(--fs-sm);
}

.source-cred-grid dt {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.source-cred-grid dd {
  margin: 0;
  color: var(--text);
}

.source-cred-grid code {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--accent-text);
  word-break: break-all;
  background: var(--surface-dim);
  border: 1px solid var(--border);
  padding: 2px 7px;
}

.source-user-comment {
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.source-actions {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.source-repo-title {
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  color: var(--text-strong);
  margin: var(--space-4) 0 var(--space-2);
}

.source-code-block {
  margin: 0 0 var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.source-code-block code {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--accent-text);
  white-space: pre;
}

/* --- source access audit log --- */
.source-audit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.source-audit-head h3 {
  margin: 0;
}

.source-audit-note {
  margin-top: var(--space-3);
  font-size: var(--fs-sm);
}

.source-audit-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  white-space: nowrap;
}

.source-audit-tag--success {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 55%, transparent);
  background: color-mix(in srgb, var(--success) 14%, transparent);
}

.source-audit-tag--warning {
  color: var(--anno);
  border-color: color-mix(in srgb, var(--anno) 55%, transparent);
  background: color-mix(in srgb, var(--anno) 14%, transparent);
}

.source-audit-tag--info {
  color: var(--teal);
  border-color: color-mix(in srgb, var(--teal) 45%, transparent);
  background: color-mix(in srgb, var(--teal) 12%, transparent);
}

.source-audit-tag--primary {
  color: var(--accent-text);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.source-audit-tag--muted {
  color: var(--muted);
}

/* --- in-page confirmation dialog (reuses the .modal chrome from checkout.css) --- */
.modal--confirm {
  width: 460px;
}

.confirm-message {
  color: var(--text);
  line-height: 1.5;
  margin: 0 0 var(--space-5);
}

.confirm-actions {
  display: flex;
  gap: var(--space-3);
}

/* ---- sign-in (magic-link request) ---- */
.signin-page {
  max-width: 34rem;
}

.signin-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.signin-label {
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: calc(-1 * var(--space-2));
}

.signin-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text-strong);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
}

.signin-input:focus {
  outline: none;
  border-color: var(--accent);
}

.signin-captcha {
  margin: var(--space-1) 0;
}

/* Administrator account search (/account/select): a query row plus a list of pickable results. */
.account-search-row {
  display: flex;
  align-items: stretch;
  gap: var(--space-3);
  width: 100%;
}

.account-search-row .signin-input {
  flex: 1;
}

.account-search-results {
  list-style: none;
  width: 100%;
  margin: var(--space-4) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.account-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.account-search-result-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.account-search-result-name {
  font-weight: 600;
  color: var(--text-strong);
}

.account-search-result-number {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--text-muted);
}

.account-search-result-location {
  font-size: 0.85em;
  color: var(--text-muted);
}
