/* KVNX Vault shared application components. */
:root {
  --app-bg: #070708;
  --app-surface: #0d0d0f;
  --app-surface-raised: #111114;
  --app-surface-soft: #161619;
  --app-text: #f2f0ed;
  --app-muted: #a3a09d;
  --app-subtle: #777472;
  --app-line: rgba(255, 255, 255, 0.1);
  --app-line-strong: rgba(255, 255, 255, 0.16);
  --app-red: #dd2038;
  --app-red-bright: #ff4057;
  --app-success: #4fc98a;
  --app-radius-sm: 8px;
  --app-radius-md: 14px;
  --app-radius-lg: 20px;
  --app-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --app-ease: cubic-bezier(0.22, 0.8, 0.22, 1);
  --sidebar-width: 256px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  background: var(--app-bg);
}

.auth-pending body:not([data-protected-loading-page]) {
  visibility: hidden;
}

.auth-pending body[data-protected-loading-page] {
  visibility: visible;
}

body {
  margin: 0;
  background: var(--app-bg);
  color: var(--app-text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Sprint 16.1: neutral gate shown before the authenticated application
   snapshot is valid. Product content is hidden by its HTML `hidden` attribute,
   so no placeholder value can paint while scripts or the network are slow. */
.protected-restoration {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: radial-gradient(circle at 50% 38%, rgba(221, 32, 56, 0.07), transparent 34%),
    var(--app-bg);
}

.protected-restoration[hidden],
[data-protected-content][hidden] {
  display: none;
}

.protected-restoration__content {
  width: min(100%, 440px);
  display: grid;
  justify-items: center;
  text-align: center;
}

.protected-restoration__mark {
  width: 42px;
  height: 42px;
  margin-bottom: 28px;
}

.protected-restoration h1 {
  margin: 13px 0 0;
  font-size: clamp(1.7rem, 4vw, 2.55rem);
  font-weight: 340;
  letter-spacing: -0.045em;
}

.protected-restoration p:not(.app-eyebrow) {
  max-width: 390px;
  margin: 14px 0 0;
  color: var(--app-muted);
  font-size: 0.76rem;
  line-height: 1.7;
}

.protected-restoration__indicator {
  width: 26px;
  height: 26px;
  margin-top: 28px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-top-color: var(--app-red-bright);
  border-radius: 50%;
  animation: protected-restoration-spin 900ms linear infinite;
}

.protected-restoration.is-error .protected-restoration__indicator {
  display: none;
}

.protected-restoration .app-button {
  margin-top: 24px;
}

@keyframes protected-restoration-spin {
  to { transform: rotate(360deg); }
}

button,
input {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
}

::selection {
  color: var(--app-text);
  background: rgba(221, 32, 56, 0.72);
}

:focus-visible {
  outline: 2px solid var(--app-red-bright);
  outline-offset: 3px;
}

.app-skip-link {
  position: fixed;
  z-index: 200;
  top: 12px;
  left: 16px;
  padding: 11px 15px;
  border-radius: var(--app-radius-sm);
  background: var(--app-text);
  color: var(--app-bg);
  font-size: 0.75rem;
  font-weight: 700;
  translate: 0 -180%;
  transition: translate 180ms ease;
}

.app-skip-link:focus {
  translate: 0 0;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}

.app-brand__mark {
  width: 27px;
  height: 34px;
  object-fit: contain;
}

.app-brand__name {
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.18em;
}

.app-brand__name strong {
  font-weight: 700;
}

.app-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--app-muted);
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.app-eyebrow::before {
  width: 24px;
  height: 1px;
  background: var(--app-red);
  box-shadow: 0 0 8px rgba(221, 32, 56, 0.78);
  content: "";
}

.app-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 20px;
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-sm);
  background: transparent;
  color: var(--app-text);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: translate 180ms var(--app-ease), border-color 180ms ease,
    background-color 180ms ease, box-shadow 180ms ease;
}

.app-button:hover {
  border-color: var(--app-line-strong);
  background: rgba(255, 255, 255, 0.035);
  translate: 0 -1px;
}

.app-button:active {
  translate: 0 0;
}

.app-button--primary {
  border-color: var(--app-red);
  background: var(--app-red);
  box-shadow: 0 12px 30px rgba(221, 32, 56, 0.2);
}

.app-button--primary:hover {
  border-color: #ed2841;
  background: #ed2841;
  box-shadow: 0 15px 34px rgba(221, 32, 56, 0.28);
}

.app-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  translate: none;
}

.app-icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  background: transparent;
  color: var(--app-muted);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.app-icon-button:hover {
  border-color: var(--app-line-strong);
  background: rgba(255, 255, 255, 0.035);
  color: var(--app-text);
}

.app-icon-button svg {
  width: 18px;
  height: 18px;
}

.app-card {
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-md);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 58%),
    var(--app-surface);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
}

.app-card__label {
  margin: 0;
  color: var(--app-subtle);
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.app-status-dot {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
  background: var(--app-red);
  box-shadow: 0 0 9px rgba(221, 32, 56, 0.82);
}

.app-visually-hidden {
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
