/* dbaclaw portal — product console stylesheet, no framework. */
:root {
  --navy: #07111f;
  --navy-2: #0d1f35;
  --blue: #1f6feb;
  --cyan: #13a9a1;
  --ok: #1f9d64;
  --warn: #d97706;
  --high: #dc2626;
  --bg: #f5f7fb;
  --bg-soft: #eef3f8;
  --card: #ffffff;
  --border: #dce3ee;
  --text: #102033;
  --muted: #5b697a;
  --mysql: #00758f;
  --pg: #336791;
  --oracle: #c74634;
  --code-bg: #0d1f35;
  --code-fg: #e6edf3;
  --radius: 8px;
  --content-max: 1280px;
  --gutter: 40px;
  --shadow: 0 18px 50px rgba(16, 32, 51, 0.08);
}

* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; padding: 0; overflow-x: clip; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 15px; line-height: 1.58;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: none; }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
button, input, textarea { font: inherit; }

.container { margin: 0 auto; max-width: var(--content-max); padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.mono  { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* ====================== Header ====================== */
.site-header {
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.header-inner { align-items: center; display: flex; gap: 34px; min-height: 82px; }

.brand { align-items: baseline; color: #fff; display: flex; gap: 12px; min-width: max-content; text-decoration: none; }
.brand-mark   { font-size: 30px; font-weight: 850; }
.brand-accent { color: #67e8d6; }
.brand-tag    { color: #aebfd3; font-size: 15px; }

.nav { align-items: center; display: flex; flex: 1; gap: 26px; }
.nav a {
  border-bottom: 2px solid transparent;
  color: #d6e3f5; font-size: 17px; font-weight: 700;
  padding: 29px 0 26px;
}
.nav a:hover, .nav a.active { border-bottom-color: #67e8d6; color: #fff; }

.auth {
  align-items: center; color: #aebfd3;
  display: flex; font-size: 15px; gap: 14px;
}
.auth .avatar    { border-radius: 50%; height: 28px; width: 28px; }
.auth .user-name { color: #fff; }
.link-muted      { color: #8ea3bb; }
.link-muted:hover { color: #fff; }

.btn-ghost {
  border: 1px solid rgba(255,255,255,0.38);
  border-radius: var(--radius);
  color: #fff; padding: 8px 12px;
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); }

/* Language toggle pill (preserved from i18n branch) */
.lang-switch {
  display: inline-flex; gap: 2px; padding: 2px;
  border-radius: 999px; background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.12);
}
.lang-link {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  color: #d6e3f5; text-decoration: none; font-weight: 700;
}
.lang-link:hover { color: #fff; }
.lang-link.active { background: #fff; color: var(--navy); }

/* ====================== Layout ====================== */
.main { padding-bottom: 72px; }    /* .container provides L/R; .main adds bottom only */

.site-footer {
  background: #fff; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 12px;
  margin-top: 48px; padding: 20px 0;
}
.footer-inner { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; }

.eyebrow {
  color: #67e8d6; font-size: 12px; font-weight: 850; letter-spacing: 0;
  margin: 0 0 12px; text-transform: uppercase;
}
.eyebrow.dark { color: var(--cyan); }

h1, h2, h3, h4, p { margin-top: 0; }

.section-heading { margin: 58px auto 24px; max-width: 920px; }
.section-heading.compact { margin-left: 0; }
.section-heading h1,
.section-heading h2 {
  color: var(--text);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.12; margin-bottom: 12px;
}
.section-heading p:not(.eyebrow) { color: var(--muted); font-size: 17px; }

.workspace-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ====================== Home Hero ====================== */
/* Important: the hero stays inside the container — no negative margin and no
   deep inner padding — so its text starts at exactly the same viewport-x as
   every other page's content. Navigating home → /mysql → /pg → /history is
   visually continuous: only the dark band itself disappears, the text
   anchor never shifts. */
.product-hero {
  background:
    linear-gradient(135deg, rgba(31,111,235,0.28), transparent 36%),
    linear-gradient(145deg, var(--navy) 0%, var(--navy-2) 58%, #092326 100%);
  border-radius: var(--radius);
  color: #fff;
  display: grid; gap: 56px;
  grid-template-columns: minmax(0, 1.2fr) minmax(400px, 0.8fr);
  margin: 32px 0 36px;
  padding: 64px 56px 72px;
}
.hero-copy h1 {
  font-size: clamp(42px, 6vw, 70px); line-height: 1.04;
  margin-bottom: 24px; max-width: 860px;
}
.lead { color: #d3e0ef; font-size: 20px; line-height: 1.75; max-width: 900px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }

.hero-console {
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius);
  box-shadow: 0 26px 80px rgba(0,0,0,0.3);
  padding: 26px;
}
.console-top {
  align-items: center; display: flex; justify-content: space-between;
  margin-bottom: 22px;
}
.console-top span    { color: #bdd0e7; }
.console-top strong  {
  background: rgba(19,169,161,0.18);
  border: 1px solid rgba(103,232,214,0.28);
  border-radius: 999px; color: #67e8d6;
  font-size: 12px; padding: 6px 10px;
}
.score-card { background: #fff; border-radius: var(--radius); color: var(--text); padding: 22px; }
.score-card span, .score-card small { color: var(--muted); display: block; }
.score-card strong {
  color: var(--cyan); display: block;
  font-size: 70px; line-height: 1; margin: 8px 0;
}
.risk-stack { display: grid; gap: 10px; margin-top: 18px; }
.risk-stack div {
  align-items: center; background: rgba(255,255,255,0.09);
  border-radius: var(--radius); display: grid; gap: 10px;
  grid-template-columns: 12px 1fr auto; padding: 13px 14px;
}
.dot { border-radius: 50%; display: block; height: 10px; width: 10px; }
.dot.high { background: var(--high); }
.dot.mid  { background: var(--warn); }
.dot.ok   { background: var(--ok); }

/* ====================== Metric strip ====================== */
.metric-strip {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: grid; gap: 1px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: -52px 0 0;
  overflow: hidden; position: relative; z-index: 5;
}
.metric-strip div  { background: #fff; padding: 22px; }
.metric-strip strong { display: block; font-size: 25px; line-height: 1.1; }
.metric-strip span   { color: var(--muted); display: block; font-size: 13px; margin-top: 6px; }

/* ====================== Engine / feature / workflow grids ====================== */
.engine-grid, .feature-grid, .workflow-grid { display: grid; gap: 20px; }
.engine-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.engine-card { padding: 24px; }
.engine-card header { align-items: center; display: flex; gap: 10px; margin-bottom: 16px; }
.engine-card h3 { font-size: 21px; margin: 0; }
.engine-card p  { color: var(--muted); line-height: 1.7; }
.engine-specs { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.engine-specs span {
  background: #edf7f6; border: 1px solid #cbe9e6;
  border-radius: 999px; color: #12615d;
  font-size: 12px; padding: 7px 10px;
}
.muted-card { background: #fbfcfe; }

.workflow-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.workflow-step { border-left: 3px solid var(--blue); padding: 8px 18px 0; }
.workflow-step span { color: var(--cyan); display: block; font-weight: 850; margin-bottom: 16px; }
.workflow-step h3 { font-size: 20px; margin-bottom: 8px; }
.workflow-step p  { color: var(--muted); }

.features {
  background: var(--bg-soft);
  border-radius: var(--radius);
  margin: 64px 0 0;
  padding: 48px 40px;
}
.feature-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.feature {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.feature h4 { font-size: 17px; margin-bottom: 8px; }
.feature p  { color: var(--muted); font-size: 14px; }

.privacy-note {
  background: #fff8e5; border: 1px solid #f1d995;
  border-left: 4px solid #d9a526; border-radius: var(--radius);
  margin: 36px 0 0; padding: 20px 22px;
}
.privacy-note h3 { font-size: 17px; margin-bottom: 8px; }
.privacy-note p  { margin-bottom: 0; }

/* ====================== Buttons ====================== */
.btn-primary, .btn-secondary, .btn-text {
  align-items: center; border-radius: var(--radius);
  display: inline-flex; font-weight: 800;
  justify-content: center; min-height: 46px; padding: 0 18px;
}
.btn-primary {
  background: var(--blue); border: 1px solid var(--blue);
  color: #fff; cursor: pointer;
}
.btn-primary:hover:not(:disabled) { background: #185ec8; }
.btn-primary:disabled { background: #9aa8b8; border-color: #9aa8b8; cursor: not-allowed; }

.btn-secondary {
  background: #fff; border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary.dark {
  background: transparent;
  border-color: rgba(255,255,255,0.34);
  color: #fff;
}
.btn-secondary.disabled { color: var(--muted); cursor: default; }

.btn-text { color: #d3e0ef; padding-left: 4px; padding-right: 4px; }

.engine-badge {
  border-radius: 999px; color: #fff;
  display: inline-block; font-size: 11px; font-weight: 850;
  padding: 4px 10px;
}
.engine-mysql  { background: var(--mysql); }
.engine-pg     { background: var(--pg); }
.engine-oracle { background: var(--oracle); }

/* ====================== Engine page ====================== */
/* No inner-page max-width: every page sits in the same .container/main box
   so navigating home ↔ /mysql ↔ /pg ↔ /history is visually continuous —
   the dark home hero is the only intentional left/right padding exception. */
.engine-hero {
  align-items: end; display: grid; gap: 24px;
  grid-template-columns: 1fr auto;
  margin: 42px 0 24px;
}
.engine-hero h1 {
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.12; margin-bottom: 12px;
}
.engine-hero .muted { font-size: 17px; max-width: 920px; }
.engine-hero-meta { display: flex; gap: 10px; }
.engine-hero-meta span {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--muted);
  padding: 12px 14px;
}
.engine-hero-meta strong { color: var(--text); }

.engine-page {
  display: grid; gap: 24px;
  /* both tracks may shrink to 0 to avoid forcing a horizontal scrollbar
     when info-side embeds a long curl URL inside <pre class="code"> */
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
}
.upload-side, .info-side { padding: 24px; }

.card-title { align-items: center; display: flex; gap: 12px; margin-bottom: 18px; }
.card-title h2 { font-size: 22px; margin: 0; }

.dropzone {
  background: #f8fbfe; border: 2px dashed #b9c8d8;
  border-radius: var(--radius); cursor: pointer;
  padding: 34px 18px; text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover { background: #edf7f6; border-color: var(--cyan); }
.dropzone-icon { color: var(--cyan); font-size: 13px; font-weight: 850; margin-bottom: 8px; text-transform: uppercase; }
.dropzone-hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

.file-list { list-style: none; margin: 14px 0 0; padding: 0; }
.file-list li {
  align-items: center; background: #f4f7fa;
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius); display: flex;
  font-size: 13px; gap: 8px;
  margin-bottom: 7px; padding: 9px 12px;
}
.file-list .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .fsize { color: var(--muted); font-size: 12px; }
.file-list .del   { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 18px; }
.file-list .del:hover { color: var(--high); }

.meta-fields {
  border: 1px solid var(--border); border-radius: var(--radius);
  margin: 22px 0 0; padding: 16px;
}
.meta-fields legend { color: var(--muted); font-size: 12px; padding: 0 6px; }
.meta-fields label  { color: var(--muted); display: block; font-size: 12px; margin-bottom: 12px; }
.meta-fields input  {
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); display: block;
  margin-top: 6px; min-height: 42px;
  padding: 9px 10px; width: 100%;
}
.meta-fields input:focus {
  border-color: var(--cyan); outline: none;
  box-shadow: 0 0 0 3px rgba(19,169,161,0.15);
}
.meta-fields .row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }

.actions { align-items: center; display: flex; gap: 10px; margin-top: 16px; }
.actions .btn-ghost {
  background: #fff; border-color: var(--border);
  color: var(--text); cursor: pointer;
}

.status { color: var(--muted); font-size: 13px; margin-top: 16px; min-height: 20px; }
.spinner {
  animation: spin 0.9s linear infinite;
  border: 2px solid #d5dde8; border-radius: 50%;
  border-top-color: var(--cyan);
  display: inline-block; height: 12px;
  margin-right: 6px; vertical-align: -2px; width: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error {
  background: #fdecec; border-left: 4px solid var(--high);
  border-radius: var(--radius); color: var(--high);
  display: none; font-size: 13px;
  margin-top: 12px; padding: 10px 12px;
}
.error.show { display: block; }

.result {
  background: #f0f8f4; border-left: 4px solid var(--ok);
  border-radius: var(--radius); display: none;
  margin-top: 18px; padding: 18px;
}
.result.show { display: block; }
.result-head { align-items: center; display: flex; gap: 14px; margin-bottom: 10px; }
.score-badge {
  align-items: center; border-radius: 50%;
  color: #fff; display: flex; font-size: 20px; font-weight: 850;
  height: 56px; justify-content: center; width: 56px;
}
.score-badge.green  { background: var(--ok); }
.score-badge.yellow { background: var(--warn); }
.score-badge.red    { background: var(--high); }
.score-badge.grey   { background: var(--muted); }
.result h3 { color: var(--text); font-size: 16px; margin: 0; }

.findings { margin: 10px 0; }
.sev {
  border-radius: 999px; color: #fff;
  display: inline-block; font-size: 11px; font-weight: 800;
  margin: 3px 6px 3px 0; padding: 3px 10px;
}
.sev-high { background: var(--high); }
.sev-mid  { background: var(--warn); }
.sev-low  { background: #3498db; }
.sev-info { background: var(--muted); }

.ai-summary {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 14px 0; padding: 12px 14px;
}
.ai-summary h4 { font-size: 13px; margin: 0 0 6px; }
.ai-body       { color: var(--text); font-size: 13px; }

.status-rail {
  border-bottom: 1px solid var(--border);
  display: grid; gap: 12px;
  margin-bottom: 22px; padding-bottom: 22px;
}
.status-rail div    { display: grid; gap: 3px; grid-template-columns: 34px 1fr; }
.status-rail span   { color: var(--cyan); font-weight: 850; grid-row: span 2; }
.status-rail strong { color: var(--text); }
.status-rail small  { color: var(--muted); }

.info-side h3 { font-size: 16px; margin-bottom: 10px; }
.code {
  background: var(--code-bg); border-radius: var(--radius);
  color: var(--code-fg); font-size: 12px; line-height: 1.65;
  margin: 8px 0 16px; overflow-x: auto;
  padding: 13px 14px; white-space: pre;
  max-width: 100%;  /* never push the grid track wider than its share */
}

/* ====================== History ====================== */
.history { margin-top: 42px; }
.table-card { overflow-x: auto; padding: 0; }
.history-table { border-collapse: collapse; min-width: 860px; width: 100%; }
.history-table th, .history-table td {
  border-bottom: 1px solid var(--border);
  font-size: 13px; padding: 13px 16px; text-align: left;
}
.history-table th { background: #f8fbfe; color: var(--muted); font-size: 12px; font-weight: 800; }
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover { background: #fbfcfd; }
.findings-cell { white-space: nowrap; }
.score-pill {
  border-radius: 999px; color: #fff;
  display: inline-block; font-size: 12px; font-weight: 850;
  padding: 3px 10px;
}
.score-pill.green  { background: var(--ok); }
.score-pill.yellow { background: var(--warn); }
.score-pill.red    { background: var(--high); }

.empty-state { padding: 42px; text-align: center; }
.empty-state h2 { font-size: 28px; margin-bottom: 10px; }
.empty-state p  { color: var(--muted); margin-left: auto; margin-right: auto; max-width: 560px; }
.empty-cta { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }

/* ====================== Responsive ====================== */
@media (max-width: 980px) {
  .product-hero, .engine-page, .engine-hero { grid-template-columns: 1fr; }
  .engine-grid, .feature-grid, .workflow-grid, .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .engine-hero-meta { flex-wrap: wrap; }
}
@media (max-width: 720px) {
  :root { --gutter: 20px; }
  .header-inner { align-items: flex-start; flex-direction: column; gap: 12px; padding-bottom: 16px; padding-top: 16px; }
  .nav { flex-wrap: wrap; gap: 14px; }
  .nav a { padding: 4px 0; }
  .auth { width: 100%; }
  .product-hero { padding: 40px 20px 52px; }
  .features { padding: 32px 20px; }
  .hero-cta, .actions { align-items: stretch; flex-direction: column; }
  .engine-grid, .feature-grid, .workflow-grid, .metric-strip, .meta-fields .row { grid-template-columns: 1fr; }
  .empty-state { padding: 30px 20px; }
}
