:root {
  --bg: #0b0f19;
  --panel: #131a2b;
  --panel2: #1a2338;
  --border: #24304d;
  --text: #e6eaf5;
  --muted: #8a94ad;
  --accent: #4f8cff;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
.container { max-width: 900px; margin: 0 auto; padding: 24px 16px 80px; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 0 16px; flex-wrap: wrap; gap: 8px; }

/* =============================================================
   LANDING — paleta limpia y profesional (target: pharma QA)
   ============================================================= */
body.landing {
  --l-bg: #fafbfc;
  --l-bg-alt: #f1f4f8;
  --l-panel: #ffffff;
  --l-text: #0f1c2e;
  --l-text-soft: #3c4a5e;
  --l-muted: #6b7785;
  --l-accent: #0a3d62;
  --l-accent-2: #38ada9;
  --l-accent-soft: #e8f1f5;
  --l-border: #e3e8ef;
  --l-amber: #c98a1d;
  --l-green: #15803d;
  background: var(--l-bg); color: var(--l-text);
}
body.landing .brand-mark { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--l-text); text-decoration: none; }
body.landing .brand-mark.muted { color: var(--l-text-soft); }
body.landing .landing-nav { display: flex; align-items: center; justify-content: space-between; padding: 16px 32px; max-width: 1200px; margin: 0 auto; flex-wrap: wrap; gap: 16px; }
body.landing .landing-nav-links { display: flex; gap: 24px; }
body.landing .landing-nav-links a { color: var(--l-text-soft); text-decoration: none; font-size: 0.94rem; }
body.landing .landing-nav-links a:hover { color: var(--l-accent); }
body.landing .landing-nav-cta { display: flex; gap: 8px; align-items: center; }
body.landing .hero { padding: 64px 32px 96px; max-width: 1200px; margin: 0 auto; position: relative; }
body.landing .hero-inner { display: grid; grid-template-columns: 1.2fr 1fr; gap: 64px; align-items: center; }
@media (max-width: 920px) { body.landing .hero-inner { grid-template-columns: 1fr; } }
body.landing .hero-eyebrow { display: inline-block; padding: 6px 12px; background: var(--l-accent-soft); color: var(--l-accent); border-radius: 999px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 16px; }
body.landing .hero h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.12; letter-spacing: -0.02em; font-weight: 700; margin-bottom: 20px; }
body.landing .hero-accent { color: var(--l-accent); }
body.landing .hero-sub { font-size: 1.08rem; color: var(--l-text-soft); margin-bottom: 28px; max-width: 560px; }
body.landing .hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
body.landing .hero-ctas.center { justify-content: center; }
body.landing .hero-fineprint { font-size: 0.82rem; color: var(--l-muted); }
body.landing .hero-art { position: relative; height: 360px; }
body.landing .hero-doc-card { position: absolute; background: var(--l-panel); border: 1px solid var(--l-border); border-radius: 12px; padding: 18px; box-shadow: 0 10px 30px rgba(10,61,98,0.08); width: 280px; transition: transform 0.3s ease; }
body.landing .hero-doc-card:nth-child(1) { top: 0; left: 0; transform: rotate(-3deg); }
body.landing .hero-doc-card.offset { top: 80px; right: 0; left: auto; transform: rotate(2deg); }
body.landing .hero-doc-card.offset2 { bottom: 0; left: 60px; transform: rotate(-1deg); }
body.landing .hero-doc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--l-border); }
body.landing .hero-doc-badge { font-weight: 700; font-size: 0.85rem; color: var(--l-accent); letter-spacing: 0.04em; }
body.landing .hero-doc-status { font-size: 0.75rem; padding: 4px 8px; border-radius: 4px; background: #dcfce7; color: var(--l-green); }
body.landing .hero-doc-status.amber { background: #fef3c7; color: var(--l-amber); }
body.landing .hero-doc-lines .line { height: 8px; background: var(--l-bg-alt); border-radius: 2px; margin-bottom: 8px; }
body.landing .hero-doc-lines .line.wide { width: 85%; }
body.landing .hero-doc-lines .line.narrow { width: 60%; }

body.landing .section { padding: 80px 32px; max-width: 1200px; margin: 0 auto; }
body.landing .section-alt { background: var(--l-bg-alt); max-width: none; }
body.landing .section-alt .section-inner { max-width: 1200px; margin: 0 auto; }
body.landing .section-inner { max-width: 1200px; margin: 0 auto; }
body.landing .section-head { max-width: 720px; margin-bottom: 48px; }
body.landing .section-head .eyebrow { display: inline-block; padding: 4px 10px; background: var(--l-accent-soft); color: var(--l-accent); border-radius: 999px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 12px; }
body.landing .section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.2; letter-spacing: -0.01em; font-weight: 700; }
body.landing .section-head h2 .muted { color: var(--l-muted); font-weight: 500; }
body.landing .section-head .section-sub { font-size: 1rem; color: var(--l-text-soft); margin-top: 8px; }
body.landing .section.center { text-align: center; }
body.landing .section-cta { background: linear-gradient(135deg, var(--l-accent) 0%, #072a47 100%); color: #fff; }
body.landing .section-cta h2 { color: #fff; }
body.landing .section-cta .cta-sub { color: rgba(255,255,255,0.85); font-size: 1.1rem; margin-top: 8px; margin-bottom: 32px; }

body.landing .problem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 920px) { body.landing .problem-grid { grid-template-columns: 1fr; } }
body.landing .problem-card { background: var(--l-panel); border: 1px solid var(--l-border); border-radius: 12px; padding: 28px; }
body.landing .problem-icon { font-size: 2rem; margin-bottom: 12px; }
body.landing .problem-card h3 { font-size: 1.15rem; margin-bottom: 8px; color: var(--l-text); }
body.landing .problem-card p { color: var(--l-text-soft); font-size: 0.94rem; }

body.landing .steps { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 16px; align-items: start; }
@media (max-width: 920px) { body.landing .steps { grid-template-columns: 1fr; } body.landing .step-arrow { transform: rotate(90deg); justify-self: center; } }
body.landing .step { background: var(--l-panel); border: 1px solid var(--l-border); border-radius: 12px; padding: 24px; }
body.landing .step-num { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--l-accent); color: #fff; font-weight: 700; margin-bottom: 16px; }
body.landing .step h3 { font-size: 1.1rem; margin-bottom: 8px; }
body.landing .step p { color: var(--l-text-soft); font-size: 0.92rem; margin-bottom: 12px; }
body.landing .step-foot { font-size: 0.84rem !important; color: var(--l-muted) !important; padding-top: 12px; border-top: 1px dashed var(--l-border); }
body.landing .step-foot b { color: var(--l-text-soft); }
body.landing .step-arrow { font-size: 1.5rem; color: var(--l-muted); align-self: center; padding-top: 60px; }

body.landing .docs-grid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 24px; }
@media (max-width: 920px) { body.landing .docs-grid { grid-template-columns: 1fr; } }
body.landing .docs-col { background: var(--l-panel); border: 1px solid var(--l-border); border-radius: 12px; padding: 24px; }
body.landing .docs-col h4 { font-size: 1rem; margin-bottom: 16px; color: var(--l-accent); font-weight: 700; }
body.landing .docs-col.feature-col { background: linear-gradient(135deg, var(--l-accent-soft), #fff); border-color: var(--l-accent-soft); }
body.landing .docs-col ul { list-style: none; padding: 0; }
body.landing .docs-col li { padding: 8px 0; border-bottom: 1px solid var(--l-bg-alt); color: var(--l-text-soft); font-size: 0.9rem; }
body.landing .docs-col li:last-child { border-bottom: none; }
body.landing .check-list li { padding-left: 24px; position: relative; }
body.landing .check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--l-accent); font-weight: 700; }
body.landing .check-list li b { color: var(--l-text); }

body.landing .audit-demo { background: var(--l-text); border-radius: 12px; padding: 24px; color: #e6eaf5; }
body.landing .audit-demo pre { font-family: "SF Mono", Monaco, "Cascadia Code", monospace; font-size: 0.84rem; line-height: 1.6; white-space: pre-wrap; }
body.landing .audit-note { color: var(--l-text-soft); margin-top: 16px; font-size: 0.92rem; }
body.landing .audit-note code { background: var(--l-bg-alt); padding: 2px 6px; border-radius: 4px; font-size: 0.86rem; color: var(--l-accent); }

body.landing .plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 920px) { body.landing .plans { grid-template-columns: 1fr; } }
body.landing .plan { background: var(--l-panel); border: 1px solid var(--l-border); border-radius: 12px; padding: 32px 24px; position: relative; display: flex; flex-direction: column; }
body.landing .plan.highlight { border-color: var(--l-accent); border-width: 2px; box-shadow: 0 16px 40px rgba(10,61,98,0.1); }
body.landing .plan-tag { position: absolute; top: -12px; right: 24px; background: var(--l-accent); color: #fff; font-size: 0.74rem; padding: 4px 12px; border-radius: 999px; font-weight: 600; }
body.landing .plan h3 { font-size: 1.2rem; margin-bottom: 8px; }
body.landing .plan-price { display: flex; align-items: baseline; gap: 4px; margin-bottom: 8px; }
body.landing .plan-price .amount { font-size: 2.2rem; font-weight: 700; color: var(--l-text); letter-spacing: -0.02em; }
body.landing .plan-price .period { color: var(--l-muted); font-size: 0.9rem; }
body.landing .plan-desc { color: var(--l-muted); font-size: 0.9rem; margin-bottom: 20px; }
body.landing .plan-fee { font-size: 0.78rem; color: var(--l-muted); margin: -8px 0 16px; padding: 8px 10px; background: var(--l-bg-alt); border-radius: 6px; }
body.landing .plan-fee b { color: var(--l-text-soft); }
body.landing .plan ul { list-style: none; padding: 0; margin-bottom: 24px; flex-grow: 1; }
body.landing .plan li { padding: 6px 0; padding-left: 22px; position: relative; color: var(--l-text-soft); font-size: 0.9rem; }
body.landing .plan li::before { content: "✓"; position: absolute; left: 0; color: var(--l-accent); font-weight: 700; }
body.landing .plan .btn { width: 100%; }
body.landing .pricing-note { text-align: center; margin-top: 24px; color: var(--l-muted); font-size: 0.9rem; }

body.landing .faq-grid { display: grid; gap: 12px; max-width: 800px; }
body.landing .faq-item { background: var(--l-panel); border: 1px solid var(--l-border); border-radius: 10px; padding: 18px 22px; }
body.landing .faq-item summary { font-weight: 600; cursor: pointer; color: var(--l-text); list-style: none; display: flex; justify-content: space-between; align-items: center; }
body.landing .faq-item summary::after { content: "+"; font-size: 1.4rem; color: var(--l-muted); transition: transform 0.2s; }
body.landing .faq-item[open] summary::after { content: "−"; }
body.landing .faq-item p { margin-top: 12px; color: var(--l-text-soft); font-size: 0.94rem; }
body.landing .faq-item p b { color: var(--l-text); }

body.landing .landing-footer { background: var(--l-bg-alt); padding: 40px 32px; margin-top: 0; }
body.landing .landing-footer-inner { max-width: 1200px; margin: 0 auto; text-align: center; }
body.landing .footer-text { color: var(--l-text-soft); font-size: 0.9rem; margin-top: 12px; }
body.landing .footer-text a { color: var(--l-accent); text-decoration: none; }
body.landing .footer-meta { color: var(--l-muted); font-size: 0.8rem; margin-top: 6px; }
body.landing .footer-legal { color: var(--l-muted); font-size: 0.72rem; margin-top: 14px; max-width: 720px; margin-left: auto; margin-right: auto; line-height: 1.5; }

/* Botones para el landing (sobreescriben los del app para colores claros) */
body.landing .btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; border-radius: 6px; font-weight: 600; font-size: 0.9rem; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: all 0.15s ease; gap: 6px; }
body.landing .btn.small { padding: 6px 12px; font-size: 0.82rem; }
body.landing .btn.big { padding: 14px 24px; font-size: 1rem; }
body.landing .btn.full { width: 100%; }
body.landing .btn.primary { background: var(--l-accent); color: #fff; border-color: var(--l-accent); }
body.landing .btn.primary:hover { background: #082e4b; border-color: #082e4b; }
body.landing .btn.ghost { background: transparent; color: var(--l-text); border-color: var(--l-border); }
body.landing .btn.ghost:hover { background: var(--l-bg-alt); border-color: var(--l-text-soft); }

.brand { display: flex; align-items: center; gap: 10px; }
.badge {
  display: inline-block; background: rgba(79,140,255,.15); color: var(--accent);
  border: 1px solid rgba(79,140,255,.4); border-radius: 999px;
  font-size: .75rem; padding: 3px 12px; font-weight: 700; letter-spacing: .02em;
}
.tagline { color: var(--muted); font-size: .8rem; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.userchip {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px; font-size: .78rem; color: var(--muted);
}
.userchip b { color: var(--text); }

.offline-banner {
  background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.35);
  color: var(--amber); border-radius: 8px; padding: 10px 14px; font-size: .8rem; margin-bottom: 16px;
}
.offline-banner code { color: var(--text); }

.screen { display: none; }
.screen.active { display: block; }

.welcome-banner { background: linear-gradient(135deg, var(--panel) 0%, var(--panel2) 100%); border: 1px solid var(--border); border-radius: 14px; padding: 28px 32px; margin: 16px 0 24px; display: flex; gap: 18px; align-items: flex-start; position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.15); }
.welcome-icon { font-size: 2.4rem; line-height: 1; flex-shrink: 0; }
.welcome-content { flex: 1; }
.welcome-content h2 { font-size: 1.3rem; margin-bottom: 4px; color: var(--text); }
.welcome-content > p { color: var(--muted); margin-bottom: 18px; }
.welcome-content > p b { color: var(--accent); }
.welcome-steps { display: flex; gap: 24px; flex-wrap: wrap; }
.welcome-step { display: flex; gap: 12px; align-items: flex-start; flex: 1; min-width: 200px; }
.welcome-num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 0.86rem; flex-shrink: 0; }
.welcome-step b { display: block; color: var(--text); font-size: 0.92rem; margin-bottom: 2px; }
.welcome-step span { display: block; color: var(--muted); font-size: 0.8rem; }
.welcome-banner .btn.primary { align-self: center; flex-shrink: 0; }
.welcome-dismiss { position: absolute; top: 12px; right: 12px; background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; padding: 4px 8px; }
.welcome-dismiss:hover { color: var(--text); }

.app-footer { display: flex; gap: 16px; justify-content: center; padding: 24px 16px 32px; font-size: 0.8rem; color: var(--muted); flex-wrap: wrap; }
.app-footer a { color: var(--muted); text-decoration: none; }

.notif-wrapper { position: relative; }
.notif-btn { position: relative; }
.notif-badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 0.66rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; min-width: 16px; text-align: center; line-height: 1.4; }
.notif-dropdown { position: absolute; right: 0; top: calc(100% + 6px); width: 360px; max-height: 460px; overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.4); z-index: 100; }
.notif-head { padding: 12px 16px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 600; }
.notif-list { display: flex; flex-direction: column; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.84rem; display: flex; flex-direction: column; gap: 4px; }
.notif-item:last-child { border-bottom: none; }
.notif-item.acked { opacity: 0.5; }
.notif-item .notif-msg { color: var(--text); }
.notif-item .notif-meta { color: var(--muted); font-size: 0.74rem; display: flex; justify-content: space-between; }
.notif-item .notif-ack { background: transparent; border: 1px solid var(--border); color: var(--muted); font-size: 0.72rem; padding: 2px 8px; border-radius: 4px; cursor: pointer; align-self: flex-start; }
.notif-item .notif-ack:hover { color: var(--text); border-color: var(--accent); }
.notif-foot { padding: 10px 16px; border-top: 1px solid var(--border); text-align: center; }
.notif-empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 0.86rem; }
.app-footer a:hover { color: var(--text); }

.empty-state { text-align: center; padding: 32px 16px; }
.empty-state .empty-icon { font-size: 2.4rem; margin-bottom: 12px; opacity: 0.8; }
.empty-state h3 { font-size: 1rem; margin-bottom: 6px; color: var(--text); }
.empty-state .hint { color: var(--muted); font-size: 0.86rem; max-width: 360px; margin: 0 auto 12px; }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px; margin-top: 16px;
}
.panel h2 { font-size: 1.15rem; margin-bottom: 4px; }
.panel .hint { color: var(--muted); font-size: .8rem; margin-bottom: 20px; }
.auth-panel { max-width: 420px; margin: 60px auto; }
.auth-error { color: var(--red); font-size: .8rem; margin-bottom: 12px; }
.auth-demo { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); text-align: center; }
.auth-demo .hint { color: var(--muted); font-size: 0.86rem; margin-bottom: 10px; }
.auth-demo .hint.small { font-size: 0.74rem; margin-top: 8px; margin-bottom: 0; }

.progress { position: sticky; top: 0; background: var(--bg); padding: 10px 0; z-index: 10; }
.progress .bar { height: 4px; background: var(--panel2); border-radius: 999px; overflow: hidden; }
.progress .fill { height: 100%; background: var(--accent); width: 0%; transition: width .3s; }
.progress .label { font-size: .75rem; color: var(--muted); margin-top: 4px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.field .desc { color: var(--muted); font-size: .75rem; font-weight: 400; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=password], select, textarea {
  width: 100%; background: var(--panel2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: .9rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.check label { font-size: .85rem; font-weight: 400; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
.rows-head { display: grid; gap: 8px; font-size: .72rem; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.dyn-row { display: grid; gap: 8px; margin-bottom: 8px; align-items: center; }
.dyn-row input, .dyn-row select { padding: 8px 10px; font-size: .82rem; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); border-radius: 8px;
  padding: 8px 14px; font-size: .85rem; cursor: pointer; font-weight: 500;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.small { padding: 6px 10px; font-size: .78rem; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.nav { display: flex; justify-content: space-between; margin-top: 24px; }
.output-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

.alert {
  background: rgba(79,140,255,.1); border: 1px solid rgba(79,140,255,.3);
  border-radius: 8px; padding: 12px 16px; font-size: .82rem; margin-top: 16px;
}

/* Project */
.project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0; }
.stat-box { background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.stat-box .k { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-box .v { font-size: 1.3rem; font-weight: 700; margin-top: 2px; }
.stat-box .v.good { color: var(--green); }
.stat-box .v.warn { color: var(--amber); }
.stat-box .v.bad { color: var(--red); }
.stat-box .hint { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.stat-box.bad { border-color: rgba(248,113,113,.35); }
.stat-box.warn { border-color: rgba(251,191,36,.35); }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 16px; }
.dash-progress { margin-top: 18px; padding: 16px; background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; }
.dash-progress h4 { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 10px; font-weight: 600; }
.dash-progress .progress-bar { display: block; margin-bottom: 10px; }
.dash-progress .next-doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel); border-radius: 8px; border: 1px solid var(--border); margin-top: 6px; font-size: 0.88rem; }
.dash-progress .next-doc .hint { color: var(--muted); font-size: 0.78rem; }
.dash-progress .next-doc b { flex: 1; }
.dash-progress .next-doc.ok { border-color: rgba(52,211,153,.3); color: var(--green); }

.docs-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.docs-table th { text-align: left; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.docs-table td { padding: 10px; border-bottom: 1px solid var(--border); }
.docs-table tr.clickable { cursor: pointer; }
.docs-table tr.clickable:hover { background: var(--panel2); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.dot.gray { background: var(--muted); }
.score-pill { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.score-pill.good { background: rgba(52,211,153,.15); color: var(--green); }
.score-pill.warn { background: rgba(251,191,36,.15); color: var(--amber); }
.score-pill.bad { background: rgba(248,113,113,.15); color: var(--red); }

/* Doc viewer */
.doc-content {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 24px; margin-top: 16px; max-height: none; overflow: visible;
}
.doc-layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; margin-top: 16px; align-items: start; }
@media (max-width: 800px) { .doc-layout { grid-template-columns: 1fr; } .doc-toc { display: none; } }
.doc-toc { position: sticky; top: 16px; max-height: calc(100vh - 100px); overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px; transition: all 0.2s; }
.doc-toc.collapsed { grid-column: 1; padding: 8px; }
.doc-toc.collapsed .doc-toc-head span, .doc-toc.collapsed nav { display: none; }
.doc-toc.collapsed .doc-toc-toggle { transform: rotate(180deg); }
.doc-toc-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.doc-toc-toggle { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 0 4px; line-height: 1; }
.doc-toc-toggle:hover { color: var(--text); }
.doc-toc nav a { display: block; padding: 5px 8px; font-size: 0.84rem; color: var(--muted); text-decoration: none; border-left: 2px solid transparent; border-radius: 3px; transition: all 0.15s; line-height: 1.35; }
.doc-toc nav a:hover { color: var(--text); background: var(--panel2); }
.doc-toc nav a.active { color: var(--accent); border-left-color: var(--accent); background: var(--panel2); font-weight: 600; }
.doc-toc nav a.lvl-3 { padding-left: 22px; font-size: 0.8rem; }
.doc-toc nav a.lvl-4 { padding-left: 36px; font-size: 0.78rem; }
.doc-toc-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; gap: 4px; }
.doc-toc-foot button { flex: 1; background: var(--panel2); border: 1px solid var(--border); color: var(--muted); padding: 5px 6px; font-size: 0.74rem; border-radius: 4px; cursor: pointer; }
.doc-toc-foot button:hover { color: var(--text); border-color: var(--accent); }
.doc-content h1 { font-size: 1.4rem; margin: 20px 0 12px; border-bottom: 2px solid #e2e8f0; padding-bottom: 6px; scroll-margin-top: 80px; }
.doc-content h2 { font-size: 1.15rem; margin: 18px 0 8px; scroll-margin-top: 80px; }
.doc-content h3 { font-size: 1rem; margin: 14px 0 6px; scroll-margin-top: 80px; }
.doc-content p { margin: 8px 0; }
.doc-content table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: .8rem; }
.doc-content th, .doc-content td { border: 1px solid #d6dce8; padding: 6px 8px; text-align: left; vertical-align: top; }
.doc-content th { background: #eef2f8; }
.doc-content ul, .doc-content ol { margin: 8px 0 8px 22px; }
.doc-content blockquote { border-left: 3px solid #c3cede; margin: 10px 0; padding: 4px 12px; color: #45536b; }
.doc-content code { background: #eef2f8; border-radius: 4px; padding: 1px 5px; font-size: .8em; }
.doc-content hr { border: none; border-top: 1px solid #d6dce8; margin: 16px 0; }
.doc-content mark.gap {
  background: rgba(248,113,113,.14); color: #b91c1c; border-radius: 4px;
  padding: 1px 6px; font-weight: 600; font-size: .82em;
}
.gaps-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.gap-chip { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.35); color: var(--red); border-radius: 999px; padding: 3px 12px; font-size: .75rem; }
.gaps-bar .ok-chip { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.35); color: var(--green); }

.evidence-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-top: 14px; }
.evidence-panel h3 { font-size: 0.95rem; margin-bottom: 4px; }
.evidence-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.evidence-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.evidence-item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; font-size: 0.84rem; }
.evidence-item .ev-step { font-weight: 600; color: var(--text); min-width: 100px; }
.evidence-item .ev-result { padding: 2px 8px; border-radius: 4px; font-weight: 600; font-size: 0.74rem; }
.evidence-item .ev-result.pass { background: rgba(52,211,153,.12); color: var(--green); }
.evidence-item .ev-result.fail { background: rgba(248,113,113,.12); color: var(--red); }
.evidence-item .ev-note { color: var(--muted); flex: 1; font-style: italic; }
.evidence-item .ev-time { color: var(--muted); font-size: 0.74rem; }
.evidence-item .ev-shotted { color: var(--accent); font-size: 0.74rem; }
.evidence-item .ev-del { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 0.9rem; padding: 0 4px; }
.evidence-item .ev-del:hover { color: var(--red); }
.evidence-add summary { color: var(--accent); cursor: pointer; font-weight: 600; font-size: 0.86rem; padding: 8px 0; }
.evidence-add summary:hover { color: var(--text); }
.evidence-form { display: flex; flex-direction: column; gap: 10px; padding: 10px 0 4px; max-width: 500px; }
.sign-info {
  background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.3); color: var(--green);
  border-radius: 8px; padding: 10px 14px; font-size: .78rem; margin-top: 12px; word-break: break-all;
}

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(4,6,12,.8); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 24px; width: 100%; max-width: 820px; }
.modal .doc-content { max-height: 60vh; overflow-y: auto; }
.selftest-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.selftest-summary .stat { padding: 12px; border-radius: 8px; text-align: center; font-weight: 700; }
.selftest-summary .stat .v { font-size: 1.4rem; }
.selftest-summary .stat .k { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.8; margin-top: 2px; }
.selftest-summary .stat.total { background: var(--panel2); }
.selftest-summary .stat.pass { background: rgba(52,211,153,.15); color: var(--green); }
.selftest-summary .stat.fail { background: rgba(248,113,113,.15); color: var(--red); }
.selftest-summary .stat.na { background: rgba(138,148,173,.15); color: var(--muted); }
.selftest-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.selftest-table th, .selftest-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.selftest-table th { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.selftest-result { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 0.72rem; font-weight: 700; min-width: 48px; text-align: center; }
.selftest-result.pass { background: rgba(52,211,153,.15); color: var(--green); }
.selftest-result.fail { background: rgba(248,113,113,.15); color: var(--red); }
.selftest-result.na { background: rgba(138,148,173,.15); color: var(--muted); }
.selftest-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--muted); }

.attention-panel { margin-top: 12px; padding: 12px 16px; background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.3); border-radius: 8px; }
.attention-panel h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--amber); margin-bottom: 8px; font-weight: 600; }
.attention-item { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(251,191,36,.15); font-size: 0.84rem; }
.attention-item:last-child { border-bottom: none; }
.attention-icon { font-size: 1.1rem; flex-shrink: 0; }
.attention-body { flex: 1; }
.attention-msg { color: var(--text); }
.attention-meta { color: var(--muted); font-size: 0.72rem; margin-top: 2px; }
.attention-ack { background: transparent; border: 1px solid var(--border); color: var(--muted); font-size: 0.74rem; padding: 3px 10px; border-radius: 4px; cursor: pointer; flex-shrink: 0; }
.attention-ack:hover { color: var(--text); border-color: var(--accent); }
.attention-more { color: var(--muted); font-size: 0.78rem; text-align: center; padding-top: 6px; }

.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--green); color: #052e1b;
  padding: 10px 18px; border-radius: 8px; font-weight: 600; font-size: .85rem;
  opacity: 0; transform: translateY(10px); transition: all .25s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media print {
  body { background: #fff; }
  .topbar, .btn, .gaps-bar, .nav, .sign-info { display: none !important; }
  .container { max-width: none; padding: 0; }
  .panel { border: none; padding: 0; margin: 0; background: #fff; }
  .doc-content { border-radius: 0; padding: 0; }
}
