/* Login-only design pass using unslop by Damir Sokolovsky (@heydamir).
   Method: https://github.com/heydamir/unslop (CC BY 4.0).
   Scope stays on #authView; the signed-in workspace keeps its own design. */
#authView {
  --auth-bg: #f0f3f4;
  --auth-surface: #fff;
  --auth-raised: #f7f9fa;
  --auth-text: #192e3b;
  --auth-secondary: #52616b;
  --auth-muted: #61717b;
  --auth-line: #dbe2e6;
  --auth-input-line: #82939e;
  --auth-accent: #09678b;
  --auth-accent-hover: #075572;
  --auth-accent-soft: #e8f2f6;
  --auth-plan: #6e828f;
  min-height: calc(100svh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(480px, .85fr);
  background: var(--auth-surface);
  color: var(--auth-text);
  font-family: "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}
html[data-theme="dark"] #authView {
  --auth-bg: #181d21;
  --auth-surface: #11171b;
  --auth-raised: #1c242a;
  --auth-text: #edf1f3;
  --auth-secondary: #b6c0c7;
  --auth-muted: #a0afb8;
  --auth-line: #35424b;
  --auth-input-line: #667c8b;
  --auth-accent: #83c9e5;
  --auth-accent-hover: #a1d8ed;
  --auth-accent-soft: #243943;
  --auth-plan: #a4b6c2;
}
#authView .auth-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 48px clamp(32px, 5vw, 88px);
  color: var(--auth-text);
  background: var(--auth-bg);
  border-right: 1px solid var(--auth-line);
  isolation: auto;
}
#authView .auth-visual::before, #authView .auth-visual::after { content: none; }
#authView .auth-intro { width: 100%; max-width: 640px; }
#authView .auth-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 24px;
  color: var(--auth-secondary);
  font-size: 14px;
  font-weight: 500;
}
#authView .auth-eyebrow > span { width: 28px; height: 2px; background: var(--auth-accent); }
#authView .auth-intro-title {
  margin: 0;
  color: var(--auth-text);
  font-size: clamp(36px, 3.6vw, 60px);
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -.04em;
}
#authView .auth-intro-copy { max-width: 460px; margin: 24px 0 0; color: var(--auth-secondary); font-size: 17px; line-height: 1.65; }
#authView .auth-project-preview { margin: 32px 0 0; }
#authView .auth-project-preview figcaption { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; color: var(--auth-secondary); font-size: 12px; line-height: 20px; }
#authView .auth-project-preview figcaption > span:last-child { color: var(--auth-muted); }
#authView .auth-project-sheet { overflow: hidden; border: 1px solid var(--auth-line); border-radius: 12px; background: var(--auth-surface); box-shadow: 0 4px 16px rgb(0 0 0 / 3%); }
#authView .auth-project-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px; border-bottom: 1px solid var(--auth-line); }
#authView .auth-project-label { color: var(--auth-secondary); font-size: 12px; line-height: 20px; }
#authView .auth-project-heading h3 { margin: 4px 0 0; color: var(--auth-text); font-size: 19px; font-weight: 500; line-height: 24px; }
#authView .auth-project-number { color: var(--auth-muted); font: 12px/20px ui-monospace, Consolas, monospace; }
#authView .auth-project-evidence { display: grid; grid-template-columns: 1fr 1fr; }
#authView .auth-plan-preview { padding: 20px 16px 8px; background: var(--auth-raised); }
#authView .auth-preview-label { display: flex; align-items: center; gap: 8px; color: var(--auth-secondary); font-size: 12px; line-height: 20px; }
#authView .auth-preview-label > span { color: var(--auth-muted); font: 11px/20px ui-monospace, Consolas, monospace; }
#authView .auth-floor-plan { display: block; width: 100%; height: auto; max-height: 224px; margin-top: 12px; color: var(--auth-plan); }
#authView .auth-floor-plan text { fill: var(--auth-muted); font: 11px "Segoe UI", sans-serif; }
#authView .auth-plan-dimensions { opacity: .55; }
#authView .auth-plan-pin circle { fill: var(--auth-accent); stroke: var(--auth-surface); stroke-width: 3px; }
#authView .auth-plan-pin text { fill: var(--auth-surface); font-size: 13px; font-weight: 600; }
#authView .auth-report-preview { padding: 20px; border-left: 1px solid var(--auth-line); }
#authView .auth-report-title { display: flex; align-items: center; gap: 8px; margin-top: 24px; color: var(--auth-secondary); font-size: 12px; }
#authView .auth-report-title svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
#authView .auth-report-preview h4 { margin: 12px 0 8px; color: var(--auth-text); font-size: 16px; line-height: 24px; font-weight: 500; }
#authView .auth-report-preview p { margin: 0; color: var(--auth-secondary); font-size: 13px; line-height: 1.65; }
#authView .auth-report-source { display: flex; align-items: center; gap: 8px; margin-top: 20px; color: var(--auth-secondary); font-size: 11px; line-height: 18px; }
#authView .auth-evidence-marker { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; border: 1px solid var(--auth-accent); border-radius: 50%; color: var(--auth-accent); font-size: 11px; }
#authView .auth-review-state { display: flex; align-items: center; gap: 8px; margin-top: 20px; color: var(--auth-accent); font-size: 11px; line-height: 18px; }
#authView .auth-review-state > span { width: 6px; height: 6px; border: 1.5px solid currentColor; border-radius: 50%; }
#authView .auth-project-footer { display: flex; align-items: center; gap: 8px; padding: 12px 24px; border-top: 1px solid var(--auth-line); color: var(--auth-secondary); font-size: 12px; line-height: 20px; }
#authView .auth-project-footer svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: var(--auth-accent); stroke-width: 1.5; stroke-linecap: round; }
#authView .auth-intro-note { max-width: 460px; margin: 24px 0 0; color: var(--auth-muted); font-size: 13px; line-height: 1.65; }

/* The form is the primary task; providers and sample workspaces follow it. */
#authView .auth-card { align-self: center; width: min(416px, calc(100% - 80px)); margin: 40px auto; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--auth-text); box-shadow: none; backdrop-filter: none; }
#authView .auth-card :is(h1, h2) { margin: 0; color: var(--auth-text); font-size: 28px; font-weight: 500; letter-spacing: -.025em; line-height: 1.25; }
#authView .auth-card .kicker { margin: 0 0 8px; color: var(--auth-secondary); font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; }
#authView .auth-card .subtle { margin: 12px 0 0; color: var(--auth-secondary); font-size: 14px; line-height: 1.6; }
#authView #loginPanel .stack-form { gap: 20px; margin-top: 28px; }
#authView .auth-card label > span, #authView .auth-password-heading > label { margin: 0 0 8px; color: var(--auth-text); font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none; line-height: 20px; }
#authView .auth-password-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
#authView .auth-password-heading > label { margin: 0; }
#authView .auth-card :is(input, select, textarea) { min-height: 48px; padding: 12px; border: 1px solid var(--auth-input-line); border-radius: 8px; color: var(--auth-text); background: var(--auth-surface); box-shadow: none; font-size: 16px; transition: border-color 150ms ease, background-color 150ms ease; }
#authView .auth-card :is(input, select, textarea):focus { border-color: var(--auth-accent); outline: 2px solid var(--auth-accent); outline-offset: 2px; box-shadow: none; }
#authView .auth-card .check-row input { min-height: 20px; width: 20px; }
#authView .auth-card .check-row span { margin: 0; color: var(--auth-secondary); font-size: 13px; font-weight: 400; }
#authView .auth-card :is(.primary, .secondary) { min-height: 48px; border-radius: 8px; font-size: 14px; font-weight: 500; box-shadow: none; transition: background-color 150ms ease, border-color 150ms ease; }
#authView .auth-card .primary { margin: 0; color: var(--auth-surface); border-color: var(--auth-accent); background: var(--auth-accent); }
#authView .auth-card .primary:hover { background: var(--auth-accent-hover); border-color: var(--auth-accent-hover); }
#authView .auth-card .primary:disabled { opacity: .55; cursor: wait; }
#authView .auth-card .secondary { color: var(--auth-text); border-color: var(--auth-input-line); background: var(--auth-surface); }
#authView .auth-card :is(.text-button, .back-button) { margin: 0; color: var(--auth-accent); font-size: 13px; font-weight: 500; line-height: 20px; letter-spacing: 0; }
#authView .auth-card .back-button { margin-bottom: 24px; }
#authView #loginPanel .auth-forgot-button { min-height: 24px; padding: 0; }
#authView .auth-card :is(button, a):focus-visible { outline: 2px solid var(--auth-accent); outline-offset: 4px; }
#authView .auth-card .auth-provider-separator { margin: 20px 0 16px; gap: 16px; color: var(--auth-muted); font-size: 12px; }
#authView .auth-separator::before, #authView .auth-separator::after { background: var(--auth-line); }
#authView #loginPanel .google-login-placeholder { min-height: 44px; border-color: var(--auth-input-line); color: var(--auth-text); background: var(--auth-surface); font-size: 14px; font-weight: 400; }
#authView #loginPanel .google-login-control > small { margin-top: 4px; color: var(--auth-muted); font-size: 12px; font-weight: 400; line-height: 20px; }
#authView .auth-register-prompt { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 24px; padding: 0; border: 0; color: var(--auth-secondary); font-size: 13px; line-height: 24px; }
#authView .auth-register-prompt .text-button { display: inline; }
#authView .demo-access { display: grid; gap: 16px; margin-top: 24px; padding: 24px 0 0; border: 0; border-top: 1px solid var(--auth-line); border-radius: 0; background: transparent; }
#authView .demo-access > div > strong { color: var(--auth-text); font-size: 14px; line-height: 20px; font-weight: 500; }
#authView .demo-access > div > small { margin-top: 4px; color: var(--auth-muted); font-size: 12px; line-height: 20px; }
#authView .demo-access-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#authView .demo-access-actions button { grid-column: auto; min-width: 0; min-height: 64px; padding: 12px; border: 1px solid var(--auth-line); border-radius: 8px; color: var(--auth-text); background: var(--auth-surface); font-weight: 400; box-shadow: none; transition: background-color 150ms ease, border-color 150ms ease; }
#authView .demo-access-actions button:hover { background: var(--auth-raised); border-color: var(--auth-input-line); }
#authView .demo-access-actions button strong { color: var(--auth-text); font-size: 12px; line-height: 20px; font-weight: 500; }
#authView .demo-access-actions button small { margin-top: 0; color: var(--auth-muted); font-size: 11px; line-height: 18px; font-weight: 400; }
#authView .auth-legal-links { justify-content: center; gap: 24px; margin-top: 24px; font-size: 12px; line-height: 20px; }
#authView .auth-legal-links a { color: var(--auth-muted); }

/* Header refinements apply only while an authentication panel is visible. */
body:has(#authView:not(.hidden)) .portal-topbar { height: 72px; min-height: 72px; padding: 0 40px; color: #192e3b; border-bottom: 1px solid #dbe2e6; background: #fff; box-shadow: none; backdrop-filter: none; }
body:has(#authView:not(.hidden)) .portal-brand { gap: 12px; color: #192e3b; font-size: 17px; font-weight: 600; letter-spacing: .015em; }
body:has(#authView:not(.hidden)) .brand-symbol { width: 32px; height: 36px; border-radius: 7px; background: #192e3b; color: #fff; font-size: 20px; box-shadow: none; }
body:has(#authView:not(.hidden)) .theme-toggle { min-height: 40px; box-shadow: none; background: #fff; }
body:has(#authView:not(.hidden)) .theme-toggle-track i { box-shadow: none; }
body:has(#authView:not(.hidden)) .portal-brand > span:last-child { display: inline; }
html[data-theme="dark"] body:has(#authView:not(.hidden)) .portal-topbar { color: #edf1f3; border-bottom-color: #35424b; background: #11171b; }
html[data-theme="dark"] body:has(#authView:not(.hidden)) .portal-brand { color: #edf1f3; }
html[data-theme="dark"] body:has(#authView:not(.hidden)) .brand-symbol { color: #11171b; background: #edf1f3; }
html[data-theme="dark"] body:has(#authView:not(.hidden)) .theme-toggle { color: #edf1f3; border-color: #35424b; background: #1c242a; }
html[data-theme="dark"] body:has(#authView:not(.hidden)) .theme-toggle-track i { background: #edf1f3; }
html[data-theme="dark"] body:has(#authView:not(.hidden)) .theme-toggle-moon { color: #11171b; }

/* Override the older dark-login selectors as well as the shared form rules. */
html[data-theme="dark"] #authView #loginPanel input { color: var(--auth-text); border-color: var(--auth-input-line); background: var(--auth-surface); }
html[data-theme="dark"] #authView #loginPanel input:focus { border-color: var(--auth-accent); box-shadow: none; }
html[data-theme="dark"] #authView #loginPanel .stack-form > .primary { color: var(--auth-surface); border-color: var(--auth-accent); background: var(--auth-accent); }
html[data-theme="dark"] #authView #loginPanel .stack-form > .primary:hover { border-color: var(--auth-accent-hover); background: var(--auth-accent-hover); }
html[data-theme="dark"] #authView #loginPanel :is(.auth-forgot-button, .auth-register-prompt .text-button) { color: var(--auth-accent); }
html[data-theme="dark"] #authView #loginPanel label > span { color: var(--auth-text); }

@media (min-width: 1500px) { #authView .auth-card { width: 432px; } }
@media (max-width: 1100px) {
  #authView { grid-template-columns: minmax(0, 1fr) minmax(432px, .9fr); }
  #authView .auth-visual { padding: 40px 32px; }
  #authView .auth-card { width: calc(100% - 64px); }
  #authView .auth-project-evidence { grid-template-columns: 1fr; }
  #authView .auth-plan-preview { display: none; }
  #authView .auth-report-preview { border-left: 0; }
  #authView .auth-project-footer { padding: 12px 20px; }
}
@media (max-width: 800px) {
  #authView { display: block; min-height: calc(100svh - 64px); padding: 40px 24px 32px; }
  #authView .auth-visual { display: none; }
  #authView .auth-card { width: 100%; max-width: 416px; margin: 0 auto; }
  body:has(#authView:not(.hidden)) .portal-topbar { height: 64px; min-height: 64px; padding: 0 24px; }
  body:has(#authView:not(.hidden)) .theme-toggle { min-width: 44px; min-height: 44px; }
  html[data-theme="dark"] body:has(#authView:not(.hidden)) .theme-toggle-moon { color: #edf1f3; }
}
@media (max-width: 440px) {
  #authView { padding: 32px 24px 24px; }
  #authView .auth-card :is(h1, h2) { font-size: 26px; }
  #authView #loginPanel .stack-form { margin-top: 24px; }
  #authView .demo-access-actions { grid-template-columns: 1fr; gap: 8px; }
  #authView .demo-access-actions button { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; padding: 12px; }
  #authView .demo-access-actions button strong { font-size: 13px; }
  #authView .demo-access-actions button small { font-size: 12px; }
  #authView .auth-register-prompt { gap: 4px 8px; }
  #authView .auth-register-prompt .text-button { min-height: 32px; }
  #authView .auth-legal-links a { display: inline-flex; align-items: center; min-height: 44px; }
  #authView .auth-card .two-columns { grid-template-columns: 1fr; }
}
