/* ========== Tool pages: estimator / mapper / validator ========== */

.ma-tool-page { padding-bottom: 5rem; }
.ma-tool-app { margin: 1.5rem 0 3rem; }

/* ===== Estimator ===== */
.ma-estimator {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.ma-estimator__grid {
  display: grid; grid-template-columns: 1fr 380px; gap: 2rem;
}
@media (max-width: 800px) { .ma-estimator__grid { grid-template-columns: 1fr; } }

.ma-field { margin-bottom: 1rem; }
.ma-field label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .375rem; color: var(--text); }
.ma-field label span { font-family: var(--font-mono); color: var(--accent); float: right; }
.ma-field input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; background: var(--surface-2);
  border-radius: var(--radius); outline: none; cursor: pointer;
}
.ma-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 0;
}
.ma-field input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 0;
}
.ma-field select {
  width: 100%; padding: .5rem .625rem; font-size: .9375rem;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.ma-field select:focus { border-color: var(--accent); outline: 2px solid rgba(41, 98, 255, .25); outline-offset: 0; }
.ma-field--checks { display: grid; gap: .5rem; }
.ma-field--checks label { display: flex; align-items: center; gap: .5rem; font-weight: 400; color: var(--muted); cursor: pointer; }
.ma-field--checks input[type="checkbox"] { accent-color: var(--accent); }

.ma-estimator__result {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  position: sticky; top: 5rem; align-self: flex-start;
}
.ma-estimator__title { font-size: 1rem; margin: 0 0 1rem; font-weight: 600; }
.ma-estimator__metric { margin-bottom: 1rem; }
.ma-estimator__big {
  font-family: var(--font-mono); font-size: 1.875rem; font-weight: 700;
  color: var(--text); line-height: 1.1;
}
.ma-estimator__sub { font-size: .8125rem; color: var(--muted); }
.ma-estimator__money {
  font-family: var(--font-mono); font-size: 1.125rem; font-weight: 600;
  color: var(--success); margin-top: .5rem;
}
.ma-estimator__phases { margin: 1rem 0; display: grid; gap: .5rem; }
.ma-estimator__phase {
  display: grid; grid-template-columns: 1fr auto; gap: .375rem;
  font-size: .8125rem; position: relative; padding-bottom: 4px;
}
.ma-estimator__phase span:last-child { font-family: var(--font-mono); color: var(--muted); }
.ma-estimator__bar {
  position: absolute; bottom: 0; left: 0; height: 3px;
  background: var(--accent); border-radius: 2px;
  transition: width .3s ease;
}
.ma-estimator__phase[data-phase="audit"]   .ma-estimator__bar { background: var(--success); }
.ma-estimator__phase[data-phase="map"]     .ma-estimator__bar { background: var(--accent); }
.ma-estimator__phase[data-phase="dual"]    .ma-estimator__bar { background: var(--warn); }
.ma-estimator__phase[data-phase="cutover"] .ma-estimator__bar { background: var(--accent-2); }

.ma-estimator__risk {
  padding: .625rem .875rem; border-radius: var(--radius);
  font-size: .875rem; margin: 1rem 0;
}
.ma-estimator__risk[data-level="low"]    { background: rgba(16,185,129,.1); color: var(--success); }
.ma-estimator__risk[data-level="medium"] { background: rgba(245,158,11,.12); color: var(--warn); }
.ma-estimator__risk[data-level="high"]   { background: rgba(239,68,68,.12);  color: var(--danger); }

.ma-estimator__flags {
  font-size: .8125rem; color: var(--muted); margin-bottom: 1rem;
  background: var(--surface); padding: .75rem; border-radius: var(--radius);
}
.ma-estimator__flags ul { padding-left: 1.25rem; margin: .375rem 0 0; }
.ma-estimator__flags li { margin: .25rem 0; }

/* ===== Event Mapping Wizard ===== */
.ma-mapper {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.ma-mapper__head {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.ma-mapper__head input {
  flex: 1; padding: .625rem .875rem;
  font-family: var(--font-mono); font-size: .9375rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  outline: none;
}
.ma-mapper__head input:focus { border-color: var(--accent); }
.ma-mapper__count { font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }
.ma-mapper__results { padding: .5rem; max-height: 70vh; overflow-y: auto; }
.ma-mapper__row { padding: .75rem; border-bottom: 1px solid var(--border); }
.ma-mapper__row:last-child { border-bottom: 0; }
.ma-mapper__row summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 1rem; }
.ma-mapper__row summary::-webkit-details-marker { display: none; }
.ma-mapper__evt { font-family: var(--font-mono); font-weight: 600; color: var(--text); }
.ma-mapper__evt-desc { font-size: .8125rem; color: var(--muted); }
.ma-mapper__panes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .75rem; margin-top: .75rem; }
.ma-mapper__pane {
  background: var(--code-bg); color: var(--code-text);
  border-radius: var(--radius); padding: .75rem; position: relative;
}
.ma-mapper__dest { font-family: var(--font-mono); font-size: .6875rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(230,234,242,.55); margin-bottom: .375rem; }
.ma-mapper__pane pre { margin: 0; font-family: var(--font-mono); font-size: .75rem; line-height: 1.55; overflow-x: auto; }
.ma-mapper__copy {
  position: absolute; top: .5rem; right: .5rem;
  background: rgba(255,255,255,.06); color: var(--code-text);
  border: 0; padding: .15rem .5rem; border-radius: var(--radius);
  font-family: var(--font-mono); font-size: .6875rem; cursor: pointer;
}
.ma-mapper__copy:hover { background: rgba(255,255,255,.12); }
.ma-mapper__empty { padding: 2rem; text-align: center; color: var(--muted); }

/* ===== Parallel-Run Validator ===== */
.ma-validator {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.ma-validator__inputs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
@media (max-width: 700px) { .ma-validator__inputs { grid-template-columns: 1fr; } }
.ma-validator__drop {
  display: block; padding: 1.25rem; cursor: pointer;
  background: var(--bg); border: 2px dashed var(--border);
  border-radius: var(--radius); text-align: center;
  transition: all .15s ease;
}
.ma-validator__drop:hover { border-color: var(--accent); background: rgba(41,98,255,.03); }
.ma-validator__drop input { display: none; }
.ma-validator__label { display: block; font-weight: 500; margin-bottom: .5rem; font-size: .875rem; }
.ma-validator__hint { font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }

.ma-validator__threshold { margin: 1rem 0; font-size: .875rem; }
.ma-validator__threshold input { width: 5rem; padding: .25rem .5rem; margin-left: .375rem; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); }

.ma-validator__result { margin-top: 1.5rem; }
.ma-validator__result table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: .8125rem; }
.ma-validator__result th, .ma-validator__result td { padding: .375rem .625rem; text-align: right; border-bottom: 1px solid var(--border); }
.ma-validator__result th { background: var(--bg); font-weight: 600; color: var(--muted); text-align: left; }
.ma-validator__result th:first-child, .ma-validator__result td:first-child { text-align: left; }
.ma-validator__result tr[data-flagged="true"] { background: rgba(239,68,68,.05); }
.ma-validator__result tr[data-flagged="true"] td:last-child { color: var(--danger); font-weight: 600; }
.ma-validator__summary {
  margin-top: 1rem; padding: 1rem; background: var(--bg);
  border-radius: var(--radius); display: flex; gap: 2rem; flex-wrap: wrap;
}
.ma-validator__summary p { margin: 0; font-size: .875rem; color: var(--muted); }
.ma-validator__empty { color: var(--muted); padding: 1rem 0; }
.ma-validator__empty code { font-family: var(--font-mono); background: var(--surface-2); padding: .1rem .375rem; border-radius: var(--radius); }

/* Print stylesheet for checklists */
@media print {
  .ma-header, .ma-footer, .ma-cta-block, .ma-author-bio, .no-print { display: none !important; }
  .ma-article { padding: 0; }
  .ma-article__body { max-width: 100%; }
  body { color: #000; background: #fff; }
  a { color: #000; text-decoration: underline; }
}

/* Glossary */
.ma-glossary__abc {
  display: flex; gap: .25rem; flex-wrap: wrap;
  margin: 1rem 0 2rem;
  font-family: var(--font-mono); font-size: .875rem;
}
.ma-glossary__abc a {
  display: inline-block; padding: .25rem .5rem;
  background: var(--surface); color: var(--text);
  border-radius: var(--radius); border: 1px solid var(--border);
}
.ma-glossary__abc a:hover { border-color: var(--accent); }
.ma-glossary__group { margin-bottom: 2rem; scroll-margin-top: 5rem; }
.ma-glossary__list { display: grid; gap: 1rem; }
.ma-glossary__list dt { font-weight: 600; }
.ma-glossary__list dt a { color: var(--text); }
.ma-glossary__list dt a:hover { color: var(--accent); }
.ma-glossary__list dd { color: var(--muted); margin: 0 0 .5rem; font-size: .9375rem; }

.ma-article__breadcrumb { font-family: var(--font-mono); font-size: .8125rem; margin-bottom: .5rem; }
.ma-article__breadcrumb a { color: var(--muted); }
.ma-article__breadcrumb a:hover { color: var(--accent); }

.ma-atlas-page__legend { font-family: var(--font-mono); font-size: .75rem; color: var(--muted); margin-top: 1.5rem; display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.ma-checklist__actions { margin-top: 1rem; }

/* Aggregator pages */
.ma-aggregator__pairs { margin: 3rem auto 5rem; }
.ma-aggregator__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem; margin-top: 1.5rem;
}
.ma-pair-tile {
  display: block; padding: 1.25rem 1.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  transition: all .15s ease;
}
.ma-pair-tile:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--text); }
.ma-pair-tile h3 { margin: 0 0 .375rem; font-size: 1rem; font-weight: 600; }
.ma-pair-tile p { margin: 0 0 .75rem; font-size: .8125rem; color: var(--muted); line-height: 1.5; }
.ma-pair-tile__meta { display: flex; gap: .75rem; align-items: center; }
.ma-pair-tile__time { font-family: var(--font-mono); font-size: .6875rem; color: var(--muted); }
.ma-pair-tile[data-color="emerald"] { border-left: 3px solid var(--success); }
.ma-pair-tile[data-color="amber"]   { border-left: 3px solid var(--warn); }
.ma-pair-tile[data-color="rose"]    { border-left: 3px solid var(--danger); }

/* Reconciliation table styling */
.ma-reconciliation {
  margin: 2rem 0; padding: 1.5rem;
  background: var(--surface); border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}
.ma-reconciliation h3 { margin-top: 0; font-size: 1.125rem; }
.ma-reconciliation table {
  width: 100%; border-collapse: collapse;
  font-family: var(--font-mono); font-size: .8125rem; margin-top: .75rem;
}
.ma-reconciliation th { text-align: left; padding: .5rem; background: var(--bg); font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); }
.ma-reconciliation td { padding: .5rem; border-bottom: 1px solid var(--border); }
.ma-reconciliation td.ok { color: var(--success); }
.ma-reconciliation td.warn { color: var(--warn); }
.ma-reconciliation td.bug { color: var(--danger); font-weight: 600; }
