:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f4f7fb;
  line-height: 1.5;
  --blue: #155eef;
  --blue-dark: #0d47b5;
  --blue-soft: #eaf1ff;
  --navy: #0b1f44;
  --muted: #66758c;
  --line: #dce3ee;
  --green: #0aaa7b;
  --amber: #f3a008;
  --orange: #f05a24;
  --red: #d9382b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; }
a { color: var(--blue-dark); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.35rem); line-height: 1.04; letter-spacing: -.045em; margin-bottom: 12px; }
h2 { line-height: 1.18; letter-spacing: -.025em; }
h3 { line-height: 1.25; }

.app-header { background: linear-gradient(100deg, #0a4bd4, #1d68f2); color: white; padding: 11px 0; box-shadow: 0 2px 12px rgba(22, 73, 170, .2); }
.app-header a { color: white; text-decoration: none; font-weight: 650; }
nav, .container { max-width: 1240px; margin: auto; padding-left: 24px; padding-right: 24px; }
nav { display: flex; gap: 19px; align-items: center; min-height: 48px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800 !important; margin-right: auto; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 32px; border: 2px solid rgba(255,255,255,.9); border-radius: 7px; font-size: .75rem; letter-spacing: .05em; }
.nav-logout { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35); color: white; padding: 8px 13px; }
.container { padding-top: 42px; padding-bottom: 72px; }

.page-heading, .result-heading, .section-heading { display: flex; justify-content: space-between; gap: 24px; }
.page-heading, .result-heading { margin-bottom: 30px; }
.page-heading { align-items: flex-end; padding: 12px 0; }
.compact-heading { align-items: center; }
.result-heading { align-items: center; }
.result-heading h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); max-width: 900px; }
.eyebrow { color: var(--blue); font-size: .74rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 8px; }
.lead { color: #53637a; font-size: 1.12rem; max-width: 730px; margin-bottom: 0; }
.source-url { display: block; max-width: 850px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-meta { color: var(--muted); margin-bottom: 5px; }

.card { background: white; border: 1px solid var(--line); border-radius: 13px; padding: 24px; box-shadow: 0 7px 24px rgba(28, 52, 91, .06); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.stack > * + * { margin-top: 14px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .84rem; word-break: break-all; }
pre { overflow: auto; background: #f0f4fa; padding: 14px; border-radius: 8px; }

label { display: block; font-weight: 700; margin-bottom: 6px; }
input, select, textarea, button { width: 100%; font: inherit; padding: 11px 13px; border: 1px solid #bdc8d8; border-radius: 8px; background: white; }
input:focus, select:focus, textarea:focus { outline: 3px solid #ccdcff; border-color: var(--blue); }
textarea { min-height: 105px; }
button, .button { display: inline-block; width: auto; background: var(--blue); color: white; border: 0; padding: 10px 16px; border-radius: 8px; text-decoration: none; cursor: pointer; font-weight: 750; }
.button.secondary, button.secondary { background: var(--blue-soft); color: var(--blue-dark); }
button:disabled { cursor: not-allowed; opacity: .45; }
.field-help { color: var(--muted); font-size: .86rem; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.top-actions { margin-bottom: 28px; }
.top-actions form, .history-card-footer form { display: contents; }
.error, .success-message { padding: 12px 15px; border-radius: 8px; }
.error { background: #fff0ed; border: 1px solid #f6bbb1; }
.success-message { color: #087453; background: #e6f8f2; border: 1px solid #a9e3d1; }

.new-analysis-panel { margin-bottom: 22px; scroll-margin-top: 20px; }
.new-analysis-panel > summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; }
.new-analysis-panel > summary::-webkit-details-marker { display: none; }
.new-analysis-panel > summary > span:first-child { display: grid; }
.new-analysis-panel > summary small { color: var(--blue); font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.new-analysis-panel > summary strong { font-size: 1.2rem; }
.summary-action { color: var(--blue); font-weight: 750; }
.analysis-form { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; padding-top: 23px; margin-top: 18px; border-top: 1px solid var(--line); }
.form-wide { grid-column: 1 / -1; }
.form-submit { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.optional-fields { border: 1px solid var(--line); border-radius: 9px; padding: 12px; }
.optional-fields summary, .technical-details summary, .admin-create-site summary { cursor: pointer; font-weight: 750; }
.optional-fields > div { margin-top: 14px; }

.history-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 18px; margin-bottom: 18px; }
.history-toolbar > div { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; color: var(--muted); }
.history-count { color: var(--navy); font-size: 1.8rem; line-height: 1; font-weight: 850; }
.history-filters { flex: 1; display: grid; grid-template-columns: minmax(180px, 1fr) 170px 175px auto auto; gap: 8px; align-items: center; }
.history-filters button { height: 44px; }
.clear-filter { font-size: .88rem; font-weight: 700; text-align: center; }
.analysis-history { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.history-card { min-width: 0; padding: 21px; display: flex; flex-direction: column; min-height: 410px; }
.history-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.history-card-top > div { min-width: 0; }
.site-kicker { color: var(--blue); font-size: .72rem; text-transform: uppercase; font-weight: 850; letter-spacing: .09em; }
.history-card h2 { font-size: 1.22rem; margin: 8px 0 5px; }
.history-card h2 a { color: var(--navy); text-decoration: none; }
.history-card h2 a:hover { color: var(--blue); text-decoration: underline; }
.history-url { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0; }
.history-score-row, .audit-score-row { display: flex; justify-content: space-around; align-items: center; gap: 15px; }
.history-score-row { margin: 25px 0; }

.score-ring { --ring-color: var(--green); width: 96px; height: 96px; flex: 0 0 auto; padding: 7px; border-radius: 50%; background: conic-gradient(var(--ring-color) calc(var(--score) * 1%), #e5e9f0 0); display: grid; place-items: center; }
.score-ring > div { width: 100%; height: 100%; border-radius: 50%; background: white; display: grid; place-content: center; text-align: center; }
.score-ring strong { color: var(--ring-color); font-size: 1.65rem; line-height: 1; }
.score-ring small { color: var(--muted); font-size: .65rem; text-transform: uppercase; font-weight: 850; letter-spacing: .08em; margin-top: 4px; }
.score-ring.watch { --ring-color: var(--amber); }
.score-ring.risk { --ring-color: var(--orange); }
.score-ring.empty { --ring-color: #cbd2dc; }
.score-ring.compact { width: 72px; height: 72px; padding: 5px; }
.score-ring.compact strong { font-size: 1.22rem; }
.score-ring.compact small { font-size: .56rem; }

.work-status { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: auto; }
.work-status > div { display: grid; }
.work-status span { color: var(--muted); font-size: .82rem; }
.progress-track { height: 8px; background: #e5eaf2; border-radius: 999px; overflow: hidden; margin-top: 9px; }
.progress-track span { display: block; height: 100%; min-width: 0; max-width: 100%; background: linear-gradient(90deg, #1660ef, #43a1ff); border-radius: inherit; transition: width .25s ease; }
.progress-track.large { height: 11px; margin: 16px 0 20px; }
.history-card-footer { border-top: 1px solid var(--line); margin-top: 19px; padding-top: 15px; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: .78rem; }
.history-card-footer .button, .history-card-footer button { padding: 8px 11px; font-size: .82rem; }
.pagination { margin-top: 24px; display: flex; justify-content: center; align-items: center; gap: 16px; }
.admin-create-site { max-width: 680px; margin: 36px auto 0; color: var(--muted); }
.admin-create-site form { margin-top: 12px; }
.admin-create-site input { flex: 1; }
.empty-state { text-align: center; grid-column: 1 / -1; padding: 55px 24px; }
.empty-icon { font-size: 3rem; color: var(--blue); }

.badge { display: inline-block; padding: 5px 10px; border-radius: 999px; background: #e7ebf1; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.green, .completed, .success { background: #ddf7ee; color: #087453; }
.yellow, .partial, .queued, .preparing, .checking_plugin, .collecting, .normalizing, .synthesizing, .publishing, .running { background: #fff1c7; color: #805700; }
.red, .failed, .blocked_auth, .blocked_quota, .blocked_plugin, .timed_out { background: #ffe4df; color: #982c22; }

.checklist-panel { margin-bottom: 20px; border-top: 4px solid var(--blue); }
.checklist-heading { display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.checklist-heading h2 { margin-bottom: 7px; }
.checklist-heading p:last-child { color: var(--muted); margin: 0; }
.progress-number { display: grid; text-align: right; white-space: nowrap; }
.progress-number strong { color: var(--blue); font-size: 2.2rem; line-height: 1; }
.progress-number span { color: var(--muted); font-size: .78rem; }
.checklist { padding: 0; margin: 0; list-style: none; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.checklist li + li { border-top: 1px solid var(--line); }
.checklist form { margin: 0; }
.check-toggle { display: flex; align-items: center; width: 100%; border: 0; border-radius: 0; background: white; color: var(--navy); text-align: left; padding: 13px 15px; }
.check-toggle:hover { background: #f6f9ff; }
.check-box { width: 24px; height: 24px; border: 2px solid #aeb9c9; border-radius: 5px; display: grid; place-items: center; flex: 0 0 auto; color: white; font-weight: 900; }
.check-text { display: flex; justify-content: space-between; align-items: center; gap: 15px; width: 100%; margin-left: 12px; }
.check-text small { color: var(--muted); text-transform: capitalize; }
.checklist li.done .check-box { background: var(--green); border-color: var(--green); }
.checklist li.done .check-text strong { color: #7c8798; text-decoration: line-through; }

.audit-summary { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(420px, 1.6fr); gap: 25px; align-items: center; margin-bottom: 20px; }
.audit-summary h2 { margin-bottom: 7px; }
.audit-summary p:last-child { color: var(--muted); margin-bottom: 0; }
.audit-score-row { grid-column: 2; grid-row: 1; }
.analysis-duration { grid-column: 1 / -1; text-align: right; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--line); padding-top: 10px; }

.comparison-panel { margin-bottom: 20px; }
.comparison-panel .section-heading { align-items: center; margin-bottom: 16px; }
.comparison-panel h2 { margin-bottom: 0; }
.comparison-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.comparison-grid article { background: #f7f9fd; border: 1px solid var(--line); border-radius: 10px; padding: 13px; display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 8px; align-items: end; }
.comparison-grid article > span:first-child { grid-column: 1 / -1; color: var(--muted); font-size: .7rem; font-weight: 850; text-transform: uppercase; }
.comparison-grid article div { display: grid; }
.comparison-grid small { color: var(--muted); }
.comparison-grid strong { font-size: 1.35rem; }
.comparison-arrow { align-self: center; color: var(--muted); }
.delta { font-size: .75rem; font-style: normal; font-weight: 850; align-self: center; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--muted); }

.editorial-summary { margin-bottom: 30px; }
.editorial-summary > p:last-child { font-size: 1rem; line-height: 1.72; margin-bottom: 0; color: #435168; }
.implementation-section, .copy-section { margin: 34px 0; }
.implementation-section .section-heading, .copy-section .section-heading { align-items: flex-end; margin-bottom: 14px; }
.implementation-section h2, .copy-section h2 { margin-bottom: 0; }
.action-grid, .copy-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.action-card h3 { margin: 14px 0 9px; }
.action-card > p { color: #4d5c72; }
.action-card.completed-action { opacity: .68; border-color: #a9e3d1; }
.action-card.completed-action h3 { text-decoration: line-through; }
.action-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .78rem; }
.priority { text-transform: capitalize; border-radius: 999px; padding: 2px 8px; background: #eef2f7; font-weight: 800; }
.priority-high, .priority-alta, .priority-critical, .priority-crítica, .priority-critica { color: #9a2c20; background: #ffe5df; }
.priority-medium, .priority-media { color: #805700; background: #fff1c7; }
.action-steps { color: #4d5c72; padding-left: 20px; }
.action-steps li + li { margin-top: 6px; }
.validation-box { background: #eef4ff; border-left: 3px solid var(--blue); border-radius: 7px; padding: 12px; font-size: .87rem; }
.validation-box strong, .validation-box span { display: block; }
.validation-box span { color: var(--muted); margin-top: 4px; }

.copy-card { border-top: 3px solid var(--blue); }
.copy-card-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.copy-card-heading h3 { margin-bottom: 0; }
.copy-button { padding: 7px 11px; font-size: .8rem; }
.copy-content { white-space: pre-wrap; background: #f6f8fc; border: 1px solid var(--line); border-radius: 8px; padding: 13px; margin: 15px 0 10px; }
.copy-card > p { color: var(--muted); font-size: .83rem; margin-bottom: 0; }
.copy-empty { margin: 24px 0; }

.utility-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 28px 0; }
.download-list { display: flex; flex-wrap: wrap; gap: 8px; }
.download-list a { background: var(--blue-soft); border-radius: 8px; padding: 8px 12px; text-decoration: none; font-weight: 750; }
.technical-details { margin-top: 28px; }
.technical-details > summary { padding: 16px 0; color: #435168; }
.table-shell { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: white; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid #e4e9f1; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #526177; }
.progress-card { text-align: center; padding: 48px 24px; margin-bottom: 24px; }
.progress-card .large { max-width: 480px; margin: 18px auto; }
.metric { font-size: 3rem; font-weight: 850; line-height: 1; }
.login { max-width: 440px; margin: 10vh auto; }

.settings-list { display: grid; gap: 16px; max-width: 900px; }
.settings-card { display: grid; grid-template-columns: minmax(180px, .45fr) 1fr auto; align-items: center; gap: 24px; }
.settings-card h2 { margin: 5px 0 0; }
.toggle-setting { display: grid; grid-template-columns: auto 1fr; gap: 13px; align-items: center; margin: 0; cursor: pointer; }
.toggle-setting input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.toggle-track { width: 46px; height: 26px; background: #cdd5e0; border-radius: 999px; position: relative; transition: background .2s; }
.toggle-track::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: white; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: transform .2s; }
.toggle-setting input:checked + .toggle-track { background: var(--blue); }
.toggle-setting input:checked + .toggle-track::after { transform: translateX(20px); }
.toggle-setting input:focus-visible + .toggle-track { outline: 3px solid #bfd2ff; }
.toggle-setting strong, .toggle-setting small { display: block; }
.toggle-setting small { color: var(--muted); font-weight: 400; margin-top: 3px; }

@media (max-width: 980px) {
  .analysis-history { grid-template-columns: 1fr; }
  .history-filters { grid-template-columns: 1fr 1fr; }
  .history-filters input { grid-column: 1 / -1; }
  .audit-summary { grid-template-columns: 1fr; }
  .audit-score-row { grid-column: 1; grid-row: auto; }
  .comparison-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-card { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  nav { flex-wrap: wrap; gap: 12px 16px; }
  .brand { width: calc(100% - 70px); }
  nav form { margin-left: auto; }
  .container { padding: 27px 16px 55px; }
  .page-heading, .result-heading, .section-heading, .checklist-heading { align-items: flex-start; flex-direction: column; }
  .history-heading .button { width: 100%; text-align: center; }
  .analysis-form, .history-filters { grid-template-columns: 1fr; }
  .form-wide, .history-filters input { grid-column: 1; }
  .form-submit { align-items: stretch; flex-direction: column; }
  .history-toolbar { align-items: stretch; flex-direction: column; }
  .history-card { min-height: 0; }
  .history-score-row { gap: 8px; }
  .score-ring.compact { width: 62px; height: 62px; }
  .score-ring.compact strong { font-size: 1.05rem; }
  .history-card-footer { align-items: flex-start; flex-direction: column; }
  .audit-score-row { display: grid; grid-template-columns: repeat(2, 1fr); justify-items: center; }
  .comparison-grid, .action-grid, .copy-grid, .utility-grid { grid-template-columns: 1fr; }
  .source-url { max-width: 90vw; }
  .check-text { align-items: flex-start; flex-direction: column; gap: 2px; }
  .analysis-duration { text-align: left; }
}
