/* The account page. One column of cards, narrow enough to read: this page is mostly prose
   and short forms, and nothing on it benefits from the full width of a desktop window. */
.accountmain {
  max-width: 46rem; margin: 0 auto; padding: 16px 12px 48px;
  display: flex; flex-direction: column; gap: 14px;
}
.accountmain .card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
}
.accountmain h2 { margin: 0 0 8px; font-size: 1.05em; }
.accountmain .muted { color: var(--muted); line-height: 1.55; margin: 0 0 12px; }
.accountmain .small { font-size: .9em; }

.stack { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.stack label { display: flex; flex-direction: column; gap: 4px; width: 100%; font-size: .92em; }
/* …except a checkbox row inside a shared filter control, which is a label with its control
   beside it rather than above it. The form's own labels stack; these do not. */
.stack .flist label.dropitem { flex-direction: row; align-items: center; width: 100%; gap: 8px; }
.stack input { width: 100%; }
/* …but not a checkbox in a shared filter control, which the form would otherwise stretch
   to the full width of the row and leave no room for the name beside it. */
.stack .flist input[type="checkbox"] { width: auto; flex: none; }
/* The form stretches every input; the two that live inside a shared filter control keep
   their own width. The controls themselves are styled in styles.css, beside the feed's. */
.stack .lookup input { width: 100%; font-size: .9em; }
.stack .vehadd input { width: 7em; }
.stack.row { flex-direction: row; align-items: center; }

/* The key itself. Monospace and allowed to wrap: on a phone it does not fit on one line,
   and truncating the one string the page exists to show would be the wrong trade. */
.keyrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--sel); border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 8px; overflow-wrap: anywhere; user-select: all;
}
.loading { color: var(--muted); padding: 20px 12px; }

/* Genuinely a sequence — you pick a name, you are given a key, you save it — so it is
   numbered. The counter sits in the margin rather than indenting the text. */
.steps { margin: 0 0 14px; padding-left: 1.4em; display: flex; flex-direction: column; gap: 8px; }
.steps li { line-height: 1.55; }
.steps b { font-weight: 600; }

/* ---- The line between a notification and a webhook ----
   Below a labelled rule and folded shut rather than the next card down. Not hidden: the
   heading says how many are set, and it opens itself when there are any.
   See docs/decisions/frontend.md#the-account-page. */
.levelrule {
  display: flex; align-items: center; gap: 10px; margin: 4px 0 0;
  font-size: .78em; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.levelrule::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Dashed rather than solid, and without the panel background the cards have: this is a
   boundary you may cross, not another card of content. */
.advanced { border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; }
.advhead {
  display: flex; align-items: center; gap: 9px; width: 100%;
  font: inherit; font-size: 1.05em; font-weight: 600; text-align: left; cursor: pointer;
  background: none; border: 0; color: var(--text); padding: 0;
}
.advhead .chev { margin-left: auto; font-size: .72em; font-weight: 400; color: var(--muted); }
.advhead:focus-visible { outline: 2px solid var(--police); outline-offset: 3px; }
.advbody { margin-top: 12px; }
/* What crossing the line means, in one sentence, at the top of what it guards. */
.advwarn {
  font-size: .9em; color: var(--muted);
  border-left: 2px solid var(--prio-med); padding-left: 10px; margin: 0 0 10px;
}

/* ---- A saved filter on a list row ----
   The feed's own chips, flat and not clickable here: on a saved row a chip that removed a
   filter would be an edit nobody asked to make.
   See docs/decisions/frontend.md#shared-scripts. */
.rowfilter { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 1px 0; }
.rowfilterlabel { color: var(--muted); font-size: .78em; letter-spacing: .05em; text-transform: uppercase; }
.fchip.flat {
  cursor: default; font-size: .8em; padding: 1px 8px;
  background: var(--panel2); color: var(--text); border-color: var(--border);
}
.fchip.flat.none { color: var(--muted); font-style: italic; }

/* ---- Webhooks ---- */
.hooklist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.hookrow {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
}
.hookrow.off { opacity: .55; }
.hookmain { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }

/* Rows, not columns. Three unbreakable buttons beside a shrinkable column left it 124px of
   a 340px row with the buttons landing across the filter chips. Stacking is *shorter* than
   the wrapping was: 151px against 187px at 375px wide. */
.hookrow { flex-direction: column; align-items: stretch; gap: 8px; }
.hookactions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding-top: 8px; border-top: 1px solid var(--border);
}
/* Wide enough and they go back beside the content: there the column was never squeezed, and
   stacking would only cost height. The hairline goes too — it separates stacked things. */
@media (min-width: 620px) {
  .hookrow { flex-direction: row; align-items: center; gap: 9px; }
  .hookmain { gap: 2px; }
  .hookactions { padding-top: 0; border-top: 0; flex-wrap: nowrap; }
}
/* An endpoint is long and the interesting half is the end of it, so it truncates at the
   front rather than the back. */
.hookurl { direction: rtl; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.filterset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0; }
.filterset legend { padding: 0 6px; color: var(--muted); font-size: .9em; }
.filterset label { margin-bottom: 8px; }
.filterset .flist label.dropitem { margin-bottom: 0; }

/* One toggle left of what used to be a row: the enabled switch, which is not a filter. The
   filters are the shared controls in filterui.js, styled in styles.css. What survives from
   here is that off is a badge drained of colour rather than a different shape. */
.toggles { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.setlabel { color: var(--muted); font-size: .9em; min-width: 5.5em; }

.toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: .92em; cursor: pointer; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: none; color: var(--muted);
  transition: color .12s, border-color .12s, background-color .12s;
}
.toggle.on { color: var(--text); background: var(--sel); }
@media (hover: hover) { .toggle:hover { border-color: var(--muted); } }
.toggle:focus-visible { outline: 2px solid var(--police); outline-offset: 2px; }



.setnote { margin: 2px 0 0; }

.accountmain textarea {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92em; line-height: 1.45; resize: vertical;
}

.fieldhelp { margin: 4px 0 8px; }
.fieldhelp summary { cursor: pointer; color: var(--muted); font-size: .92em; }
.fieldtable { border-collapse: collapse; margin-top: 8px; font-size: .9em; }
.fieldtable td { padding: 2px 10px 2px 0; vertical-align: top; }

/* The preview is the point of the editor, so it is separated from the form rather than
   tucked under it. */
.preview { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; }
.preview h3 { margin: 0 0 8px; font-size: .95em; }
.rendered {
  background: var(--sel); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; overflow-x: auto; margin: 0 0 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em;
}
.problems { color: var(--prio-high); margin: 0; padding-left: 1.2em; line-height: 1.6; }
.examples { display: flex; flex-direction: column; gap: 3px; }
.exline { display: flex; gap: 8px; align-items: baseline; font-size: .9em; color: var(--muted); }

/* On/off reads as a word, not as a tick: this is the one setting that decides whether the
   webhook does anything at all, and a checkbox states that too quietly. */
.toggle.tstate { min-width: 4em; justify-content: center; }
.toggle.tstate.on { border-color: var(--prio-low); color: var(--text); }

.statepill {
  font-size: .72em; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px;
  margin-left: 6px; color: var(--muted); vertical-align: middle;
}
.statepill.on { color: var(--text); border-color: var(--muted); }

/* What this filter would actually do, in numbers from real traffic. It sits above the
   rendered body because it is the thing most likely to change what you type next. */
.rate {
  border: 1px solid var(--border); border-left-width: 3px; border-radius: 8px;
  padding: 8px 10px; margin-bottom: 10px; font-size: .92em; line-height: 1.5;
  color: var(--muted);
}
.rate b { color: var(--text); }
.rate.over { border-left-color: var(--prio-med); color: var(--text); }

.stack.row.wrap { flex-wrap: wrap; }

/* Picking which real message the body is rendered from. Buttons, because they change what
   is above them. */
.examples { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.examples p { margin: 4px 0 2px; }
.exline {
  display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left;
  font: inherit; font-size: .9em; color: var(--muted); cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px;
}
.exline.on { border-color: var(--border); background: var(--sel); color: var(--text); }
@media (hover: hover) { .exline:hover { border-color: var(--border); } }
.extext { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.testresult {
  margin-top: 10px; padding: 8px 10px; border-radius: 8px; font-size: .92em; line-height: 1.5;
  border: 1px solid var(--border); border-left-width: 3px;
}
.testresult.good { border-left-color: var(--prio-low); }
.testresult.bad { border-left-color: var(--prio-high); }
.testresult .muted { color: var(--muted); }

/* ---- Delivery log ---- */
.hookitem { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.hooklist .hookrow { border: 0; border-radius: 0; }
.health { display: block; }
.health.ok { color: var(--prio-low); }
.health.bad { color: var(--prio-high); }

.hooklog { border-top: 1px solid var(--border); background: var(--sel); padding: 8px 10px; }
.hooklog p { margin: 0; }
.logtable { border-collapse: collapse; width: 100%; font-size: .88em; }
.logtable td { padding: 3px 8px 3px 0; vertical-align: top; }
.logwhen { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.logstatus { font-variant-numeric: tabular-nums; color: var(--muted); }
.logdetail { overflow-wrap: anywhere; }

/* The outcome is a word, not a colour alone: "dropped on purpose" and "we tried and it
   broke" are different things and a red dot would say neither. */
.outcome { font-weight: 600; white-space: nowrap; }
.outcome.ok { color: var(--prio-low); }
.outcome.bad { color: var(--prio-high); }
.outcome.warn { color: var(--prio-med); }

.testtag {
  font-size: .82em; border: 1px solid var(--border); border-radius: 4px;
  padding: 0 4px; margin-right: 5px; color: var(--muted);
}

/* A header is a name and a value, so it is two fields — "Name: value" is asking them to get
   the colon wrong. The value is a password field: it is usually a bearer token. */
.headerrow { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.headerrow .hname { flex: 0 1 12rem; }
.headerrow .hvalue { flex: 1 1 12rem; min-width: 0; }

.danger-card { border-color: var(--prio-high); }
.danger-card .btn.danger { color: #fff; background: var(--prio-high); border-color: var(--prio-high); }
.btn.danger { color: #fff; background: var(--prio-high); border-color: var(--prio-high); }

/* Push sits above the list because it is how most people will get their first destination:
   nothing to type, one tap. */
.pushbox {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px;
}
.pushbox p { margin: 4px 0 0; max-width: 34rem; }
.pushbox .btn { white-space: nowrap; }
