/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 100%; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.55;
  color: #1a1a2e;
  background: #f8f9fb;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === SKIP LINK === */
.skip-link {
  position: absolute; top: -100px; left: 0; background: #1a1a2e; color: #fff; padding: 8px 16px; z-index: 1000; text-decoration: none;
}
.skip-link:focus { top: 0; }

/* === HEADER === */
.site-header {
  background: #1a1a2e;
  color: #e0e0f0;
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { font-size: 1.4rem; }
.brand-name { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.site-nav { display: flex; gap: 20px; }
.site-nav a {
  color: #c0c0e0;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: #fff; border-bottom-color: #ff6b6b; }

/* === MAIN === */
main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

/* === INTRO === */
.intro-section {
  text-align: center;
  margin-bottom: 32px;
}
.intro-section h1 {
  font-size: 2rem;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.intro-tagline {
  font-size: 1.05rem;
  color: #4a4a6a;
  max-width: 620px;
  margin: 0 auto 16px;
}
.intro-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
  line-height: 1.2;
}
.btn-primary { background: #ff6b6b; color: #fff; border-color: #ff6b6b; }
.btn-primary:hover { background: #e55a5a; border-color: #e55a5a; }
.btn-secondary { background: #fff; color: #1a1a2e; border-color: #d0d0e0; }
.btn-secondary:hover { background: #f0f0f8; border-color: #b0b0c0; }
.btn-ghost { background: transparent; color: #4a4a6a; border-color: transparent; }
.btn-ghost:hover { background: #e8e8f0; }
.btn-small { padding: 6px 14px; font-size: 0.82rem; border-radius: 6px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* === SECTION HEADINGS === */
.section-heading {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e0e0f0;
}
.section-note {
  font-size: 0.9rem;
  color: #5a5a7a;
  margin-bottom: 16px;
}

/* === TABLE CONTROLS === */
.table-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e0e0f0;
}
.control-divider { color: #c0c0d0; user-select: none; }
.run-label { font-size: 0.82rem; font-weight: 600; color: #4a4a6a; white-space: nowrap; }
.run-label-input {
  width: 150px;
  padding: 5px 10px;
  border: 1px solid #d0d0e0;
  border-radius: 6px;
  font-size: 0.82rem;
  background: #fafafc;
}
.run-label-input:focus { outline: 2px solid #ff6b6b; outline-offset: 1px; border-color: #ff6b6b; }

/* === TABLE === */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 8px; }
.split-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  font-size: 0.9rem;
  min-width: 700px;
}
.split-table th {
  background: #1a1a2e;
  color: #e0e0f0;
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.split-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}
.split-table tbody tr:hover { background: #f8f8ff; }
.split-table tfoot td {
  background: #f0f0f8;
  font-weight: 700;
  border-top: 2px solid #d0d0e0;
  padding: 10px 12px;
}
.col-num { width: 40px; text-align: center; }
.col-name { min-width: 140px; }
.col-time { width: 100px; }
.col-delta { width: 100px; }
.col-variance { width: 90px; }
.col-action { width: 50px; text-align: center; }
.foot-label { text-align: right; }
.foot-time, .foot-delta { font-variant-numeric: tabular-nums; }

.split-table input[type="text"],
.split-table input[type="number"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d0d0e0;
  border-radius: 5px;
  font-size: 0.88rem;
  background: #fafafc;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s;
}
.split-table input:focus { outline: 2px solid #ff6b6b; outline-offset: 1px; border-color: #ff6b6b; }
.split-table .delta-cell {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: help;
  position: relative;
}
.delta-negative { color: #1b8c3a; }
.delta-positive { color: #c0392b; }
.delta-zero { color: #888; }
.delta-cell:hover::after {
  content: attr(data-cumulative);
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}
.variance-cell { font-variant-numeric: tabular-nums; color: #5a5a7a; }
.btn-delete-row {
  background: none;
  border: none;
  color: #c0c0d0;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.btn-delete-row:hover { color: #c0392b; background: #fde8e8; }

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  background: #fff;
  border-radius: 10px;
  border: 2px dashed #d0d0e0;
  color: #6a6a8a;
}
.empty-state.hidden { display: none; }

/* === SUMMARY === */
.summary-section { margin-top: 28px; }
.summary-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid #e0e0f0;
  margin-bottom: 12px;
  min-height: 60px;
}
.summary-card p { font-size: 0.95rem; color: #3a3a5a; line-height: 1.6; }
.summary-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.copy-confirm {
  font-size: 0.85rem;
  color: #1b8c3a;
  font-weight: 600;
  transition: opacity 0.3s;
}
.copy-confirm.hidden { opacity: 0; pointer-events: none; }

/* === SUPPORT === */
.support-section { margin-top: 40px; }
.support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.support-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid #e0e0f0;
}
.support-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 8px;
}
.support-card p, .support-card li {
  font-size: 0.9rem;
  color: #4a4a6a;
  margin-bottom: 8px;
}
.support-card ul { padding-left: 20px; }
.support-card li { margin-bottom: 6px; }

/* === ABOUT NOTE === */
.about-note-section {
  margin-top: 40px;
  padding: 24px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e0e0f0;
}
.about-note-section p { font-size: 0.9rem; color: #4a4a6a; margin-bottom: 8px; }
.version-note { font-size: 0.82rem; color: #888; }
.version-note a { color: #5a5aa0; }

/* === FOOTER === */
.site-footer {
  background: #1a1a2e;
  color: #a0a0c0;
  text-align: center;
  padding: 16px 20px;
  font-size: 0.82rem;
  margin-top: auto;
}
.site-footer a { color: #c0c0e0; text-decoration: underline; }
.site-footer a:hover { color: #fff; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .intro-section h1 { font-size: 1.5rem; }
  .intro-tagline { font-size: 0.95rem; }
  .table-controls { gap: 6px; padding: 10px 12px; }
  .run-label-input { width: 110px; }
  .split-table { font-size: 0.8rem; min-width: 600px; }
  .split-table th, .split-table td { padding: 6px 8px; }
  .support-grid { grid-template-columns: 1fr; }
  .summary-actions { flex-direction: column; align-items: stretch; }
  .summary-actions .btn { justify-content: center; }
}
@media (max-width: 480px) {
  main { padding: 16px 12px 28px; }
  .header-inner { flex-direction: column; align-items: flex-start; }
  .site-nav { gap: 12px; }
  .intro-actions { flex-direction: column; }
  .intro-actions .btn { width: 100%; justify-content: center; }
}

/* === PRINT === */
@media print {
  .site-header, .site-footer, .intro-actions, .table-controls, .summary-actions, .btn-delete-row, .skip-link { display: none; }
  body { background: #fff; color: #000; }
  .split-table { box-shadow: none; border: 1px solid #ccc; }
  .split-table th { background: #eee; color: #000; }
  .support-section, .about-note-section { break-inside: avoid; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
