:root {
  color-scheme: dark;
  --bg: #080b10;
  --panel: #11161e;
  --panel-soft: #171e28;
  --line: #28313d;
  --text: #f4f7fb;
  --muted: #94a0ae;
  --blue: #6b8cff;
  --blue-soft: rgba(107, 140, 255, 0.13);
  --orange: #ff9d5c;
  --green: #72d6aa;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 75% -20%, #17223a 0, var(--bg) 38%); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.hero { max-width: 1240px; margin: 0 auto; padding: 72px 24px 42px; display: flex; align-items: end; justify-content: space-between; gap: 32px; }
.hero-copy { max-width: 780px; }
.eyebrow, .section-kicker { margin: 0 0 10px; color: var(--blue); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; }
h1 { margin: 0; font-size: clamp(3rem, 7vw, 6.8rem); line-height: 0.93; letter-spacing: -0.065em; }
.lede { max-width: 680px; margin: 28px 0 0; color: var(--muted); font-size: 1.16rem; line-height: 1.65; }
.primary-button { border: 0; border-radius: 999px; padding: 15px 24px; background: var(--blue); color: white; font-weight: 800; cursor: pointer; box-shadow: 0 14px 40px rgba(107, 140, 255, 0.25); }
.primary-button:hover { filter: brightness(1.1); transform: translateY(-1px); }

main { max-width: 1240px; margin: 0 auto; padding: 0 24px 72px; }
.phase-tabs { margin: 0 0 24px; display: flex; gap: 8px; border-bottom: 1px solid var(--line); }
.phase-tab { padding: 15px 19px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-weight: 800; }
.phase-tab span { margin-left: 8px; font-size: 0.72rem; font-weight: 600; }
.phase-tab.active { border-bottom-color: var(--blue); color: var(--text); }
.phase-content { display: none; }
.phase-content.active { display: block; }
.panel { border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(145deg, rgba(23, 30, 40, 0.94), rgba(13, 17, 24, 0.96)); box-shadow: 0 22px 70px rgba(0, 0, 0, 0.22); }
.controls-panel { padding: 25px; display: grid; grid-template-columns: 210px 1fr; gap: 32px; align-items: center; }
h2 { margin: 0; font-size: 1.35rem; }
.controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
input[type="number"] { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #0b1017; color: var(--text); }
.wide-label { grid-column: 1 / -1; }
.wide-label span { display: flex; align-items: center; gap: 14px; }
input[type="range"] { width: 100%; accent-color: var(--blue); }
output { min-width: 48px; color: var(--text); font-size: 0.95rem; }

.pipeline { position: relative; margin: 30px 0; padding: 34px 20px 54px; display: grid; grid-template-columns: 1fr auto 1fr auto 1.35fr auto 1fr auto 1fr; align-items: center; gap: 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stage { min-height: 116px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.stage span { color: var(--muted); font-size: 0.7rem; font-weight: 800; }
.stage strong { font-size: 1rem; }
.stage small { color: var(--muted); }
.accent-stage { border-color: rgba(107, 140, 255, 0.5); background: var(--blue-soft); }
.warning-stage { border-color: rgba(255, 157, 92, 0.45); }
.arrow { color: var(--muted); font-size: 1.3rem; }
.rework-loop { position: absolute; left: 46%; bottom: 16px; color: var(--orange); font-size: 0.72rem; }
.insight { margin: 22px 0; padding: 18px 22px; border-left: 3px solid var(--green); background: rgba(114, 214, 170, 0.08); color: #c7f3df; line-height: 1.5; }

.metrics-grid { margin: 22px 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.metric-label { color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.metric-value { display: block; margin-top: 10px; font-size: 1.65rem; font-weight: 800; }
.metric-change { display: block; margin-top: 5px; color: var(--green); font-size: 0.75rem; }
.metric-change.negative { color: var(--orange); }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chart-card { padding: 24px; overflow: hidden; }
.chart-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.legend { color: var(--muted); font-size: 0.7rem; display: flex; align-items: center; gap: 6px; }
.blue-dot, .orange-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.orange-dot { margin-left: 8px; background: var(--orange); }
canvas { display: block; width: 100%; height: auto; margin-top: 16px; }
.phase-two-header { padding: 24px 2px 30px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.phase-two-header h2 { font-size: 2.3rem; letter-spacing: -0.04em; }
.phase-two-header p:not(.section-kicker), .jira-status p, .phase-two-actions p { margin: 8px 0 0; color: var(--muted); }
.secondary-button { border: 1px solid var(--line); border-radius: 999px; padding: 13px 20px; background: var(--panel-soft); color: var(--text); font-weight: 800; cursor: pointer; }
.jira-status { padding: 20px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.status-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--blue); font-weight: 900; }
.status-pill { padding: 7px 11px; border-radius: 999px; background: var(--blue-soft); color: #a9baff; font-size: 0.7rem; font-weight: 800; }
.status-pill.connected { background: rgba(114, 214, 170, 0.12); color: var(--green); }
.status-pill.error { background: rgba(255, 157, 92, 0.12); color: var(--orange); }
.teams-grid { margin: 18px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.team-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.team-card-header { margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; }
.team-badge { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--blue-soft); color: #a9baff; font-weight: 900; }
.remove-team { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.team-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.team-fields .full { grid-column: 1 / -1; }
.team-fields input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #0b1017; color: var(--text); }
.phase-two-actions { padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.save-message { min-height: 24px; color: var(--green); text-align: right; }
.auth-panel, .import-panel { margin-top: 18px; padding: 22px; }
.auth-panel { display: grid; grid-template-columns: 1fr auto; gap: 16px 24px; align-items: center; }
.auth-panel p, .import-panel p { margin: 7px 0 0; color: var(--muted); }
.login-form, .account-view, .import-controls { display: flex; align-items: center; gap: 12px; }
.login-form input { min-width: 280px; border: 1px solid var(--line); border-radius: 999px; padding: 13px 17px; background: #0b1017; color: var(--text); }
.inline-message { grid-column: 1 / -1; min-height: 20px; }
.import-panel { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px 24px; }
.import-controls input { max-width: 320px; color: var(--muted); }
footer { padding: 30px 24px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 0.78rem; }

@media (max-width: 850px) {
  .hero { padding-top: 42px; align-items: start; flex-direction: column; }
  .controls-panel { grid-template-columns: 1fr; }
  .controls { grid-template-columns: 1fr 1fr; }
  .pipeline { grid-template-columns: 1fr; }
  .arrow { transform: rotate(90deg); text-align: center; }
  .rework-loop { position: static; grid-column: 1; text-align: center; }
  .metrics-grid, .charts-grid, .teams-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .controls, .metrics-grid, .charts-grid, .teams-grid { grid-template-columns: 1fr; }
  .wide-label { grid-column: auto; }
  h1 { font-size: 3.5rem; }
  .phase-tab span { display: none; }
  .phase-two-header, .phase-two-actions { align-items: stretch; flex-direction: column; }
  .auth-panel, .import-panel { grid-template-columns: 1fr; }
  .login-form, .account-view, .import-controls { align-items: stretch; flex-direction: column; }
  .login-form input { min-width: 0; width: 100%; }
}
