:root { color-scheme: light dark; background: var(--estate-bg); font-synthesis: none; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
[data-key-page] { display: flex; flex-direction: column; min-block-size: 100dvh; }

.key-main { flex: 1; padding: clamp(var(--estate-space-4), 6vw, 64px) var(--estate-gutter); }
.key-card {
  display: grid; max-inline-size: 27.5rem; margin-inline: auto;
  padding: clamp(var(--estate-space-3), 6vw, 32px); gap: var(--estate-space-3);
}
.key-card h1 {
  margin: 0; font: 650 clamp(1.75rem, 4vw, 2rem)/1.15 var(--estate-font);
  letter-spacing: normal; overflow-wrap: anywhere;
}
.key-card p { margin: 0; }
#destination, #status { color: var(--estate-muted); }
#status[data-state="failed"] { color: var(--estate-warn); }
/* Keep the live region present while its empty state takes no space. */
.key-progress { display: contents; }
#key-status > #status:empty { margin-block-start: calc(-1 * var(--estate-space-3)); }
#passkey-progress > #status:empty { margin-block-start: calc(-1 * var(--estate-space-2)); }
.key-flow, .key-actions { display: grid; gap: var(--estate-space-2); }
.key-flow:not(:has(> :not([hidden]))) { display: none; }
.key-actions p { margin-block-end: var(--estate-space-1); }
.key-card ul { margin-block: 0 var(--estate-space-2); padding-inline-start: var(--estate-space-4); }
.key-card .estate-button { inline-size: 100%; min-block-size: 44px; justify-content: center; }
.key-card .estate-button:not(.primary, .quiet), .key-card .estate-field input { border-color: var(--estate-muted); }
.key-card .estate-button:hover:not(.primary, :disabled) { border-color: var(--estate-accent); }
.key-card .estate-button:disabled {
  opacity: 1; background: var(--estate-bg); color: var(--estate-muted);
  border-color: var(--estate-muted); cursor: wait;
}
.key-card .estate-field input { min-block-size: 44px; }
#passkeys li + li { margin-block-start: var(--estate-space-2); }
#passkeys li > p { color: var(--estate-muted); }
.key-help-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--estate-space-2); }
.key-help-heading h2 { margin: 0; font-size: 1.15rem; }
.key-help[open] { flex: 1 0 100%; }
.key-help summary {
  display: inline-grid; place-items: center; width: 28px; height: 28px; cursor: pointer; list-style: none;
  border: 1px solid var(--estate-muted); border-radius: 50%; font-size: .85rem;
}
.key-help summary::-webkit-details-marker { display: none; }
.key-help p { margin-block-start: var(--estate-space-2); }
#recovery-secret { font-family: ui-monospace, monospace; }
[data-key-page] .estate-footer { margin-block-start: 0; border-block-start: 0; }
[data-key-page] .estate-footer-inner { padding-block: var(--estate-space-3); }
[data-key-page] .estate-footer-note:empty { display: none; }
[data-key-page] .estate-footer-estate { display: flex; flex-wrap: wrap; gap: var(--estate-space-3); }
.estate-footer a:hover { color: var(--estate-ink); text-decoration: underline; }

[data-key-page] > .estate-header {
  --estate-header-h: 56px;
  padding-block: 0;
  border-bottom: 1px solid var(--estate-line);
}
.key-card { font: 14px/1.5 var(--estate-font); }
.key-card h1 { font-size: 20px; }
.key-card:has(#manage:not([hidden])) {
  max-inline-size: none;
  margin: 0;
  padding: 16px clamp(12px, 3vw, 36px);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.key-main:has(#manage:not([hidden])) { padding: 0; }
#manage { grid-template-columns: 280px minmax(0, 1fr) 300px; gap: 0; }
#manage > :is(#account-name, #return-to-app) { grid-column: 1 / -1; }
#account-name { color: var(--estate-muted); overflow-wrap: anywhere; padding-bottom: 8px; }
#return-to-app { justify-self: start; }
.key-section { min-width: 0; padding: 12px; border-block: 1px solid var(--estate-line); }
.key-section + .key-section { border-inline-start: 1px solid var(--estate-line); }
.key-section h2 { margin: 0; font: 650 16px/1.35 var(--estate-font); }
.key-section p { margin-block: 6px; }
.key-section ul { margin: 0 0 8px; padding: 0; list-style: none; }
.key-section .estate-button, #return-to-app { inline-size: auto; min-block-size: 36px; font-size: 13px; }
.key-device-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-block: 8px; }
:is(#passkeys, #manage-browsers) li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 0 6px; padding-block: 6px; border-bottom: 1px solid var(--estate-line);
}
:is(#passkeys, #manage-browsers) li + li { margin: 0; }
:is(#passkeys, #manage-browsers) li > p {
  grid-column: 1; margin: 0; color: var(--estate-muted); font-size: 13px; overflow-wrap: anywhere;
}
:is(#passkeys, #manage-browsers) li > button { grid-column: 2; grid-row: 1 / span 2; }
:is(#passkeys, #manage-browsers) li > strong { overflow-wrap: anywhere; }
@media (max-width: 56rem) {
  #manage { grid-template-columns: minmax(0, 1fr); }
  .key-section { padding-inline: 0; border-bottom: 0; }
  .key-section + .key-section { border-inline-start: 0; }
}
