/* Layout rules for the account SPA. Colours, radii and fonts come from theme.css tokens only. */

@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); }

html, body { margin: 0; }
body { font: 14px/1.5 var(--font-sans); color: var(--foreground); background: var(--background); -webkit-font-smoothing: antialiased; }
#app { min-height: 100vh; }
#blazor-error-ui { display: none; }
.ap-legal { max-width: 72ch; margin-inline: auto; font-size: 1rem; overflow-wrap: anywhere; }
.ap-legal h1 { font-size: 2rem; line-height: 1.2; }
.ap-legal h2 { margin-top: 2rem; font-size: 1.25rem; line-height: 1.4; }
.ap-legal p, .ap-legal ul { margin-block: 1rem; }
.ap-legal ul { list-style: disc outside; padding-left: 1.5rem; }
.ap-legal li + li { margin-top: .5rem; }
.ap-legal-table { overflow-x: auto; margin-block: 1rem; }
.ap-legal table { min-width: 36rem; width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; }
.ap-legal th, .ap-legal td { padding: .5rem; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.ap-legal caption { text-align: left; margin-bottom: .5rem; }
.ap-legal a, .ap-legal-links a { text-decoration: underline; text-underline-offset: .2em; }
.ap-legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem 1.5rem; padding: 1.5rem; }
.ap-loading { margin: 24px; color: var(--muted-foreground); }
.ap-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ap-muted { color: var(--muted-foreground); }

/* Sidebar brand and user footer */
.ap-brand-mark { width: 32px; height: 32px; border-radius: var(--radius); background: var(--sidebar-primary); color: var(--sidebar-primary-foreground); display: grid; place-items: center; font-family: var(--font-mono); font-size: 12px; font-weight: 600; flex: none; }
.ap-brand-mark img { width: 100%; height: 100%; }
.ap-brand-name { display: block; color: var(--sidebar-accent-foreground); font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.ap-avatar { display: flex; flex: none; }
.ap-user { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ap-user b { color: var(--sidebar-accent-foreground); font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-user span { font-family: var(--font-mono); font-size: 11px; opacity: 0.7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-collapsible="icon"] .ap-user { display: none; }
[data-sidebar="footer"] [data-sidebar="menu-button"][data-size="lg"] { --sidebar-menu-button-collapsed-padding-lg: 0px; }
/* Blueprint's sticky sidebar also stretches to the page height, so it scrolled away with long pages.
   Capping it at the viewport keeps it in place; its content area scrolls if the menu overflows. */
@media (min-width: 768px) { aside.peer { height: 100dvh; min-height: 0; } }
/* Held only until BbSidebarProvider seeds its state after its first render; see js/sidebar.js. */
html.ap-sidebar-collapsed aside.peer { width: var(--sidebar-width-icon); overflow: hidden; transition: none; }

/* Header and page */
/* The inset is a flex item; without this its min-content width (long unbreakable text) widens the page. */
.ap-inset { min-width: 0; }
/* Branded hosts: the way back to the owning app, painted in the brand's --primary override from theme.<brand>.css. */
.ap-brand-banner { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; background: var(--primary); color: var(--primary-foreground); font-size: 14px; font-weight: 600; text-decoration: none; }
.ap-brand-banner:hover { text-decoration: underline; text-underline-offset: 4px; }
.ap-header { height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--border); }
/* Below Blueprint's 768px breakpoint the sidebar becomes a sheet, so its footer trigger is out of reach. */
.ap-menu-trigger { display: none; }
.ap-spacer { flex: 1; }
.ap-page { padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.ap-page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.ap-page-head h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.ap-page-head p { margin: 4px 0 0; color: var(--muted-foreground); }
.ap-page-head h1:focus, .ap-card-title:focus { outline: none; } /* FocusOnNavigate moves focus here; the heading is not interactive */
.ap-page-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }

/* Cards */
.ap-guest { width: 100%; max-width: 26rem; margin: 32px auto 0; }
.ap-card-title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1; }
.ap-card-links { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--muted-foreground); }
.ap-card-links a:hover { color: var(--foreground); text-decoration: underline; text-underline-offset: 4px; }

/* Forms */
/* Separates the operation's alert from the form; the alert renders no element when there is no error. */
.ap-form-shell { display: flex; flex-direction: column; gap: 16px; }
.ap-form { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.ap-form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-alert-list { margin: 4px 0 0; padding-left: 18px; }
/* Blueprint nudges alert content up 3px and leaves a trailing title margin, which makes the box
   bottom-heavy. Both are dropped so all four paddings read as equal. */
.ap-alert > svg + div { translate: none; }
.ap-alert h5:last-child { margin-bottom: 0; }
/* A page-level banner (confirmed / not confirmed on login) sits above the form shell, outside its
   own gap, so it needs the same 16px the shell keeps between its alert and the form. */
.ap-alert + .ap-form-shell { margin-top: 16px; }

/* Description list */
.ap-dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); }
.ap-dl dt, .ap-dl dd { margin: 0; padding: 10px 16px 10px 0; border-bottom: 1px solid var(--border); }
.ap-dl dt { color: var(--muted-foreground); }
.ap-dl dd { overflow-wrap: anywhere; }
.ap-dl dt:last-of-type, .ap-dl dd:last-of-type { border-bottom: 0; }

/* Account administration */
.ap-admin-search { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; max-width: 42rem; }
.ap-admin-control { padding: 0 10px; min-height: 2.25rem; background: var(--background); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius); }
.ap-admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 16rem; gap: 16px; align-items: start; margin-top: 20px; }
.ap-admin-results { min-width: 0; padding: 16px; background: var(--card); color: var(--card-foreground); border: 1px solid var(--border); border-radius: var(--radius); }
.ap-admin-table-scroll { overflow-x: auto; }
.ap-admin-details { min-width: 0; overflow-wrap: anywhere; }
.ap-admin-details .ap-dl { grid-template-columns: minmax(0, 1fr); }
.ap-admin-details .ap-dl dt { padding-bottom: 0; border-bottom: 0; }
.ap-admin-details .ap-dl dd { padding-top: 4px; }
.ap-admin-table { width: 100%; min-width: 48rem; border-collapse: collapse; margin-bottom: 16px; text-align: left; }
.ap-admin-table th, .ap-admin-table td { padding: 12px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.ap-admin-table th { color: var(--muted-foreground); font-weight: 500; padding: 4px; white-space: nowrap; }
.ap-admin-table th button { display: inline-flex; align-items: center; gap: 6px; }
.ap-admin-table td time { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 12px; }
.ap-admin-selected { background: var(--muted); }
.ap-admin-history { min-width: 0; }
.ap-admin-redirects { margin: 0 0 16px; padding-left: 20px; }
.ap-admin-heading { font-size: 14px; margin: 20px 0 12px; font-weight: 600; }
.ap-admin-permissions, .ap-admin-actions { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.ap-admin-permission { display: flex; align-items: center; gap: 8px; }

/* Sessions */
.ap-session-client { display: flex; align-items: center; gap: 8px; }
/* The agent string is long and low-value: one line, full text in the tooltip. */
.ap-session-agent { display: block; margin-top: 4px; max-width: 34rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-foreground); font-size: 12px; }
.ap-session-when, .ap-session-actions { white-space: nowrap; }
.ap-checkbox-field { display: flex; align-items: center; gap: 8px; }
@media (max-width: 900px) { .ap-admin-grid { grid-template-columns: minmax(0, 1fr); } }

/* Phones: Blueprint's sidebar breakpoint is 768px. */
@media (max-width: 767px) {
	.ap-menu-trigger { display: inline-flex; }
	/* Inside the sheet the rail and the collapse toggle have no sidebar context and do nothing; tapping outside or a link closes it. */
	[role="dialog"] .ap-rail-toggle, [role="dialog"] [data-sidebar="rail"] { display: none; }
	/* Blueprint paints the sheet with --sidebar but leaves its text colour to the page, so the links inherited the near-black body text. */
	[role="dialog"][data-side="left"] { color: var(--sidebar-foreground); }
	/* Blueprint removes the sheet the moment it closes; MainLayout holds the close for this exit animation. */
	.ap-sheet-closing [role="dialog"][data-side="left"] { animation: ap-sheet-out 300ms ease-in forwards; pointer-events: none; }
	.ap-sheet-closing .fixed.inset-0 { animation: ap-fade-out 300ms ease-in forwards; pointer-events: none; }
	.ap-header { padding: 0 12px; }
	.ap-page { padding: 16px; gap: 16px; }
	.ap-guest { margin-top: 8px; }
	.ap-dl { grid-template-columns: minmax(0, 1fr); }
	.ap-dl dt { padding-bottom: 0; border-bottom: 0; }
	.ap-dl dd { padding-top: 4px; }
	/* Each row becomes a block; labelled cells show their column header inline. */
	.ap-table-stacked, .ap-table-stacked tbody, .ap-table-stacked tr { display: block; min-width: 0; }
	.ap-table-stacked thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
	.ap-table-stacked tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
	.ap-table-stacked td { display: grid; grid-template-columns: 6rem minmax(0, 1fr); justify-items: start; gap: 12px; padding: 2px 0; border-bottom: 0; }
	.ap-table-stacked td::before { content: attr(data-label); color: var(--muted-foreground); }
	.ap-table-stacked td:not([data-label]) { display: block; }
	.ap-session-agent { max-width: 100%; }
}
@keyframes ap-sheet-out { to { transform: translateX(-100%); } }
@keyframes ap-fade-out { to { opacity: 0; } }
