/* PatchRadar responsive visual system and mobile containment layer.
   Loaded as a same-origin stylesheet so Cloudflare Pages remains fully static. */

html:root {
  --bg: #050b14;
  --surface: rgba(10, 23, 40, 0.86);
  --surface-strong: #0b1a2d;
  --surface-soft: rgba(18, 38, 64, 0.66);
  --border: rgba(145, 181, 220, 0.2);
  --border-strong: rgba(84, 214, 255, 0.42);
  --text: #f4f8ff;
  --muted: #a9b8ca;
  --accent: #5cddff;
  --accent-strong: #26bce9;
  --accent-soft: rgba(92, 221, 255, 0.12);
  --radius: 1.35rem;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 14px 38px rgba(0, 0, 0, 0.18);
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

@supports (overflow: clip) {
  html,
  body {
    overflow-x: clip;
  }
}

html body {
  position: relative;
  background:
    radial-gradient(circle at 12% -4%, rgba(38, 188, 233, 0.2), transparent 34rem),
    radial-gradient(circle at 96% 10%, rgba(99, 102, 241, 0.18), transparent 31rem),
    linear-gradient(160deg, #050b14 0%, #081523 48%, #050d18 100%);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgba(126, 168, 210, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 168, 210, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  content: "";
  pointer-events: none;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 85%);
}

#app {
  width: 100%;
  max-width: 100%;
  isolation: isolate;
}

#app :where(main, section, article, aside, header, footer, nav, div, form, label) {
  min-width: 0;
}

#app :where(section, article, aside, form, div, nav) {
  max-width: 100%;
}

#app :where(h1, h2, h3, h4, p, small, strong, a, button, label, td, th) {
  overflow-wrap: anywhere;
}

body .site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  width: 100%;
  max-width: 100vw;
  padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 1px solid rgba(133, 174, 215, 0.14);
  background: linear-gradient(180deg, rgba(4, 12, 23, 0.96), rgba(5, 15, 27, 0.9));
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}

.site-header .top-nav {
  width: 100%;
  max-width: 1440px;
  min-height: 4.75rem;
  margin-inline: auto;
  padding-inline: clamp(0.85rem, 2.6vw, 2rem);
}

.site-header .brand-mark {
  min-width: 0;
  border-radius: 0.9rem;
}

.site-header .brand-icon {
  flex: 0 0 auto;
  border-color: rgba(92, 221, 255, 0.48);
  background:
    linear-gradient(145deg, rgba(92, 221, 255, 0.28), rgba(99, 102, 241, 0.2)),
    rgba(8, 25, 43, 0.8);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08), 0 10px 28px rgba(23, 151, 195, 0.18);
}

.site-header .nav-links {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.site-header .nav-links::-webkit-scrollbar {
  display: none;
}

.site-header .nav-links a {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 2.75rem;
  align-items: center;
  scroll-snap-align: start;
  border: 1px solid transparent;
  border-radius: 0.85rem;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.site-header .nav-links a:hover {
  border-color: rgba(92, 221, 255, 0.18);
  background: rgba(92, 221, 255, 0.08);
}

.site-header .nav-links a[aria-current="page"] {
  border-color: rgba(92, 221, 255, 0.22);
  background: linear-gradient(135deg, rgba(92, 221, 255, 0.16), rgba(99, 102, 241, 0.12));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 8px 22px rgba(0, 0, 0, 0.16);
}

.site-header .live-indicator {
  background: rgba(7, 21, 37, 0.66);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

body .page-shell {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding: clamp(1rem, 3vw, 2.4rem) clamp(0.85rem, 3vw, 2rem) max(4rem, env(safe-area-inset-bottom, 0px));
  gap: clamp(0.95rem, 2vw, 1.4rem);
}

.page-shell > * {
  min-width: 0;
  max-width: 100%;
  animation: patchradar-enter 520ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.page-shell > *:nth-child(2) { animation-delay: 45ms; }
.page-shell > *:nth-child(3) { animation-delay: 90ms; }
.page-shell > *:nth-child(4) { animation-delay: 135ms; }
.page-shell > *:nth-child(5) { animation-delay: 180ms; }
.page-shell > *:nth-child(n + 6) { animation-delay: 220ms; }

.page-shell .hero-page,
.page-shell .page-hero {
  position: relative;
  isolation: isolate;
  grid-template-columns: minmax(0, 1.4fr) minmax(17rem, 0.6fr);
  min-width: 0;
  max-width: 100%;
  border-color: rgba(122, 169, 214, 0.22);
  background:
    linear-gradient(135deg, rgba(7, 24, 42, 0.97), rgba(10, 28, 49, 0.83)),
    radial-gradient(circle at 82% 15%, rgba(92, 221, 255, 0.16), transparent 25rem);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.3), inset 0 1px rgba(255, 255, 255, 0.035);
}

.page-shell .hero-page::before,
.page-shell .page-hero::before {
  position: absolute;
  z-index: -1;
  width: 20rem;
  height: 20rem;
  top: -10rem;
  right: -6rem;
  border-radius: 999px;
  background: rgba(92, 221, 255, 0.09);
  filter: blur(10px);
  content: "";
  animation: patchradar-orbit 10s ease-in-out infinite alternate;
  pointer-events: none;
}

.page-shell .hero-page > *,
.page-shell .page-hero > * {
  min-width: 0;
  max-width: 100%;
}

.page-shell h1 {
  max-width: 56rem;
  font-size: clamp(2.35rem, 5vw, 4.9rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.page-shell .compact-page-hero h1 {
  font-size: clamp(2.15rem, 4.4vw, 4rem);
}

.page-shell h2,
.page-shell h3 {
  text-wrap: balance;
}

.page-shell .lede {
  max-width: 60rem;
  color: #c0cee0;
}

.page-shell .page-hero-actions,
.page-shell .hero-actions {
  min-width: 0;
  max-width: 100%;
}

.page-shell button,
.page-shell .button-link,
.page-shell .file-picker {
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(135deg, #62ddfb, #81e8ff);
  box-shadow: 0 14px 38px rgba(27, 183, 237, 0.22), inset 0 1px rgba(255, 255, 255, 0.28);
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.page-shell .secondary-button,
.page-shell .file-picker {
  border-color: rgba(92, 221, 255, 0.3);
  background: linear-gradient(145deg, rgba(9, 25, 43, 0.94), rgba(12, 32, 53, 0.86));
  color: #e5f9ff;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.045);
}

.page-shell .panel,
.page-shell .metrics article,
.page-shell .source-health-card,
.page-shell .command-card,
.page-shell .inventory-summary-card,
.page-shell .report-actions-card {
  border-color: rgba(137, 176, 215, 0.2);
  background:
    linear-gradient(150deg, rgba(12, 29, 49, 0.91), rgba(7, 19, 34, 0.83));
  box-shadow: var(--shadow-soft), inset 0 1px rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
}

.page-shell .value-card,
.page-shell .onboarding-card,
.page-shell .signal-guide-grid article,
.page-shell .report-preview-grid article,
.page-shell .intel-preview-card,
.page-shell .intel-stream-card,
.page-shell .guidance-card,
.page-shell .queue-summary-grid article {
  border-color: rgba(137, 176, 215, 0.17);
  background: linear-gradient(150deg, rgba(9, 24, 41, 0.82), rgba(6, 18, 31, 0.7));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.page-shell .metrics,
.page-shell .value-grid,
.page-shell .onboarding-grid,
.page-shell .intel-preview-grid,
.page-shell .source-health-grid,
.page-shell .signal-guide-grid,
.page-shell .guidance-grid,
.page-shell .report-preview-grid,
.page-shell .queue-summary-grid {
  min-width: 0;
  max-width: 100%;
}

.page-shell .source-health-card p {
  min-height: 0;
}

.page-shell .source-health-card {
  position: relative;
  overflow: hidden;
}

.page-shell .source-health-card::after {
  position: absolute;
  height: 2px;
  inset: auto 1.15rem 0;
  background: linear-gradient(90deg, var(--accent), transparent);
  content: "";
  opacity: 0.55;
}

.page-shell .status-dot {
  animation: patchradar-pulse 2.4s ease-out infinite;
}

.page-shell .intel-controls,
.page-shell .finding-controls,
.page-shell .sla-controls,
.page-shell .inventory-layout,
.page-shell .report-layout,
.page-shell .feed-limitations {
  min-width: 0;
  max-width: 100%;
}

.page-shell input,
.page-shell select,
.page-shell textarea {
  min-width: 0;
  max-width: 100%;
  border-color: rgba(145, 181, 220, 0.25);
  background: rgba(3, 13, 25, 0.76);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.page-shell .table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  box-shadow: inset -18px 0 24px -24px rgba(92, 221, 255, 0.5);
}

.page-shell table {
  min-width: 760px;
}

.page-shell .compact-table {
  min-width: 640px;
}

body .site-footer {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding: 2rem clamp(0.85rem, 3vw, 2rem) max(2.5rem, env(safe-area-inset-bottom, 0px));
}

@media (hover: hover) and (pointer: fine) {
  .page-shell button:hover,
  .page-shell .button-link:hover,
  .page-shell .file-picker:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 18px 44px rgba(27, 183, 237, 0.28), inset 0 1px rgba(255, 255, 255, 0.28);
  }

  .page-shell .panel:hover,
  .page-shell .metrics article:hover,
  .page-shell .source-health-card:hover,
  .page-shell .intel-preview-card:hover,
  .page-shell .intel-stream-card:hover,
  .page-shell .guidance-card:hover {
    transform: translateY(-2px);
    border-color: rgba(92, 221, 255, 0.3);
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.24), inset 0 1px rgba(255, 255, 255, 0.045);
  }

  .page-shell .panel,
  .page-shell .metrics article,
  .page-shell .source-health-card,
  .page-shell .intel-preview-card,
  .page-shell .intel-stream-card,
  .page-shell .guidance-card {
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  }
}

@media (max-width: 1080px) {
  .page-shell .hero-page,
  .page-shell .page-hero,
  .page-shell .inventory-layout,
  .page-shell .report-layout,
  .page-shell .feed-limitations {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-shell .hero-page,
  .page-shell .page-hero {
    min-height: auto;
  }

  .page-shell .inventory-side-panel,
  .page-shell .report-side-panel {
    position: static;
  }

  .page-shell .finding-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .site-header .top-nav {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
    padding-block: 0.7rem;
  }

  .site-header .brand-mark {
    width: fit-content;
  }

  .site-header .nav-links {
    justify-content: flex-start;
    padding: 0.2rem;
    border: 1px solid rgba(137, 176, 215, 0.1);
    border-radius: 0.95rem;
    background: rgba(7, 20, 35, 0.48);
  }

  .site-header .live-indicator {
    display: none;
  }

  .page-shell .source-health-grid,
  .page-shell .signal-guide-grid,
  .page-shell .guidance-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-shell .metrics,
  .page-shell .value-grid,
  .page-shell .onboarding-grid,
  .page-shell .intel-preview-grid,
  .page-shell .report-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  body .page-shell {
    padding: 0.8rem 0.75rem max(3rem, env(safe-area-inset-bottom, 0px));
    gap: 0.85rem;
  }

  .site-header .top-nav {
    padding-inline: 0.75rem;
  }

  .site-header .brand-mark strong {
    font-size: 1rem;
  }

  .site-header .brand-mark small {
    display: none;
  }

  .site-header .nav-links a {
    min-height: 2.6rem;
    padding-inline: 0.72rem;
    font-size: 0.82rem;
  }

  .page-shell .hero-page,
  .page-shell .page-hero,
  .page-shell .panel {
    border-radius: 1.1rem;
    padding: 1.05rem;
  }

  .page-shell h1,
  .page-shell .compact-page-hero h1 {
    max-width: 100%;
    font-size: clamp(1.9rem, 8.8vw, 2.75rem);
    line-height: 1.04;
    letter-spacing: -0.045em;
  }

  .page-shell .lede {
    margin-top: 0.9rem;
    font-size: 1rem;
    line-height: 1.58;
  }

  .page-shell .eyebrow {
    font-size: 0.7rem;
    letter-spacing: 0.11em;
  }

  .page-shell .metrics,
  .page-shell .value-grid,
  .page-shell .onboarding-grid,
  .page-shell .intel-preview-grid,
  .page-shell .report-preview-grid,
  .page-shell .queue-summary-grid,
  .page-shell .finding-controls,
  .page-shell .intel-controls,
  .page-shell .sla-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-shell .section-heading,
  .page-shell .intel-stream-header,
  .page-shell .sla-box {
    align-items: stretch;
    flex-direction: column;
  }

  .page-shell .hero-actions,
  .page-shell .page-hero-actions,
  .page-shell .import-actions,
  .page-shell .storage-actions,
  .page-shell .report-actions-card {
    width: 100%;
    align-items: stretch;
  }

  .page-shell .hero-actions > *,
  .page-shell .page-hero-actions > *,
  .page-shell .import-actions > *,
  .page-shell .storage-actions > *,
  .page-shell .report-actions-card > *,
  .page-shell .section-heading > button,
  .page-shell .section-heading > .text-link {
    width: 100%;
  }

  .page-shell button,
  .page-shell .button-link,
  .page-shell .file-picker {
    min-height: 3rem;
    padding: 0.82rem 0.9rem;
  }

  .page-shell .source-health-card,
  .page-shell .metrics article,
  .page-shell .value-card,
  .page-shell .onboarding-card,
  .page-shell .intel-preview-card,
  .page-shell .intel-stream-card,
  .page-shell .guidance-card,
  .page-shell .queue-summary-grid article {
    padding: 0.95rem;
  }

  .page-shell .intel-signal-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .page-shell .intel-stat,
  .page-shell .wide-stat {
    width: 100%;
    min-width: 0;
  }

  .page-shell .table-wrap {
    border-radius: 0.8rem;
  }

  .page-shell table {
    min-width: 700px;
  }

  .page-shell .compact-table {
    min-width: 560px;
  }

  body .site-footer {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 0.75rem;
  }

  .site-footer .footer-links {
    justify-content: flex-start;
  }
}

@media (max-width: 430px) {
  .site-header .brand-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.72rem;
  }

  .site-header .nav-links a {
    padding-inline: 0.65rem;
    font-size: 0.78rem;
  }

  body .page-shell {
    padding-inline: 0.65rem;
  }

  .page-shell .hero-page,
  .page-shell .page-hero,
  .page-shell .panel {
    padding: 0.92rem;
  }

  .page-shell h1,
  .page-shell .compact-page-hero h1 {
    font-size: clamp(1.78rem, 8.9vw, 2.3rem);
  }
}

@keyframes patchradar-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes patchradar-orbit {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-1.5rem, 1.25rem, 0) scale(1.08); }
}

@keyframes patchradar-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.2); }
  50% { box-shadow: 0 0 0 0.42rem rgba(74, 222, 128, 0.02); }
}

@media (prefers-reduced-motion: reduce) {
  .page-shell > *,
  .page-shell .hero-page::before,
  .page-shell .page-hero::before,
  .page-shell .status-dot {
    animation: none !important;
  }

  .page-shell :where(button, .button-link, .file-picker, .panel, article),
  .site-header .nav-links a {
    transition: none !important;
  }
}
