:root {
  --color-bg: #f7f8fa;
  --color-surface: #ffffff;
  --color-border: #e2e5ea;
  --color-text: #1a2233;
  --color-muted: #5b6472;
  --color-primary: #0f2942;
  --color-primary-hover: #163a5c;
  --color-accent: #1c6e5c;
  --color-danger: #b3261e;
  --color-warning-bg: #fff6e5;
  --color-warning-border: #f0c674;
  --color-success-bg: #e9f7ef;
  --color-success-border: #8fd6a8;
  --color-error-bg: #fdecea;
  --color-error-border: #e79a94;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--color-bg); color: var(--color-text); line-height: 1.55; }
img { max-width: 100%; }
a { color: var(--color-primary); }
h1, h2, h3 { line-height: 1.25; color: var(--color-primary); }
.muted { color: var(--color-muted); }
.small { font-size: 0.875rem; }
.center-text { text-align: center; }
.text-left { text-align: left; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 560px; }
.page-pad { padding-top: 40px; padding-bottom: 60px; }
.section { padding: 48px 24px; }

/* Header */
.site-header { background: var(--color-surface); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; color: var(--color-primary); text-decoration: none; }
.main-nav { display: flex; align-items: center; gap: 20px; }
.main-nav a:not(.btn) { text-decoration: none; color: var(--color-text); font-size: 0.95rem; }
.main-nav a.active { color: var(--color-primary); font-weight: 600; }
.link-button { background: none; border: none; color: var(--color-text); cursor: pointer; font-size: 0.95rem; padding: 0; }

/* Buttons */
.btn { display: inline-block; padding: 10px 18px; border-radius: 8px; font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer; font-size: 0.95rem; text-align: center; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary { background: #fff; color: var(--color-primary); border-color: var(--color-border); }
.btn-secondary:hover { background: #f0f2f5; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { display: block; width: 100%; margin-top: 8px; }
.btn.disabled, .btn:disabled { opacity: 0.6; cursor: default; }
.btn-active { outline: 2px solid var(--color-accent); }

/* Cards & forms */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; margin-bottom: 24px; }
.auth-card { max-width: 420px; margin: 0 auto; }
label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 0.9rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="file"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 8px; font-size: 0.95rem; background: #fff; color: var(--color-text);
}
input:disabled { background: #f0f2f5; color: var(--color-muted); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.alert { padding: 12px 16px; border-radius: 8px; margin: 12px 0; font-size: 0.9rem; border: 1px solid; }
.alert-error { background: var(--color-error-bg); border-color: var(--color-error-border); color: var(--color-danger); }
.alert-success { background: var(--color-success-bg); border-color: var(--color-success-border); color: #1e6b3a; }
.alert-warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: #7a5b00; }

.demo-banner { background: #fff6e5; border: 1px dashed #f0c674; color: #7a5b00; font-weight: 700; text-align: center; padding: 10px; border-radius: 8px; margin-bottom: 16px; letter-spacing: 0.02em; }

/* Hero */
.hero { background: linear-gradient(180deg, #0f2942 0%, #163a5c 100%); color: #fff; padding: 90px 24px 70px; }
.hero-inner { max-width: 760px; margin: 0 auto; text-align: center; }
.hero h1 { color: #fff; font-size: 2.3rem; margin-bottom: 16px; }
.hero-subtitle { font-size: 1.1rem; color: #cfd8e3; margin-bottom: 28px; }
.hero-ctas { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hero-ctas .muted { color: #a9b6c6; }

.lead { font-size: 1.05rem; color: var(--color-muted); max-width: 760px; }

/* Steps */
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.steps li { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; }
.step-number { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary); color: #fff; font-weight: 700; margin-bottom: 10px; }

/* Before/after */
.before-after { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ba-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; }
.ba-tag { display: inline-block; background: #eef1f5; color: var(--color-muted); padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; margin-bottom: 12px; }
.ba-tag-after { background: var(--color-primary); color: #fff; }
.ba-mock { font-family: "Courier New", monospace; font-size: 0.95rem; }
.ba-line { padding: 6px 0; border-bottom: 1px dashed var(--color-border); }
.ba-redacted { display: inline-block; width: 140px; height: 14px; background: #111; border-radius: 2px; vertical-align: middle; }

/* Benefits / audience */
.benefits-grid, .audience-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.benefit { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 18px; }
.audience-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 18px; text-align: center; font-weight: 600; color: var(--color-primary); }

/* Plans */
.plans-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.plan-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 24px; text-align: center; }
.plan-card.plan-current { border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(15,41,66,0.1); }
.plan-price { font-size: 1.8rem; font-weight: 700; color: var(--color-primary); margin: 8px 0 0; }
.plan-price span { font-size: 0.9rem; color: var(--color-muted); font-weight: 400; }
.plan-credits { font-weight: 600; margin: 4px 0 12px; }
.plan-summary { padding-left: 18px; }

/* FAQ */
.faq details { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; padding: 14px 16px; margin-bottom: 10px; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq p { margin: 10px 0 0; color: var(--color-muted); }

.cta-final { text-align: center; }

/* Footer */
.site-footer { background: #0f2942; color: #cfd8e3; margin-top: 60px; padding: 36px 0 20px; }
.footer-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; }
.site-footer a { color: #cfd8e3; }
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.fine-print { font-size: 0.8rem; color: #8fa0b4; margin-top: 20px; }

/* Dashboard */
.dashboard-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 18px; }
.stat-label { display: block; font-size: 0.8rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { display: block; font-size: 1.6rem; font-weight: 700; color: var(--color-primary); margin-top: 4px; }
.stat-link { font-size: 0.85rem; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--color-border); font-size: 0.9rem; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: #eef1f5; color: var(--color-muted); }
.badge-completed { background: var(--color-success-bg); color: #1e6b3a; }
.badge-ready_for_review { background: var(--color-warning-bg); color: #7a5b00; }
.badge-failed, .badge-expired { background: var(--color-error-bg); color: var(--color-danger); }

/* File upload */
.file-drop { display: flex; align-items: center; justify-content: center; border: 2px dashed var(--color-border); border-radius: var(--radius); padding: 40px 20px; text-align: center; cursor: pointer; margin: 10px 0; color: var(--color-muted); position: relative; }
.file-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.spinner { width: 36px; height: 36px; border: 4px solid var(--color-border); border-top-color: var(--color-primary); border-radius: 50%; margin: 20px auto; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Editor */
.editor-layout { display: flex; gap: 0; height: calc(100vh - 64px); }
.editor-pages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 24px; background: #e9ebef; }
.editor-pages.is-adding-manual .overlay-layer { cursor: crosshair; }
.page-wrap { position: relative; background: #fff; box-shadow: var(--shadow); }
.page-wrap img { display: block; width: 100%; height: 100%; user-select: none; }
.overlay-layer { position: absolute; inset: 0; }
.page-number-label { position: absolute; bottom: -22px; left: 0; font-size: 0.75rem; color: var(--color-muted); }
.detection-box { position: absolute; background: rgba(10, 10, 10, 0.88); border: 1px solid rgba(0,0,0,0.6); cursor: pointer; }
.detection-box.is-disabled { background: rgba(179, 38, 30, 0.08); border: 1.5px dashed var(--color-danger); }
.detection-box.is-manual { outline: 1px solid var(--color-accent); }
.detection-box.is-drawing { background: rgba(28, 110, 92, 0.25); border: 1.5px dashed var(--color-accent); }
.detection-box.is-hover { outline: 2px solid #ffb703; }

.editor-sidebar { width: 340px; flex-shrink: 0; background: var(--color-surface); border-left: 1px solid var(--color-border); padding: 20px; overflow-y: auto; display: flex; flex-direction: column; }
.detections-list { flex: 1; overflow-y: auto; margin: 12px 0; }
.detections-page-header { font-size: 0.75rem; text-transform: uppercase; color: var(--color-muted); font-weight: 700; margin: 14px 0 6px; }
.detection-row { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 6px; }
.detection-row:hover { background: #f0f2f5; }
.detection-row.is-disabled .detection-label, .detection-row.is-disabled .detection-value { text-decoration: line-through; color: var(--color-muted); }
.detection-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.detection-label { font-size: 0.78rem; font-weight: 700; color: var(--color-primary); }
.detection-value { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detection-delete { background: none; border: none; color: var(--color-muted); cursor: pointer; font-size: 1rem; padding: 2px 6px; }
.detection-delete:hover { color: var(--color-danger); }
.editor-actions { border-top: 1px solid var(--color-border); padding-top: 14px; }

.legal-content h2 { margin-top: 28px; }

@media (max-width: 900px) {
  .steps, .benefits-grid, .audience-grid, .plans-grid, .stats-grid, .before-after { grid-template-columns: 1fr 1fr; }
  .editor-layout { flex-direction: column; }
  .editor-sidebar { width: 100%; border-left: none; border-top: 1px solid var(--color-border); }
}

@media (max-width: 600px) {
  .steps, .benefits-grid, .audience-grid, .plans-grid, .stats-grid, .before-after, .two-col { grid-template-columns: 1fr; }
  .header-row { flex-direction: column; height: auto; padding: 12px 0; gap: 10px; }
  .main-nav { flex-wrap: wrap; justify-content: center; }
  .hero h1 { font-size: 1.7rem; }
}
