/* Shph 2.0.2 — global interface quality layer */
:root {
  --shph-space-1: .375rem;
  --shph-space-2: .625rem;
  --shph-space-3: .875rem;
  --shph-space-4: 1rem;
  --shph-space-5: 1.25rem;
  --shph-space-6: 1.5rem;
  --shph-space-8: 2rem;
  --shph-space-10: 2.5rem;
  --shph-space-12: 3rem;
  --shph-radius-sm: .7rem;
  --shph-radius-md: 1rem;
  --shph-radius-lg: 1.35rem;
  --shph-radius-xl: 1.75rem;
  --shph-control-height: 46px;
  --shph-control-height-lg: 52px;
  --shph-border-soft: color-mix(in srgb, currentColor 11%, transparent);
  --shph-shadow-card: 0 18px 50px rgba(31, 35, 48, .08);
  --shph-shadow-float: 0 22px 70px rgba(22, 27, 45, .16);
  --shph-ease: cubic-bezier(.2, .75, .25, 1);
}

* { scroll-margin-top: 104px; }
html { text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }
body { overflow-wrap: anywhere; }
img, video, iframe, canvas, svg { max-width: 100%; }
img, video { height: auto; }
button, input, select, textarea { font: inherit; }
button, [role="button"], a { -webkit-tap-highlight-color: transparent; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--shph-primary, #7366ff) 42%, transparent);
  outline-offset: 3px;
}

/* Shared surfaces and controls */
:where(.public-page, .page-body) .card {
  border: 1px solid color-mix(in srgb, currentColor 9%, transparent);
  border-radius: var(--shph-radius-lg);
  box-shadow: var(--shph-shadow-card);
  overflow: clip;
}
:where(.public-page, .page-body) .card-header,
:where(.public-page, .page-body) .card-footer {
  padding: clamp(1rem, 2vw, 1.35rem) clamp(1rem, 2.5vw, 1.5rem);
  border-color: color-mix(in srgb, currentColor 8%, transparent);
  background: color-mix(in srgb, currentColor 2.3%, transparent);
}
:where(.public-page, .page-body) .card-body { padding: clamp(1rem, 2.5vw, 1.5rem); }

:where(.public-page, .page-body) .btn {
  min-height: var(--shph-control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .68rem 1rem;
  border-radius: .8rem;
  font-weight: 750;
  line-height: 1.15;
  white-space: normal;
  transition: transform .18s var(--shph-ease), box-shadow .18s var(--shph-ease), background-color .18s ease, border-color .18s ease;
}
:where(.public-page, .page-body) .btn:hover { transform: translateY(-1px); }
:where(.public-page, .page-body) .btn:active { transform: translateY(0); }
:where(.public-page, .page-body) .btn-sm { min-height: 40px; padding: .52rem .8rem; border-radius: .7rem; }
:where(.public-page, .page-body) .btn-lg { min-height: var(--shph-control-height-lg); padding-inline: 1.25rem; border-radius: .95rem; }
:where(.public-page, .page-body) .btn svg,
:where(.public-page, .page-body) .btn i { flex: 0 0 auto; }
:where(.public-page, .page-body) .btn[aria-busy="true"] { cursor: progress; opacity: .82; }
:where(.public-page, .page-body) .btn[aria-busy="true"]::after {
  content: "";
  width: .95rem;
  aspect-ratio: 1;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: shph-ui-spin .75s linear infinite;
}
@keyframes shph-ui-spin { to { transform: rotate(1turn); } }

:where(.public-page, .page-body) :is(.form-control, .form-select) {
  min-height: var(--shph-control-height);
  padding: .68rem .85rem;
  border-radius: .78rem;
  border-color: color-mix(in srgb, currentColor 15%, transparent);
  box-shadow: none;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
:where(.public-page, .page-body) textarea.form-control { min-height: 120px; resize: vertical; }
:where(.public-page, .page-body) :is(.form-control, .form-select):focus {
  border-color: color-mix(in srgb, var(--shph-primary, #7366ff) 60%, currentColor 10%);
  box-shadow: 0 0 0 .22rem color-mix(in srgb, var(--shph-primary, #7366ff) 14%, transparent);
}
:where(.public-page, .page-body) .form-label {
  margin-bottom: .5rem;
  color: inherit;
  font-weight: 750;
  line-height: 1.3;
}
:where(.public-page, .page-body) :is(.form-text, .invalid-feedback, .valid-feedback) { margin-top: .45rem; line-height: 1.45; }
:where(.public-page, .page-body) .input-group { align-items: stretch; }
:where(.public-page, .page-body) .input-group-text {
  min-width: var(--shph-control-height);
  justify-content: center;
  padding-inline: .8rem;
  border-color: color-mix(in srgb, currentColor 15%, transparent);
}
:where(.public-page, .page-body) .form-check-input { width: 1.2rem; height: 1.2rem; margin-top: .13rem; }
:where(.public-page, .page-body) .form-check-label { padding-left: .2rem; line-height: 1.5; }

:where(.public-page, .page-body) .alert {
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  border-radius: var(--shph-radius-md);
  padding: 1rem 1.1rem;
  line-height: 1.5;
}
:where(.public-page, .page-body) .badge { padding: .48em .68em; border-radius: 999px; font-weight: 750; }

/* Admin page hierarchy */
.page-body .shph-workspace {
  width: min(100%, 1560px);
  margin-inline: auto;
  padding: clamp(1rem, 2.2vw, 2rem);
}
.shph-page-masthead {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin: 0 0 clamp(1rem, 2vw, 1.5rem);
  padding: clamp(1rem, 2.5vw, 1.55rem);
  border: 1px solid color-mix(in srgb, currentColor 9%, transparent);
  border-radius: var(--shph-radius-xl);
  background:
    radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--shph-primary, #7366ff) 15%, transparent), transparent 33%),
    color-mix(in srgb, var(--bs-body-bg, #fff) 92%, transparent);
  box-shadow: var(--shph-shadow-card);
  overflow: hidden;
  isolation: isolate;
}
.shph-page-masthead::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(125deg, transparent 50%, color-mix(in srgb, var(--shph-primary, #7366ff) 6%, transparent));
}
.shph-page-masthead__identity { display: flex; align-items: flex-start; gap: 1rem; min-width: 0; }
.shph-page-masthead__icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border-radius: .95rem;
  color: #fff;
  background: linear-gradient(145deg, var(--shph-primary, #7366ff), color-mix(in srgb, var(--shph-primary, #7366ff) 65%, #15102c));
  box-shadow: 0 10px 28px color-mix(in srgb, var(--shph-primary, #7366ff) 27%, transparent);
}
.shph-page-masthead__icon svg { width: 22px; height: 22px; }
.shph-page-masthead__eyebrow {
  margin: 0 0 .35rem;
  color: color-mix(in srgb, currentColor 62%, transparent);
  font-size: .73rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.shph-page-masthead h1 { margin: 0; font-size: clamp(1.4rem, 2.5vw, 2rem); line-height: 1.15; letter-spacing: -.025em; }
.shph-page-masthead p { max-width: 760px; margin: .5rem 0 0; color: color-mix(in srgb, currentColor 68%, transparent); line-height: 1.55; }
.shph-page-masthead__meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; }
.shph-context-chip {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  max-width: 260px;
  padding: .55rem .75rem;
  border: 1px solid color-mix(in srgb, currentColor 10%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bs-body-bg, #fff) 78%, transparent);
  font-size: .78rem;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shph-context-chip svg { width: 15px; height: 15px; flex: 0 0 auto; }
.shph-context-chip--role { color: color-mix(in srgb, var(--shph-primary, #7366ff) 78%, currentColor); }

.page-body .row.g-4 { --bs-gutter-x: clamp(1rem, 2vw, 1.5rem); --bs-gutter-y: clamp(1rem, 2vw, 1.5rem); }
.page-body .card-header h5 { margin: 0; font-size: 1.02rem; font-weight: 800; }
.page-body .card-header p { margin-top: .35rem; line-height: 1.5; }
.page-body .card .table-responsive { margin: 0; }
.page-body .table-responsive {
  position: relative;
  overflow: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}
.page-body .table { min-width: 680px; margin: 0; }
.page-body .table > :not(caption) > * > * { padding: .9rem 1rem; vertical-align: middle; border-color: color-mix(in srgb, currentColor 8%, transparent); }
.page-body .table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: color-mix(in srgb, currentColor 62%, transparent);
  background: color-mix(in srgb, var(--bs-body-bg, #fff) 96%, transparent);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .055em;
  text-transform: uppercase;
  white-space: nowrap;
}
.page-body .table tbody tr { transition: background-color .16s ease; }
.page-body .table tbody tr:hover { background: color-mix(in srgb, var(--shph-primary, #7366ff) 4.5%, transparent); }

/* Public navigation discovery menu */
.site-header .navbar { min-height: 72px; }
.site-header .navbar-brand { min-width: 0; }
.site-header .nav-link { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: .75rem; }
.shph-explore-menu > .dropdown-toggle { border: 0; background: transparent; }
.shph-explore-menu > .dropdown-toggle::after { margin-left: .45rem; vertical-align: .12em; }
.shph-explore-dropdown {
  width: min(92vw, 620px);
  margin-top: .7rem;
  padding: .75rem;
  border: 1px solid color-mix(in srgb, currentColor 11%, transparent);
  border-radius: 1.25rem;
  background: color-mix(in srgb, var(--bs-body-bg, #fff) 92%, transparent);
  box-shadow: var(--shph-shadow-float);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}
.shph-explore-dropdown__intro { padding: .45rem .55rem .8rem; border-bottom: 1px solid color-mix(in srgb, currentColor 8%, transparent); }
.shph-explore-dropdown__intro strong { display: block; font-size: .88rem; }
.shph-explore-dropdown__intro span { display: block; margin-top: .2rem; color: color-mix(in srgb, currentColor 62%, transparent); font-size: .76rem; }
.shph-explore-dropdown__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; padding-top: .55rem; }
.shph-explore-dropdown .dropdown-item {
  min-width: 0;
  min-height: 66px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: .65rem;
  padding: .65rem;
  border-radius: .85rem;
  color: inherit;
  white-space: normal;
}
.shph-explore-dropdown .dropdown-item:hover,
.shph-explore-dropdown .dropdown-item:focus,
.shph-explore-dropdown .dropdown-item.active {
  color: inherit;
  background: color-mix(in srgb, var(--shph-primary, #7366ff) 9%, transparent);
}
.shph-explore-dropdown .dropdown-item > i {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: .75rem;
  color: color-mix(in srgb, var(--shph-primary, #7366ff) 85%, currentColor);
  background: color-mix(in srgb, var(--shph-primary, #7366ff) 10%, transparent);
  font-size: .95rem;
}
.shph-explore-dropdown .dropdown-item span { min-width: 0; }
.shph-explore-dropdown .dropdown-item strong,
.shph-explore-dropdown .dropdown-item small { display: block; overflow: hidden; text-overflow: ellipsis; }
.shph-explore-dropdown .dropdown-item strong { font-size: .8rem; line-height: 1.25; }
.shph-explore-dropdown .dropdown-item small { margin-top: .18rem; color: color-mix(in srgb, currentColor 58%, transparent); font-size: .68rem; line-height: 1.3; }

/* Public content quality and fitting */
.public-page main > :is(section, .container):not(:first-child) { content-visibility: auto; contain-intrinsic-size: auto 600px; }
.public-page :is(.ratio, .video-card-media, .song-cover, .product-image, .gallery-card, .collection-card) { overflow: hidden; }
.public-page :is(.ratio, .video-card-media, .song-cover, .product-image, .gallery-card, .collection-card) img { width: 100%; height: 100%; object-fit: cover; }
.public-page img.is-image-error { opacity: 0; }
.shph-image-error-surface { position: relative; background: linear-gradient(135deg, color-mix(in srgb, var(--shph-primary, #7366ff) 12%, transparent), color-mix(in srgb, currentColor 4%, transparent)); }
.shph-image-error-surface::after { content: "Image unavailable"; position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; color: color-mix(in srgb, currentColor 55%, transparent); font-size: .75rem; font-weight: 700; text-align: center; }

/* Footer uses four balanced columns */
.site-footer .footer-main-grid { grid-template-columns: minmax(260px, 1.65fr) repeat(3, minmax(130px, .55fr)); gap: clamp(1.5rem, 4vw, 3rem); }
.site-footer .footer-link-column li + li { margin-top: .5rem; }
.site-footer .footer-link-column a { min-height: 36px; display: inline-flex; align-items: center; }

/* Empty and status states */
.shph-empty, .shph-empty-state { padding: clamp(1.5rem, 4vw, 3rem); text-align: center; color: color-mix(in srgb, currentColor 60%, transparent); }
.shph-system-health-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.shph-system-health-card { padding: 1rem; border: 1px solid color-mix(in srgb, currentColor 9%, transparent); border-radius: var(--shph-radius-md); background: color-mix(in srgb, currentColor 2.3%, transparent); }
.shph-system-health-card span { display: block; color: color-mix(in srgb, currentColor 58%, transparent); font-size: .73rem; font-weight: 750; text-transform: uppercase; letter-spacing: .055em; }
.shph-system-health-card strong { display: block; margin-top: .35rem; font-size: 1.5rem; line-height: 1; }
.shph-check-list { display: grid; gap: .65rem; }
.shph-check-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: start; gap: .75rem; padding: .85rem; border: 1px solid color-mix(in srgb, currentColor 9%, transparent); border-radius: .9rem; }
.shph-check-item__icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: .7rem; }
.shph-check-item.is-ok .shph-check-item__icon { color: #147a4f; background: rgba(25, 180, 112, .11); }
.shph-check-item.is-failed .shph-check-item__icon { color: #b82d3f; background: rgba(220, 53, 69, .11); }
.shph-check-item h6 { margin: 0; font-size: .86rem; }
.shph-check-item p { margin: .25rem 0 0; color: color-mix(in srgb, currentColor 62%, transparent); font-size: .75rem; line-height: 1.45; }
.shph-check-item code { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dark surfaces */
:root[data-theme="dark"] .shph-explore-dropdown,
html[data-admin-theme="dark"] .shph-page-masthead,
html[data-admin-theme="dark"] .shph-context-chip {
  background-color: color-mix(in srgb, #11131b 92%, transparent);
}
:root[data-theme="dark"] .site-header .dropdown-menu { color: rgba(255,255,255,.92); }
html[data-admin-theme="dark"] .page-body .table thead th { background-color: #151720; }

/* Tablet and mobile */
@media (max-width: 1199.98px) {
  .shph-page-masthead { flex-direction: column; }
  .shph-page-masthead__meta { justify-content: flex-start; }
  .shph-system-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer .footer-main-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer .footer-brand-column { grid-column: 1 / -1; }
}

@media (max-width: 991.98px) {
  .site-header .navbar { min-height: 64px; }
  .shph-public-nav-panel .navbar-nav { gap: .3rem; }
  .shph-public-nav-panel .nav-link { width: 100%; justify-content: space-between; min-height: 48px; padding-inline: .9rem; }
  .shph-explore-menu { width: 100%; }
  .shph-explore-dropdown {
    position: static !important;
    width: 100%;
    transform: none !important;
    margin: .2rem 0 .55rem;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .shph-explore-dropdown__grid { grid-template-columns: 1fr; }
  .shph-explore-dropdown .dropdown-item { min-height: 58px; }
  .header-actions { width: 100%; }
  .header-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 767.98px) {
  :root { --shph-control-height: 48px; }
  .page-body .shph-workspace { padding: .9rem; }
  .shph-page-masthead { padding: 1rem; border-radius: 1.2rem; }
  .shph-page-masthead__identity { gap: .75rem; }
  .shph-page-masthead__icon { width: 42px; height: 42px; flex-basis: 42px; border-radius: .8rem; }
  .shph-page-masthead h1 { font-size: 1.35rem; }
  .shph-page-masthead p { font-size: .82rem; }
  .shph-page-masthead__meta { width: 100%; }
  .shph-context-chip { max-width: 100%; flex: 1 1 150px; justify-content: center; }
  .page-body .card { border-radius: 1.05rem; }
  .page-body .card-header,
  .page-body .card-body,
  .page-body .card-footer { padding: 1rem; }
  .page-body .table { min-width: 620px; }
  .page-body .table > :not(caption) > * > * { padding: .78rem .8rem; }
  .page-body :is(.d-flex, .btn-group).flex-wrap > .btn { flex: 1 1 145px; }
  .page-body .card-header.d-flex > :is(.btn, form) { width: 100%; }
  .page-body .card-header.d-flex form .btn { width: 100%; }
  .public-page .container, .public-page .shph-public-container { --bs-gutter-x: 1.5rem; }
  .site-footer .footer-main-grid { grid-template-columns: 1fr; }
  .site-footer .footer-brand-column { grid-column: auto; }
  .site-footer .footer-channel-actions { width: 100%; }
  .site-footer .footer-channel-actions .btn { flex: 1 1 145px; }
  .shph-check-item { grid-template-columns: 34px minmax(0, 1fr); }
  .shph-check-item code { grid-column: 2; max-width: 100%; }
}

@media (max-width: 479.98px) {
  .shph-page-masthead__icon { display: none; }
  .shph-page-masthead__meta { display: grid; grid-template-columns: 1fr; }
  .shph-context-chip { width: 100%; }
  .shph-system-health-grid { grid-template-columns: 1fr 1fr; gap: .65rem; }
  .shph-system-health-card { padding: .8rem; }
  .shph-system-health-card strong { font-size: 1.25rem; }
  :where(.public-page, .page-body) .btn:not(.btn-sm) { width: 100%; }
  :where(.public-page, .page-body) .btn-group .btn { width: auto; }
}

@media (hover: none) and (pointer: coarse) {
  :where(.public-page, .page-body) :is(a, button, .btn, .nav-link, .dropdown-item) { touch-action: manipulation; }
  :where(.public-page, .page-body) .btn:hover { transform: none; }
}

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