@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --ink: #172235;
  --muted: #66748a;
  --muted-2: #8792a3;
  --line: #e3e8ef;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --blue: #245fce;
  --blue-dark: #194ba8;
  --blue-soft: #edf4ff;
  --navy: #101827;
  --green: #b68a36;
  --red: #bd4b4b;
  --shadow: 0 8px 28px rgba(22, 35, 53, .055);
}
* { box-sizing: border-box; }
html { background: var(--canvas); scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.55; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { height: 66px; display:flex; align-items:center; justify-content:space-between; padding:0 max(24px, calc((100vw - 1180px)/2)); background:var(--navy); color:#fff; }
.brand { display:flex; align-items:center; gap:11px; color:#fff; font-family:Manrope,sans-serif; font-weight:800; letter-spacing:-.02em; }
.brand:hover { text-decoration:none; }
.brand-mark { width:36px; height:36px; display:grid; place-items:center; border-radius:8px; background:#2867D8; color:#fff; font-family:serif; font-size:23px; font-weight:700; line-height:1; box-shadow:0 3px 10px rgba(40,103,216,.22); }
.brand-light { color:#aeb9c9; font-weight:500; }
.top-note { color:#b9c4d3; font-size:12px; }
.shell { max-width:1180px; margin:0 auto; padding:54px 24px 72px; }
.intro { max-width:760px; margin:0 0 40px; }
.eyebrow { margin:0 0 12px; color:var(--blue); font-size:11px; font-weight:700; letter-spacing:.16em; }
h1,h2,h3,p { margin-top:0; }
h1 { margin-bottom:14px; font:800 clamp(36px,5vw,54px)/1.12 Manrope,sans-serif; letter-spacing:-.045em; color:#152239; }
h1 span { color:#4776c9; }
.lede { max-width:680px; color:var(--muted); font-size:17px; line-height:1.65; }
h2 { margin:0; font:700 18px/1.3 Manrope,sans-serif; letter-spacing:-.02em; }
.section-heading { display:flex; justify-content:space-between; align-items:flex-end; gap:18px; margin-bottom:16px; }
.section-heading p,.score-head p,.meter-title p { margin:5px 0 0; color:var(--muted); font-size:13px; }
.subtle-tag,.info-pill { display:inline-flex; align-items:center; border:1px solid var(--line); background:#fff; border-radius:999px; padding:5px 10px; color:var(--muted); font-size:11px; font-weight:600; white-space:nowrap; }
.metrics-section { margin-bottom:20px; }
.dashboard { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }
.stat-card { min-height:94px; padding:15px 16px; background:var(--surface); border:1px solid var(--line); border-radius:11px; box-shadow:0 2px 8px rgba(22,35,53,.025); }
.label { color:var(--muted); font-size:11px; line-height:1.35; min-height:30px; }
.value { margin-top:5px; color:#1c2b42; font:700 23px Manrope,sans-serif; font-variant-numeric:tabular-nums; }
.value .moved { color:var(--blue); font-size:13px; }
.value .same { color:var(--muted-2); font-size:13px; }
.score-box,.editor-card,.meter-card { background:var(--surface); border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow); }
.score-box { padding:19px 21px 15px; margin-bottom:22px; }
.score-head,.meter-title { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.score-head h2 { font-size:16px; }
.bar { display:flex; height:9px; overflow:hidden; background:#edf0f4; border-radius:20px; margin:17px 0 11px; }
#barH { width:50%; background:#B68A36; transition:width .25s ease; }
#barA { width:50%; background:#DED6C6; transition:width .25s ease; }
.score-legend { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px 20px; color:#526176; font-size:12px; }
.score-legend b { margin-left:5px; color:var(--ink); }
.dot { display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:5px; }
.dot-clear { background:#B68A36; } .dot-pattern { background:#DED6C6; }
.score-note { margin:11px 0 0; color:var(--muted-2); font-size:11px; }
.editor-card { padding:22px; margin-bottom:20px; }
.editor-heading { align-items:center; }
.button { border:1px solid transparent; border-radius:8px; padding:10px 14px; font-size:13px; font-weight:700; transition:background .15s,border-color .15s,transform .15s; }
.button:disabled { opacity:.55; cursor:not-allowed; }
.button-primary { color:#fff; background:var(--blue); padding:12px 18px; box-shadow:0 3px 8px rgba(36,95,206,.18); }
.button-primary:hover:not(:disabled) { background:var(--blue-dark); transform:translateY(-1px); }
.button-primary span { margin-left:12px; font-size:17px; }
.button-secondary { color:#33445d; background:#fff; border-color:var(--line); }
.button-secondary:hover { border-color:#9aabc2; background:#f8fafc; }
.button-quiet { color:#41536c; background:#f6f8fb; border-color:var(--line); }
.button-quiet:hover { background:#edf2f8; }
textarea { display:block; width:100%; min-height:220px; resize:vertical; padding:17px 18px; color:var(--ink); background:#fcfdff; border:1px solid #d8e0eb; border-radius:10px; outline:none; line-height:1.7; font-size:15px; }
textarea:focus,input:focus,select:focus { border-color:#7da4e8; box-shadow:0 0 0 3px rgba(52,120,246,.11); outline:none; }
textarea::placeholder,input::placeholder { color:#9aa5b4; }
.input-highlight-wrap { position:relative; width:100%; min-height:220px; }
.input-highlight { position:absolute; z-index:1; inset:1px; overflow:hidden; padding:17px 18px; border-radius:9px; color:transparent; white-space:pre-wrap; overflow-wrap:anywhere; word-break:break-word; line-height:1.7; font-size:15px; font-family:inherit; pointer-events:none; }
.input-highlight .over-limit-text { color:transparent; background:rgba(190,70,70,.22); border-bottom:2px solid #bd4b4b; border-radius:2px; }
.input-highlight-wrap textarea { position:relative; z-index:2; background:transparent; }
.input-highlight-wrap textarea.over { border-color:#bd4b4b; }
.input-highlight-wrap textarea::placeholder { color:#9aa5b4; }
.settings-grid { display:grid; grid-template-columns:1.25fr 1fr 1fr; gap:18px; margin-top:20px; }
.setting label:not(.remember-option) { display:block; margin-bottom:7px; color:#34445b; font-size:12px; font-weight:700; }
.setting input[type=password],.setting select { width:100%; height:40px; padding:8px 10px; color:var(--ink); background:#fff; border:1px solid #d8e0eb; border-radius:7px; }
.setting input[type=password] { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:12px; }
.key-actions { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:9px; }
.remember-option { display:flex; align-items:center; gap:7px; color:#47566c; font-size:12px; }
input[type=checkbox] { accent-color:var(--blue); }
.text-button { padding:0; border:0; background:none; color:var(--blue); font-size:11px; font-weight:600; }
.text-button:hover { text-decoration:underline; }
.field-note { margin:6px 0 0; color:var(--muted-2); font-size:11px; line-height:1.45; }
.action-row { display:flex; align-items:center; gap:18px; margin-top:21px; padding-top:18px; border-top:1px solid #edf0f4; }
.toggle { display:flex; align-items:center; gap:7px; color:#526176; font-size:12px; }
.shortcut { margin-left:auto; color:var(--muted-2); font-size:11px; }
.privacy-note { margin:15px 0 0; padding:10px 12px; color:#647187; background:#f7f9fc; border-radius:7px; font-size:11px; line-height:1.55; }
.privacy-note strong { color:#43536a; }
.busy { display:flex; align-items:center; gap:10px; margin-top:14px; padding:10px 12px; color:#42536b; background:#f5f8fd; border:1px solid #e1e9f5; border-radius:8px; font-size:12px; }
.busy[hidden] { display:none; } .busy b { margin-left:auto; font-variant-numeric:tabular-nums; }
.spinner { width:14px; height:14px; border:2px solid #cbd8ed; border-top-color:var(--blue); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.busy-in { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:13px; }
.hg { display:inline-block; }
.meter-card { display:none; padding:19px 21px; margin-bottom:22px; }
.meter-title { margin-bottom:14px; }
.meter-row { display:flex; justify-content:space-between; margin:8px 0 5px; color:#526176; font-size:12px; }
.track { position:relative; height:8px; overflow:visible; background:#edf0f4; border-radius:20px; }
.fill { height:100%; width:0; border-radius:20px; transition:width .25s ease; }
.mark { position:absolute; top:-3px; width:2px; height:14px; background:#26364c; }
.results-section { margin-top:28px; }
.results-toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; margin:14px 0 12px; }
.tabs { display:inline-flex; gap:3px; padding:3px; background:#e9edf3; border-radius:8px; }
.tabs button { padding:7px 12px; border:0; border-radius:6px; color:#647187; background:transparent; font-size:12px; font-weight:600; }
.tabs button.on { color:#1d2c42; background:#fff; box-shadow:0 1px 3px rgba(22,35,53,.12); }
.legend { display:flex; flex-wrap:wrap; gap:12px; color:var(--muted); font-size:11px; }
.legend span { display:flex; align-items:center; gap:5px; }
.sw { width:9px; height:9px; border-radius:2px; display:inline-block; }
.sw.rem { background:#f5dada; border:1px solid #e8bcbc; }
.sw.new { background:#d7eee4; border:1px solid #b5ddca; }
.panes { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.panes.clean { grid-template-columns:1fr; }
.panes.clean #origWrap { display:none; }
.result-pane { min-width:0; overflow:hidden; border:1px solid var(--line); border-radius:10px; background:#fff; }
.pane-title { display:flex; align-items:center; min-height:43px; padding:9px 13px; color:#506078; background:#f8fafc; border-bottom:1px solid var(--line); font-size:12px; font-weight:700; }
.pane-head { justify-content:space-between; }
.out-box { min-height:180px; max-height:560px; overflow:auto; padding:16px; white-space:pre-wrap; overflow-wrap:anywhere; color:#28364a; font-size:13px; line-height:1.8; }
.out-box:empty:before { content:attr(data-empty); color:#a0aaba; }
.hl-rem { background:#fde7e7; color:#9c3838; text-decoration:line-through; border-radius:2px; }
.hl-new { background:#e0f3e9; color:#176345; border-radius:2px; }
.copy-btn { padding:5px 9px; border:1px solid var(--line); border-radius:6px; color:#53647b; background:white; font-size:11px; font-weight:600; }
.copy-btn:hover:not(:disabled) { border-color:#a6b8d3; }
.copy-btn:disabled { opacity:.4; cursor:default; }
.status-message { min-height:20px; margin:10px 0 0; color:#53647b; font-size:12px; }
.principles { margin-top:54px; padding-top:26px; border-top:1px solid var(--line); }
.principle-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-top:17px; }
.principle-grid > div { padding:17px; border:1px solid var(--line); border-radius:10px; background:rgba(255,255,255,.7); }
.principle-grid span { color:var(--blue); font-size:11px; font-weight:700; }
.principle-grid h3 { margin:7px 0 5px; font:700 14px Manrope,sans-serif; }
.principle-grid p { margin:0; color:var(--muted); font-size:12px; }
.footer { display:flex; justify-content:space-between; gap:25px; padding:22px max(24px, calc((100vw - 1180px)/2)); color:#aeb9c9; background:var(--navy); font-size:11px; }
.footer span:first-child { color:#fff; font-weight:700; white-space:nowrap; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
@media (max-width:850px) {
  .dashboard { grid-template-columns:repeat(3,1fr); }
  .settings-grid { grid-template-columns:1fr 1fr; }
  .settings-grid .setting:first-child { grid-column:1/-1; }
}
@media (max-width:600px) {
  .topbar { padding:0 17px; } .top-note { display:none; }
  .shell { padding:36px 15px 50px; }
  .intro { margin-bottom:30px; }
  h1 { font-size:37px; }
  .lede { font-size:15px; }
  .dashboard { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .stat-card { min-height:85px; }
  .editor-card { padding:15px; }
  .settings-grid { grid-template-columns:1fr; gap:14px; }
  .settings-grid .setting:first-child { grid-column:auto; }
  .action-row { flex-wrap:wrap; gap:12px; }
  .shortcut { width:100%; margin-left:0; }
  .section-heading { align-items:flex-start; }
  .panes { grid-template-columns:1fr; }
  .results-toolbar { align-items:flex-start; flex-direction:column; }
  .principle-grid { grid-template-columns:1fr; }
  .footer { flex-direction:column; padding:20px 16px; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto!important; animation:none!important; transition:none!important; } }

/* Invite-only access gate and account bar */
.login-shell { min-height: calc(100vh - 150px); display:flex; align-items:center; justify-content:center; padding:54px 20px; background:linear-gradient(135deg,#f7f8fb,#eef2f7); }
.login-card { width:min(100%,520px); padding:34px; border:1px solid var(--line); border-radius:16px; background:#fff; box-shadow:0 16px 48px rgba(21,35,55,.08); }
.login-card h1 { margin:8px 0 14px; font-size:clamp(32px,5vw,46px); line-height:1.08; }
.login-card .lede { margin-bottom:24px; }
.login-card label { display:block; margin:14px 0 7px; color:var(--ink); font-size:12px; font-weight:700; }
.login-card input { display:block; width:100%; min-height:44px; padding:11px 13px; border:1px solid var(--line); border-radius:8px; color:var(--ink); background:#fff; font:inherit; }
.login-card .button { width:100%; margin-top:14px; justify-content:center; }
.user-bar { display:flex; align-items:center; gap:14px; color:#e7edf5; font-size:12px; }
.user-bar .text-button { color:#f3dca6; }
[hidden] { display:none !important; }
@media(max-width:600px) { .login-card { padding:23px 18px; } .user-bar { font-size:10px; gap:8px; } }
.charbar { display:flex; justify-content:space-between; gap:12px; margin-top:7px; color:var(--muted); font-size:11px; }
.charbar.over { color:#b42318; }

.preview-banner{display:flex;gap:14px;align-items:center;flex-wrap:wrap;padding:12px 20px;background:#fff8e8;border-bottom:1px solid #ead8ae;color:#5d4821;font-size:.92rem}
.preview-banner a{margin-left:auto;color:#765719;font-weight:700}
.preview-banner strong{color:#503b16}


/* sAIral visual refinement */
:root { --gold:#B68A36; --champagne:#DED6C6; --ivory:#F7F3E9; --diamond:#FFFFFF; }
.brand { gap:12px; }
.brand-mark { flex:0 0 36px; }
.diagnostics-disclosure { margin:26px 0 0; padding:0; border:1px solid var(--line); border-radius:14px; background:#fff; box-shadow:var(--shadow); }
.diagnostics-disclosure > summary { padding:17px 20px; color:#4d5a6c; font-weight:650; cursor:pointer; list-style:none; }
.diagnostics-disclosure > summary::-webkit-details-marker { display:none; }
.diagnostics-disclosure > summary:after { content:'＋'; float:right; color:var(--gold); font-weight:700; }
.diagnostics-disclosure[open] > summary:after { content:'−'; }
.diagnostics-disclosure > .metrics-section, .diagnostics-disclosure > .score-box, .diagnostics-disclosure > .meter-card { margin:0 16px 16px; box-shadow:none; }
.diagnostics-disclosure > .metrics-section { padding-top:8px; }
.diagnostics-disclosure .bar { background:#F0ECE4; }
.diagnostics-disclosure #barH { background:#B68A36 !important; }
.diagnostics-disclosure #barA { background:#DED6C6 !important; }
.diagnostics-disclosure .track .fill { background:#B68A36 !important; }
.diagnostics-disclosure .track .mark { background:#30302D; }
.editor-card { border-radius:16px; padding:24px; }
textarea { background:#fff; border-radius:12px; }
.button-primary { background:#B68A36; border-color:#B68A36; color:#fff; }
.button-primary:hover { background:#9F762C; border-color:#9F762C; }
@media(max-width:700px){ .diagnostics-disclosure > .metrics-section, .diagnostics-disclosure > .score-box, .diagnostics-disclosure > .meter-card { margin-left:10px; margin-right:10px; } .editor-card { padding:17px; } }
