:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232d;
  --border: #2a3140;
  --text: #e6e9ef;
  --muted: #8b95a5;
  --accent: #4c8dff;
  --accent-2: #2f6fe0;
  --good: #33c17a;
  --bad: #e5534b;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand span {
  font-weight: 400;
  color: var(--muted);
  font-size: 14px;
  margin-left: 8px;
}

.user-box { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.user-box.hidden { display: none; }

.app {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}
.app:has(.landing) { max-width: 1080px; }

/* ═══ LANDING PAGE ═══ */
.hero {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 24px 0 48px;
  flex-wrap: wrap;
}
.hero-text { flex: 1 1 380px; min-width: 320px; }
.hero-art { flex: 1 1 320px; min-width: 260px; max-width: 400px; margin: 0 auto; }
.hero-art svg { width: 100%; height: auto; display: block; }
.hero-eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.hero-title { font-size: 40px; margin-bottom: 16px; line-height: 1.1; }
.hero-version { color: var(--muted); font-weight: 400; font-size: 26px; }
.hero-tag { color: var(--muted); font-size: 15px; line-height: 1.6; max-width: 480px; margin-bottom: 24px; }
.hero-footnote { color: var(--muted); font-size: 12px; margin-top: 14px; }

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-bottom: 24px;
}
.feature-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.feature-card h3 { color: var(--text); text-transform: none; font-size: 15px; letter-spacing: 0; border: none; margin-bottom: 6px; }
.feature-card p { font-size: 13px; line-height: 1.5; margin: 0; }

.plan-note { font-size: 13px; color: var(--muted); margin-top: 14px; padding: 10px 12px; background: var(--panel-2); border-radius: 6px; border: 1px solid var(--border); }

@media (max-width: 720px) {
  .hero { flex-direction: column; text-align: center; }
  .hero-tag { margin-left: auto; margin-right: auto; }
  .features { grid-template-columns: 1fr; }
}

.footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
p.subtitle { color: var(--muted); margin: 0 0 24px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; margin-top: 10px; }
input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 90px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { color: var(--bad); }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 16px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-size: 14px; }
.tab.active { color: var(--text); border-color: var(--accent); }

.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.list-item:hover { border-color: var(--accent); }
.list-item .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-pass { background: rgba(51,193,122,0.15); color: var(--good); }
.badge-fail { background: rgba(229,83,75,0.15); color: var(--bad); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
tr:last-child td { border-bottom: none; }

.error-box {
  background: rgba(229,83,75,0.1);
  border: 1px solid rgba(229,83,75,0.4);
  color: #f0a29d;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}
.info-box {
  background: rgba(76,141,255,0.1);
  border: 1px solid rgba(76,141,255,0.4);
  color: #a9c6ff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--accent); cursor: pointer; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ═══ HELP / USER MANUAL ═══ */
.help-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 24px; }
.help-toc a {
  font-size: 12px; padding: 6px 12px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 999px; color: var(--muted); text-decoration: none;
}
.help-toc a:hover { color: var(--text); border-color: var(--accent); }
.help-step-title { display: flex; align-items: center; margin-bottom: 10px; }
.help-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: #fff; font-size: 13px; font-weight: 700; margin-right: 10px; flex-shrink: 0;
}
.help-kbd {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
}

.rebar-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; margin-bottom: 6px; align-items: center; }
.demand-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr auto; gap: 8px; margin-bottom: 6px; align-items: center; }
.row-remove { cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; padding: 4px 8px; }
.row-remove:hover { color: var(--bad); }

#sectionCanvas { background: #fff; border-radius: 6px; flex-shrink: 0; }
.chart-nom { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.chart-nom input { width: auto; }
#interactionChart { background: #fff; border-radius: 6px; overflow: hidden; }

.muted { color: var(--muted); }
.mt-16 { margin-top: 16px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ PRINT REPORT — hidden on screen, shown only when printing ═══ */
#printArea { display: none; }
#printArea .pr-hdr { border-bottom: 2px solid #003d82; padding-bottom: 6px; margin-bottom: 8px; }
#printArea .pr-hdr h1 { font-size: 18px; color: #003d82; margin-bottom: 3px; }
#printArea .pr-meta { font-size: 11px; color: #333; line-height: 1.6; }
#printArea h3 { font-size: 13px; color: #0056b3; border-bottom: 1px solid #0056b3; padding-bottom: 3px; margin: 10px 0 6px; }
#printArea .pr-row { display: flex; gap: 14px; margin-bottom: 6px; }
#printArea .pr-section-col { flex: 0 0 210px; }
#printArea .pr-section-col img { width: 100%; border: 1px solid #ccc; display: block; }
#printArea .pr-mat-col { flex: 1; font-size: 12px; line-height: 1.8; color: #222; }
#printArea .pr-chart { page-break-inside: avoid; }
#printArea .pr-chart img { width: 100%; border: 1px solid #ccc; display: block; }
#printArea table { width: 100%; border-collapse: collapse; font-size: 11px; color: #222; }
#printArea th, #printArea td { border: 1px solid #999; padding: 3px 4px; text-align: center; }
#printArea th { background: #e9ecef; }
#printArea td.ok { color: #155724; font-weight: bold; }
#printArea td.no { color: #721c24; font-weight: bold; }
#printArea .pr-summary { margin-top: 12px; padding: 10px; text-align: center; font-size: 16px; font-weight: bold; border-radius: 5px; page-break-inside: avoid; }
#printArea .pr-pass { background: #d4edda; color: #155724; border: 2px solid #28a745; }
#printArea .pr-fail { background: #f8d7da; color: #721c24; border: 2px solid #dc3545; }
#printArea .pr-footer { margin-top: 8px; font-size: 9px; color: #888; text-align: right; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea { display: block !important; position: absolute; left: 0; top: 0; width: 100%; padding: 0; }
}
