:root {
  /* Premium Light Theme Colors */
  --bg-dark: hsl(240, 20%, 98%);       /* Clean light gray background */
  --bg-sidebar: hsl(240, 12%, 96%);   /* Cool gray sidebar to perfectly contrast dark logo */
  --card-dark: hsla(0, 0%, 100%, 0.85); /* Semi-transparent pure white cards */
  --card-border: hsla(240, 8%, 90%, 0.9);
  --card-border-hover: hsla(215, 95%, 50%, 0.2); /* Hover border with blue accent */
  
  --text-primary: hsl(240, 10%, 12%);
  --text-secondary: hsl(240, 6%, 38%);
  --text-muted: hsl(240, 4%, 60%);
  
  /* Brand/Accents - Replaced purple with Oceanic Tech Blue to Teal/Cyan */
  --accent-blue: hsl(215, 95%, 50%);  /* Sleek Tech Blue */
  --accent-cyan: hsl(175, 90%, 40%);  /* Vibrant Teal/Cyan */
  --accent-gradient: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  --accent-gradient-hover: linear-gradient(135deg, hsl(215, 95%, 45%), hsl(175, 90%, 35%));
  
  /* Status Colors */
  --color-success: hsl(150, 75%, 35%);
  --color-warning: hsl(35, 85%, 45%);
  --color-danger: hsl(0, 75%, 50%);
  
  --line: var(--card-border);
  --line-strong: hsla(240, 8%, 86%, 1);
  
  --ink: var(--text-primary);
  --text: var(--text-secondary);
  --muted: var(--text-muted);
  --page: var(--bg-dark);
  --surface: var(--card-dark);
  --soft: hsla(240, 10%, 94%, 0.6);
  
  --blue: hsl(210, 95%, 45%);
  --teal: hsl(180, 95%, 40%);
  --green: var(--color-success);
  --amber: var(--color-warning);
  --red: var(--color-danger);

  color-scheme: light;
  font-family: 'Plus Jakarta Sans', Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background-color: var(--page);
  background-image: 
    radial-gradient(at 0% 0%, hsla(215, 95%, 50%, 0.02) 0px, transparent 55%),
    radial-gradient(at 100% 100%, hsla(175, 90%, 40%, 0.02) 0px, transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  transition: border-color 200ms ease, background 200ms ease, color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--accent-gradient);
  color: white;
  padding: 0 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 4px 18px -4px hsla(215, 95%, 50%, 0.35);
}

button:hover {
  background: var(--accent-gradient-hover);
  box-shadow: 0 6px 20px -2px hsla(215, 95%, 50%, 0.45);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
pre:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 3px;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  min-width: 0;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--card-border);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.brand {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--card-border);
}

.brand img {
  width: 140px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
  margin-left: 0;
}

.sidebar nav {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.sidebar a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.sidebar a.active,
.sidebar a:hover {
  background: hsla(215, 95%, 50%, 0.06);
  color: var(--accent-blue);
  box-shadow: inset 0 0 0 1px hsla(215, 95%, 50%, 0.1);
}

.sidebar a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--accent-gradient);
  border-radius: 0 4px 4px 0;
}

main {
  padding: 32px;
  display: grid;
  gap: 24px;
  align-content: start;
  min-width: 0;
}

main > * {
  min-width: 0;
  max-width: 100%;
}

.topbar {
  width: 100%;
  max-width: 100%;
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 20px;
  background: var(--card-dark);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(16px);
  min-width: 0;
}

.topbar > * {
  min-width: 0;
}

.page-title {
  display: grid;
  gap: 4px;
}

.page-title span {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.page-title strong {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 800;
}

.page-title em {
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-style: normal;
  font-weight: 600;
  line-height: 1.35;
}

.login-panel,
.account-panel,
.submit-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.oauth-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: hsl(0, 0%, 100%);
  color: var(--text-primary);
  padding: 0 16px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.oauth-button:hover {
  background: var(--soft);
  transform: translateY(-1px);
}

.oauth-button.google {
  border-color: hsla(4, 82%, 58%, 0.3);
}
.oauth-button.google:hover {
  border-color: var(--red);
  box-shadow: 0 0 12px -3px hsla(0, 82%, 58%, 0.2);
}

.oauth-button.microsoft {
  border-color: hsla(202, 73%, 40%, 0.3);
}
.oauth-button.microsoft:hover {
  border-color: var(--blue);
  box-shadow: 0 0 12px -3px hsla(202, 73%, 40%, 0.2);
}

.oauth-button.apple {
  border-color: hsla(0, 0%, 0%, 0.15);
}
.oauth-button.apple:hover {
  border-color: var(--text-primary);
  box-shadow: 0 0 12px -3px hsla(0, 0%, 0%, 0.15);
}

.account-panel {
  justify-content: end;
}

.avatar {
  width: 40px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  font-weight: 800;
  box-shadow: 0 2px 8px hsla(215, 95%, 50%, 0.25);
}

.account-copy {
  min-width: 180px;
  display: grid;
  gap: 2px;
}

.account-copy strong {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.account-copy span {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ghost-button {
  border: 1px solid var(--card-border);
  background: hsl(0, 0%, 100%);
  color: var(--text-secondary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.ghost-button:hover {
  background: var(--soft);
  color: var(--text-primary);
  border-color: var(--line-strong);
}

.tenant-chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 0 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  background: hsla(240, 10%, 96%, 0.5);
}

.status-pill {
  color: var(--color-success);
  border-color: hsla(150, 80%, 40%, 0.2);
  background: hsla(150, 80%, 40%, 0.05);
}

.status-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
  animation: pulsePulse 2s infinite;
}

@keyframes pulsePulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 10px var(--color-success); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.workspace {
  background: var(--card-dark);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(16px);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.workspace:hover {
  border-color: var(--card-border-hover);
}

.workspace.compact {
  padding: 20px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-blue);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--text-primary);
  font-weight: 800;
}

h1 {
  font-size: clamp(1.6rem, 2.2vw, 2.25rem);
  line-height: 1.15;
}

h2 {
  font-size: 1.2rem;
  letter-spacing: 0.5px;
}

.subcopy,
.muted {
  color: var(--text-secondary);
}

.subcopy {
  max-width: 720px;
  margin: 8px 0 0;
  line-height: 1.5;
}

.muted {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.submit-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(300px, 380px);
  gap: 20px;
}

.submit-panel {
  align-content: end;
  align-items: flex-end;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  background: hsla(240, 10%, 97%, 0.4);
}

.submit-panel label:first-child {
  flex: 1 1 420px;
}

label {
  display: grid;
  gap: 8px;
  min-width: 180px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
}

input,
select {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: hsl(0, 0%, 100%);
  padding: 0 16px;
  color: var(--text-primary);
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01) inset;
}

input:hover,
select:hover {
  border-color: hsla(240, 8%, 80%, 1);
}

input:focus,
select:focus {
  border-color: var(--accent-blue);
  outline: none;
  box-shadow: 0 0 0 3px hsla(215, 95%, 50%, 0.12);
}

output {
  width: 100%;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 4px;
}

.score-card {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 20px;
  align-items: center;
  background: hsla(240, 10%, 97%, 0.4);
}

.score-ring {
  width: 112px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent-blue) 0% 193deg, hsla(240, 8%, 90%, 0.5) 193deg 360deg);
  color: var(--text-primary);
  font-size: 2.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 12px hsl(0, 0%, 100%), 0 4px 18px -4px hsla(215, 95%, 50%, 0.25);
  position: relative;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  min-height: 116px;
  display: grid;
  align-content: space-between;
  background: hsl(0, 0%, 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.01);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.metric:hover {
  transform: translateY(-2px);
  border-color: hsla(215, 95%, 50%, 0.3);
  box-shadow: 0 8px 24px -12px hsla(215, 95%, 50%, 0.4);
}

.metric strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.metric span {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: capitalize;
}

.meter {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: hsla(240, 5%, 84%, 0.3);
  margin-top: 8px;
}

.meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-gradient);
  box-shadow: 0 0 8px hsla(215, 95%, 50%, 0.3);
}

.fix-list {
  display: grid;
  gap: 12px;
}

.fix {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 4px 16px;
  align-items: start;
  background: hsl(0, 0%, 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.01);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.fix:hover {
  border-color: var(--card-border-hover);
  transform: translateX(4px);
}

.fix-rank {
  grid-row: span 2;
  width: 28px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: 0 2px 8px hsla(215, 95%, 50%, 0.3);
}

.fix strong {
  color: var(--text-primary);
  line-height: 1.3;
  font-size: 1rem;
}

.fix span:last-child {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Actions Group in section heading */
.actions-group {
  display: flex;
  gap: 10px;
}

#toggle-json,
#copy-json {
  min-height: 36px;
  padding: 0 16px;
  font-size: 0.85rem;
  border-radius: 8px;
  font-weight: 600;
}

#toggle-json {
  background: hsl(0, 0%, 100%);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

#toggle-json:hover {
  background: var(--soft);
  border-color: var(--card-border-hover);
}

#copy-json {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 8px hsla(215, 95%, 50%, 0.25);
}

#copy-json.copied {
  background: var(--color-success);
  box-shadow: 0 0 12px var(--color-success);
}

/* Terminal style preview window - remains Dark for high code legibility */
.terminal-window {
  border: 1px solid hsl(240, 10%, 15%);
  border-radius: 12px;
  background: hsl(240, 10%, 3%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  margin-top: 16px;
}

.terminal-header {
  background: hsl(240, 10%, 6%);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid hsl(240, 10%, 15%);
}

.terminal-header .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  display: inline-block;
}

.terminal-header .dot.red { background: #ff5f56; }
.terminal-header .dot.yellow { background: #ffbd2e; }
.terminal-header .dot.green { background: #27c93f; }

.terminal-title {
  margin-left: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: hsl(240, 5%, 50%);
}

.json-view {
  margin: 0;
  max-height: 400px;
  overflow: auto;
  border: none;
  border-radius: 0;
  background: transparent;
  color: hsl(210, 24%, 90%);
  padding: 20px 24px;
  font: 0.875rem/1.6 "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  scrollbar-width: thin;
  scrollbar-color: hsla(240, 5%, 84%, 0.15) transparent;
}

.json-view::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.json-view::-webkit-scrollbar-thumb {
  background: hsla(240, 5%, 84%, 0.15);
  border-radius: 3px;
}

.json-view::-webkit-scrollbar-thumb:hover {
  background: hsla(240, 5%, 84%, 0.3);
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .account-panel {
    justify-content: start;
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
    overflow-x: hidden;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 16px 20px;
    min-width: 0;
    overflow: hidden;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
    height: auto;
  }

  .brand {
    min-height: auto;
    padding: 4px 8px 12px;
    border-bottom: none;
  }

  .brand img {
    width: 120px;
  }

  .sidebar nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 0;
    width: 100%;
  }

  .sidebar a {
    text-align: center;
    min-width: 0;
    justify-content: center;
    padding: 10px;
    font-size: 0.85rem;
  }

  .sidebar a.active::before {
    display: none;
  }

  .submit-grid,
  .score-card {
    grid-template-columns: 1fr;
  }

  .section-heading {
    display: grid;
    gap: 12px;
  }
}

@media (max-width: 620px) {
  main {
    padding: 16px;
  }

  .topbar,
  .workspace {
    padding: 16px;
    width: 100%;
    max-width: 100%;
  }

  .sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .login-panel,
  .account-panel,
  .submit-panel {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .oauth-button,
  .ghost-button,
  .submit-panel button,
  label {
    width: 100%;
    min-width: 0;
  }

  .tenant-chip,
  .status-pill {
    width: fit-content;
    max-width: 100%;
    white-space: normal;
  }
}
