/* API Management Portal: base tokens and every shared component (docs/DECISIONS.md, items 38-40).
   Direction A ("family polish") is the default look. The admin section loads admin.css on top,
   which only re-tunes some tokens and adds the dashboard shell: the components here are shared. */

:root {
  --p-primary: #4361ee;        /* family primary */
  --p-primary-hover: #3a56d4;  /* family primary-dark */
  --p-primary-soft: #eef1fe;
  --p-accent: #4cc9f0;         /* family secondary: decoration only, never text */
  --p-bg: #f5f7fa;
  --p-surface: #ffffff;
  --p-border: #dee2e6;
  --p-text: #212529;
  --p-text-muted: #5c636a;
  --p-success: #1e7e45;  --p-success-soft: #e6f6ec;
  --p-warning: #8a5300;  --p-warning-soft: #fff4dc;
  --p-danger:  #c0392b;  --p-danger-soft:  #fdecea;
  --p-info:    #1c5fa8;  --p-info-soft:    #e7f3ff;
  --p-neutral: #495057;  --p-neutral-soft: #e9ecef;
  --p-radius: 0.5rem;
  --p-radius-sm: 0.375rem;
  --p-shadow-sm: 0 .125rem .25rem rgba(0, 0, 0, .075);
  --p-shadow: 0 .5rem 1rem rgba(0, 0, 0, .10);
  --p-focus: 0 0 0 .2rem rgba(67, 97, 238, .45);
  --p-font-size: 1rem;
  --p-table-font-size: 0.9375rem;
  --p-cell-pad: 0.75rem;
}

/* 16px at every width (docs/DECISIONS.md, item 40). */
html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--p-bg);
  color: var(--p-text);
  font-size: var(--p-font-size);
  line-height: 1.55;
}

a { color: var(--p-primary); }
a:hover { color: var(--p-primary-hover); }
h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: .25rem; }
h2 { font-size: 1.25rem; font-weight: 600; }
.text-muted { color: var(--p-text-muted) !important; }
.mr-2 { margin-right: 0.5rem; }

/* ---- the page frame (docs/DECISIONS.md, item 58) ----
   The shared menu inserts its header first in <body> and its footer last; the portal never styles
   either, it only arranges the containers around them. <body> is a column at least as tall as the
   window and <main> takes the free space, so the footer sits at the bottom of a short page and
   after the content of a long one. */
.p-page { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; margin: 0; }
.p-page > main { flex: 1 0 auto; padding-bottom: 3rem; }

/* One container width for the user bar and every page's content. From 1200px it is the content
   width of the menu's own bar (1170px with 15px padding), so the portal's edges line up with the
   family header's; below that, Bootstrap's own steps. */
@media (min-width: 1200px) { .container { max-width: 1164px; } }

/* The family user bar below the menu: right-aligned on the shared container's edge. */
.p-userbar { display: flex; justify-content: flex-end; align-items: center; min-height: 3.5rem; padding-top: .75rem; padding-bottom: .25rem; }

/* The menu's bar is fixed at the top, 60px high, above everything (its own z-index). When it is on
   the page, what the portal positions against the top of the window moves below it. */
/* Scrolling to an element, and keyboard focus moving down the page, stop below the bar instead of
   leaving the element hidden under it. */
html:has(#DynabicMenuInnerDiv) { scroll-padding-top: calc(60px + 1rem); }
@media (min-width: 576px) {
  /* On phones the toasts sit at the bottom of the window already. */
  body:has(#DynabicMenuInnerDiv) .p-toasts { top: calc(60px + 1rem); }
}
body:has(#DynabicMenuInnerDiv) .modal { top: 60px; height: calc(100% - 60px); }
@media (max-width: 991.98px) {
  body:has(#DynabicMenuInnerDiv) .offcanvas-lg.offcanvas-start { top: 60px; }
}

/* ---- Home (docs/DECISIONS.md, item 59): Direction A tokens only ---- */
.p-home { padding-top: 1.5rem; }
.p-hero { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: center; padding: 2.5rem 0 1rem; }
.p-hero h1 { font-size: 2.5rem; line-height: 1.15; margin-bottom: .5rem; }
/* No text-transform: the brand is written lowercase, aspose.ai. */
.p-hero-kicker { color: var(--p-primary-hover); font-weight: 600; letter-spacing: .02em; font-size: .9375rem; margin-bottom: .5rem; }
.p-hero-lead { font-size: 1.25rem; color: var(--p-text-muted); max-width: 38rem; margin-bottom: 1.75rem; }
.p-hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.p-hero-actions .btn-lg { padding: .8rem 1.6rem; font-size: 1.0625rem; box-shadow: var(--p-shadow-sm); }
.p-hero-note { color: var(--p-text-muted); font-size: .9375rem; margin: 1rem 0 0; }

/* A key as the key page shows it: decoration, built from CSS, no data. */
.p-hero-visual { display: flex; justify-content: center; }
.p-keyvisual { width: min(100%, 26rem); background: var(--p-surface); border: 1px solid var(--p-border); border-radius: var(--p-radius); box-shadow: var(--p-shadow); padding: 1.5rem; position: relative; overflow: hidden; }
.p-keyvisual::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: linear-gradient(90deg, var(--p-primary), var(--p-accent)); }
.p-keyvisual-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.p-keyvisual-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--p-primary-soft); color: var(--p-primary); }
.p-keyvisual-label { font-weight: 600; flex: 1; }
.p-badge-like { font-size: .8125rem; font-weight: 600; color: var(--p-success); background: var(--p-success-soft); border-radius: 999px; padding: .15rem .6rem; }
.p-keyvisual-key code { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; color: var(--p-text); background: var(--p-bg); border-radius: var(--p-radius-sm); padding: .6rem .75rem; letter-spacing: .02em; }
.p-keyvisual-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; color: var(--p-text-muted); font-size: .875rem; margin: 1rem 0; }
.p-keyvisual-foot { font-size: .875rem; color: var(--p-text-muted); border-top: 1px solid var(--p-border); padding-top: .75rem; }

.p-section { margin-top: 3rem; }
.p-section > h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.25rem; }
.p-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr; gap: 1.25rem; counter-reset: none; }
.p-step { padding: 1.5rem; }
.p-step p { color: var(--p-text-muted); margin-bottom: 0; }
.p-step code.p-key { white-space: nowrap; }
.p-step-num { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--p-primary); color: #fff; font-weight: 700; margin-bottom: .75rem; }
.p-step-title { font-size: 1.125rem; font-weight: 600; margin-bottom: .35rem; }
.p-code { margin: .85rem 0 0; background: #1f2430; color: #e9ecef; border-radius: var(--p-radius-sm); padding: .65rem .85rem; font-size: .875rem; white-space: pre-wrap; }
.p-code code { color: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.p-facts { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr; gap: 1rem 2rem; }
.p-facts li { display: flex; gap: .85rem; align-items: flex-start; background: var(--p-surface); border: 1px solid var(--p-border); border-radius: var(--p-radius); padding: 1rem 1.25rem; }
.p-facts i { color: var(--p-primary); font-size: 1.125rem; margin-top: .2rem; width: 1.25rem; text-align: center; flex: none; }
.p-home-help { color: var(--p-text-muted); margin: 2.5rem 0 0; }

/* Signed in: the same sections, tighter. */
.p-home.is-signed-in .p-hero { padding-top: 1.5rem; }
.p-home.is-signed-in .p-section { margin-top: 2rem; }
.p-home.is-signed-in .p-step { padding: 1.1rem 1.25rem; }
.p-home.is-signed-in .p-facts li { padding: .75rem 1rem; }

@media (min-width: 768px) {
  .p-facts { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 992px) {
  .p-steps { grid-template-columns: repeat(3, 1fr); }
  .p-hero { grid-template-columns: 7fr 5fr; gap: 3rem; padding-top: 3.5rem; }
  .p-hero h1 { font-size: 3rem; }
}
@media (max-width: 575.98px) {
  .p-hero h1 { font-size: 2rem; }
  .p-hero-actions .btn-lg { width: 100%; }
}
.p-step .p-step-more { margin-top: .85rem; }

/* ---- API reference (docs/DECISIONS.md, item 63): one card per app ---- */
.p-apiref-intro { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; margin-bottom: 2rem; }
.p-apiref-lead { font-size: 1.125rem; color: var(--p-text-muted); max-width: 44rem; margin: 0; }
.p-apiref-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.p-apiref-list > li { display: flex; }
.p-apiref-app { position: relative; display: flex; flex-direction: column; width: 100%; padding: 1.5rem 3rem 1.5rem 1.5rem; }
.p-apiref-name { font-size: 1.125rem; font-weight: 600; margin: 0; }
.p-apiref-missing { color: var(--p-text-muted); font-size: .9375rem; margin: .5rem 0 0; }
/* The whole card is the link: normal text, a lift and a primary border on hover, a focus ring
   around the whole card. */
.p-apiref-app.is-link { color: var(--p-text); text-decoration: none; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.p-apiref-app.is-link:hover { border-color: var(--p-primary); box-shadow: var(--p-shadow); transform: translateY(-2px); }
.p-apiref-app.is-link:focus-visible { outline: 3px solid var(--p-primary); outline-offset: 3px; }
.p-apiref-icon { position: absolute; top: 1.6rem; right: 1.5rem; color: var(--p-primary); }
@media (min-width: 768px) {
  .p-apiref-list { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 992px) {
  .p-apiref-list { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 575.98px) {
  .p-apiref-intro .btn { width: 100%; }
}

/* Widths and icon colours that used to be inline style attributes: no page carries an inline style,
   so the Content-Security-Policy never needs 'unsafe-inline' for the portal's own markup (item 58). */
.p-width-narrow { max-width: 36rem; }
.p-width-wide { max-width: 44rem; }
.p-width-date { max-width: 16rem; }
.p-icon-warning { color: var(--p-warning); }
.p-icon-danger { color: var(--p-danger); }

.p-accent-bar { height: 4px; width: 4rem; border-radius: 999px; background: linear-gradient(90deg, var(--p-primary), var(--p-accent)); margin: .5rem 0 1.25rem; }

/* ---- cards ---- */
.p-card { background: var(--p-surface); border: 1px solid var(--p-border); border-radius: var(--p-radius); box-shadow: var(--p-shadow-sm); }
.p-card > .p-card-header { padding: .875rem 1.25rem; border-bottom: 1px solid var(--p-border); font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.p-card > .p-card-body { padding: 1.25rem; }
details.p-card > summary.p-card-header { cursor: pointer; list-style: none; border-bottom: 0; }
details.p-card > summary.p-card-header::-webkit-details-marker { display: none; }
details.p-card[open] > summary.p-card-header { border-bottom: 1px solid var(--p-border); }
details.p-card[open] > summary .p-chevron { transform: rotate(180deg); }

/* The "Create a key" card: the most prominent element on the user key page. */
.p-create { border: 2px solid var(--p-primary); box-shadow: var(--p-shadow); position: relative; overflow: hidden; }
.p-create::before { content: ''; display: block; height: 6px; background: linear-gradient(90deg, var(--p-primary), var(--p-accent)); }
.p-create > .p-card-body { padding: 1.75rem; }
.p-create .p-create-title { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }
.p-create .p-create-lead { color: var(--p-text-muted); margin-bottom: 1.25rem; }
.p-create .btn-primary { padding: .65rem 1.5rem; font-size: 1.0625rem; }
.p-create.is-limit { border-color: var(--p-warning); }
.p-create.is-limit::before { background: var(--p-warning); }
.p-create fieldset:disabled { opacity: .6; }

/* ---- buttons ---- */
.btn { border-radius: var(--p-radius-sm); font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--p-primary); --bs-btn-border-color: var(--p-primary); --bs-btn-hover-bg: var(--p-primary-hover); --bs-btn-hover-border-color: var(--p-primary-hover); --bs-btn-active-bg: var(--p-primary-hover); --bs-btn-active-border-color: var(--p-primary-hover); --bs-btn-disabled-bg: var(--p-primary); --bs-btn-disabled-border-color: var(--p-primary); }
.btn-danger { --bs-btn-bg: var(--p-danger); --bs-btn-border-color: var(--p-danger); --bs-btn-hover-bg: #a93226; --bs-btn-hover-border-color: #a93226; --bs-btn-active-bg: #a93226; --bs-btn-disabled-bg: var(--p-danger); --bs-btn-disabled-border-color: var(--p-danger); }
.btn-outline-danger { --bs-btn-color: var(--p-danger); --bs-btn-border-color: var(--p-danger); --bs-btn-hover-bg: var(--p-danger); --bs-btn-hover-border-color: var(--p-danger); --bs-btn-active-bg: var(--p-danger); }
.btn-outline-secondary { --bs-btn-color: var(--p-neutral); --bs-btn-border-color: #adb5bd; --bs-btn-hover-bg: var(--p-neutral); --bs-btn-hover-border-color: var(--p-neutral); }
.btn[aria-busy="true"] { cursor: progress; }
.btn .spinner-border { width: 1em; height: 1em; border-width: .15em; margin-right: .4rem; vertical-align: -0.125em; }
/* A list is loading behind a filter button: the spinner replaces the label, the button stays usable. */
.btn.p-spin { position: relative; color: transparent !important; }
.btn.p-spin .spinner-border { position: absolute; left: 50%; top: 50%; margin: -.5em 0 0 -.5em; color: #fff; }

/* Visible focus on everything interactive. */
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus,
a:focus-visible, summary:focus-visible, .btn-close:focus-visible, .p-copy:focus-visible, .page-link:focus-visible {
  outline: 0; box-shadow: var(--p-focus);
}

/* ---- tables ---- */
.p-table { width: 100%; margin: 0; font-size: var(--p-table-font-size); border-collapse: collapse; }
.p-table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--p-text-muted); font-weight: 600; background: var(--p-bg); border-bottom: 1px solid var(--p-border); padding: .6rem var(--p-cell-pad); white-space: nowrap; text-align: left; }
.p-table th.p-th-plain { text-transform: none; letter-spacing: 0; font-weight: 400; white-space: normal; }
.p-table td { padding: var(--p-cell-pad); border-bottom: 1px solid var(--p-border); vertical-align: middle; }
.p-table tbody tr:last-child td { border-bottom: 0; }
.p-table tbody tr:hover td { background: #fafbfe; }
.p-table td.actions { text-align: right; white-space: nowrap; }
.p-table .p-prewrap { white-space: pre-wrap; }

/* ---- badges, chips, identifiers ---- */
.p-badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; }
.p-badge i { font-size: .7rem; }
.p-badge-active { color: var(--p-success); background: var(--p-success-soft); }
.p-badge-expired { color: var(--p-neutral); background: var(--p-neutral-soft); }
.p-badge-revoked { color: var(--p-danger); background: var(--p-danger-soft); }
.p-badge-suspended { color: var(--p-warning); background: var(--p-warning-soft); }
.p-badge-admin { color: var(--p-primary-hover); background: var(--p-primary-soft); }
.p-chip { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border: 1px solid var(--p-border); border-radius: var(--p-radius-sm); background: var(--p-surface); margin: 0 .2rem .2rem 0; white-space: nowrap; }
code.p-key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875em; color: var(--p-text); background: var(--p-bg); padding: .1rem .35rem; border-radius: .25rem; }
.p-guid { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8125rem; }
/* At least 24 x 24 px to press (WCAG 2.2 target size), without making the line it sits in taller. */
.p-copy { border: 0; background: transparent; color: var(--p-text-muted); padding: .1rem .35rem; border-radius: .25rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.5rem; min-height: 1.5rem; vertical-align: middle; }
.p-copy:hover { color: var(--p-primary); background: var(--p-primary-soft); }
.p-copy.copied { color: var(--p-success); }
.p-userid { font-size: .875rem; color: var(--p-text-muted); }

/* ---- usage indicator ---- */
.p-usage { display: flex; gap: .3rem; }
.p-usage span { width: 2.25rem; height: .5rem; border-radius: 999px; background: var(--p-neutral-soft); }
.p-usage span.on { background: var(--p-primary); }
.p-usage.full span.on { background: var(--p-warning); }

/* ---- empty, error and unavailable states ---- */
.p-empty { text-align: center; padding: 2.5rem 1rem; color: var(--p-text-muted); }
.p-empty > i { font-size: 2rem; display: block; margin-bottom: .75rem; color: #adb5bd; }
.p-empty .title { color: var(--p-text); font-weight: 600; margin-bottom: .25rem; }
.p-empty.is-error > i { color: var(--p-danger); }
.p-empty.is-unavailable > i { color: var(--p-warning); }
.p-ref { font-size: .75rem; color: var(--p-text-muted); margin-top: .25rem; }

/* ---- skeletons ---- */
.p-skel { display: block; height: .8rem; border-radius: .25rem; background: linear-gradient(90deg, #e9ecef 25%, #f4f6f8 37%, #e9ecef 63%); background-size: 400% 100%; animation: p-shimmer 1.4s ease infinite; }
.p-skel.pill { height: 1.2rem; width: 4.5rem; border-radius: 999px; }
.p-skel.btn-like { height: 1.9rem; width: 4.5rem; border-radius: var(--p-radius-sm); margin-left: auto; }
@keyframes p-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---- toasts ---- */
.p-toasts { position: fixed; top: 4.5rem; right: 1rem; z-index: 1090; display: flex; flex-direction: column; gap: .5rem; width: min(24rem, calc(100vw - 2rem)); pointer-events: none; }
.p-toasts > div { display: flex; flex-direction: column; gap: .5rem; }
.p-toast { pointer-events: auto; background: var(--p-surface); border: 1px solid var(--p-border); border-left: 4px solid var(--p-info); border-radius: var(--p-radius-sm); box-shadow: var(--p-shadow); padding: .7rem .75rem .7rem .9rem; display: flex; gap: .65rem; align-items: flex-start; font-size: .9375rem; }
.p-toast i.kind { margin-top: .2rem; color: var(--p-info); }
.p-toast.success { border-left-color: var(--p-success); } .p-toast.success i.kind { color: var(--p-success); }
.p-toast.error { border-left-color: var(--p-danger); } .p-toast.error i.kind { color: var(--p-danger); }
.p-toast.warning { border-left-color: var(--p-warning); } .p-toast.warning i.kind { color: var(--p-warning); }
.p-toast .body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.p-toast .btn-close { font-size: .65rem; margin-top: .2rem; }
.p-toast .p-toast-action { margin-top: .5rem; }
@media (max-width: 575.98px) { .p-toasts { top: auto; bottom: 1rem; right: 1rem; left: 1rem; width: auto; } }

/* ---- modals ---- */
.modal-content { border-radius: var(--p-radius); border: 1px solid var(--p-border); box-shadow: var(--p-shadow); }
.modal-title { font-weight: 700; }

/* ---- small screens: the user's keys become cards (docs/DECISIONS.md, item 40) ---- */
/* Cards up to 991px (docs/DECISIONS.md, item 60): at 768-991px the eight key columns do not fit the container. */
@media (max-width: 991.98px) {
  .p-table.as-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .p-table.as-cards, .p-table.as-cards tbody, .p-table.as-cards tr, .p-table.as-cards td { display: block; width: 100%; }
  .p-table.as-cards tr { border-bottom: 1px solid var(--p-border); padding: .75rem 1rem; }
  .p-table.as-cards tbody tr:last-child { border-bottom: 0; }
  .p-table.as-cards td { border: 0; padding: .15rem 0; display: flex; gap: .75rem; }
  .p-table.as-cards td[data-label]::before { content: attr(data-label); flex: 0 0 6.5rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--p-text-muted); padding-top: .15rem; }
  .p-table.as-cards td.actions { text-align: left; padding-top: .5rem; }
  .p-table.as-cards td.actions .btn { width: 100%; }
  .p-table.as-cards td.p-state-cell { display: block; }
  .p-create > .p-card-body { padding: 1.25rem; }
}

/* ---- reduced motion: no shimmer, no slide ---- */
@media (prefers-reduced-motion: reduce) {
  .p-skel { animation: none; background: #e9ecef; }
  .modal.fade .modal-dialog, .offcanvas, .fade { transition: none !important; }
  .spinner-border { animation-duration: 1.5s; }
  .p-apiref-app.is-link { transition: none; }
  .p-apiref-app.is-link:hover { transform: none; }
}

/* Identifiers inside text and inputs: monospace, but the surrounding size and colour. */
code.p-guid { color: inherit; }

/* Bootstrap's pink for inline code (#d63384) is 4.5:1 on white at best and less on the page and
   table-header greys. This darker pink of the same hue is at least 5.8:1 on all of them. */
code { color: #ab296a; }
.form-control.p-guid { font-size: 1em; }
