:root {
  --bg: #23282c;
  --surface: #2b3035;
  --surface-raised: #30363b;
  --surface-soft: #353b40;
  --surface-input: #262c31;
  --text: #f2f6f4;
  --muted: #98a8a1;
  --muted-strong: #c3cec9;
  --line: #26343a;
  --line-soft: #1d2a30;
  --accent: #32d46d;
  --accent-strong: #20b85a;
  --accent-soft: rgba(50, 212, 109, 0.1);
  --warning: #e9bd54;
  --danger: #f17878;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --body: "Aptos", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --title: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(50, 212, 109, 0.025), transparent 17rem),
    var(--bg);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
}

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

.layout {
  width: min(1540px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

/* Header */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.7fr);
  gap: 28px;
  align-items: stretch;
  padding: 30px 32px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 10px;
  background: var(--accent);
  color: #06120a;
}

.brand-mark svg {
  width: 27px;
  height: 27px;
}

.brand-mark path:first-child {
  fill: currentColor;
  stroke: none;
}

.brand-mark path:not(:first-child) {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eyebrow,
.section-tag,
.site-label,
.context-kicker {
  display: block;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 760px;
  margin: 5px 0 0;
  font-family: var(--title);
  font-size: clamp(1.9rem, 2.7vw, 2.75rem);
  font-weight: 750;
  line-height: 1.04;
  letter-spacing: -0.025em;
}

.hero-copy > p {
  max-width: 830px;
  margin: 20px 0 0 64px;
  color: var(--muted-strong);
  font-size: 1rem;
}

.hero-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.hero-panel-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.hero-pill,
.version-badge,
.risk-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.hero-pill,
.version-badge {
  padding: 6px 9px;
}

.version-badge {
  color: var(--accent);
}

.hero-meta {
  display: grid;
  gap: 6px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Alerts */
.alert {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}

.alert-error {
  border: 1px solid rgba(241, 120, 120, 0.32);
  background: rgba(241, 120, 120, 0.08);
  color: #ffd0d0;
}

.is-hidden,
.is-context-hidden {
  display: none !important;
}

/* Workspace */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(420px, 0.78fr);
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.builder-shell {
  display: grid;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-builder {
  padding: 26px;
}

.panel-editor {
  padding: 18px 20px;
}

.panel-results {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 22px;
  scrollbar-width: thin;
  scrollbar-color: #36454b transparent;
}

.panel-header,
.mode-panel-header,
.site-card-head,
.submission-row,
.mode-strip,
.export-bar,
.context-block-head,
.site-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.panel-header-primary {
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-header h2,
.editor-details-summary h2,
.results-header h2 {
  margin: 4px 0 0;
  font-family: var(--title);
  font-size: 1.35rem;
  letter-spacing: -0.015em;
}

.panel-copy {
  max-width: 640px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-actions,
.tab-row,
.toggle-row,
.editor-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Inputs */
.context-block {
  margin-top: 22px;
}

.context-block-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  margin-top: 16px;
}

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

.field {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
}

.field-wide {
  grid-column: 1 / -1;
}

.field > span {
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.yaml-editor {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface-input);
  color: var(--text);
  padding: 10px 11px;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease;
}

.field input,
.field select {
  height: 42px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #64736d;
}

.field select {
  appearance: none;
  color-scheme: dark;
  padding-right: 36px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3 5l4 4 4-4' fill='none' stroke='%2398a8a1' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 11px center,
    var(--surface-input);
}

.field select option {
  background: #262c31;
  color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.yaml-editor:focus {
  border-color: rgba(50, 212, 109, 0.7);
  box-shadow: 0 0 0 3px rgba(50, 212, 109, 0.09);
  background-color: #2c3338;
}

.input-with-suffix {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-input);
  overflow: hidden;
}

.input-with-suffix:focus-within {
  border-color: rgba(50, 212, 109, 0.7);
  box-shadow: 0 0 0 3px rgba(50, 212, 109, 0.09);
}

.input-with-suffix input {
  border: 0;
  border-radius: 0;
  box-shadow: none !important;
  background: transparent;
}

.input-with-suffix > span {
  padding: 0 11px;
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.field textarea {
  resize: vertical;
}

/* Buttons */
.button,
.mode-tab {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 800;
}

.button:hover:not(:disabled),
.mode-tab:hover {
  border-color: #3a4a50;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.button-primary {
  min-height: 44px;
  padding-inline: 18px;
  background: var(--accent);
  color: #06120a;
}

.button-primary:hover:not(:disabled) {
  background: #3ce278;
  border-color: #3ce278;
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--text);
}

.button-ghost,
.button-pill {
  border-color: var(--line);
  background: transparent;
  color: var(--muted-strong);
}

.button-pill.is-active {
  border-color: rgba(50, 212, 109, 0.45);
  background: var(--accent-soft);
  color: var(--accent);
}

.button-compact {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 0.78rem;
}

.button-large {
  min-width: 170px;
}

/* Mode navigation */
.mode-strip {
  margin-top: 26px;
  padding: 20px 0 0;
  border-top: 1px solid var(--line-soft);
}

.mode-strip h3,
.mode-panel-header h3,
.site-card h3,
.dashboard-site h3 {
  margin: 4px 0 0;
  font-family: var(--title);
  letter-spacing: -0.01em;
}

.mode-strip h3 {
  font-size: 1.05rem;
}

.mode-tab {
  min-height: 38px;
  padding: 7px 11px;
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mode-tab.is-active {
  border-color: rgba(50, 212, 109, 0.45);
  background: var(--accent-soft);
  color: var(--accent);
}

.mode-panel {
  display: none;
  margin-top: 18px;
}

.mode-panel.is-active {
  display: block;
}

.mode-panel-header {
  align-items: flex-end;
  padding: 0 2px 12px;
}

.mode-panel-header h3 {
  font-size: 1.25rem;
}

.mode-panel-header p {
  max-width: 700px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.mode-form-card {
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: #282e33;
}

/* Site cards */
.site-stack {
  display: grid;
  gap: 14px;
}

.site-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #282e33;
  overflow: hidden;
}

.site-card-head {
  padding: 15px 17px;
  border-bottom: 1px solid var(--line-soft);
  background: #30363b;
}

.site-card h3 {
  font-size: 1.05rem;
}

.site-section {
  padding: 17px;
}

.site-section + .site-section {
  border-top: 1px solid var(--line-soft);
}

.site-section-head {
  margin-bottom: 12px;
}

.site-section-head span {
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.toggle-row {
  margin-top: 14px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

.toggle input {
  margin: 0;
  accent-color: var(--accent);
}

.advanced-panel {
  border-top: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.01);
}

.site-card > .advanced-panel {
  margin-top: 0;
  padding: 0;
}

.global-advanced {
  margin-top: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}

.advanced-panel summary {
  padding: 12px 14px;
  cursor: pointer;
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 800;
  user-select: none;
}

.advanced-panel[open] summary {
  border-bottom: 1px solid var(--line-soft);
}

.advanced-panel > .settings-grid {
  padding: 0 15px 15px;
}

/* Submission */
.submission-row {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}

.submission-row strong {
  display: block;
  font-size: 0.92rem;
}

.submission-hint {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

/* Editor */
.editor-details > summary,
.result-details > summary {
  list-style: none;
}

.editor-details > summary::-webkit-details-marker,
.result-details > summary::-webkit-details-marker {
  display: none;
}

.editor-details-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.editor-details[open] .editor-details-summary {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.editor-details-body {
  padding-top: 14px;
}

.editor-controls {
  align-items: flex-start;
  margin-bottom: 12px;
}

.editor-note {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-hint {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.yaml-editor {
  min-height: 480px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
}

/* Results */
.results-header {
  align-items: flex-start;
}

.export-bar {
  margin: 16px 0 0;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--line-soft);
}

.export-bar > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 14px;
}

.summary-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #282e33;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.summary-card strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-family: var(--title);
  font-size: 1.18rem;
  line-height: 1.2;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 5px;
  margin-top: 16px;
  padding: 22px;
  border: 1px dashed #34434a;
  border-radius: var(--radius-md);
  color: var(--muted);
  background: #262c31;
}

.empty-state-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 5px;
  border: 1px solid rgba(50, 212, 109, 0.3);
  border-radius: 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.76rem;
}

.empty-state strong {
  color: var(--muted-strong);
  font-size: 0.9rem;
}

.empty-state span {
  max-width: 360px;
  font-size: 0.82rem;
}

.results-section {
  margin-top: 18px;
}

.section-title {
  margin-bottom: 8px;
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-sites {
  display: grid;
  gap: 10px;
}

.dashboard-site {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #282e33;
}

.dashboard-site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-site h3 {
  font-size: 0.98rem;
}

.risk-pill {
  padding: 4px 7px;
  font-size: 0.66rem;
}

.risk-low,
.risk-compliant {
  border-color: rgba(50, 212, 109, 0.28);
  color: #74e79d;
  background: rgba(50, 212, 109, 0.07);
}

.risk-medium,
.risk-partial {
  border-color: rgba(233, 189, 84, 0.28);
  color: #efcc77;
  background: rgba(233, 189, 84, 0.07);
}

.risk-high,
.risk-critical,
.risk-non-compliant {
  border-color: rgba(241, 120, 120, 0.3);
  color: #f39a9a;
  background: rgba(241, 120, 120, 0.07);
}

.metric-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 12px 0 0;
  border-top: 1px solid var(--line-soft);
}

.metric-list div {
  min-width: 0;
  padding: 9px 8px 7px 0;
  border-bottom: 1px solid var(--line-soft);
}

.metric-list div:nth-child(even) {
  padding-left: 10px;
  border-left: 1px solid var(--line-soft);
}

.metric-list dt {
  color: var(--muted);
  font-size: 0.69rem;
}

.metric-list dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
}

.output-block {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: #262c31;
}

.output-human {
  padding: 13px 14px;
}

.output-human-title {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 800;
}

.output-human-list {
  display: grid;
  gap: 7px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}

.output-human-list li {
  position: relative;
  padding-left: 14px;
  color: var(--muted-strong);
  font-size: 0.79rem;
  line-height: 1.45;
}

.output-human-list li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.output-placeholder {
  color: var(--muted);
  font-size: 0.8rem;
}

.result-details {
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.result-details > summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.result-details[open] > summary {
  margin-bottom: 8px;
}

.output-json {
  max-height: 430px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  color: #cce6d8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 1260px) {
  .settings-grid-context {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.8fr);
  }
}

@media (max-width: 1050px) {
  .hero,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    padding: 20px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .panel-results {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 14px;
  }

  .layout {
    width: min(100% - 20px, 1540px);
    padding-top: 10px;
  }

  .hero {
    padding: 20px;
  }

  .brand-row {
    flex-direction: column;
    gap: 14px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .hero-copy > p {
    margin-left: 0;
  }

  .panel-builder,
  .panel-results {
    padding: 18px;
  }

  .settings-grid,
  .settings-grid-context,
  .metric-list,
  .summary-cards {
    grid-template-columns: 1fr;
  }

  .metric-list div:nth-child(even) {
    padding-left: 0;
    border-left: 0;
  }

  .panel-header,
  .mode-panel-header,
  .mode-strip,
  .submission-row,
  .site-card-head,
  .export-bar,
  .editor-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .tab-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .mode-tab {
    width: 100%;
  }

  .button-large {
    width: 100%;
  }

  .hero-panel-top {
    align-items: flex-start;
  }
}

.product-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 14px 2px 4px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .product-footer {
    display: grid;
    gap: 4px;
  }
}
