/* ==========================================================================
   Proposal Writer: white and blue design system
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Blue scale */
  --blue-25: #f7faff;
  --blue-50: #eff5ff;
  --blue-100: #dbe8ff;
  --blue-200: #bfd5ff;
  --blue-300: #93b7fd;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #172554;

  /* Neutrals (cool slate) */
  --ink: #0b1630;
  --ink-2: #33415c;
  --muted: #64748b;
  --subtle: #94a3b8;
  --line: #e3e9f3;
  --line-strong: #cdd7e6;
  --bg: #f5f8fd;
  --surface: #ffffff;
  --surface-2: #f8fafd;

  --accent: var(--blue-700);
  --accent-hover: var(--blue-800);
  --accent-soft: var(--blue-50);
  --gradient: linear-gradient(135deg, #2f6bff 0%, #1d4ed8 55%, #1e3a9e 100%);

  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --ok: #067647;
  --ok-soft: #ecfdf3;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(11, 22, 48, 0.05);
  --shadow-sm: 0 1px 3px rgba(11, 22, 48, 0.06), 0 1px 2px rgba(11, 22, 48, 0.04);
  --shadow: 0 4px 6px -2px rgba(11, 22, 48, 0.04), 0 12px 24px -6px rgba(29, 78, 216, 0.08);
  --shadow-lg: 0 24px 48px -12px rgba(11, 22, 48, 0.22);
  --ring: 0 0 0 4px rgba(37, 99, 235, 0.16);

  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.6 var(--font);
  font-feature-settings: "cv11", "ss01";
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.app-body {
  background:
    radial-gradient(900px 320px at 85% -80px, rgba(59, 130, 246, 0.10), transparent 70%),
    radial-gradient(700px 260px at 0% -60px, rgba(29, 78, 216, 0.06), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  min-height: 100dvh;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; color: var(--ink); letter-spacing: -0.02em; }
h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 750; }
h2 { font-size: 1rem; line-height: 1.3; font-weight: 650; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; border-radius: 4px; }
kbd {
  font: 600 0.72rem/1 var(--font); color: var(--ink-2);
  padding: 3px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface);
}

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: var(--mono); font-size: 0.9em; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); box-shadow: var(--shadow); }
.stack > * + * { margin-top: 18px; }
.stack-sm > * + * { margin-top: 8px; }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 24px; min-height: 68px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); justify-self: start; }
.brand-logo { width: 36px; height: 36px; display: block; border-radius: 10px; box-shadow: 0 4px 12px rgba(29, 78, 216, 0.28); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 750; font-size: 1.05rem; letter-spacing: -0.02em; }
.brand-accent { color: var(--accent); margin-left: 3px; }
.brand-tag { font-size: 0.72rem; color: var(--muted); font-weight: 500; }

.main-nav {
  display: inline-flex; gap: 2px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
}
.main-nav a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 9px;
  color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 0.9rem;
  transition: color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.main-nav a .i { width: 17px; height: 17px; color: var(--subtle); transition: color 0.15s; }
.main-nav a:hover { color: var(--accent); }
.main-nav a:hover .i { color: var(--accent); }
.main-nav a[aria-current="page"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.main-nav a[aria-current="page"] .i { color: var(--accent); }

.header-user { justify-self: end; display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 0.82rem; color: #fff;
  background: var(--gradient); box-shadow: 0 0 0 3px var(--blue-50);
}
.user-email { font-size: 0.85rem; color: var(--ink-2); font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Layout ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 36px 24px 80px; outline: none; }
.screen > * + * { margin-top: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-sub { color: var(--muted); margin-top: 6px; max-width: 640px; }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.panel-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.panel-sub { color: var(--muted); font-size: 0.8rem; margin-top: 1px; }
.panel-tools { display: flex; align-items: center; gap: 6px; }
.panel-body { padding: 20px 22px; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.panel-foot { padding: 16px 22px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.tile {
  width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--blue-50); color: var(--accent); box-shadow: inset 0 0 0 1px var(--blue-100);
}
.tile .i { width: 19px; height: 19px; }
.tile-solid { background: var(--gradient); color: #fff; box-shadow: 0 4px 10px rgba(29, 78, 216, 0.3); }
.tile-sm { width: 32px; height: 32px; border-radius: 9px; }
.tile-sm .i { width: 16px; height: 16px; }

.counter {
  font-size: 0.78rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
}
.counter.over-limit { color: var(--danger); background: var(--danger-soft); border-color: #fecdca; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600;
  color: var(--ink-2); padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
}
.chip:empty { display: none; }

/* ---------- Writer workspace ---------- */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: stretch; }
#generate-form .panel-body { padding-bottom: 18px; }
#job {
  flex: 1; min-height: 440px; resize: vertical; border: 0; padding: 0; background: transparent; box-shadow: none;
  font-size: 0.95rem; line-height: 1.7; color: var(--ink);
}
#job:focus { box-shadow: none; }
#generate-form:focus-within { border-color: var(--blue-300); box-shadow: var(--shadow), var(--ring); }
.foot-hint { margin-top: 10px; text-align: center; font-size: 0.8rem; color: var(--muted); }
#generate-status:not(:empty)::before { content: "· "; }

.panel-output { min-height: 100%; }
.result-empty, .result-loading, .result { padding: 22px; flex: 1; display: flex; flex-direction: column; }
.result-empty { align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 40px 28px; }
.result-empty > p { color: var(--muted); font-size: 0.9rem; }
.empty-art {
  width: 92px; height: 92px; border-radius: 28px; display: grid; place-items: center; margin-bottom: 6px;
  background: radial-gradient(circle at 30% 25%, #ffffff, var(--blue-50) 70%); box-shadow: inset 0 0 0 1px var(--blue-100), 0 10px 30px rgba(29, 78, 216, 0.12);
}
.empty-art img { border-radius: 14px; }
.checklist { list-style: none; padding: 0; margin: 10px 0 0; text-align: left; display: grid; gap: 10px; }
.checklist li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.88rem; color: var(--ink-2); }
.checklist .i {
  width: 20px; height: 20px; padding: 3px; border-radius: 50%; margin-top: 1px;
  color: var(--accent); background: var(--blue-50); stroke-width: 3;
}

.result-loading { gap: 18px; }
.loading-head { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--accent); font-size: 0.92rem; }
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue-600); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5); animation: pulse 1.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); } 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); } }
.skeleton { display: flex; flex-direction: column; gap: 11px; }
.skeleton span {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, #edf2fb 0%, #dfe8f8 40%, #edf2fb 80%); background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skeleton span.gap { height: 6px; background: none; animation: none; }
.skeleton span:nth-child(1) { width: 92%; } .skeleton span:nth-child(2) { width: 86%; } .skeleton span:nth-child(3) { width: 64%; }
.skeleton span:nth-child(5) { width: 88%; } .skeleton span:nth-child(6) { width: 95%; } .skeleton span:nth-child(7) { width: 78%; }
.skeleton span:nth-child(8) { width: 52%; } .skeleton span:nth-child(10) { width: 70%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.result { gap: 14px; animation: rise 0.25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.proposal-editor {
  flex: 1; min-height: 380px; resize: vertical;
  font-size: 0.96rem; line-height: 1.75; padding: 16px 18px; background: var(--blue-25); border-color: var(--line);
}
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.meta-text { font-size: 0.8rem; color: var(--muted); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
label { font-weight: 600; font-size: 0.88rem; color: var(--ink); }
input, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 11px 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
input { height: 44px; }
input::placeholder, textarea::placeholder { color: var(--subtle); }
input:hover, textarea:hover { border-color: var(--blue-200); }
input:focus, textarea:focus { outline: none; border-color: var(--blue-600); box-shadow: var(--ring); background: #fff; }
.input-group { position: relative; }
.input-group input { padding-right: 48px; }
.input-group .icon-btn { position: absolute; right: 5px; top: 5px; }
.hint { color: var(--muted); font-size: 0.8rem; }

/* ---------- Buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 0.9rem; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none; user-select: none;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s, transform 0.06s;
}
.btn .i { width: 17px; height: 17px; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { height: 36px; padding: 0 13px; font-size: 0.85rem; border-radius: 9px; }
.btn-lg { height: 50px; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-primary {
  color: #fff; background: var(--gradient);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 6px 16px -4px rgba(29, 78, 216, 0.55);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 10px 22px -6px rgba(29, 78, 216, 0.6); }
.btn-secondary { color: var(--ink); background: var(--surface); border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.btn-secondary .i { color: var(--accent); }
.btn-secondary:hover:not(:disabled) { border-color: var(--blue-300); background: var(--blue-25); color: var(--accent); }
.btn-ghost { color: var(--ink-2); background: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--accent); }
.btn-danger-ghost { color: var(--danger); background: transparent; }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }
.btn.is-copied { background: var(--ok); box-shadow: none; filter: none; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--muted);
  display: inline-grid; place-items: center; cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--blue-50); color: var(--accent); }
.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.action-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.push-right { margin-left: auto; }

.spinner {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite;
}
.is-loading .spinner { display: inline-block; }
.is-loading .btn-icon { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner, .pulse-dot, .skeleton span { animation-duration: 3s; }
  .result { animation: none; }
}

/* ---------- Alerts / badges / status ---------- */
.alert { padding: 11px 14px; border-radius: 10px; font-size: 0.87rem; line-height: 1.5; border: 1px solid transparent; background: var(--surface-2); }
.alert-error { background: var(--danger-soft); color: #b42318; border-color: #fecdca; }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: #fedf89; }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: #abefc6; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; font-weight: 650; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; color: var(--accent); background: var(--blue-50); border: 1px solid var(--blue-100);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-muted { color: var(--ink-2); background: var(--surface-2); border-color: var(--line); }
.badge-muted::before { display: none; }
.badge-warn { color: var(--warn); background: var(--warn-soft); border-color: #fedf89; }
.badge:empty { display: none; }
.save-status { font-size: 0.8rem; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.save-status:not(:empty)::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.save-status.ok { color: var(--ok); }
.save-status.dirty { color: var(--warn); }
.save-status.error { color: var(--danger); }

/* ---------- History ---------- */
/* Only reset the bottom margin so the page's vertical rhythm (.screen > * + *) still applies. */
.history-list { list-style: none; margin-bottom: 0; padding: 0; display: grid; gap: 12px; }
.history-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: start;
  padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); transition: border-color 0.15s, box-shadow 0.15s;
}
.history-item:hover { border-color: var(--blue-200); box-shadow: var(--shadow); }
.history-open { display: block; width: 100%; min-width: 0; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.history-open:hover .history-job { color: var(--accent); }
.history-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; font-size: 0.78rem; color: var(--muted); }
.history-job { font-weight: 650; font-size: 0.98rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color 0.15s; }
.history-proposal {
  margin-top: 4px; color: var(--muted); font-size: 0.88rem; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.history-actions { display: flex; align-items: center; gap: 4px; }
.history-actions .icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; }
.page-info { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.empty-state { align-items: center; text-align: center; gap: 10px; padding: 56px 24px; }
.empty-state p { color: var(--muted); margin-bottom: 8px; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; align-items: start; }
.status-list { margin: 0; display: grid; gap: 4px; }
.status-row {
  display: grid; grid-template-columns: auto 120px minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px dashed var(--line);
}
.status-row:last-child { border-bottom: 0; }
.status-row dt { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.status-row dd { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; word-break: break-word; }
#settings-form .panel-foot { display: flex; }

/* ---------- Dialog ---------- */
.dialog {
  width: min(880px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.dialog[open] { animation: pop 0.18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }
.dialog::backdrop { background: rgba(11, 22, 48, 0.45); backdrop-filter: blur(3px); }
.dialog-inner { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.dialog-body { padding: 18px 22px; overflow: auto; }
.dialog-foot { padding: 14px 22px 18px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.dialog .proposal-editor { min-height: 320px; }
.job-details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.job-details summary { cursor: pointer; padding: 12px 14px; font-weight: 600; font-size: 0.88rem; color: var(--ink-2); list-style-position: inside; }
.job-details[open] summary { border-bottom: 1px solid var(--line); }
.job-text {
  margin: 0; padding: 14px; max-height: 240px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  font: 0.87rem/1.6 var(--font); color: var(--ink-2);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 200;
  display: inline-flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 12px; background: var(--blue-900); color: #fff;
  font-size: 0.88rem; font-weight: 500; box-shadow: var(--shadow-lg);
}
.toast .i { width: 18px; height: 18px; color: #86efac; }

/* ---------- Login ---------- */
.auth-page { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-aside {
  position: relative; overflow: hidden; color: #fff; padding: 48px 56px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  background:
    radial-gradient(600px 400px at 110% 10%, rgba(147, 183, 253, 0.35), transparent 60%),
    radial-gradient(500px 360px at -10% 100%, rgba(59, 130, 246, 0.45), transparent 60%),
    linear-gradient(160deg, #1e3a9e 0%, #1d4ed8 55%, #2563eb 100%);
}
.auth-aside::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.12;
  background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 70%);
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside .brand { color: #fff; }
.auth-aside .brand-tag { color: rgba(255, 255, 255, 0.75); }
.auth-aside .brand-accent { color: var(--blue-200); }
.auth-aside .brand-logo { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.auth-pitch h1 { color: #fff; font-size: 2.3rem; line-height: 1.15; letter-spacing: -0.03em; max-width: 480px; }
.auth-pitch p { color: rgba(255, 255, 255, 0.82); margin-top: 14px; font-size: 1.02rem; max-width: 460px; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.auth-points li { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.auth-points .i { width: 26px; height: 26px; padding: 5px; border-radius: 8px; background: rgba(255, 255, 255, 0.16); color: #fff; stroke-width: 2.5; }
.auth-legal { font-size: 0.8rem; color: rgba(255, 255, 255, 0.65); }
.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card > * + * { margin-top: 12px; }
.auth-mobile-brand { display: none; }
.auth-title { font-size: 1.7rem; }
.auth-sub { color: var(--muted); }
.auth-card form { margin-top: 26px; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 22px; font-size: 0.8rem; color: var(--muted); }
.auth-foot .i { width: 14px; height: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .header-inner { grid-template-columns: auto 1fr auto; }
  .main-nav { justify-self: center; }
  .user-email { display: none; }
}
@media (max-width: 900px) {
  .workspace, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  #job { min-height: 260px; }
  .proposal-editor { min-height: 300px; }
  .result-empty { padding: 32px 22px; }
  .auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-mobile-brand { display: flex; justify-content: center; margin-bottom: 8px; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .header-inner { grid-template-columns: 1fr auto; padding: 10px 16px; row-gap: 10px; min-height: 0; }
  .brand-tag { display: none; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; width: 100%; justify-self: stretch; }
  .main-nav a { flex: 1; justify-content: center; padding: 8px 6px; }
  .logout-label { display: none; }
  .container { padding: 22px 16px 64px; }
  h1 { font-size: 1.45rem; }
  .panel-head, .panel-body, .panel-foot, .result-empty, .result-loading, .result { padding-left: 16px; padding-right: 16px; }
  .page-head .btn { width: 100%; }
  /* Primary action full width, secondary actions paired underneath. */
  .action-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .action-bar > .btn:first-child, .action-bar > .push-right { grid-column: 1 / -1; }
  #settings-form .action-bar > .push-right { grid-column: auto; }
  .action-bar .btn { width: 100%; padding: 0 10px; }
  .push-right { margin-left: 0; }
  .panel-sub { font-size: 0.76rem; }
  .history-item { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 16px; }
  .history-item > .tile { display: none; }
  .history-actions { justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 8px; }
  .status-row { grid-template-columns: auto minmax(0, 1fr); }
  .status-row dd { grid-column: 2; }
  .dialog-head, .dialog-body, .dialog-foot { padding-left: 16px; padding-right: 16px; }
}
