/* The dialogs and the forms inside them. Loaded after styles.css, which carries
   the page's shell, cards and list. */

/* --------------------------------------------------------------- dialogs ---- */
#alert-modal, #cond-modal, #auth-modal {
  position: fixed; inset: 0; z-index: 125;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
/* A dialog owns the page while it is open: the page behind it must not scroll
   under the scrim. The reserved lane keeps the page's width unchanged while
   the scrollbar is hidden, so closing a dialog cannot flash a layout shift. */
body:has(#alert-modal), body:has(#cond-modal), body:has(#auth-modal),
body:has(#dc-modal.on), body:has(#pitch-modal) {
  overflow: hidden;
  padding-right: var(--overlay-scrollbar, 0px);
}
#alert-modal .amodal-box, #cond-modal .amodal-box, #auth-modal .amodal-box { width: min(520px, 100%); }
/* The scrim is a child of the fixed host and carries z-index 100; the box was
   auto, so the scrim painted over the dialog and dimmed it. */
#alert-modal .amodal-box, #cond-modal .amodal-box,
#auth-modal .amodal-box, #auth-modal .auth-card { z-index: 101; }
/* The condition sheet is the builder's own size: a narrower card centred on a
   wider one read as a dialog that had wandered in beside the one it belongs to. */
.amodal-box .amodal-body { gap: 4px; }
#dc-modal { position: fixed; inset: 0; z-index: 130; display: none; }
#dc-modal.on {
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.dc-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .7); backdrop-filter: none; }
.dc-box {
  position: relative; z-index: 1;
  width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  margin: 0; padding: 18px;
  border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--card); box-shadow: var(--shadow);
}
.dc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dc-head h3 { font-size: 16px; font-weight: 600; }
.dc-list { display: flex; flex-direction: column; gap: 12px; }
.dc-item { display: flex; gap: 10px; }
.dc-mark {
  flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong); color: var(--ink-3); font-size: 11px;
}
.dc-mark.done { background: var(--up-soft); border-color: var(--up); color: var(--up); }
.dc-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
/* The dialog is drawn inside a settings card, whose generic `.scard p` rule is
   more specific than the dialog's own paragraph classes. Scope these to the
   dialog so its step name stays the stronger line and the explanation stays
   quieter, as the dialog's own sizes say. */
.dc-box .dc-name { font-size: 12.5px; color: var(--ink); font-weight: 500; }
.dc-box .dc-lead, .dc-box .dc-hint { color: var(--ink-4); font-size: 11px; }
.dc-ok { color: var(--up); font-size: 11px; }
.dc-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
/* The two step actions are anchors, and as flex children they blockify with
   their label at the top-left - a wide dark box that reads as an input, not a
   button. The footer's native button centers its label, so the dialog had two
   different button shapes. Center every dialog action and lift its fill to the
   same field tone the close control uses; the base `.sbtn` remains the smaller
   account-page control everywhere else. */
.dc-box .sbtn {
  display: flex; align-items: center; justify-content: center;
  background: var(--field); border-color: var(--line-strong);
}

/* --------------------------------------------------------------- builder ---- */
/* The label column is measured by its longest caption, not guessed: at the size
   below "NOTIFICATIONS" runs ninety-seven of these pixels, so the column is a
   hundred and four and the word stays on one line - a caption that wraps is two
   lines of tracking over a row that is one. */
.ab {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.ab:last-of-type { border-bottom: 0; }
/* The Item row is the builder's first question and its longest field, so its
   label goes above it and the control takes the dialog's whole width - the same
   edge the conditions rail and the sentence under it start on, rather than the
   eighty-eight pixels a column that only says "Item" was holding. */
.ab-itemrow { grid-template-columns: minmax(0, 1fr); gap: 5px; }
.ab-itemrow .ab-lab { padding-top: 0; }
.ab-lab {
  color: var(--ink-4); padding-top: 10px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em;
  text-transform: none;
}
.ab-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.ab-ctl input[type="search"], .ab-ctl input[type="text"],
.ab-ctl input[type="number"], .ab-ctl select {
  height: 36px; padding: 0 10px;
  border-radius: 6px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--ink);
  font-family: var(--sans); font-size: 12px; outline: none;
  min-width: 0; flex: 1 1 140px;
}
.ab-ctl input:focus, .ab-ctl select:focus { border-color: var(--line-strong); }
.ab-ctl .ghost { flex: 0 0 auto; }
/* The builder's two switch rows read from the right edge, like every other
   answer in the form: the frequency is a pair of segments rather than a field,
   so it gathers against that edge, and the destinations are the only control on
   their row, so they take all of it. */
.ab-trigger { flex: 1 1 auto; justify-content: flex-end; }
.ab-ctl > .anotify { flex: 1 1 auto; min-width: 0; }
.ab-ctl > .anotify summary {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  /* The names sit at the row's right edge like the frequency beside them, and a
     long set that wraps keeps that edge on its second line too. */
  text-align: right;
}

/* The Item row: icon, the field, its clear, and the answers under it. */
.ab-item { position: relative; display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.ab-item-ico {
  flex: 0 0 30px; width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px; background: var(--field); overflow: hidden;
}
.ab-item-ico img { width: 24px; height: 24px; object-fit: contain; }
.ab-item-q { flex: 1 1 auto; width: auto; padding-right: 30px; }
.ab-item-x {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; display: grid; place-items: center;
  border: 0; border-radius: 5px; background: transparent;
  color: var(--ink-4); cursor: pointer;
}
.ab-item-x[hidden] { display: none; }
.ab-item-x:hover { background: var(--field); color: var(--ink); }
/* Fixed to the window, like the destination list: the dialog's body scrolls and
   an absolute plate inside it was cut off at that edge. The field's rect is
   measured in alerts.js (`placeAlertItemList`). */
.ab-item-list {
  position: fixed; z-index: 118;
  max-height: 220px; overflow: auto; padding: 5px;
  border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--card-2); box-shadow: var(--shadow);
}
.ab-item-list[hidden] { display: none; }
/* A plate with more answers than its cap says so under the last whole row: the
   same edge fade the search card and the comparison picker wear, turned to the
   foot. `fitMark` keeps `.more` in step with what is still below the fold. */
.ab-item-list.more {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
}
.ab-item-list .note { padding: 8px 9px; color: var(--ink-3); font-size: 11px; }
.anew-hit {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 8px;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--ink-2); text-align: left; font-size: 12px; cursor: pointer;
}
.anew-hit:hover, .anew-hit[aria-selected="true"] { background: var(--field); color: var(--ink); }
.anew-hit .ico {
  display: flex; flex: 0 0 22px; width: 22px; height: 22px;
  align-items: center; justify-content: center;
}
.anew-hit img { width: 20px; height: 20px; object-fit: contain; flex: 0 0 auto; }
.anew-hit .n { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.anew-hit .c { color: var(--ink-4); font-family: var(--mono); font-size: 10px; }
.anew-hit .k { flex: 0 0 auto; color: var(--accent); font-size: 10px; }

/* The conditions: a named rail, its add control, and the rows it holds. */
.ab-conds { padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.ab-conds-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ab-conds-title {
  color: var(--ink-4);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em;
  text-transform: none;
}
.ab-cond-add {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  flex: 0 0 auto;
  height: 32px; padding: 0 10px; white-space: nowrap;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--ink-3);
  font-size: 11.5px; cursor: pointer;
}
.ab-cond-add:hover { border-color: var(--line-strong); color: var(--ink); }
.ab-cond-add[hidden] { display: none; }
.ab-cond-add[disabled] { cursor: default; color: var(--ink-4); border-color: var(--line); }
.ab-cond-add.locked {
  color: var(--accent); border-color: var(--accent-line);
  background: var(--accent-soft);
}
.ab-cond-add .ab-cond-crown {
  flex: 0 0 auto; width: 12px; height: 12px;
}
/* The same crown on the builder's primary act, where the lock is the second
   line on one item rather than a second condition. */
.ab-foot [data-alert-add] .ab-cond-crown {
  flex: 0 0 auto; width: 12px; height: 12px; margin-left: 6px; vertical-align: -1px;
}
.ab-flow { margin-top: 8px; }
.ab-flow-nodes { display: flex; flex-direction: column; gap: 6px; }
.ab-flow-nodes:empty { display: none; }
/* The conditions rail before its first row: a dashed slot the width of the row
   that will fill it, rather than a named section sitting over a bare strip. */
.ab-cond-empty {
  margin: 8px 0 0; padding: 8px 9px;
  border: 1px dashed var(--line-strong); border-radius: 8px;
  color: var(--ink-4); font-size: 11.5px; line-height: 1.45;
  /* Centred: the slot is the section talking to itself before it has a row to
     read, and a sentence set against the left edge read as a value. */
  text-align: center;
}
.ab-cond-empty[hidden] { display: none; }
.ab-cond {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 8px;
  padding: 7px 9px;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--ink-2); font-size: 11.5px;
}
.ab-cond[data-trigger] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); }
.ab-cond-kicker {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em;
  text-transform: none; color: var(--ink-4);
}
.ab-cond[data-trigger] .ab-cond-kicker { color: var(--accent); }
.ab-cond-words { min-width: 0; overflow-wrap: anywhere; }
.ab-cond-acts { display: inline-flex; align-items: center; gap: 1px; }
.ab-cond-mini, .ab-cond-x {
  flex: 0 0 auto; width: 24px; height: 24px;
  display: grid; place-items: center;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--ink-4); cursor: pointer;
}
.ab-cond-mini[hidden] { display: none; }
.ab-cond-mini:hover, .ab-cond-x:hover { background: var(--field); color: var(--ink); }
.ab-summary[hidden] { display: none; }
/* The summary is the sentence the line will send, so it is a plate of its own
   kind: the card's ground rather than the field's, a brighter edge, and the
   accent down its left side. A condition is something to press; this is what
   pressing them produces, and it has to be told apart at a glance. */
.ab-summary {
  display: block; line-height: 1.55;
  margin: 8px 0 2px; padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--card-2);
  color: var(--ink); font-size: 11.5px;
}
.ab-gap { flex: 1 1 auto; height: 0; }
.ab-foot {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; flex-wrap: wrap; padding-top: 10px;
}
/* The delete is the builder's destructive action: left of the gap, in the
   warning ink. The selector has to match the button it names. */
.ab-foot [data-alert-delete] { color: var(--down); }
.ab-foot .abtn[disabled] { opacity: .45; cursor: default; }
/* One footer, one shape: the quiet pair and the save are the same box as every
   other control (34px, 6px radius) rather than pills beside a rectangle, and
   the two dialogs' footers agree with each other. */
.ab-foot .abtn, #cond-modal .abtn {
  height: 34px; padding: 0 13px; border-radius: 6px; font-size: 12px;
}
/* One save, one colour: adding a condition is the same kind of commit as
   creating the line, so its button wears the same accent rather than sitting
   dark beside the Cancel like a second way out. */
.abtn[data-alert-add], .abtn[data-cond-save] {
  height: 34px; padding: 0 14px; border-radius: 6px;
  background: var(--accent); color: #17130d; border: 0; font-weight: 600;
}
.abtn[data-alert-add][disabled], .abtn[data-cond-save][disabled] {
  opacity: .45; cursor: default;
}
.abtn[hidden] { display: none; }
.abtn.adanger { color: var(--down); }
/* The dialogs' headings take the app's own size (Connect Discord, the alert
   dialog's own title) instead of a caption's. The builder is a sheet with a
   field, a rail and a footer under it, so its title is read as the page's title
   rather than as a caption on top of them: nineteen is the step between the
   board's card heads (14) and the item page's own (22), at the tracking those
   take. */
#alert-modal .amodal-box h3, #cond-modal .amodal-box h3 {
  font-size: 19px; font-weight: 600; letter-spacing: -.015em;
}
/* The condition dialog sits ON the builder, so its scrim has to paint over the
   builder's footer - otherwise the save button showed through beside it. */
#cond-modal { z-index: 126; }
/* A short screen - a landscape phone - used to crop the sheet before its footer:
   the whole box scrolled as one piece, so the pair of buttons that decide the
   form sat under the screen's edge. The box is a column now, the form between
   the head and the foot scrolls, and the foot stays on the glass. */
#alert-modal .amodal-box, #cond-modal .amodal-box {
  display: flex; flex-direction: column;
  max-height: calc(100dvh - 32px);
}
#alert-modal .amodal-body, #cond-modal .amodal-body {
  min-height: 0; overflow-y: auto;
  /* A condition row can be the pixel that takes the body over its height. Keep
     the lane reserved so the scrollbar cannot flash a width change on submit. */
  scrollbar-gutter: stable;
}
#alert-modal .ab-foot, #cond-modal .ab-foot { position: sticky; bottom: 0; background: var(--card); }

/* the level box and its condition tiles */
.acond-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.acond-tile {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink-3);
  font-size: 11px;
  cursor: pointer;
}
.acond-tile input { position: absolute; opacity: 0; pointer-events: none; }
.acond-tile:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); }
/* The radio is invisible, so focus has to be drawn on the label it belongs to. */
.acond-tile:has(input:focus-visible) {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.acond-tile-ico { display: grid; place-items: center; }
.acond-tile-ico svg { width: 15px; height: 15px; }
/* The condition sheet is read as the builder's own: a caption over each
   question, a hairline under it, and a question a condition does not ask taken
   away with its caption rather than left as a word over an empty row. */
#cond-modal .acond-fields { padding-top: 2px; }
#cond-modal .acond-sec {
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
#cond-modal .acond-sec:first-child { padding-top: 0; }
#cond-modal .acond-sec:has(> [hidden]) { display: none; }
#cond-modal .acond-sec .ab-conds-title { display: block; margin-bottom: 7px; }
.acond-toggle { display: flex; gap: 4px; flex-wrap: wrap; }
.acond-toggle[hidden] { display: none; }
.acond-seg { position: relative; }
.acond-seg input { position: absolute; opacity: 0; pointer-events: none; }
.acond-seg span {
  display: inline-flex; align-items: center; justify-content: center;
  height: 28px; padding: 0 10px;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--ink-4);
  font-size: 10.5px; cursor: pointer; text-transform: none;
}
.acond-seg:has(input:checked) span { border-color: var(--line-strong); color: var(--ink); background: var(--field); }
.acond-seg:has(input:focus-visible) span {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.acond-num[hidden] { display: none; }
/* The target is the calculator's number field, on the width the builder's rows
   have, and the unit rides INSIDE it against the last digit - a price is written
   "1,250gp", never as a number at one edge with its unit at another. The field
   widens to what is typed (see `fitTarget`), so the two travel together and the
   pair stays centred in the box. The steppers are the calculator's 26px squares
   beside it, not part of the pill. */
.acond-num {
  display: flex; align-items: center; gap: 8px;
  padding: 0; border: 0; border-radius: 0; background: none;
}
#cond-modal .acond-amt {
  flex: 1 1 auto; min-width: 0; height: 34px;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  padding: 0 9px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg-2);
  /* The pill is the field's label: its padding and unit are part of the target,
     not dead space beside the two-character input. */
  cursor: text;
}
#cond-modal .acond-amt:focus-within { border-color: var(--line-strong); }
#cond-modal .acond-amt input {
  flex: 0 0 auto; width: 2ch; min-width: 2ch; height: 100%; padding: 0;
  border: 0; background: none; outline: none; text-align: center;
  font-family: var(--mono); font-size: 13px;
}
#cond-modal .acond-amt em {
  color: var(--ink-4); font-style: normal; font-size: 10px;
}
#cond-modal .acond-step { width: 26px; height: 26px; border-radius: 8px; background: var(--bg-2); }
.acond-num input {
  flex: 1 1 auto; min-width: 0;
  height: 38px; border: 0; background: transparent; outline: none;
  color: var(--ink); font-family: var(--mono); font-size: 17px; text-align: center;
}
.acond-num em { color: var(--ink-4); font-style: normal; font-size: 10px; padding-right: 4px; }
.acond-step {
  width: 32px; height: 38px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--field); color: var(--ink-3);
  font-size: 15px; line-height: 1; cursor: pointer;
}
.acond-step:hover { color: var(--ink); }
.acond-hint { display: block; padding-top: 6px; }
.acond-hint[hidden] { display: none; }
.acond-hint-note { display: block; color: var(--ink-4); font-size: 10.5px; }
.acond-hint-note[hidden] { display: none; }
.acond-suggest[hidden] { display: none; }
/* The offer under the target wears the app's suggestion chip (see .suggest-chip
   in styles.css): the same dashed number the calculator puts beside its fields,
   so a reader who has pressed one there recognises this one. Its words can be
   long - an estimate says so - so it is allowed a second line here. */
.acond-suggest { max-width: 100%; }
.cond-note { color: var(--ink-4); font-size: 10.5px; }
.cond-tip {
  position: fixed; z-index: 140;
  max-width: 240px; padding: 6px 9px;
  border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--card-2); color: var(--ink-2);
  font-size: 10.5px; opacity: 0; pointer-events: none;
}
.cond-tip.open { opacity: 1; }

/* the destination picker in a builder row */
.anotify { position: relative; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-2); }
.anotify summary {
  list-style: none; cursor: pointer;
  padding: 9px 10px; color: var(--ink-2); font-size: 11.5px;
}
.anotify summary::-webkit-details-marker { display: none; }
.anotify[open] { border-color: var(--line-strong); }
.anotify-list {
  position: fixed; z-index: 118;
  max-height: 240px; overflow: auto;
  padding: 5px;
  border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--card-2); box-shadow: var(--shadow);
}
/* One destination, one row: the checkbox and its name take the width and the
   Set-up link for a channel that is not ready sits at the end of that row.
   Without this the link fell onto a line of its own under the label, so every
   disabled destination cost two rows and the list read as broken pairs. */
.anotify-opt { display: flex; align-items: center; gap: 8px; }
.anotify-opt > label { flex: 1 1 auto; min-width: 0; }
.anotify-opt .anotify-setup { flex: 0 0 auto; }
.anotify-list label {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 5px;
  color: var(--ink-2); font-size: 11.5px; cursor: pointer;
}
.anotify-list label:hover { background: var(--field); }
.anotify-list label.off { opacity: .55; cursor: default; }
.anotify-list label.off:hover { background: none; }
.anotify-list input { accent-color: var(--accent); }

/* the log view */
.apanel-lines, .apanel-logs { display: flex; flex-direction: column; gap: 7px; }
.logs-view .logs-head {
  color: var(--ink-4); font-size: 10.5px;
  text-transform: none; letter-spacing: .06em;
  padding: 6px 0;
}

/* mobile */
@media (max-width: 620px) {
  .ab { grid-template-columns: 1fr; gap: 5px; }
  .ab-lab { padding-top: 0; }
  .aitem { align-items: flex-start; }
  .acond-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* The footer wraps rather than pushing Delete and Clear off a 320px sheet. */
  .ab-gap { flex-basis: 100%; }
  .ab-foot > .abtn { flex: 1 1 auto; }
  /* A thumb's dialog: every control is 44 high, the same floor the page's own
     phone layer gives the filters and the page head. The 40 this block used to
     carry was a size of its own, and the builder was the one surface where a
     thumb got a smaller row than everywhere else. */
  #alert-modal .abtn, #cond-modal .abtn, .adel { height: 44px; }
  .ab-ctl input[type="search"], .ab-ctl input[type="text"],
  .ab-ctl input[type="number"], .ab-ctl select { height: 44px; }
  .ab-cond-add { height: 44px; }
  .ab-cond-mini, .ab-cond-x { width: 44px; height: 44px; }
  .ab-item-x { width: 44px; height: 44px; right: 1px; }
  .ab-item-q { padding-right: 48px; }
  /* The conditions header already carries the way to add one - "Add condition"
     sits in it - and on a phone the dashed sentence under that header repeated
     the instruction over 59px of sheet. The empty rail is said once, by the
     control that fills it. */
  #alert-modal .ab-cond-empty { display: none; }
  .anew-hit { min-height: 44px; }
  .anotify-list label { min-height: 44px; }
  .anotify-setup { display: inline-flex; align-items: center; min-height: 44px; }
  .acond-seg span { height: 44px; }
  .acond-tile { padding: 10px; min-height: 44px; }
  .acond-step { height: 44px; }
  .acond-num input { height: 44px; }
  /* The same field, at a thumb's size: the calculator's own mobile floor. */
  #cond-modal .acond-amt { height: 44px; }
  #cond-modal .acond-step { width: 44px; height: 44px; }
  .acond-suggest { min-height: 44px; display: inline-flex; align-items: center; }
}

/* Labels are sentence-case and use the body face; mono is for values. */
.ab-lab, .ab-conds-title, .ab-cond-kicker, .logs-view .logs-head {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0;
}
.acond-seg span { font-size: 11px; }

/* The dialog layer loads after the page, so its phone-only form rules live here. */
@media (max-width: 620px) {
  /* The destination picker is a disclosure, so it opens IN the form rather than
     as a plate floating past the sheet's foot: at 390 the fixed list hung 150px
     below the dialog, over the page behind it. In the flow, the footer follows
     it down, the sheet scrolls, and the keyboard cannot cover what is inline. */
  .anotify-list {
    position: static;
    width: auto !important;
    max-height: none !important;
    margin-top: 6px;
    box-shadow: none;
  }
  .anotify summary i { display: inline-block; transition: transform var(--t-quick); }
  .anotify[open] summary i { transform: rotate(90deg); }
  /* The level is the condition's own number: the box grew to its digits (20px
     for one), which left a thumb aiming at a letter's width. */
  #cond-modal .acond-amt input { min-width: 44px; }
}
@media (pointer: coarse) and (min-width: 621px) and (max-width: 860px) {
  #alert-modal, #cond-modal, #auth-modal {
    align-items: flex-start !important;
    padding-bottom: calc(16px + var(--kb, 0px)) !important;
  }
  #alert-modal .amodal-box, #cond-modal .amodal-box,
  #auth-modal .auth-card {
    max-height: calc(100dvh - 32px - var(--kb, 0px)) !important;
  }
}

/* The alert destination picker's boxes are the site's, not the platform's:
   a drawn square with the accent check, matching the rest of the rail. */
.anotify-list input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 18px;
  width: 18px; height: 18px;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg);
  position: relative;
  cursor: pointer;
}
.anotify-list input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
}
.anotify-list input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px; top: 1px;
  width: 5px; height: 10px;
  border-right: 2px solid #17130d;
  border-bottom: 2px solid #17130d;
  transform: rotate(45deg);
}
.anotify-list input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.anotify-list input[type="checkbox"]:disabled {
  opacity: .45;
  cursor: default;
}

/* The condition notes are the only words some tiles carry, and the plate was
   drawn at 10.5px - the one explanation a phone could not read. */
@media (pointer: coarse), (max-width: 620px) {
  .cond-tip { font-size: 12px; max-width: min(260px, calc(100vw - 24px)); }
  /* The destination picker's summary is the control that opens the list. */
  .anotify summary { min-height: 44px; }
}

/* The Discord dialog is defined here - panels.css is the sheets' own file and
   loads after styles.css - so its phone inset belongs here too. Its shared
   dialog edges come from the phone pattern below. */
@media (max-width: 620px) {
  .dc-box { padding: 18px 16px; }
}

/* A dialog's close × was 44 tall and 28 wide: half a thumb, on every one of
   them. The width is the same floor as the height. */
@media (pointer: coarse), (max-width: 620px) {
  .adel { min-width: 44px; }
}

/* A 320 sheet cannot hold the three frequency words on one line at their desk
   width. Stacking them cost three 44px rows - 181px of sheet - for a choice
   that is one row of three segments everywhere else, and pushed the whole
   builder past a short phone's height on its own. A third of the sheet each,
   with the words breaking onto a second line inside the same 44px, is the same
   control at the same thumb size as the desk's. */
@media (max-width: 380px) {
  .ab-trigger {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px; width: 100%;
  }
  .ab-trigger .acond-seg { min-width: 0; }
  .ab-trigger .acond-seg span {
    width: 100%; height: 44px; padding: 4px 6px;
    justify-content: center; text-align: center; line-height: 1.2;
    white-space: normal;
  }
}

/* ---------------------------------------------- phone dialogs, one pattern --- */
/* The bell's notifications card is the shape every dialog a phone opens takes
   now: a rounded panel inset from all four edges and centred on the glass,
   over a scrim that fades with it. The alert builder and its condition sheet,
   the item's notes, a flip plan, the Discord steps and sign-in were each
   pinned to the foot and stretched edge to edge, so the same dialog changed
   shape with the surface it was opened from. The motion is one short lift. The
   home bar and the keyboard are added to the inset, never to the card. */
@keyframes dialog-card-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}
@keyframes dialog-scrim-in { from { opacity: 0; } to { opacity: 1; } }

/* The pattern follows the input, not only the width: a phone on its side and a
   tablet are coarse pointers too, and the flip tool's edit/sell/buy dialogs
   were the ones that kept the desk's card there while every other layer had
   already switched. */
@media (max-width: 620px), (pointer: coarse) {
  #alert-modal, #cond-modal, #auth-modal, #flip-modal, #notes-modal.on,
  #dc-modal.on, #rl-review-modal, #rl-connect-modal, #pitch-modal {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px !important;
    padding-bottom: calc(12px + max(var(--kb, 0px), env(safe-area-inset-bottom, 0px))) !important;
  }
  /* One card, one set of edges: the width the phone has less its gutters, the
     height it has above the keys, and the same corners on every surface. */
  #alert-modal .amodal-box, #cond-modal .amodal-box, #auth-modal .auth-card,
  #flip-modal .flip-dialog, #notes-modal.on .note-dialog, #dc-modal.on .dc-box,
  #rl-review-modal .rl-review-dialog, #rl-connect-modal .rl-connect-dialog,
  #pitch-modal .pitch {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    max-height: calc(100dvh - 24px - max(var(--kb, 0px), env(safe-area-inset-bottom, 0px))) !important;
    /* The root --radius stays the desk's 10; the phone card layer is 15. */
    border-radius: 15px !important;
    animation: dialog-card-in 200ms var(--ease) both;
    overscroll-behavior: contain;
  }
  #alert-modal > .ascrim, #cond-modal > .ascrim, #auth-modal > .ascrim,
  #flip-modal > .flip-scrim, #notes-modal.on > .note-scrim, #dc-modal.on > .dc-scrim,
  #rl-review-modal > .rl-review-scrim, #rl-connect-modal > .rl-connect-scrim,
  #pitch-modal > .pitch-scrim {
    animation: dialog-scrim-in 200ms ease both;
  }
  /* The drawer the pattern is taken from opens with it, so no two dialogs a
     phone can reach land differently. */
  #notif-drawer:not([hidden]) {
    border-radius: 15px;
    animation: dialog-card-in 200ms var(--ease) both;
  }
  @media (prefers-reduced-motion: reduce) {
    #alert-modal .amodal-box, #cond-modal .amodal-box, #auth-modal .auth-card,
    #flip-modal .flip-dialog, #notes-modal.on .note-dialog, #dc-modal.on .dc-box,
    #rl-review-modal .rl-review-dialog, #rl-connect-modal .rl-connect-dialog,
    #pitch-modal .pitch, #notif-drawer:not([hidden]),
    #alert-modal > .ascrim, #cond-modal > .ascrim, #auth-modal > .ascrim,
    #flip-modal > .flip-scrim, #notes-modal.on > .note-scrim, #dc-modal.on > .dc-scrim,
    #rl-review-modal > .rl-review-scrim, #rl-connect-modal > .rl-connect-scrim,
    #pitch-modal > .pitch-scrim {
      animation: none;
    }
  }
}
/* A tablet has the gutters but not the phone's full width: the same centred
   card, held to the width a dialog is read at. */
@media (pointer: coarse) and (min-width: 621px) {
  #alert-modal .amodal-box, #cond-modal .amodal-box, #auth-modal .auth-card,
  #flip-modal .flip-dialog, #notes-modal.on .note-dialog, #dc-modal.on .dc-box,
  #rl-review-modal .rl-review-dialog, #rl-connect-modal .rl-connect-dialog,
  #pitch-modal .pitch {
    width: min(520px, 100%) !important;
  }
}

/* ------------------------------------------------------------- sign in ---- */
/* The auth card is the one dialog with a form, a provider row and two ways
   out. Its pieces are styled as one surface here: the base card gives it the
   frame, and these rules give that frame a reading order. The provider marks
   are inline SVGs, so their plate is measured - an SVG without a width paints
   at its intrinsic size and takes over the card. */
#auth-modal .auth-card {
  width: min(400px, calc(100vw - 32px));
  padding: 26px;
  border-radius: var(--radius);
  background:
    radial-gradient(90% 65% at 50% -10%, rgba(255, 138, 31, .09), transparent 60%),
    var(--card);
  box-shadow: 0 28px 90px -32px #000;
}
#auth-modal .auth-card .adel {
  position: absolute; top: 14px; right: 14px;
  border: 1px solid var(--line);
}
#auth-modal .auth-card > .mark {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--ink-3);
  font-family: var(--mono); font-size: 9.5px;
  letter-spacing: .18em; text-transform: uppercase;
}
#auth-modal .auth-card > .mark::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
}
#auth-modal .auth-card h2 {
  margin-top: 12px;
  font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.12;
}
#auth-modal .auth-card > .sub {
  max-width: 35ch; margin-top: 8px;
  color: var(--ink-3); font-size: 12px; line-height: 1.55;
}
#auth-modal .prow {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 20px;
}
#auth-modal .pbtn {
  flex: 1 1 140px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 42px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-xs);
  background: var(--field); color: var(--ink-2);
  font-size: 12px; font-weight: 500;
}
#auth-modal .pbtn svg { width: 17px; height: 17px; flex: 0 0 17px; }
#auth-modal .pbtn.discord {
  border-color: rgba(88, 101, 242, .42);
  background: rgba(88, 101, 242, .14);
  color: var(--ink);
}
#auth-modal .pbtn.google { color: var(--ink); }
#auth-modal .auth-or {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0;
  color: var(--ink-4);
  font-family: var(--mono); font-size: 9.5px;
  letter-spacing: .12em; text-transform: uppercase;
}
#auth-modal .auth-or::before, #auth-modal .auth-or::after {
  content: ""; flex: 1 1 auto; height: 1px; background: var(--line);
}
#auth-modal .auth-or span { line-height: 1; }
#auth-modal #auth-form {
  display: flex; flex-direction: column; gap: 12px;
  margin-top: 16px;
}
#auth-modal .auth-or + #auth-form { margin-top: 0; }
#auth-modal #auth-form label {
  display: flex; flex-direction: column; gap: 6px;
  color: var(--ink-3); font-size: 11px; font-weight: 500;
}
#auth-modal #auth-form input {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: var(--bg-2); color: var(--ink);
  font-family: var(--sans); font-size: 12.5px; outline: none;
}
#auth-modal #auth-form input:focus {
  border-color: var(--line-strong); background: var(--field);
}
#auth-modal #auth-form input::placeholder { color: var(--ink-4); }
#auth-modal #auth-form input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-2) inset;
  -webkit-text-fill-color: var(--ink);
}
#auth-modal #auth-go {
  width: 100%; height: 42px; margin-top: 2px;
  border: 0; border-radius: var(--radius-xs);
  background: var(--accent); color: #17130d;
  font-size: 12.5px; font-weight: 600;
}
#auth-modal #auth-go:hover { background: var(--accent-2); }
#auth-modal .auth-switch {
  margin-top: 1px; text-align: center;
  color: var(--ink-4); font-size: 11.5px;
}
#auth-modal .auth-switch .link { font-size: 11.5px; }
#auth-modal .auth-err {
  margin-top: 10px;
  color: var(--down); font-size: 11.5px; line-height: 1.45;
}
#auth-modal .auth-err:empty { display: none; }
@media (max-width: 620px) {
  #auth-modal .auth-card { padding: 22px 20px; }
  #auth-modal .auth-card h2 { font-size: 24px; }
  #auth-modal #auth-go { height: 44px; }
}
