/* ==========================================================================
   Sophos Portfolio — Executive Light Theme, Header, Layout & Toast Styles
   Palette: Crisp Enterprise White & Sophos Royal Blue
   ========================================================================== */

:root {
  color-scheme: light;
  --sp-bg-page: #F6F8FC;
  --sp-surface: #FFFFFF;
  --sp-surface-soft: #F8FAFC;
  --sp-surface-tint: #EFF6FF;
  --sp-blue: #005BC8;
  --sp-blue-bright: #1976FF;
  --sp-blue-hover: #0046A0;
  --sp-ink-primary: #0A1633;
  --sp-ink-navy: #001A4D;
  --sp-ink-body: #334155;
  --sp-ink-muted: #64748B;
  --sp-emerald: #059669;
  --sp-amber: #D97706;
  --sp-danger: #DC2626;
  --sp-border: #E2E8F0;
  --sp-border-strong: #CBD5E1;
  --sp-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  --sp-shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.05);
  --sp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sp-header-h: 66px;
  --sp-radius: 14px;
  --sp-radius-sm: 8px;
  --sp-transition: 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  --sp-spring: 0.36s cubic-bezier(0.22, 1, 0.36, 1);
  --sp-spring: 0.42s linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1.004 83.8%, 1);
  --sp-spring-snappy: 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  --sp-spring-snappy: 0.3s linear(0, 0.012, 0.049 2.4%, 0.197 5.3%, 0.642 12.6%, 0.878 17.8%, 0.994 22.8%, 1.036 27.6%, 1.044 31.8%, 1.035 37.5%, 1.009 49.4%, 0.997 61.5%, 1.001 82.6%, 1);
}

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

html {
  scrollbar-gutter: stable;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse 85% 42% at 50% -6%, rgba(219, 234, 254, 0.52) 0%, rgba(246, 248, 252, 0) 64%),
    #F5F7FC;
  color: var(--sp-ink-primary);
  font-family: var(--sp-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

a {
  color: var(--sp-blue);
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

.sp-version-tag,
.sp-tab-kbd,
.sp-stage-kpi-item strong,
.sp-inspector-metric-val,
.sp-spotlight-counter,
.sp-metric-val,
.sp-fusion-stage-summary {
  font-variant-numeric: tabular-nums;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #F1F5F9;
}

::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

/* ---------- App Shell ---------- */

.sp-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Top Navigation Header ---------- */

.sp-header {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--sp-header-h);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 4px 20px rgba(10, 22, 51, 0.045);
}

.sp-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-shrink: 1;
  cursor: pointer;
}

.sp-brand-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--sp-ink-navy);
}

.sp-brand-logo svg {
  display: block;
}

.sp-brand-divider {
  width: 1px;
  height: 26px;
  background: var(--sp-border);
  flex-shrink: 0;
}

.sp-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sp-brand-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--sp-ink-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-brand-sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--sp-ink-muted);
  white-space: nowrap;
}

.sp-brand-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--sp-surface-tint);
  border: 1px solid #BFDBFE;
  color: var(--sp-blue);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sp-version-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: #F1F5F9;
  border: 1px solid var(--sp-border);
  color: var(--sp-ink-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.01em;
  cursor: default;
  user-select: text;
  transition: color var(--sp-transition), border-color var(--sp-transition), background var(--sp-transition);
}

.sp-version-tag:hover {
  color: var(--sp-ink-primary);
  background: var(--sp-border);
  border-color: var(--sp-border-strong);
}

/* ---------- Navigation Tabs ---------- */

.sp-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(241, 245, 249, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

.sp-tab-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #475569;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: color var(--sp-transition), background-color var(--sp-transition), border-color var(--sp-transition), box-shadow var(--sp-spring-snappy), transform var(--sp-spring-snappy);
}

.sp-tab-btn:hover {
  color: var(--sp-ink-primary);
  background: rgba(255, 255, 255, 0.72);
}

.sp-tab-btn.is-active {
  color: var(--sp-blue);
  background: var(--sp-surface);
  border-color: rgba(191, 219, 254, 0.9);
  box-shadow: 0 4px 14px rgba(0, 91, 200, 0.14), 0 1px 2px rgba(15, 23, 42, 0.05);
}

.sp-tab-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  background: #E2E8F0;
  color: #475569;
}

.sp-tab-btn.is-active .sp-tab-kbd {
  background: var(--sp-surface-tint);
  color: var(--sp-blue);
}

/* ---------- Right Header Controls ---------- */

.sp-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sp-btn {
  appearance: none;
  border: 1px solid var(--sp-border-strong);
  background: var(--sp-surface);
  color: var(--sp-ink-primary);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color var(--sp-transition), background-color var(--sp-transition), border-color var(--sp-transition), box-shadow var(--sp-spring-snappy), transform var(--sp-spring-snappy);
}

.sp-btn:hover {
  border-color: var(--sp-blue);
  background: var(--sp-surface-soft);
  color: var(--sp-blue);
  transform: translateY(-1px);
}

.sp-btn-primary {
  background: linear-gradient(135deg, #005BC8 0%, #1976FF 100%);
  border-color: var(--sp-blue);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(0, 91, 200, 0.24);
}

.sp-btn-primary:hover {
  background: linear-gradient(135deg, #0046A0 0%, #005BC8 100%);
  border-color: var(--sp-blue-hover);
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(0, 91, 200, 0.3);
}

.sp-btn:disabled,
.sp-btn[disabled],
.sp-btn:disabled:hover,
.sp-btn[disabled]:hover {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.sp-btn-primary:disabled,
.sp-btn-primary[disabled],
.sp-btn-primary:disabled:hover,
.sp-btn-primary[disabled]:hover {
  background: var(--sp-blue);
  border-color: var(--sp-blue);
  color: #FFFFFF;
}

.sp-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Main Stage ---------- */

.sp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.sp-view-container {
  flex: 1;
  width: 100%;
  min-height: 0;
}

@keyframes spViewFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sp-view-container.is-tab-entering > * {
  animation: spViewFadeIn 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

html.is-view-transitioning .sp-view-container > * {
  animation: none;
}

@keyframes spVtOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes spVtIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  body:not(.sp-presentation-mode) .sp-header {
    view-transition-name: sp-app-header;
  }

  ::view-transition-old(root) {
    animation: spVtOut 0.16s ease forwards;
  }

  ::view-transition-new(root) {
    animation: spVtIn 0.24s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  ::view-transition-group(sp-fusion-wheel),
  ::view-transition-group(sp-fusion-board) {
    animation-duration: 0.34s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sp-view-container.is-tab-entering > *,
  .sp-view-container > * {
    animation: none;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

.sp-view-container.is-wheel-view,
.sp-view-container.is-network3d-view {
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 16px 12px;
}

.sp-view-container.is-padded-view {
  max-width: 1760px;
  margin: 0 auto;
  padding: 22px 24px 48px;
}

.sp-view-container.is-licensing-view {
  max-width: 1760px;
  margin: 0 auto;
  padding: 16px 24px 48px;
}

/* ---------- Presentation Fullscreen Mode ---------- */

.sp-presentation-bar {
  display: none;
}

body.sp-presentation-mode .sp-header {
  display: none;
}

body.sp-presentation-mode .sp-view-container.is-wheel-view,
body.sp-presentation-mode .sp-view-container.is-network3d-view {
  max-width: 100%;
  padding: 8px 12px 8px;
}

body.sp-presentation-mode .sp-view-container.is-padded-view {
  padding-top: 28px;
}

body.sp-presentation-mode .sp-view-container.is-licensing-view {
  padding-top: 24px;
}

body.sp-presentation-mode .sp-presentation-bar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 14px;
  pointer-events: none;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.sp-presentation-mode .sp-pres-bar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--sp-border-strong);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  transform: translateY(calc(-100% - 14px));
  opacity: 0;
  pointer-events: none;
  transition: transform var(--sp-spring-snappy), opacity 0.2s ease;
}

body.sp-presentation-mode .sp-presentation-bar.is-revealed .sp-pres-bar-inner,
body.sp-presentation-mode .sp-presentation-bar:hover .sp-pres-bar-inner,
body.sp-presentation-mode .sp-presentation-bar:focus-within .sp-pres-bar-inner {
  transform: translateY(8px);
  opacity: 1;
  pointer-events: auto;
}

body.sp-presentation-mode .sp-pres-peek-pill {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 12px 3px;
  border-radius: 0 0 10px 10px;
  border: 1px solid rgba(203, 213, 225, 0.85);
  border-top: none;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #475569;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0.62;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition: opacity 0.18s ease, transform 0.2s ease, background-color 0.18s ease, color 0.18s ease;
}

body.sp-presentation-mode .sp-pres-peek-pill:hover {
  opacity: 1;
  color: var(--sp-blue);
  background: rgba(255, 255, 255, 0.96);
}

body.sp-presentation-mode .sp-pres-peek-bar {
  display: inline-block;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: #005BC8;
  flex-shrink: 0;
}

body.sp-presentation-mode .sp-presentation-bar.is-revealed .sp-pres-peek-pill,
body.sp-presentation-mode .sp-presentation-bar:hover .sp-pres-peek-pill,
body.sp-presentation-mode .sp-presentation-bar:focus-within .sp-pres-peek-pill {
  opacity: 0;
  transform: translate(-50%, -6px);
  pointer-events: none;
}

body.sp-presentation-mode .sp-pres-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--sp-blue);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

body.sp-presentation-mode .sp-pres-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  background: #F1F5F9;
  border: 1px solid var(--sp-border);
}

body.sp-presentation-mode .sp-pres-tab-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #475569;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--sp-transition), background-color var(--sp-transition), border-color var(--sp-transition), box-shadow var(--sp-spring-snappy), transform var(--sp-spring-snappy);
}

body.sp-presentation-mode .sp-pres-tab-btn:hover {
  color: var(--sp-ink-primary);
  background: rgba(255, 255, 255, 0.72);
}

body.sp-presentation-mode .sp-pres-tab-btn.is-active {
  background: var(--sp-surface);
  color: var(--sp-blue);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.09);
}

body.sp-presentation-mode .sp-btn-pres-exit {
  padding: 6px 11px;
  font-size: 12px;
}

/* ---------- Toast Notifications ---------- */

#sp-toast-root {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}

.sp-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  border-radius: var(--sp-radius-sm);
  background: var(--sp-surface);
  border: 1px solid var(--sp-border-strong);
  box-shadow: var(--sp-shadow);
  color: var(--sp-ink-primary);
  font-size: 13px;
  line-height: 1.4;
  animation: spToastIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.sp-toast.is-leaving {
  animation: spToastOut 0.18s ease forwards;
}

.sp-toast--success {
  border-left: 3px solid var(--sp-emerald);
}

.sp-toast--warning {
  border-left: 3px solid var(--sp-amber);
}

.sp-toast--error {
  border-left: 3px solid var(--sp-danger);
}

.sp-toast--info {
  border-left: 3px solid var(--sp-blue);
}

.sp-toast-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--sp-blue);
}

.sp-toast--success .sp-toast-dot {
  background: var(--sp-emerald);
}

.sp-toast--warning .sp-toast-dot {
  background: var(--sp-amber);
}

.sp-toast--error .sp-toast-dot {
  background: var(--sp-danger);
}

.sp-toast-msg {
  flex: 1;
  color: var(--sp-ink-body);
}

.sp-toast-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--sp-ink-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}

.sp-toast-close:hover {
  color: var(--sp-ink-primary);
}

@keyframes spToastIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spToastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

/* ---------- Empty / Error Fallback ---------- */

.sp-empty-state {
  margin: 48px auto;
  max-width: 540px;
  padding: 28px;
  text-align: center;
  border-radius: var(--sp-radius);
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  box-shadow: var(--sp-shadow-sm);
  color: var(--sp-ink-body);
}

/* ---------- Responsive Rules ---------- */

@media (max-width: 1620px) {
  .sp-header {
    flex-wrap: wrap;
    padding: 10px 20px;
    gap: 10px;
  }

  .sp-tabs {
    order: 3;
    width: 100%;
    justify-content: center;
    overflow-x: auto;
  }
}

@media (min-width: 1081px) and (max-width: 1620px) {
  .sp-shell .sp-inspector-pane {
    top: 122px;
    max-height: calc(100vh - 138px);
    max-height: calc(100dvh - 138px);
  }
}

@media (min-width: 1181px) and (max-width: 1620px) {
  body:not(.sp-presentation-mode) .sp-shell .sp-net3d-inspector {
    top: 122px;
    max-height: calc(100vh - 142px);
    max-height: calc(100dvh - 142px);
  }
}

@media (max-width: 1240px) {
  .sp-header {
    padding: 10px 16px;
  }
}

@media (max-width: 780px) {
  .sp-brand-sub,
  .sp-tab-kbd,
  .sp-btn-label-hide-sm {
    display: none;
  }

  .sp-header {
    padding: 10px 12px;
    gap: 8px;
  }

  .sp-brand {
    gap: 9px;
  }

  .sp-brand-logo svg {
    max-width: 150px;
    height: auto;
  }

  .sp-header-actions {
    gap: 6px;
    flex-wrap: wrap;
  }

  .sp-tab-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .sp-view-container.is-wheel-view,
  .sp-view-container.is-network3d-view,
  .sp-view-container.is-padded-view {
    padding: 12px 12px 36px;
  }

  .sp-view-container.is-licensing-view,
  .sp-view-container.is-epp-compare-view {
    padding: 12px 12px 36px;
  }

  body.sp-presentation-mode .sp-presentation-bar {
    padding: 0 8px 12px;
    max-width: 100vw;
  }

  body.sp-presentation-mode .sp-pres-bar-inner {
    max-width: calc(100vw - 16px);
    padding: 4px 6px 4px 10px;
  }

  body.sp-presentation-mode .sp-pres-label {
    display: none;
  }

  body.sp-presentation-mode .sp-pres-tabs {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  body.sp-presentation-mode .sp-btn-pres-exit {
    flex-shrink: 0;
  }
}

@media (max-width: 540px) {
  .sp-brand-divider,
  .sp-brand-text {
    display: none;
  }

  .sp-tabs {
    justify-content: flex-start;
    justify-content: safe center;
    scrollbar-width: none;
  }

  .sp-tab-btn {
    padding: 5px 9px;
    font-size: 11.5px;
  }

  .sp-btn {
    padding: 7px 10px;
    font-size: 12px;
  }

  body.sp-presentation-mode .sp-pres-tab-btn {
    padding: 4px 8px;
    font-size: 11px;
  }

  body.sp-presentation-mode .sp-btn-pres-exit {
    padding: 5px 9px;
    font-size: 11px;
  }
}
