/* CoraSEOTool.com — app.css (customer area)
   Colors and type faces live in tokens.css. This file is layout only. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--font-ui);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5rem; letter-spacing: -0.02em; }
h3 { font-size: 15px; margin-top: 1.1rem; }
h4 { font-size: 13.5px; color: var(--slate); margin-top: 0.8rem; }

/* ------------------------------ topbar ------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.65rem 1.25rem;
  background: var(--topbar);
  color: var(--topbar-text);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand span { font-weight: 600; color: var(--accent); }

.mainnav { display: flex; flex-wrap: wrap; gap: 0.15rem; }
.mainnav a {
  color: var(--text-secondary);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}
.mainnav a:hover { color: var(--text); background: var(--bg-subtle); text-decoration: none; }
.mainnav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

.inline-form { display: inline; margin: 0; }

.link-btn {
  background: none;
  border: 0;
  padding: 0.35rem 0.5rem;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.link-btn:hover { color: var(--accent); background: var(--accent-soft); }

/* --------------------------- banners + page --------------------------- */

.imp-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.55rem 1.25rem;
  background: var(--warn-bg);
  color: var(--warn);
  border-bottom: 1px solid #fde68a;
  border-left: 3px solid #f59e0b;
  font-size: 13.5px;
  font-weight: 500;
}
.imp-banner .link-btn { color: var(--warn); font-weight: 700; }
.imp-banner .link-btn:hover { background: #fef3c7; color: var(--warn); }

.flash {
  margin: 0.75rem 1.25rem;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-size: 13.5px;
  border: 1px solid transparent;
}
.flash-ok, .flash-success { background: var(--ok-bg); color: var(--ok); border-color: #bfe3cd; }
.flash-error { background: var(--err-bg); color: var(--err); border-color: #f2c4c1; }
.flash-info { background: var(--info-bg); color: var(--info); border-color: #c5dbf2; }

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

.footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  color: var(--muted);
  font-size: 12.5px;
}

.page-head { margin-bottom: 1.1rem; }
.page-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 0.2rem; }
.page-sub { color: var(--muted); margin: 0 0 0.5rem; font-size: 13.5px; }

/* ------------------------------ cards ------------------------------ */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.3rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}
.card-title { font-size: 16px; font-weight: 600; margin: 0 0 0.6rem; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }
.hint { color: var(--muted); font-size: 12.5px; }

.note-box { border-left: 4px solid var(--info); background: var(--info-bg); }

/* ------------------------------ forms ------------------------------ */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 13.5px; font-weight: 600; }
.field .hint { font-weight: 400; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], select, textarea {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  min-width: 0;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid var(--accent-ring);
  border-color: var(--accent);
}
input[readonly] { background: var(--grey-bg); color: var(--muted); }

.btn {
  display: inline-block;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ok { background: var(--ok); border-color: var(--ok); }
.btn-warn { background: var(--warn); border-color: var(--warn); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent); }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 12.5px; }
.btn-wide { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }

/* ------------------------------ badges ------------------------------ */

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
  background: var(--grey-bg);
  color: var(--grey);
}
.badge-green { background: var(--ok-bg); color: var(--ok); }
.badge-amber { background: var(--warn-bg); color: var(--warn); }
.badge-red { background: var(--err-bg); color: var(--err); }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-grey { background: var(--grey-bg); color: var(--grey); }

.chip {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.chip-pct { background: var(--ok-bg); color: var(--ok); }

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 0.05rem 0.45rem;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tag-inscope { background: var(--ok-bg); color: var(--ok); }
.tag-outscope { background: var(--slate-bg); color: var(--slate); }

/* ------------------------------ tables ------------------------------ */

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.tbl thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
}
.tbl-tight th, .tbl-tight td { padding: 0.3rem 0.5rem; }
.row-inscope { background: #f2f9f4; }
.row-outscope { color: var(--muted); background: #fafbfd; }
.actions-cell { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.voice-detail {
  margin: 0.15rem 0 0.35rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.55;
}
.voice-detail p { margin: 0.2rem 0; }
.voice-detail .voice-label { font-weight: 600; color: var(--text-secondary); }
.voice-detail-row td { border-bottom: 1px solid var(--line); padding-top: 0; }

.phase-block { margin: 0.6rem 0; }

/* ------------------------- sticky coverage bar ------------------------- */

.coverage-sticky {
  position: sticky;
  top: 52px;
  z-index: 20;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(16, 26, 44, 0.08);
  margin-bottom: 1.1rem;
}
.coverage-sticky-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  padding: 0.55rem 1rem;
}
.coverage-label { font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.coverage-pct { font-weight: 800; font-size: 18px; color: var(--accent); min-width: 3.2rem; }
.coverage-track {
  flex: 1 1 220px;
  height: 12px;
  border-radius: 999px;
  background: var(--grey-bg);
  overflow: hidden;
}
.coverage-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--bar-from), var(--bar-to));
  transition: width 0.4s ease;
}
.coverage-counts { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* ------------------------------ step bar ------------------------------ */

.step-move {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem 0.15rem;
  border-top: 1px solid var(--line);
}
.step-move .step-nav {
  min-height: 40px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--text);
}
.step-move .step-nav:hover:not(:disabled) {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
.step-move .step-nav:disabled {
  background: #fff;
  color: var(--grey);
  border-color: var(--line);
  opacity: 1;
  cursor: not-allowed;
}
.step-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1rem;
  padding: 0.45rem 0.85rem 0.75rem;
}
.step-link {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
}
.step-link:hover {
  color: var(--text);
  text-decoration: none;
  border-bottom-color: var(--text);
}
.step-link[aria-current="step"] {
  font-weight: 800;
  border-bottom-color: var(--text);
}
.step-link.is-locked,
.step-link[aria-disabled="true"] {
  color: var(--grey);
  font-weight: 500;
  border-bottom-color: transparent;
  cursor: default;
}
.step-link-letter { font-weight: 700; margin-right: 0.15rem; }
.step-link:focus-visible,
.step-nav:focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 2px;
}
.step-panel[hidden] { display: none; }

/* ----------------------------- step cards ----------------------------- */

.step-card { border-left: 4px solid var(--line); }
.step-card[data-state="working"] { border-left-color: var(--info); opacity: 0.85; }
.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
}
.step-letter {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--slate);
  background: var(--slate-bg);
  border-radius: 5px;
  padding: 0.05rem 0.45rem;
  vertical-align: middle;
}
.step-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.step-version { font-size: 12px; }

.step-status.st-pending { background: var(--grey-bg); color: var(--grey); }
.step-status.st-running { background: var(--info-bg); color: var(--info); }
.step-status.st-done { background: var(--ok-bg); color: var(--ok); }
.step-status.st-stale { background: var(--slate-bg); color: var(--slate); }
.step-status.st-failed { background: var(--err-bg); color: var(--err); }

.step-delta {
  font-size: 12px;
  font-weight: 700;
  color: var(--ok);
  background: var(--ok-bg);
  border-radius: 5px;
  padding: 0.08rem 0.45rem;
}
.step-delta.delta-grey { background: var(--slate-bg); color: var(--slate); }

.step-output { margin: 0.7rem 0 0.2rem; }
.step-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.7rem; }
.step-msg { color: var(--err); font-size: 13px; font-weight: 600; }
.step-hint { margin-top: 0.4rem; }
.step-stale .step-output { opacity: 0.75; }

.out-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0.2rem 0;
  padding: 0.7rem 0.85rem;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}
.out-list { margin: 0.4rem 0; padding-left: 1.4rem; }
.out-list li { margin: 0.2rem 0; }
.out-pre {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  background: var(--bg-subtle);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  overflow-x: auto;
  white-space: pre;
}
.out-kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 0.2rem 0.9rem; margin: 0.3rem 0; }
.out-kv dt { font-weight: 600; color: var(--slate); }
.out-kv dd { margin: 0; overflow-wrap: anywhere; }

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.5rem 1rem;
  margin: 0.4rem 0 0.6rem;
}
.kv { display: flex; flex-direction: column; font-size: 13.5px; }
.kv-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }

/* ------------------------------ final pack ------------------------------ */

.packfield { border: 1px solid var(--line); border-radius: 8px; margin: 0.6rem 0; overflow: hidden; }
.packfield-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  background: var(--bg-subtle);
  padding: 0.4rem 0.7rem;
  font-size: 13px;
}
.packfield-text {
  padding: 0.7rem 0.85rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}

.copy-btn { min-width: 5.5rem; }

/* Scorecard status colors: closed green, partial amber, skipped grey,
   out_of_scope slate. */
.sc-status {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 0.08rem 0.5rem;
  border-radius: 5px;
  white-space: nowrap;
}
.sc-closed { background: var(--ok-bg); color: var(--ok); }
.sc-partial { background: var(--warn-bg); color: var(--warn); }
.sc-skipped_no_fact { background: var(--grey-bg); color: var(--grey); }
.sc-out_of_scope { background: var(--slate-bg); color: var(--slate); }
.scorecard td { vertical-align: middle; }

/* ------------------------------ dashboard ------------------------------ */

.dash-grid {
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: 1rem;
  margin: 0.8rem 0;
}
.dash-big {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  padding: 0.9rem 1.2rem;
}
.dash-pct { font-size: 34px; font-weight: 800; color: var(--accent); display: block; }
.dash-big p { margin: 0.2rem 0 0; font-size: 12px; color: var(--muted); }
.dash-strict { align-self: center; }
.dash-strict p { margin: 0.2rem 0; }
.dash-chart {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  background: #fff;
  margin-top: 0.9rem;
}
.dash-wide { grid-column: 1 / -1; }
canvas { max-width: 100%; }

/* ------------------------------ auth shells ------------------------------ */

.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 42%);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.75rem 1.6rem;
  box-shadow: 0 8px 30px rgba(16, 26, 44, 0.18);
}
.auth-brand { font-weight: 800; font-size: 17px; margin-bottom: 1rem; }
.auth-brand span { font-weight: 600; color: var(--accent); }
.auth-card .flash { margin: 0 0 0.8rem; }
.auth-form { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 0.6rem; }
.auth-form .field { font-weight: 600; font-size: 13.5px; }
.auth-links { margin: 1rem 0 0; font-size: 13px; text-align: center; }

/* ------------------------------ misc pages ------------------------------ */

.plan-card .plan-price { font-size: 20px; font-weight: 700; margin: 0.2rem 0; }
.order-form { display: flex; align-items: end; flex-wrap: wrap; gap: 0.8rem; margin-top: 0.6rem; }
.pay-form { display: inline-flex; gap: 0.4rem; align-items: center; }
.pay-form select { padding: 0.3rem 0.45rem; font-size: 13px; }

.usage-notes {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  background: var(--info-bg);
  border-left: 4px solid var(--info);
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
}
.usage-notes p { margin: 0.25rem 0; }

.lock-note a { font-weight: 700; }

.waiting-card { text-align: center; padding: 2.5rem 1.5rem; }
.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  border: 4px solid var(--grey-bg);
  border-top-color: var(--accent);
  animation: cora-spin 0.9s linear infinite;
}
@keyframes cora-spin { to { transform: rotate(360deg); } }
.waiting-status { font-size: 16px; font-weight: 700; }
.waiting-timeout { margin-top: 1rem; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------ report frame ---------------------------- */

.report-stage { display: flex; flex-direction: column; gap: 0.85rem; width: 100%; }
.report-frame {
  display: block;
  width: 100%;
  height: 70vh;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-sizing: border-box;
}
.report-stage-confirm .report-frame {
  /* The bar above the frame is about 360px, and the confirm block is about 120px. */
  height: calc(100vh - 530px);
  min-height: 280px;
}
.report-confirm {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1.05rem 1.05rem;
  box-shadow: var(--shadow);
}
.report-confirm .btn { font-size: 16px; padding: 0.75rem 1.2rem; }
.report-confirm .hint { display: block; margin-top: 0.5rem; font-size: 14px; }
body.report-doc {
  background: var(--panel);
  margin: 0;
  max-width: none;
  padding: 1rem 1.15rem 2rem;
}
body.report-doc .report-doc-head { margin-bottom: 0.8rem; }
body.report-doc .report-doc-head h1 { font-size: 22px; margin-bottom: 0.15rem; }
.report-lead { margin: 0.35rem 0 0; font-size: 15px; color: var(--text); }

/* ------------------------------ responsive ------------------------------ */

@media (max-width: 720px) {
  .page { padding: 1rem 0.8rem 2.5rem; }
  .report-frame,
  .report-stage-confirm .report-frame { height: 50vh; min-height: 50vh; }
  .report-confirm .btn { width: 100%; }
  .flash { margin: 0.6rem 0.8rem; }
  .coverage-sticky { top: 0; }
  .coverage-sticky-inner { padding: 0.45rem 0.7rem; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-chart { max-width: 420px; }
  .auth-shell { align-items: flex-start; }
}
