/* Selfievo · components.css — the building blocks of the light customer theme. */
/* Ported unchanged from app/static/app.css (slice U-A0, plan-api-first-rebuild.md §2.2): „building blocks“ and the UI-B select, switch and account menu. */

/* --- building blocks ----------------------------------------------------------------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l); box-shadow: var(--elev-1); }
.card.pad { padding: 16px 18px 18px; margin-top: 16px; }
.card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head .more, .card-head .seg-nav { margin-left: auto; }

dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; }
dl.facts dt { color: var(--text-dim); }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font: 650 14px var(--font-body); white-space: nowrap; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.sm { height: 32px; padding: 0 13px; font-size: 13px; }
.btn.lg { height: 46px; padding: 0 24px; font-size: 15px; }
.btn.is-soon, .chip.is-soon { background: var(--surface-3); border-color: transparent; color: var(--text-muted); cursor: default; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px;
  border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap;
}
a.chip:hover { background: var(--surface-2); color: var(--text); }
.chip.on { background: var(--text); border-color: var(--text); color: #fff; }
a.chip.on:hover { background: #333; color: #fff; }
.chip small { font-weight: 600; color: var(--text-muted); }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 650; background: var(--surface-2); color: var(--text-dim); white-space: nowrap;
  vertical-align: middle;
}
.tag.pbx { background: #EEF3FD; color: #1D4ED8; }
.tag.bot { background: #F2ECFD; color: #6D28D9; }
.tag.plain { background: var(--surface-3); color: var(--text-dim); }
.tag.soon { background: var(--surface-3); color: var(--text-dim); text-transform: none; letter-spacing: 0; }
.tag.data { background: var(--info-bg); color: var(--info); }
.tag.lay { background: var(--warn-bg); color: var(--warn); }
.tag.ev { background: var(--surface-3); color: var(--text-dim); }
.tag.mk { background: var(--surface-2); color: var(--text-dim); text-transform: uppercase; letter-spacing: .02em; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 650; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.wait { background: var(--warn-bg); color: var(--warn); }
.pill.run { background: var(--info-bg); color: var(--info); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.hand { background: var(--handoff-bg); color: var(--handoff); }
.pill.plan { background: var(--surface-2); color: var(--text-dim); }

.modepill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.modepill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.modepill.ok { background: var(--ok-bg); color: var(--ok); }
.modepill.warn { background: var(--warn-bg); color: var(--warn); }
.modepill.info { background: var(--info-bg); color: var(--info); }
.modepill.err { background: var(--error-bg); color: var(--error); }

/* D12 certainty words: always text; the icon is decoration. */
.cert { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; white-space: nowrap; vertical-align: 1px; }
.cert.sm { font-size: 11px; padding: 1px 7px; }
.cert-exact { background: var(--ok-bg); color: var(--ok); }
.cert-depends { background: var(--warn-bg); color: var(--warn); }
.cert-unknown { background: var(--surface-3); color: var(--text-dim); }

.alert { padding: 11px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-weight: 600; margin: 12px 0; }
.alert.err { background: var(--error-bg); color: var(--error); }
.empty { padding: 14px 16px; border: 1px dashed var(--border-strong); border-radius: var(--r-m); color: var(--text-muted); }
.more { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-dim); text-decoration: none; }
.more:hover { color: var(--accent-hover); }

.grp { display: flex; align-items: center; gap: 8px; margin: 26px 0 10px; font: 700 11px var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.grp .n { font-size: 11px; font-weight: 700; background: var(--surface-3); border-radius: var(--r-pill); padding: 1px 8px; color: var(--text-dim); letter-spacing: 0; }
.grp-row { display: flex; align-items: center; justify-content: space-between; }
.grp-row .grp { margin-bottom: 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.wait { background: var(--warn-line); }

.list { overflow: hidden; }
.row:first-child { border-top: 0; }
.row-time { flex: none; width: 48px; color: var(--text-muted); font-size: 13px; }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 650; text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
a.row-title:hover { text-decoration: underline; }
.row-wait { box-shadow: inset 4px 0 0 var(--warn-line); }

.check { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; font-size: 13.5px; }
.ci { width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 800; margin-top: 1px; }
.ci.warn { background: var(--warn-bg); color: var(--warn); }

.inp {
  height: 40px; border: 1px solid var(--border-strong); border-radius: var(--r-s); padding: 0 12px;
  background: var(--surface); font-weight: 600; min-width: 0;
}
.inp.sm { height: 34px; }
.inp:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
select.inp { padding-right: 8px; }


/* === UI-B components: the select (UI plan 2026-10-08 §1.5, audit C-2) ======================
   One look for every select of the customer pages and of the staff pages. No
   native bezel (appearance: none), so WebKit draws no second box inside the
   border. One border. An own arrow from two gradients in --text-muted, so it
   follows the light and the dark theme (staff.css changes the tokens). The
   filters (`.sel`, macro `select` of templates/_controls.html) are pills like
   the chips; the form fields keep the shape of their inputs. The label is
   outside the box: hidden (.sr-only) or a muted word before it (.sel-label). */
.sel, select.st-input, select.inp, .line-pick select, .as-select, .st-section-pick select {
  -webkit-appearance: none; appearance: none;
  padding-right: 32px; min-width: 0; max-width: 100%; text-overflow: ellipsis; cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: right 18px center, right 13px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.sel {
  height: 32px; padding-left: 13px; border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  background-color: transparent; color: var(--text); font: 600 13px var(--font-body);
}
.sel:hover { background-color: var(--surface-2); }
.sel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sel option { background-color: var(--surface); color: var(--text); }
.sel-label { font-size: 13px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
/* === end of the select ===================================================================== */

/* === UI-B components: the switch (UI plan 2026-10-08 §1.5, audit C-1) ===================
   Markup: the macro `switch` of templates/_controls.html. The customer pages
   and the staff pages use it (app.css loads in both shells; the staff theme sets
   --accent-fill). One <label> holds the
   input, the track and the text, so a click on any part changes the box. The
   invisible input lies on the track (z-index 1), and the track never takes a
   click (pointer-events: none). Before, the track painted over the input and
   was outside the label: a click on the knob did nothing. */
.st-switch {
  position: relative; display: inline-flex; align-items: center; gap: 9px; min-height: 32px;
  font-size: 13px; color: var(--text-dim); cursor: pointer; user-select: none;
}
.st-switch input {
  position: absolute; left: 0; top: 50%; z-index: 1; width: 30px; height: 18px; margin: -9px 0 0;
  opacity: 0; cursor: pointer;
}
.st-switch .track {
  position: relative; flex: none; width: 30px; height: 18px; border-radius: 999px; pointer-events: none;
  background: var(--surface-3); border: 1px solid var(--border-strong);
}
.st-switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-muted);
}
.st-switch input:checked + .track { background: var(--accent-fill, var(--accent)); border-color: var(--accent-fill, var(--accent)); }
.st-switch input:checked + .track::after { left: 15px; background: #FFFFFF; }
.st-switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.st-switch:hover .track { border-color: var(--text-muted); }
.st-switch-row { margin: 4px 0 6px; }
.st-switch-lg { font-size: 14px; color: var(--text); font-weight: 650; }
/* === end of the switch ================================================================== */

/* === UI-B components: the account menu of the customer header (UI plan P2 16, audit C-13) ===
   <details class="avatar-menu"> in base.html: the avatar is the summary; app.js closes the
   menu on a click outside and on Escape. */
.avatar-menu { position: relative; flex: none; }
.avatar-menu > summary { list-style: none; cursor: pointer; }
.avatar-menu > summary::-webkit-details-marker { display: none; }
.avatar-menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 240px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-m); box-shadow: var(--elev-2);
}
.avatar-who { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; margin: 0; font-size: 13px; }
.avatar-who:not(:last-child) { margin-bottom: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle); }
.avatar-who span { color: var(--text-muted); overflow-wrap: anywhere; }
.avatar-item {
  display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--r-s); background: none;
  text-align: left; font: 600 13.5px var(--font-body); color: var(--text); text-decoration: none; cursor: pointer;
}
.avatar-item:hover { background: var(--surface-2); }
.avatar-item-form { margin: 0; }
/* === end of the account menu ================================================================ */
