/* Stage panel: header, inputs/dropzones, params, results, viewer. */
.stage-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.stage-index { font-family: var(--font-mono); color: var(--teal); font-size: 0.85rem; }
.stage-desc { color: var(--muted); max-width: 64ch; margin: 8px 0 24px; }

.section { margin-bottom: 26px; }
.section > .section-title {
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 12px;
}

/* dropzone */
.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--r-lg);
  background: var(--surface); padding: 26px; text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.drag { border-color: var(--teal); background: var(--teal-soft); }
.dropzone .dz-label { font-weight: 600; }
.dropzone .dz-help { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.dropzone input[type=file] { display: none; }
.dz-browse { color: var(--teal); text-decoration: underline; }

/* file line items (reports) */
.filelist { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.fileitem {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface);
}
.fileitem .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fileitem .fsize { color: var(--muted); font-size: 0.78rem; }
.tagbtns { display: inline-flex; gap: 6px; }
.tagbtn {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 3px 12px; font-family: var(--font-mono); font-size: 0.8rem;
}
.tagbtn.on { background: var(--teal); color: #fff; border-color: var(--teal); }

/* editable lists (template) */
.lists { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.editlist { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; background: var(--surface); }
.editlist h4 { margin: 0 0 10px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.editlist ul { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 5px; max-height: 240px; overflow: auto; }
.editlist li { display: flex; gap: 8px; align-items: center; font-family: var(--font-mono); font-size: 0.85rem; }
.editlist li button { border: 0; background: transparent; color: var(--removed); font-size: 1rem; line-height: 1; }
.editlist .addrow { display: flex; gap: 6px; }
.editlist .addrow input { flex: 1; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); font-family: var(--font-mono); }
@media (max-width: 720px) { .lists { grid-template-columns: 1fr; } }

/* "Get blank template" download links under the template uploader */
.blank-templates { margin: 12px 0 4px; }
.blank-templates h4 { margin: 0 0 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.blank-templates .addrow { display: flex; gap: 6px; }
.blank-templates .addrow a { text-transform: uppercase; letter-spacing: 0.04em; text-decoration: none; }

/* params panel */
.params { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; }
.param { display: flex; flex-direction: column; gap: 5px; }
.param label { font-size: 0.82rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.param .help { color: var(--muted); font-size: 0.76rem; }
.param input[type=text], .param input[type=number], .param select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); font-family: var(--font-mono); color: var(--ink);
}
.affects { font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--changed); border: 1px solid var(--changed-soft); background: var(--changed-soft); padding: 1px 6px; border-radius: 999px; }
@media (max-width: 720px) { .params { grid-template-columns: 1fr; } }

/* toggle */
.toggle { position: relative; width: 42px; height: 24px; flex: 0 0 auto; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background 0.15s; }
.toggle .track::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform 0.15s; }
.toggle input:checked + .track { background: var(--teal); }
.toggle input:checked + .track::before { transform: translateX(18px); }
.toggle-row { display: flex; align-items: center; gap: 10px; }

/* chips field (stringList) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.chips .tag { display: inline-flex; align-items: center; gap: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; font-family: var(--font-mono); font-size: 0.8rem; }
.chips .tag button { border: 0; background: transparent; color: var(--removed); }
.chips input { border: 0; outline: 0; flex: 1; min-width: 120px; font-family: var(--font-mono); background: transparent; }

/* modes (generate) */
.modes { display: flex; gap: 10px; margin-bottom: 18px; }
.mode {
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  padding: 10px 14px; text-align: left; min-width: 180px;
}
.mode.on { border-color: var(--teal); background: var(--teal-soft); }
.mode .mode-label { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.mode .mode-help { color: var(--muted); font-size: 0.76rem; margin-top: 3px; }
.mode .badge { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 999px; }
.mode .badge.wired { background: var(--added-soft); color: var(--added); }
.mode .badge.soon { background: var(--paper); color: var(--muted); border: 1px solid var(--line); }

/* results / banners */
.result { margin-top: 22px; }
.banner { border-radius: var(--r-md); padding: 12px 14px; font-size: 0.9rem; display: flex; gap: 10px; align-items: flex-start; }
.banner.ok    { background: var(--added-soft);   color: var(--added);   border: 1px solid var(--added); }
.banner.err   { background: var(--removed-soft); color: var(--removed); border: 1px solid var(--removed); }
.banner.warn  { background: var(--changed-soft); color: var(--changed); border: 1px solid var(--changed); }
.banner.info  { background: var(--flag-soft);    color: var(--flag);    border: 1px solid var(--flag); }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-top: 16px; }
.stat { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; background: var(--surface); }
.stat .k { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stat .v { font-family: var(--font-mono); font-size: 1.4rem; }

/* placeholder station (dashboard) */
.placeholder-card { text-align: center; padding: 56px 22px; border: 1.5px dashed var(--line); border-radius: var(--r-lg); color: var(--muted); background: var(--surface); }
.placeholder-card .big { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); margin-bottom: 6px; }

/* diff viewer */
.diff-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.count-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.count-chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; border: 1px solid var(--line); }
.count-chip .num { font-weight: 600; }
.cc-added   { background: var(--added-soft);   color: var(--added); }
.cc-removed { background: var(--removed-soft); color: var(--removed); }
.cc-changed { background: var(--changed-soft); color: var(--changed); }
.cc-flag    { background: var(--flag-soft);    color: var(--flag); }

.prior-banner { border-left: 3px solid var(--flag); background: var(--flag-soft); color: var(--flag); padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: 14px; font-size: 0.88rem; }

table.difftable { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.difftable th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border-bottom: 1px solid var(--line); padding: 8px 10px; }
table.difftable td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.difftable td.num { font-family: var(--font-mono); }
.grouprow td { background: var(--paper); font-weight: 600; font-family: var(--font-display); }
.kind { font-family: var(--font-mono); font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; }
.kind.ADDED   { background: var(--added-soft);   color: var(--added); }
.kind.REMOVED { background: var(--removed-soft); color: var(--removed); }
.kind.CHANGED { background: var(--changed-soft); color: var(--changed); }
.rowflag { font-size: 0.68rem; color: var(--flag); border: 1px solid var(--flag-soft); border-radius: 999px; padding: 0 6px; margin-left: 4px; }
tr.prior td { box-shadow: inset 3px 0 0 var(--flag); }

/* toast */
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 10px; z-index: 50; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r-md); box-shadow: var(--shadow); font-size: 0.9rem; max-width: 360px; animation: rise 0.18s ease; }
.toast.err { background: var(--removed); }
.toast.ok  { background: var(--added); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
