/* Leads portal: admin-only layout. Loaded after style.css, which holds the shared look
   (tokens, panels, buttons, pills, tiles, tables, filters, dialogs). */

/* Full screen width on big monitors (Grant, 16 Nov): tables scroll sideways instead of squeezing. */
.admin-page { --page-max: none; }
.admin-page .mock-banner { border-bottom: 0; }
.admin-page .tabbar-inner { max-width: var(--page-max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* ------------------------------------------------------------ tabs */

.tabbar { background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 1px 3px rgba(18, 35, 63, 0.06); }
.tabbar-inner { display: flex; gap: 0.25rem; overflow-x: auto; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 52px; padding: 0 1.1rem; border: 0; background: transparent;
  color: var(--navy); font-weight: 600; font-size: 1rem; cursor: pointer; white-space: nowrap;
}
.tab::after {
  content: ""; position: absolute; left: 0.6rem; right: 0.6rem; bottom: 0; height: 3px;
  border-radius: 3px 3px 0 0; background: transparent;
}
.tab:hover { background: var(--blue-soft); }
.tab[aria-selected="true"] { color: var(--blue); font-weight: 700; }
.tab[aria-selected="true"]::after { background: var(--blue); }
.tab:focus-visible { outline-offset: -3px; }
.tab-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem; height: 1.6rem;
  padding: 0 0.45rem; border-radius: 999px; background: var(--orange); color: var(--navy);
  font-size: 0.95rem; font-weight: 800;
}

/* ------------------------------------------------------------ admin tables */

.admin-page .grid tbody tr.is-spam td { background: #fff7e3; }
.admin-page .grid tbody tr.is-spam td:first-child { box-shadow: inset 4px 0 0 var(--amber-line); }
.admin-page .grid tbody tr.has-query td:first-child { box-shadow: inset 4px 0 0 var(--orange); }
.admin-page .grid tbody tr.is-dirty td:first-child { box-shadow: inset 4px 0 0 var(--orange); }
.grid .rownum { width: 3rem; color: var(--quiet); text-align: right; font-variant-numeric: tabular-nums; }
.grid .c-came { min-width: 8.5rem; }
.grid .c-came time { white-space: nowrap; }
.grid .c-site { white-space: nowrap; }
.grid .c-cust { min-width: 11.5rem; max-width: 16rem; }
.grid .c-area { min-width: 7rem; white-space: nowrap; }
.grid .c-job { min-width: 16rem; }
.grid .c-con { min-width: 10rem; white-space: nowrap; }
.grid .c-status { min-width: 8rem; }
.grid .c-cost { min-width: 13rem; }
.grid .c-query { min-width: 17.5rem; }
.grid .c-trade { min-width: 13rem; white-space: nowrap; }
.grid .c-edit { min-width: 21rem; }
.grid .c-note { min-width: 12rem; }
.grid .c-band { min-width: 9rem; }
.grid .c-band .money .money-input { width: 90px; }
.admin-page .size-select { min-height: 36px; padding: 4px 28px 4px 8px; border-radius: 8px; width: auto; max-width: 100%; }
.size-label { white-space: nowrap; }
.grid .c-change { min-width: 41rem; }
.grid .problem { margin: 0; }
.admin-page .grid .c-cust .tel-link, .admin-page .grid .c-con .user-text { white-space: nowrap; }
.site-link { color: var(--blue); font-weight: 700; white-space: nowrap; text-decoration: none; }
.site-link:hover { text-decoration: underline; }
.fit-says.is-bad { color: var(--bad); font-weight: 700; }
.c-change select { flex: none; }
.admin-page .c-change select, .admin-page .add-price select, .admin-page .decide-note {
  min-height: 40px; padding: 6px 10px; border-radius: 8px;
}
.admin-page .c-change select { padding-right: 28px; }
.c-change select[id^="site-con-"] { width: 15rem; }
.c-change select[id^="site-mode-"] { width: 9rem; }
.decide-note { width: 100%; }
.switch-text { min-width: 4.6rem; }
.admin-page .pager { justify-content: flex-end; }
.admin-page .pager .range { margin: 0 8px; }

/* ------------------------------------------------------------ contractors */

.con-list { display: grid; gap: 20px; }
.con-card { border: 1px solid var(--line); border-radius: 12px; background: #fff; min-width: 0; }
.con-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 18px;
  background: linear-gradient(#f7faff, #edf3fb); border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0;
}
.con-name { margin: 0; font-size: 1.2rem; color: var(--navy); unicode-bidi: plaintext; overflow-wrap: anywhere; }
.con-head .spacer { flex: 1 1 auto; }
.con-facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.con-facts .fact { display: flex; flex-direction: column; min-width: 0; }
.con-facts dt { font-size: 0.95rem; color: var(--muted); font-weight: 600; }
.con-facts dd { margin: 0; font-weight: 700; color: var(--navy); overflow-wrap: anywhere; }
.con-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 20px; padding: 18px; }
.con-body h4 { margin: 0 0 10px; color: var(--navy); font-size: 1.05rem; }
.con-prices-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.con-prices-bar h4 { margin: 0; }
.add-price { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 12px; padding: 12px; border: 1px dashed var(--grid); border-radius: 10px; background: #fafcff; }
.add-price select { width: 15rem; }
.alert-email { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.alert-email .f-field { flex: 0 1 24rem; }
.alert-email input[type="email"] { min-height: 40px; padding: 6px 10px; border-radius: 8px; }
.alert-email input.is-dirty { border-color: var(--amber-line); background: #fffaf0; }
.alert-email .small { flex: 1 1 100%; margin: 0; }

/* ------------------------------------------------------------ dialogs */

.admin-dialog { width: min(34rem, calc(100vw - 2rem)); }
.admin-dialog h2 { margin-bottom: 0.25rem; }
.dialog-sub { color: var(--muted); margin-bottom: 1rem; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.dialog-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 1rem; }

/* ------------------------------------------------------------ authenticator app */

.screen-setup { max-width: 34rem; margin: 1.5rem auto 0; }
.admin-page .code-input {
  width: 100%; max-width: 12rem; min-height: 52px; font-size: 1.6rem; letter-spacing: 0.35em;
  text-align: center; font-variant-numeric: tabular-nums;
}
.setup-steps { margin: 0 0 1rem; padding-left: 1.4rem; }
.setup-steps li { margin-bottom: 0.4rem; }
.setup-qr {
  display: block; width: 200px; height: 200px; margin: 0 0 1rem; padding: 10px;
  background: #fff; border: 1px solid var(--grid); border-radius: 10px; box-sizing: content-box;
}
.setup-key-label { margin: 0 0 0.25rem; color: var(--muted); }
.setup-key { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 1rem; }
.setup-secret {
  font-family: Consolas, "Courier New", monospace; font-size: 1.1rem; font-weight: 700; color: var(--navy);
  background: var(--blue-soft); padding: 6px 10px; border-radius: 8px; overflow-wrap: anywhere; letter-spacing: 0.04em;
}
.code-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 1rem 0 0; }
.mfa-state { font-weight: 700; color: var(--navy); margin: 0 0 0.5rem; }
.mfa-state.is-on { color: var(--ok); }
#mfa-code-form .field { margin-bottom: 0.75rem; }

/* ------------------------------------------------------------ narrower screens: stacked cards */

@media (max-width: 1399px) {
  .admin-page .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .con-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 999px) {
  .admin-page .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Tables keep their columns and scroll sideways inside their box; the page itself never does. */
  .grid-scroll { max-height: none; overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; }
  .grid th { position: static; }
  .add-price select { width: 100%; }
  .alert-email .f-field { flex: 1 1 100%; }
  .admin-page .c-change select { width: auto; }
  .con-head .btn-a { flex: 0 0 auto; }
}
@media (max-width: 520px) {
  .admin-page .stats { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------ test rig */

.rig-form { margin-bottom: 8px; }
.rig-form .filters { margin-bottom: 8px; }
.f-tiny input[type="text"], .filters .f-tiny input[type="text"] { width: 6rem; }
.rig-cost { margin: 0 0 4px; }
#rig-site { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 4px; }
.rig-msg:empty { display: none; }
.rig-run-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; margin: 20px 0 12px; }
.rig-run-bar .sub-title { margin: 0; }
.rig-run-bar select { min-height: 40px; padding: 6px 28px 6px 10px; border-radius: 8px; width: 26rem; max-width: 100%; }
.rig-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 16px; }
.grid .c-intend { min-width: 9rem; white-space: nowrap; }
.grid .c-decided { min-width: 16rem; }
.admin-page .grid tbody tr.is-miss td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
@media (max-width: 1399px) { .rig-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 999px) { .rig-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.filters #rig-trade { width: 20rem; max-width: 100%; }
