:root {
  --ink: #142033;
  --ink-soft: #4c5a6f;
  --navy: #25164d;
  --navy-2: #3c2572;
  --teal: #7756e8;
  --teal-dark: #5f3fd1;
  --teal-pale: #f2eeff;
  --blue-pale: #f6f3ff;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --line: #dfe6ee;
  --success: #18794e;
  --success-pale: #e8f7ef;
  --warning: #a05a00;
  --warning-pale: #fff2dc;
  --danger: #b4232e;
  --danger-pale: #fff0f1;
  --purple: #7756e8;
  --shadow: 0 18px 55px rgba(37, 22, 77, 0.09);
  --radius: 18px;
  --radius-small: 12px;
  --shell: 1180px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); line-height: 1.55; }
button, input, textarea { font: inherit; }
a { color: inherit; }
img { max-width: 100%; }
code { padding: .12em .4em; border-radius: 6px; background: var(--blue-pale); }

.shell { width: min(var(--shell), calc(100% - 36px)); margin-inline: auto; }
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 999; padding: 12px 16px; background: white; border-radius: 10px; }
.skip-link:focus { top: 12px; }

.pilot-banner { min-height: 38px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 18px; color: #563300; background: #ffe6a8; border-bottom: 1px solid #edc15b; font-size: .84rem; text-align: center; }
.pilot-banner strong { text-transform: uppercase; letter-spacing: .08em; }

.app-header { position: sticky; top: 0; z-index: 40; color: white; background: rgba(37, 22, 77, .96); backdrop-filter: blur(18px); box-shadow: 0 8px 26px rgba(37,22,77,.18); }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.app-brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.app-brand img { flex: 0 0 auto; }
.app-brand span { display: grid; line-height: 1.15; }
.app-brand strong { font-size: 1.08rem; letter-spacing: .01em; }
.app-brand small { margin-top: 4px; color: #d9d0ff; font-size: .72rem; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.user-chip { color: #ece8ff; font-size: .9rem; }
.text-link { color: #ece8ff; text-decoration: none; font-weight: 700; font-size: .9rem; }
.text-link:hover { color: white; }
.header-actions form { margin: 0; }

.app-main { min-height: calc(100vh - 150px); padding-block: 48px 78px; }
.app-footer { border-top: 1px solid var(--line); background: white; }
.footer-inner { min-height: 70px; display: flex; justify-content: space-between; align-items: center; gap: 20px; font-size: .84rem; }
.muted { color: var(--ink-soft); }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(2rem, 5vw, 3.7rem); line-height: 1.04; letter-spacing: -.035em; }
h2 { margin-bottom: 8px; font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.15; letter-spacing: -.02em; }
h3 { margin-bottom: 6px; }
.eyebrow { display: inline-block; margin-bottom: 10px; color: var(--teal-dark); text-transform: uppercase; letter-spacing: .13em; font-size: .73rem; font-weight: 850; }

.button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 12px; padding: 10px 16px; text-decoration: none; font-weight: 800; cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(119,86,232,.28); outline-offset: 2px; }
.button:disabled { opacity: .52; cursor: not-allowed; }
.button-primary { color: white; background: var(--teal); box-shadow: 0 8px 24px rgba(119,86,232,.22); }
.button-primary:hover:not(:disabled) { background: var(--teal-dark); }
.button-secondary { color: var(--navy); border-color: #bfd0df; background: white; }
.button-secondary:hover:not(:disabled) { border-color: var(--teal); }
.button-ghost { color: inherit; border-color: rgba(255,255,255,.35); background: transparent; }
.app-main .button-ghost { border-color: var(--line); background: white; }
.button-small { min-height: 36px; padding: 7px 11px; font-size: .84rem; }
.button-wide { width: 100%; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; margin-bottom: 34px; }
.page-head > div:first-child { max-width: 760px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; }
.page-head p { margin-bottom: 0; color: var(--ink-soft); font-size: 1.04rem; }
.page-head.compact { align-items: center; }
.page-head.compact h1 { margin-bottom: 8px; font-size: clamp(2rem,4vw,3rem); }
.attention-card { min-width: 240px; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid #f0c884; border-radius: 16px; background: var(--warning-pale); }
.attention-card strong { font-size: 2rem; color: var(--warning); }
.attention-card span { font-weight: 750; line-height: 1.25; }

.messages { margin-top: 18px; }
.message { padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 8px 24px rgba(37,22,77,.05); }
.message + .message { margin-top: 8px; }
.message-success { border-color: #b7dec8; background: var(--success-pale); color: #0d5b38; }
.message-error { border-color: #efb9be; background: var(--danger-pale); color: #8c1d26; }
.message-warning { border-color: #f0c884; background: var(--warning-pale); color: #7a4400; }
.message.large { padding: 24px; }
.field-error { color: var(--danger); font-size: .86rem; font-weight: 700; }
.field-help { color: var(--ink-soft); font-size: .8rem; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--blue-pale); cursor: pointer; }
.checkbox-row input { width: auto; margin-top: 4px; }
.checkbox-row span { font-weight: 650; line-height: 1.45; }

.auth-layout { min-height: 620px; display: grid; grid-template-columns: minmax(0,1.25fr) minmax(340px,.75fr); align-items: center; gap: clamp(40px,8vw,110px); }
.auth-copy h1 { max-width: 750px; font-size: clamp(3rem,7vw,6rem); }
.auth-copy > p { max-width: 700px; color: var(--ink-soft); font-size: 1.18rem; }
.trust-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.trust-row span { padding: 9px 12px; border: 1px solid #c7d9e8; border-radius: 999px; background: white; color: var(--navy); font-weight: 750; font-size: .86rem; }
.auth-panel { padding: clamp(25px,5vw,40px); }
.panel-head { margin-bottom: 24px; }
.panel-head p { margin-bottom: 0; }
.form-stack { display: grid; gap: 12px; }
.form-stack label { margin-top: 4px; font-weight: 800; font-size: .91rem; }
.form-stack input, .form-stack textarea, .form-stack select { width: 100%; border: 1px solid #bac8d6; border-radius: 12px; padding: 13px 14px; color: var(--ink); background: white; }
.form-stack textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
.form-stack input:hover, .form-stack textarea:hover, .form-stack select:hover { border-color: #86a1b7; }
.microcopy { margin: 18px 0 0; color: var(--ink-soft); font-size: .79rem; text-align: center; }

.service-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 22px; }
.service-card { position: relative; overflow: hidden; min-height: 340px; display: flex; flex-direction: column; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.service-card::after { content: ""; position: absolute; right: -70px; top: -90px; width: 190px; height: 190px; border-radius: 50%; background: radial-gradient(circle, rgba(119,86,232,.12), rgba(119,86,232,0)); pointer-events: none; }
.service-card-muted { background: #f9fbfd; box-shadow: none; }
.service-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.service-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; color: white; background: linear-gradient(135deg,var(--navy),var(--teal)); font-weight: 900; font-size: 1.2rem; }
.service-card h2 { font-size: 1.8rem; }
.service-card .domain { color: var(--ink-soft); font-weight: 650; }
.service-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: auto; padding-top: 26px; color: var(--ink-soft); font-size: .86rem; }
.card-actions { display: flex; gap: 10px; margin-top: 20px; }
.card-actions .button { flex: 1; }
.status-dot { display: inline-flex; align-items: center; gap: 7px; font-weight: 780; font-size: .86rem; }
.status-dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #8793a2; box-shadow: 0 0 0 4px rgba(135,147,162,.12); }
.status-online::before, .status-published::before, .status-succeeded::before { background: var(--success); box-shadow: 0 0 0 4px rgba(24,121,78,.12); }
.status-maintenance::before, .status-migration::before { background: var(--warning); }

.pill { display: inline-flex; align-items: center; border: 1px solid #d5dee7; border-radius: 999px; padding: 5px 9px; background: #f8fafc; color: #526176; font-size: .74rem; font-weight: 800; }
.pill-alert { border-color: #efc881; background: var(--warning-pale); color: #7e4800; }
.pill-success { border-color: #b7dec8; background: var(--success-pale); color: #0d5b38; }

.section-block { margin-top: 48px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 22px; margin-bottom: 16px; }
.section-head h2 { margin-bottom: 0; }
.section-head p { margin-bottom: 3px; }
.list-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 12px 38px rgba(37,22,77,.06); }
.history-row { min-height: 72px; display: flex; align-items: center; gap: 15px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
a.history-row:hover { background: #f8fbfd; }
.history-row:last-child { border-bottom: 0; }
.history-icon { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 5px var(--teal-pale); }
.history-main { min-width: 0; display: grid; flex: 1; }
.history-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-main small { margin-top: 3px; color: var(--ink-soft); }
.empty-row, .empty-state { padding: 30px; color: var(--ink-soft); text-align: center; }
.release-number { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; background: var(--blue-pale); color: var(--navy); font-weight: 900; }

.status-badge { display: inline-flex; width: fit-content; align-items: center; border: 1px solid #d7e0e8; border-radius: 999px; padding: 6px 10px; background: #f8fafc; color: #526176; font-size: .75rem; font-weight: 850; white-space: nowrap; }
.status-preview_ready { border-color: #9bd4d8; background: var(--teal-pale); color: #075d66; }
.status-published { border-color: #b7dec8; background: var(--success-pale); color: #0d5b38; }
.status-failed, .status-discarded { border-color: #efb9be; background: var(--danger-pale); color: #8c1d26; }
.status-running, .status-testing, .status-deploying, .status-approved, .status-revision_requested, .status-queued, .status-requested { border-color: #d7c4f4; background: #f4effd; color: #57358f; }

.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 28px; color: var(--ink-soft); font-size: .86rem; }
.breadcrumbs a { color: var(--teal-dark); font-weight: 750; text-decoration: none; }
.summary-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.summary-card { display: grid; gap: 7px; padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.summary-card > span:first-child { color: var(--ink-soft); font-size: .78rem; font-weight: 750; }

.form-layout { display: grid; grid-template-columns: minmax(0,.9fr) minmax(420px,1.1fr); align-items: start; gap: clamp(38px,8vw,100px); }
.form-layout > div:first-child { position: sticky; top: 118px; }
.form-layout > div:first-child p { max-width: 650px; color: var(--ink-soft); font-size: 1.08rem; }
.form-panel { padding: clamp(24px,4vw,38px); }
.example-box { display: grid; gap: 9px; margin-top: 28px; padding: 18px; border: 1px solid #cfe2eb; border-radius: 15px; background: var(--blue-pale); }
.example-prompt { border: 0; border-radius: 10px; padding: 10px 12px; color: var(--navy); background: white; text-align: left; cursor: pointer; }
.example-prompt:hover { box-shadow: 0 5px 16px rgba(37,22,77,.08); }
.safety-note { display: flex; gap: 11px; padding: 14px; border: 1px solid #b7dec8; border-radius: 12px; background: var(--success-pale); color: #155f3e; }
.safety-note > span { width: 26px; height: 26px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: white; font-weight: 900; }
.safety-note p { margin: 0; font-size: .86rem; }
.migration-steps p { display: flex; align-items: center; gap: 10px; margin: 0; }
.migration-steps p span { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: white; background: var(--teal); font-size: .75rem; font-weight: 900; }
.warning-list { padding: 12px 22px; }
.warning-list p { display: flex; gap: 11px; margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
.warning-list p:last-child { border-bottom: 0; }
.warning-list p span { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #7a4400; background: var(--warning-pale); font-weight: 900; }
.next-step-card { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-top: 28px; padding: clamp(24px,4vw,38px); }
.next-step-card > div { max-width: 760px; }
.next-step-card p { margin-bottom: 0; color: var(--ink-soft); }
.status-ready { border-color: #b7dec8; background: var(--success-pale); color: #0d5b38; }

.workflow-steps { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 30px; }
.step { position: relative; display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: white; color: #8793a2; font-size: .82rem; }
.step span { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: #eef1f5; font-weight: 850; }
.step-done { border-color: #a8d4d7; color: var(--navy); background: var(--teal-pale); }
.step-done span { color: white; background: var(--teal); }
.preview-section { margin-top: 8px; }
.preview-frame-wrap { overflow: hidden; border: 1px solid #c9d5e0; border-radius: 18px; background: white; box-shadow: var(--shadow); }
.preview-frame { width: 100%; height: min(680px,72vh); display: block; border: 0; background: white; }
.decision-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-top: 18px; }
.decision-grid > form { display: flex; }
.decision-card { width: 100%; min-height: 155px; display: grid; align-content: center; justify-items: start; gap: 5px; border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: white; color: var(--ink); text-align: left; cursor: pointer; }
button.decision-card:hover, details.decision-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(37,22,77,.09); }
.decision-card > span, .decision-card summary > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font-size: 1.2rem; font-weight: 900; }
.decision-card strong { font-size: .98rem; }
.decision-card small { color: var(--ink-soft); line-height: 1.35; }
.decision-approve { border-color: #a7d7bb; background: var(--success-pale); }
.decision-approve > span { color: white; background: var(--success); }
.decision-revise { padding: 0; border-color: #bcd7e8; background: var(--blue-pale); }
.decision-revise summary { min-height: 155px; display: grid; align-content: center; gap: 5px; padding: 18px; list-style: none; }
.decision-revise summary::-webkit-details-marker { display: none; }
.decision-revise summary > span { color: white; background: var(--teal); }
.decision-revise[open] { grid-column: span 2; }
.decision-revise[open] summary { min-height: auto; border-bottom: 1px solid #cbdbe8; }
.compact-form { padding: 18px; }
.compact-form textarea { min-height: 110px; }
.decision-discard { border-color: #e6c1c5; background: var(--danger-pale); }
.decision-discard > span { color: white; background: var(--danger); }
.processing-card, .success-hero { display: flex; align-items: center; gap: 24px; padding: clamp(24px,5vw,44px); }
.processing-card h2, .success-hero h2 { margin-bottom: 8px; }
.processing-card p, .success-hero p { margin-bottom: 0; color: var(--ink-soft); }
.spinner { width: 48px; height: 48px; flex: 0 0 auto; border: 5px solid #d8e7ec; border-top-color: var(--teal); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.success-icon { width: 58px; height: 58px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: white; background: var(--success); font-size: 1.8rem; font-weight: 900; }
.check-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.check-item { display: grid; grid-template-columns: auto 1fr; column-gap: 9px; padding: 15px; border: 1px solid #cce4d6; border-radius: 13px; background: var(--success-pale); }
.check-item > span { grid-row: span 2; color: var(--success); font-weight: 900; }
.check-item small { color: #3e6952; }
.conversation { display: grid; gap: 12px; }
.message-bubble { max-width: 82%; padding: 15px 17px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 7px 20px rgba(37,22,77,.04); }
.message-bubble > div { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-soft); font-size: .76rem; }
.message-bubble p { margin: 8px 0 0; }
.message-kind-customer { justify-self: end; border-color: #a9d9dd; background: var(--teal-pale); }
.message-kind-agent { border-color: #d7c4f4; background: #f7f2ff; }
.message-kind-review { border-color: #b7dec8; background: var(--success-pale); }
.prose-panel { max-width: 860px; margin-inline: auto; padding: clamp(24px,5vw,48px); }
.prose-panel h2 { margin-top: 30px; font-size: 1.2rem; }
.prose-panel p { color: var(--ink-soft); line-height: 1.75; }
.prose-panel a { color: var(--teal); }
.app-footer a { color: inherit; }

@media (max-width: 920px) {
  .pilot-banner { display: grid; gap: 1px; }
  .auth-layout, .form-layout { grid-template-columns: 1fr; }
  .auth-layout { padding-top: 24px; }
  .auth-copy h1 { font-size: clamp(2.8rem,11vw,5rem); }
  .form-layout > div:first-child { position: static; }
  .service-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .decision-grid { grid-template-columns: 1fr; }
  .decision-revise[open] { grid-column: auto; }
  .check-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 24px, var(--shell)); }
  .app-main { padding-block: 30px 58px; }
  .header-inner { min-height: 64px; }
  .app-brand small, .hide-mobile { display: none; }
  .page-head { display: grid; align-items: start; gap: 16px; }
  .page-actions { width: 100%; display: grid; justify-content: stretch; }
  .page-actions .button { width: 100%; }
  .next-step-card { display: grid; }
  .page-head .button { width: 100%; }
  .attention-card { min-width: 0; }
  .service-card { min-height: 320px; padding: 22px; }
  .card-actions { display: grid; }
  .footer-inner { min-height: 80px; display: grid; justify-content: start; align-content: center; gap: 3px; }
  .history-row { align-items: flex-start; flex-wrap: wrap; }
  .history-main { width: calc(100% - 30px); }
  .status-badge { margin-left: 25px; }
  .release-row .status-badge, .release-row form { margin-left: 57px; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .section-head .button { width: 100%; }
  .workflow-steps { grid-template-columns: 1fr 1fr; }
  .step { padding: 10px; }
  .preview-frame { height: 58vh; }
  .check-grid { grid-template-columns: 1fr; }
  .message-bubble { max-width: 95%; }
  .message-bubble > div { display: grid; gap: 2px; }
  .processing-card, .success-hero { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
