:root {
  --ink: #153243;
  --navy: #234d63;
  --teal: #116d68;
  --aqua: #79dfd1;
  --sky: #e9faf7;
  --mist: #f5fafb;
  --paper: #ffffff;
  --line: #d4e7e9;
  --muted: #58717c;
  --amber: #fff4dc;
  --shadow: 0 12px 36px rgba(35, 77, 99, .08);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--mist);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
}

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid #edb95d;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: -5rem;
  left: 1rem;
  z-index: 100;
  padding: .7rem 1rem;
  border-radius: 9px;
  background: white;
}

.skip-link:focus {
  top: 1rem;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.35rem 1rem;
  border-right: 1px solid var(--line);
  background: #e7f4f5;
}

.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .3rem .5rem 1.8rem;
  color: var(--navy);
  font-size: 1.08rem;
  font-weight: 800;
  text-decoration: none;
}

.brand small {
  display: block;
  margin-top: .1rem;
  color: var(--muted);
  font-size: .65rem;
  font-weight: 600;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50% 50% 50% 12%;
  background: var(--aqua);
  color: var(--navy);
  font-weight: 900;
  transform: rotate(-8deg);
}

.sidebar nav {
  display: grid;
  gap: .25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .75rem .8rem;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #45636e;
  text-align: left;
  font-weight: 700;
}

.nav-item:hover,
.nav-item.active {
  background: white;
  color: var(--navy);
  box-shadow: 0 4px 16px rgba(35, 77, 99, .06);
}

.nav-item > span {
  width: 1.25rem;
  text-align: center;
}

.security-status {
  position: absolute;
  right: 1rem;
  bottom: 1.25rem;
  left: 1rem;
  padding: 1rem;
  border: 1px solid #c6e3e2;
  border-radius: 13px;
  background: rgba(255, 255, 255, .72);
}

.security-status p {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0;
  font-size: .78rem;
}

.security-status small {
  display: block;
  margin: .4rem 0 0 1.1rem;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.5;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #24a779;
  box-shadow: 0 0 0 4px #d9f4e9;
}

main {
  min-width: 0;
}

.topbar {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2.2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
}

.topbar > div {
  display: grid;
}

.topbar small {
  color: var(--muted);
  font-size: .75rem;
}

.environment {
  padding: .4rem .65rem;
  border-radius: 999px;
  background: var(--sky);
  color: var(--teal);
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .06em;
}

.workspace {
  width: min(1380px, 100%);
  margin: auto;
  padding: clamp(1rem, 2.5vw, 2rem);
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.3rem;
}

.intro > div:first-child {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 .35rem;
  color: var(--teal);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -.04em;
}

.intro p:not(.eyebrow) {
  margin: .65rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.privacy-badge {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .75rem .9rem;
  border: 1px solid #b9dddd;
  border-radius: 12px;
  background: var(--sky);
  color: #315b66;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(300px, .72fr) minmax(0, 1.45fr);
  gap: 1.2rem;
  align-items: start;
}

.panel,
.source-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.search-panel {
  position: sticky;
  top: 92px;
  padding: 1.35rem;
}

.panel-heading {
  margin-bottom: 1.2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2,
.results-heading h2,
.source-panel h2 {
  margin: 0;
  font-size: 1.35rem;
}

.panel-heading > p:last-child,
.section-heading > div > p:last-child {
  margin: .3rem 0 0;
  color: var(--muted);
  font-size: .82rem;
}

form {
  display: grid;
  gap: .9rem;
}

.field {
  display: grid;
  gap: .35rem;
}

.field label {
  font-size: .8rem;
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: .76rem .85rem;
  border: 1px solid #b9ced2;
  border-radius: 10px;
  background: white;
  color: var(--ink);
}

.field textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.55;
}

.safe-check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .55rem;
  align-items: start;
  padding: .75rem;
  border-radius: 10px;
  background: var(--sky);
  color: #315b66;
  font-size: .75rem;
  line-height: 1.45;
}

.safe-check input {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  accent-color: var(--teal);
}

.primary-button {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: .75rem 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--aqua);
  color: var(--ink);
  font-weight: 800;
}

.primary-button:hover {
  background: #61d5c6;
}

.primary-button:disabled {
  cursor: wait;
  opacity: .6;
}

.results-panel {
  min-height: 630px;
  padding: 1.35rem;
}

.results-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.result-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: .4rem;
}

.result-badges span {
  padding: .32rem .55rem;
  border-radius: 999px;
  background: var(--sky);
  color: #315b66;
  font-size: .68rem;
  font-weight: 800;
}

.analysis-note {
  display: flex;
  gap: .7rem;
  margin: 1rem 0;
  padding: .85rem;
  border: 1px solid #bee3dd;
  border-radius: 12px;
  background: #effbf8;
}

.analysis-note > span {
  display: grid;
  flex: 0 0 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  background: var(--aqua);
  font-weight: 900;
}

.analysis-note strong {
  font-size: .84rem;
}

.analysis-note p {
  margin: .15rem 0 0;
  color: var(--muted);
  font-size: .78rem;
}

#status {
  color: var(--muted);
  font-size: .85rem;
}

#response {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  line-height: 1.75;
}

#response:not(:empty) {
  margin-top: 1rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--mist);
}

.empty-result {
  display: grid;
  min-height: 290px;
  place-content: center;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.empty-result strong {
  color: var(--ink);
}

.empty-result p {
  margin: .35rem 0 0;
  font-size: .85rem;
}

.disclaimer {
  margin: 1rem 0 0;
  padding: .8rem;
  border-radius: 10px;
  background: var(--amber);
  color: #66552f;
  font-size: .73rem;
}

.source-panel {
  margin-bottom: 1.2rem;
  padding: 1.2rem;
}

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

.close-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--navy);
}

.connector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .7rem;
}

.connector {
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--mist);
}

.connector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.connector h3 {
  margin: 0;
  font-size: .88rem;
}

.connector p {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .73rem;
}

.connector code {
  display: block;
  overflow: hidden;
  margin-top: .55rem;
  color: #41616d;
  font-size: .67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-state {
  padding: .25rem .45rem;
  border-radius: 999px;
  background: #fff0d5;
  color: #725216;
  font-size: .6rem;
  font-weight: 800;
  white-space: nowrap;
}

.security-note {
  margin: .85rem 0 0;
  color: var(--muted);
  font-size: .72rem;
}

.security-note strong {
  color: var(--ink);
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .sidebar {
    padding: 1.2rem .65rem;
  }

  .brand {
    justify-content: center;
    padding-inline: 0;
  }

  .brand > span:last-child,
  .security-status,
  .nav-item {
    font-size: 0;
  }

  .nav-item {
    justify-content: center;
  }

  .nav-item > span {
    font-size: 1rem;
  }

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

  .search-panel {
    position: static;
  }

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

@media (max-width: 700px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    display: flex;
    width: 100%;
    height: auto;
    align-items: center;
    padding: .55rem .7rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    margin-right: auto;
    padding: 0;
  }

  .brand > span:last-child {
    display: block;
    font-size: .9rem;
  }

  .brand small {
    display: none;
  }

  .sidebar nav {
    display: flex;
  }

  .nav-item {
    width: 42px;
    height: 42px;
    padding: 0;
  }

  .nav-item:nth-child(2),
  .nav-item:nth-child(3) {
    display: none;
  }

  .topbar {
    min-height: 60px;
  }

  .environment {
    display: none;
  }

  .workspace {
    padding: 1rem;
  }

  .intro,
  .results-heading {
    align-items: start;
    flex-direction: column;
  }

  .privacy-badge {
    width: 100%;
  }

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

  .result-badges {
    justify-content: start;
  }

  .results-panel {
    min-height: 480px;
  }
}
