:root {
  color-scheme: light;
  --ink: #17221d; --muted: #667069; --paper: #f7f4ed; --surface: #fffdf8;
  --line: #d9d5ca; --accent: #e7623f; --accent-dark: #bd4028; --mint: #dce9df;
  --forest: #234b38; --shadow: 0 22px 55px rgba(35, 75, 56, .11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 12% 8%, rgba(231,98,63,.12), transparent 28rem), radial-gradient(circle at 92% 24%, rgba(35,75,56,.11), transparent 30rem), var(--paper); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 64px; }
.auth-view { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(340px, 1.1fr); gap: clamp(28px, 6vw, 84px); min-height: calc(100vh - 106px); align-items: center; max-width: 980px; margin: 0 auto; }
.auth-view[hidden] { display: none; }
.auth-brand { max-width: 470px; }
.auth-brand h1 { font-size: clamp(3rem, 7vw, 5.4rem); }
.auth-brand > p:last-child { color: var(--muted); font-size: 1.08rem; line-height: 1.6; }
.auth-globe { width: 68px; height: 68px; margin-bottom: 18px; filter: drop-shadow(0 8px 12px rgba(23,106,162,.2)); }
.auth-card { border: 1px solid rgba(35,75,56,.13); border-radius: 24px; background: rgba(255,253,248,.96); box-shadow: var(--shadow); padding: clamp(24px, 4vw, 40px); }
.auth-form { display: grid; gap: 16px; }
.auth-form .primary-button, .auth-form .secondary-button { width: 100%; margin-top: 4px; }
.compact-auth-form { padding-top: 18px; }
.compact-auth-form > p { margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 24px 0; color: var(--muted); font-size: .82rem; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.request-account { border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; background: #fff; }
.request-account summary { padding: 15px 0; font-weight: 800; cursor: pointer; }
.request-account[open] { padding-bottom: 18px; }
.admin-link, .text-button { border: 0; color: var(--forest); background: transparent; padding: 8px 0; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.admin-link { display: block; margin: 18px auto 0; }
.form-message { min-height: 20px; margin: 0; color: var(--muted); font-size: .9rem; }
.form-message.error { color: #a43f2d; }
.form-message.success { color: #167046; }
.session-bar { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-bottom: 18px; color: var(--muted); font-size: .88rem; }
.admin-toolbar { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 18px; }
.admin-toolbar h2 { margin: 0; }
.admin-section-heading { margin: 28px 0 12px; padding-top: 22px; border-top: 1px solid var(--line); }
.admin-section-heading h2 { margin: 0; font-size: 1.15rem; }
.accounts-overview { display: grid; gap: 10px; }
.account-stat { display: grid; grid-template-columns: minmax(170px, 1.4fr) minmax(80px, .45fr) minmax(180px, 1fr); gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; }
.account-identity { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; min-width: 0; overflow-wrap: anywhere; }
.admin-badge { border-radius: 999px; padding: 3px 7px; color: #fff; background: var(--forest); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.account-metric { display: grid; gap: 3px; }
.account-metric span { color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.account-metric strong { font-size: .92rem; }
.account-metric:not(.account-login) strong { font-size: 1.25rem; }
.account-requests { display: grid; gap: 10px; }
.account-request { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; }
.account-request p { margin: 0; overflow-wrap: anywhere; }
.request-actions { display: flex; gap: 6px; }
.small-button { min-height: 36px; border: 1px solid var(--forest); border-radius: 999px; padding: 0 12px; color: var(--forest); background: transparent; font-weight: 800; cursor: pointer; }
.small-button.approve { color: #fff; background: var(--forest); }
.empty-state { margin: 0; color: var(--muted); text-align: center; padding: 24px 0; }
.hero { max-width: 850px; }
.eyebrow, .success-label { margin: 0 0 12px; color: var(--accent-dark); font-size: .76rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.8rem, 7vw, 5.45rem); font-weight: 500; letter-spacing: -.055em; line-height: .94; }
.title-row { display: flex; align-items: center; gap: 4px; width: max-content; max-width: 100%; }
.title-row h1 { flex: 0 1 auto; white-space: nowrap; font-size: clamp(1.35rem, 7vw, 5.45rem); }
.globe-icon { width: clamp(48px, 6.4vw, 72px); height: auto; flex: 0 0 auto; margin-top: -3px; filter: drop-shadow(0 7px 10px rgba(23,106,162,.2)); }
.globe-ocean { fill: url(#ocean); }
.globe-land { fill: url(#land); stroke: rgba(26,91,58,.55); stroke-width: 1; stroke-linejoin: round; }
.globe-grid { fill: none; stroke: rgba(255,255,255,.44); stroke-width: 1.2; stroke-linecap: round; }
.globe-ring { fill: none; stroke: #155d88; stroke-width: 2; }
.subtitle { margin: 0; color: var(--forest); font-size: clamp(1.08rem, 2vw, 1.35rem); line-height: 1.5; }
.divider { height: 1px; margin: 30px 0 0; background: linear-gradient(90deg, var(--accent) 0 90px, var(--line) 90px 100%); }
.generator-form { display: grid; grid-template-columns: .95fr 1.05fr; gap: 16px; margin-top: 18px; align-items: start; }
.article-section, .action-area { grid-column: 1 / -1; }
.form-section, .status-panel, .result-panel, .article-card { border: 1px solid rgba(35,75,56,.13); border-radius: 24px; background: rgba(255,253,248,.93); box-shadow: var(--shadow); }
.form-section { padding: clamp(20px, 2.7vw, 30px); }
.section-heading { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: start; margin-bottom: 20px; }
.section-heading h2 { margin-bottom: 5px; font-size: 1.35rem; }
.section-heading p { margin: 0; color: var(--muted); line-height: 1.55; }
.step { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: var(--surface); background: var(--forest); font-size: .75rem; font-weight: 800; }
.field-grid, .options-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.field { display: grid; gap: 9px; }
.field > span, .result-item label { font-weight: 750; }
.field input, .copy-row input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--ink); background: #fff; padding: 0 14px; transition: border-color .2s, box-shadow .2s; }
.field input:focus, .copy-row input:focus, .open-answer:focus { border-color: var(--forest); box-shadow: 0 0 0 4px rgba(35,75,56,.1); outline: none; }
.field small { color: var(--muted); }
.url-heading-row { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 10px; font-weight: 750; }
.source-collector-button { display: inline-flex; min-height: 42px; align-items: center; gap: 8px; border: 1px solid var(--forest); border-radius: 999px; padding: 0 16px; color: #fff; background: var(--forest); font-weight: 800; cursor: pointer; }
.source-collector-button span { font-size: 1.25rem; }
.article-url-list { display: grid; gap: 9px; }
.article-url-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.article-url-row input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--ink); background: #fff; padding: 0 14px; }
.article-url-row input:focus { border-color: var(--forest); box-shadow: 0 0 0 4px rgba(35,75,56,.1); }
.remove-url-button, .collector-close { display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--forest); background: #fff; cursor: pointer; }
.remove-url-button { width: 46px; height: 46px; font-size: 1.4rem; }
.url-help { margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-block + .options-grid { margin-top: 20px; }
.choice-block legend { margin-bottom: 12px; font-weight: 800; }
.segmented-options, .check-options { display: flex; flex-wrap: wrap; gap: 10px; }
.segmented-options label, .check-options label { position: relative; cursor: pointer; }
.segmented-options input, .check-options input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-options span, .check-options span { display: block; border: 1px solid var(--line); border-radius: 999px; background: #fff; padding: 9px 14px; font-weight: 700; transition: .2s ease; }
.segmented-options input:checked + span, .check-options input:checked + span { border-color: var(--forest); color: #fff; background: var(--forest); }
.segmented-options input:focus-visible + span, .check-options input:focus-visible + span { outline: 3px solid rgba(231,98,63,.35); }
.output-choice { margin-top: 20px; }
.compact-field { align-content: start; }
.number-control { display: grid; grid-template-columns: 48px 80px 48px; width: max-content; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.number-control input { min-height: 48px; border: 0; border-radius: 0; text-align: center; -moz-appearance: textfield; }
.number-control input::-webkit-inner-spin-button { appearance: none; }
.number-button { border: 0; color: var(--forest); background: var(--mint); font-size: 1.3rem; cursor: pointer; }
.action-area { display: grid; justify-items: center; gap: 10px; padding: 8px 0 0; }
.primary-button, .secondary-button { display: inline-flex; min-height: 52px; align-items: center; justify-content: center; gap: 28px; border-radius: 999px; padding: 0 24px; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s; }
.primary-button { border: 1px solid var(--accent); color: #fff; background: var(--accent); box-shadow: 0 12px 28px rgba(231,98,63,.23); }
.secondary-button { border: 1px solid var(--forest); color: var(--forest); background: transparent; }
.primary-button:hover, .secondary-button:hover { transform: translateY(-2px); }
.primary-button:hover { background: var(--accent-dark); }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.primary-button.compact { gap: 10px; }
.privacy-note { margin: 0; color: var(--muted); font-size: .86rem; }
.status-panel, .result-panel { margin-top: 32px; padding: clamp(24px, 4vw, 40px); }
.status-panel { display: flex; gap: 20px; align-items: center; }
.status-panel[hidden], .result-panel[hidden], .worksheet-view[hidden], #digital-result[hidden], #save-pdf[hidden], #open-worksheet[hidden] { display: none; }
.status-panel h2 { margin-bottom: 4px; }
.status-panel p { margin: 0; color: var(--muted); }
.loader { width: 42px; height: 42px; flex: 0 0 auto; border: 4px solid var(--mint); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-panel { border-color: rgba(35,75,56,.28); background: #f2f8f2; }
.result-panel h2 { font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.result-item { display: grid; gap: 9px; margin: 24px 0; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.generated-results { display: grid; gap: 16px; margin-top: 22px; }
.generated-result-card { border: 1px solid rgba(35,75,56,.18); border-radius: 16px; padding: 20px; background: #fff; }
.generated-result-card h3 { margin: 0 0 5px; font-size: 1.12rem; }
.generated-source { display: block; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.result-warning { border: 1px solid #e5c676; border-radius: 12px; margin: 0; padding: 12px 14px; color: #714e00; background: #fff7dc; }
.combined-pdf-button { justify-self: start; }
.combined-print-view { display: none; }
.collector-open { overflow: hidden; }
.source-collector { position: fixed; z-index: 1000; inset: 0; overflow-y: auto; padding: 24px; background: rgba(23,34,29,.62); backdrop-filter: blur(8px); }
.source-collector[hidden] { display: none; }
.collector-shell { width: min(1050px, 100%); min-height: calc(100vh - 48px); margin: 0 auto; border-radius: 28px; padding: clamp(24px, 4vw, 46px); background: var(--paper); box-shadow: 0 28px 90px rgba(0,0,0,.28); }
.collector-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 28px; }
.collector-header h1 { margin-bottom: 10px; font-size: clamp(2.5rem, 6vw, 4.8rem); }
.collector-header p:last-child { margin: 0; color: var(--muted); }
.collector-close { width: 48px; height: 48px; flex: 0 0 auto; font-size: 2rem; }
.collector-search-form { display: grid; gap: 24px; border: 1px solid rgba(35,75,56,.13); border-radius: 20px; padding: clamp(20px, 3vw, 30px); background: var(--surface); }
.collector-query input { font-size: 1.05rem; }
.custom-date-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.custom-date-fields[hidden] { display: none; }
.source-options { gap: 8px; }
.source-results-section { margin-top: 28px; }
.source-results-section[hidden] { display: none; }
.source-results-toolbar { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 16px; }
.source-results-toolbar h2 { margin-bottom: 4px; }
.source-results-toolbar p { margin: 0; color: var(--muted); }
.source-results { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.source-result-card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: #fff; }
.source-result-selection { display: grid; grid-template-columns: auto 1fr; gap: 11px; align-items: flex-start; cursor: pointer; }
.source-result-selection input { width: 19px; height: 19px; margin-top: 2px; accent-color: var(--forest); }
.source-result-selection > span { display: grid; gap: 5px; min-width: 0; }
.source-result-url { color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
.source-result-details { margin: 12px 0 0 30px; color: var(--muted); font-size: .86rem; }
.source-result-details summary { color: var(--forest); font-weight: 800; cursor: pointer; }
.source-result-details p { margin: 10px 0; line-height: 1.45; }
.source-result-details a { color: var(--accent-dark); font-weight: 750; }
.source-result-meta { font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.worksheet-view { max-width: 860px; margin: 0 auto; }
.worksheet-header { margin-bottom: 30px; }
.worksheet-header h1 { font-size: clamp(2.8rem, 8vw, 5.2rem); }
.worksheet-meta { color: var(--muted); }
.article-card { padding: clamp(24px, 5vw, 44px); }
.article-card h2 { font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.article-card p { font-family: Georgia, serif; font-size: 1.18rem; line-height: 1.75; }
.source-link { color: var(--accent-dark); font-weight: 750; }
.questions-list { display: grid; gap: 18px; margin: 24px 0; }
.question-card { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); padding: 24px; }
.question-number { color: var(--accent-dark); font-size: .75rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.question-card h2 { margin: 8px 0 18px; font-size: 1.06rem; line-height: 1.5; }
.open-answer { width: 100%; min-height: 110px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.answer-options { display: grid; gap: 9px; }
.answer-option { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; }
.answer-option:has(input:checked) { border-color: var(--forest); background: var(--mint); }
.worksheet-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.score-message { min-height: 24px; margin-top: 18px; font-weight: 750; }
@media (max-width: 720px) {
  .page-shell { width: min(100% - 22px, 1080px); padding: 42px 0 65px; }
  .generator-form, .field-grid, .options-grid { grid-template-columns: 1fr; }
  .article-section, .action-area { grid-column: auto; }
  .section-heading { grid-template-columns: 38px 1fr; }
  .copy-row { grid-template-columns: 1fr; }
  .copy-row .secondary-button { width: 100%; }
  .title-row { align-items: center; }
  .globe-icon { width: clamp(32px, 6vw, 48px); margin-top: 0; }
  .auth-view { grid-template-columns: 1fr; gap: 24px; min-height: auto; }
  .auth-brand h1 { font-size: 3.4rem; }
  .auth-globe { width: 54px; height: 54px; margin-bottom: 10px; }
  .account-request { grid-template-columns: 1fr; }
  .account-stat { grid-template-columns: 1fr 1fr; }
  .account-identity { grid-column: 1 / -1; }
  .url-heading-row, .source-results-toolbar { align-items: stretch; flex-direction: column; }
  .source-collector-button { justify-content: center; }
  .source-collector { padding: 0; }
  .collector-shell { min-height: 100vh; border-radius: 0; }
  .custom-date-fields, .source-results { grid-template-columns: 1fr; }
}
@media print {
  @page { margin: 8mm; }
  body { background: #fff; }
  .page-shell { width: 100%; padding: 0; }
  .no-print, .source-link { display: none !important; }
  .worksheet-header { margin-bottom: 8px; }
  .worksheet-header h1 { margin-bottom: 4px; font-size: 24pt; line-height: 1; }
  .worksheet-header .eyebrow { margin-bottom: 4px; font-size: 7pt; }
  .worksheet-meta { margin-bottom: 6px; font-size: 8pt; }
  .article-card, .question-card { box-shadow: none; break-inside: avoid; }
  .article-card { border: 1px solid #bbb; border-radius: 8px; padding: 10px 12px; }
  .article-card h2 { margin-bottom: 5px; font-size: 13pt; }
  .article-card p { margin-bottom: 0; font-size: 9pt; line-height: 1.35; }
  .questions-list { gap: 6px; margin: 8px 0 0; }
  .question-card { border-radius: 7px; padding: 8px 10px; }
  .question-number { margin-bottom: 2px; font-size: 6.5pt; }
  .question-card h2 { margin: 2px 0 6px; font-size: 8.5pt; line-height: 1.25; }
  .answer-options { grid-template-columns: 1fr 1fr; gap: 3px 8px; }
  .answer-option { border-radius: 5px; padding: 3px 5px; font-size: 7.5pt; }
  .open-answer { min-height: 30px; border-radius: 5px; padding: 4px; font-size: 8pt; }
  .open-answer::placeholder { color: transparent !important; opacity: 0 !important; }
  body.printing-combined .page-shell > section:not(#combined-print-view) { display: none !important; }
  body.printing-combined #combined-print-view { display: block !important; }
  .combined-sheet { break-after: page; }
  .combined-sheet:last-child { break-after: auto; }
}
