:root {
  color-scheme: light;
  font-family: Inter, system-ui, sans-serif;
  color: #131b2e;
  background: #faf8ff;
  --primary: #3525cd;
  --navy: #131b2e;
  --muted: #53586a;
  --surface: #ffffff;
  --soft: #f2f3ff;
  --success: #146c43;
  --shadow: 0 12px 32px rgba(19, 27, 46, .08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: #faf8ff; }
[hidden] { display: none !important; }
.login-view { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; background: #f2f3ff; }
.login-card { width: min(440px, 100%); padding: clamp(1.4rem, 5vw, 2.2rem); border: 1px solid rgba(199,196,216,.8); border-radius: 16px; background: white; box-shadow: var(--shadow); }
.login-mark { margin-bottom: 1.2rem; }
.login-card h1 { font-size: clamp(1.5rem, 6vw, 2rem); }
.login-card > p { margin: .65rem 0 1.4rem; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.login-button { width: 100%; margin-top: 1rem; }
.login-status { min-height: 1.3em; margin: .8rem 0 0 !important; color: #9f1c13 !important; font-weight: 700; }
.user-identity { max-width: 160px; overflow: hidden; color: var(--navy); font-size: .72rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
button, input, textarea { font: inherit; }
button { min-height: 44px; cursor: pointer; }
:focus-visible { outline: 3px solid #d33a3a; outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 30; padding: .75rem 1rem; background: var(--navy); color: white; }
.skip-link:focus { top: 1rem; }
.topbar { min-height: 74px; padding: .8rem max(1rem, calc((100vw - 1080px)/2)); display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--surface); border-bottom: 1px solid rgba(199,196,216,.75); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: .75rem; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--primary); color: white; font: 800 1.35rem "Plus Jakarta Sans"; }
.brand strong, .brand span { display: block; }
.brand strong { font-family: "Plus Jakarta Sans"; }
.brand div span { margin-top: .15rem; color: var(--muted); font-size: .75rem; }
.header-actions { display: flex; align-items: center; gap: .6rem; }
.save-status { color: var(--success); font-size: .76rem; font-weight: 700; }
.charter-workspace { width: min(1080px, 100%); margin: auto; padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 3rem; }
.intro-card, .brief-card, .charter-card { background: var(--surface); border: 1px solid rgba(199,196,216,.7); border-radius: 15px; }
.intro-card { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1.5rem; }
.brief-card { margin-top: 1rem; padding: 1.35rem; box-shadow: var(--shadow); }
.brief-heading { padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid #e4e2eb; }
.brief-heading p { margin: .35rem 0 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.brief-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .8rem; color: var(--muted); font-size: .72rem; }
.brief-footer > div { display: grid; gap: .15rem; text-align: right; }
.brief-footer strong { color: var(--text); font-size: .8rem; }
.generate-status { min-height: 1.2em; margin: .7rem 0 0; color: var(--primary); font-size: .75rem; font-weight: 700; }
.button-ai { min-width: 230px; background: var(--primary); color: white; }
.button-ai:disabled { cursor: wait; opacity: .7; }
.eyebrow { display: block; margin-bottom: .35rem; color: var(--primary); font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: "Plus Jakarta Sans", sans-serif; }
h1 { font-size: clamp(1.45rem, 3vw, 2rem); }
h2 { font-size: 1.15rem; }
.intro-card p { max-width: 720px; margin: .55rem 0 0; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.completion-box { min-width: 105px; padding: .85rem; border-radius: 11px; background: #e9e7ff; color: #2112a7; text-align: center; }
.completion-box strong, .completion-box span { display: block; }
.completion-box strong { font: 800 1.5rem "Plus Jakarta Sans"; }
.completion-box span { margin-top: .15rem; font-size: .68rem; font-weight: 700; }
.charter-form { display: grid; gap: 1rem; margin-top: 1rem; }
.charter-card { padding: 1.3rem; box-shadow: 0 2px 8px rgba(19,27,46,.04); }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid #e4e2eb; }
.heading-copy { display: flex; align-items: flex-start; gap: .8rem; }
.heading-copy p { margin: .28rem 0 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.step { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 9px; background: var(--primary); color: white; font-weight: 800; }
.problem-card .step { background: #b42318; }
.target-card .step { background: #996000; }
.benefit-card .step { background: #146c43; }
label { display: block; color: #343a4d; font-size: .78rem; font-weight: 700; }
input, textarea { width: 100%; margin-top: .45rem; border: 1px solid #92909f; border-radius: 9px; background: white; color: var(--navy); }
input { height: 48px; padding: 0 .9rem; }
textarea { min-height: 150px; padding: .9rem; resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #676b79; }
.copy-button { padding: .55rem .8rem; border: 1px solid #b9c2ef; border-radius: 8px; background: #edf0ff; color: #203b88; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.prompt-list { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .75rem; }
.prompt-list span { padding: .38rem .55rem; border-radius: 6px; background: var(--soft); border: 1px solid #d5d7e8; color: #343a4d; font-size: .7rem; font-weight: 700; }
.field-meta { display: flex; justify-content: space-between; gap: 1rem; margin-top: .65rem; color: var(--muted); font-size: .7rem; }
.title-rule { margin-top: .75rem; padding: .75rem; border: 1px solid #d5d7e8; border-radius: 8px; background: var(--soft); color: #343a4d; font-size: .72rem; line-height: 1.55; }
.validation-valid { color: var(--success); font-weight: 800; }
.validation-invalid { color: #9f1c13; font-weight: 800; }
input[aria-invalid="true"] { border-color: #b42318; }
.button { border: 1px solid transparent; border-radius: 9px; padding: .65rem .85rem; font-size: .74rem; font-weight: 800; }
.button-primary { background: var(--primary); color: white; }
.button-secondary { background: #edf0ff; border-color: #b9c2ef; color: #203b88; }
.button-quiet { background: white; border-color: #aaa8b7; color: #343a4d; }
.button-danger { background: #b42318; color: white; }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 30; max-width: min(380px, calc(100vw - 2rem)); padding: .8rem 1rem; border-radius: 9px; background: var(--navy); color: white; box-shadow: var(--shadow); opacity: 0; transform: translateY(16px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
dialog { width: min(450px, calc(100% - 2rem)); border: 0; border-radius: 14px; padding: 1.4rem; color: var(--navy); box-shadow: 0 24px 80px rgba(19,27,46,.25); }
dialog::backdrop { background: rgba(19,27,46,.55); }
dialog p { color: var(--muted); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; }
@media (max-width: 700px) {
  .topbar { position: static; align-items: flex-start; }
  .brand div span, .save-status { display: none; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .charter-workspace { padding: 1rem; }
  .intro-card { align-items: flex-start; gap: 1rem; }
  .card-heading { flex-direction: column; }
  .brief-footer { align-items: stretch; flex-direction: column; }
  .brief-footer > div { text-align: left; }
  .button-ai, .copy-button { width: 100%; }
  .toast { top: 1rem; bottom: auto; }
}
@media (max-width: 470px) {
  .topbar { flex-direction: column; }
  .header-actions { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
  .intro-card { flex-direction: column; }
  .completion-box { width: 100%; }
  .field-meta { flex-direction: column; gap: .3rem; }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
