/* The Ops tab of the app (Fleet, Support, Customers, Usage; staff only) on top of app.css. Colors from tokens.css and brand.css only; new
   classes start with op-. */

/* The fourth tab, and the same page layout as the Inbox and Settings. */
.ap-tab[hidden] { display: none; }
.ap-tabs:has(#tab-ops:not([hidden])) { grid-template-columns: repeat(4, 1fr); }
.si[data-view="ops"] { place-items: start center; grid-template-columns: minmax(0, 1fr); padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.si[data-view="ops"] .si-card { width: min(640px, 100%); padding: 0; background: none; border: 0; box-shadow: none; text-align: left; }
.si[data-view="ops"] .brand-logo { display: none; }
.si[data-view="ops"] .si-foot { margin-top: 20px; }
.si-view[data-v="ops"] { min-width: 0; }
.op-title:focus { outline: none; }
.op-title { overflow-wrap: anywhere; }

/* Lists that scroll sideways rather than squeeze: the sections and the ticket filters. */
.op-scroll { overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 2px; }
.op-scroll::-webkit-scrollbar { display: none; }
.op-seg { display: flex; width: max-content; }
.op-seg .ap-seg-b { flex: none; min-height: 44px; padding: 0 14px; white-space: nowrap; }
.op-chips { display: flex; gap: 8px; width: max-content; }
.op-chip { flex: none; min-height: 44px; padding: 0 14px; border: 1px solid var(--sep); border-radius: 999px; background: transparent; color: var(--muted); font: inherit;
  font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.op-chip:hover { background: var(--tint); }
.op-chip[aria-pressed="true"] { background: var(--tint-2); border-color: transparent; color: var(--fg); }
.op-chip-n { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.rt-env { align-self: center; }
.op-bar-back { display: flex; }
.op-bar-back[hidden], .op-scroll[hidden], .ap-head[hidden], .rt-env[hidden] { display: none; }
.op-back { min-height: 44px; margin-left: -14px; padding: 0 14px; font-size: 16px; }
.ap-note:focus { outline: none; }
.op-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.op-body > * { min-width: 0; }

/* Numbers at the top of a screen */
.op-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.op-kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.op-kpi { padding: 12px 14px; border: 1px solid var(--sep); border-radius: var(--r-m); background: var(--card); }
.op-kpi dt { color: var(--muted); font-size: 13px; font-weight: 600; line-height: 1.3; }
.op-kpi dd { margin: 4px 0 0; font-size: 22px; font-weight: 750; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.op-kpi dd.warn { color: var(--warn-t); }
.op-kpi dd.bad { color: var(--bad-t); }
.op-kpis.k3 .op-kpi { padding: 12px; }

/* Rows */
.op-row { align-items: center; padding-left: 16px; min-height: 64px; }
.op-row .ap-row-t { min-width: 0; }
.op-item { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; }
.op-item .ap-row-t { min-width: 0; }
.op-item .ap-badge { flex: none; margin-left: 0; }
.op-chev { flex: none; width: 8px; height: 8px; margin: 0 4px; border: solid var(--muted); border-width: 2px 2px 0 0; transform: rotate(45deg); }
.op-row:hover .op-chev { border-color: var(--fg); }
.op-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; }
.op-line .ap-badge { margin-left: 0; }
.op-line .ap-meta { margin-top: 0; }
.op-st { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.op-st.ok { color: var(--ok-t); }
.op-st.bad { color: var(--bad-t); }
.op-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.op-mono { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.op-attn { display: block; margin-top: 4px; color: var(--warn-t); font-size: 14px; font-weight: 600; line-height: 1.4; }
.op-attn.bad { color: var(--bad-t); }
.op-attn.quiet { color: var(--muted); font-weight: 500; }
.op-quiet { color: var(--muted); font-weight: 500; }
.op-backup { display: block; margin-top: 4px; }
.op-backup .ap-meta { margin-top: 0; }
.ap-badge.op-bad { background: var(--bad-bg); color: var(--bad-t); }
.op-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.op-more { padding: 4px 4px 0; }
.op-meter { appearance: none; -webkit-appearance: none; display: block; width: 100%; max-width: 280px; height: 6px; margin-top: 6px; border: 0; border-radius: 999px;
  background: var(--tint-2); overflow: hidden; }
.op-meter::-webkit-progress-bar { background: var(--tint-2); border-radius: 999px; }
.op-meter::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.op-meter::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.op-meter.warn::-webkit-progress-value { background: var(--warn); }
.op-meter.warn::-moz-progress-bar { background: var(--warn); }
.op-meter.bad::-webkit-progress-value { background: var(--bad); }
.op-meter.bad::-moz-progress-bar { background: var(--bad); }
.op-cursor { flex-wrap: wrap; }
.op-cursor .ap-row-t { flex: 1 1 160px; }
.op-spark { flex: 0 0 120px; width: 120px; height: 28px; }
.op-spark rect { fill: var(--accent); }
.op-spark rect.z { fill: var(--tint-2); }
.op-tl .ap-time { align-self: flex-start; }

/* Waiting, errors, empty */
.op-wait { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 0; }
.op-state { align-items: center; text-align: center; padding: 28px 16px; }
.op-state-t { margin: 0; font-weight: 700; font-size: 17px; }
.op-state .btn { align-self: stretch; }
.op-state .si-err { text-align: center; }

/* A ticket */
.op-head { display: flex; flex-direction: column; gap: 6px; }
.op-head .ap-meta { margin-top: 0; }
.op-head .op-line { margin-top: 2px; }
.op-thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.op-msg { padding: 12px 14px; border: 1px solid var(--sep); border-radius: var(--r-m); background: var(--card); }
.op-msg.us { background: var(--tint); }
.op-msg-h { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.op-msg-who { display: flex; flex-direction: column; min-width: 0; }
.op-msg-h strong { color: var(--fg); font-weight: 700; overflow-wrap: anywhere; }
.op-msg-h > span:last-child { flex: none; font-variant-numeric: tabular-nums; }
.op-text { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.op-flag { margin: 8px 0 0; padding: 8px 10px; border-radius: var(--r-s); background: var(--warn-bg); color: var(--warn-t); font-size: 14px; font-weight: 600; }
.op-compose { gap: 10px; }
.op-label { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.op-input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--sep); border-radius: var(--r-m); background: var(--card); color: var(--fg); font: inherit;
  font-size: 16px; }
.op-input:focus-visible { outline-offset: 0; }
.op-ta { min-height: 120px; padding: 12px 14px; line-height: 1.45; resize: vertical; }
.op-compose a.btn { text-decoration: none; }
.op-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.op-actions .btn { flex: 1 1 140px; }
.op-linkbtn { align-self: flex-start; }
.op-console { padding: 0 4px; }
.op-facts { padding: 0; }
.op-fact { display: grid; grid-template-columns: minmax(96px, 34%) minmax(0, 1fr); gap: 12px; padding: 12px 16px; margin: 0; }
.op-fact + .op-fact { border-top: 1px solid var(--sep); }
.op-fact dt { color: var(--muted); font-size: 14px; font-weight: 600; }
.op-fact dd { margin: 0; overflow-wrap: anywhere; }
.op-fact dd .op-attn:first-child { margin-top: 0; }
.op-fact dd .op-attn { margin-top: 2px; }
.op-fact dd .ap-badge { margin-left: 8px; }

/* The confirmation sheet: up from the bottom on a phone, a card in the middle on a wide screen */
.op-sheet { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: none; max-height: 90vh; max-height: 90dvh; overflow-y: auto; padding: 24px 16px calc(16px + env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); border: 1px solid var(--sep); border-bottom: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--card); color: var(--fg); box-shadow: var(--shadow-pop); text-align: left; }
.op-sheet[open] { display: flex; flex-direction: column; gap: 12px; }
.op-sheet::backdrop { background: var(--scrim); }
html:has(.op-sheet[open]) { overflow: hidden; }
.op-sheet-h { margin: 0; font-size: 20px; line-height: 1.25; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.op-sheet-h:focus { outline: none; }
.op-sheet-p { margin: 0; color: var(--muted); }
.op-sheet-note { margin: 0; padding: 10px 14px; border-radius: var(--r-m); background: var(--warn-bg); color: var(--warn-t); font-size: 14px; font-weight: 600; }
.op-sheet-act { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.op-sheet .si-err { margin: 0; }
.op-quote { margin: 0; padding: 10px 14px; border-left: 3px solid var(--sep); background: var(--tint); border-radius: 0 var(--r-s) var(--r-s) 0; white-space: pre-wrap;
  overflow-wrap: anywhere; max-height: 30vh; overflow-y: auto; font-size: 15px; }
.op-form { display: flex; flex-direction: column; gap: 12px; }
.op-field { display: flex; flex-direction: column; gap: 6px; }
.op-field[hidden] { display: none; }

/* Computer access on a customer's page (ops.js) and the support picker's way to it (app.js) */
.op-access { gap: 12px; }
.op-access-t { margin: 0; font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.op-access-t .op-st { font-size: inherit; font-weight: inherit; align-items: baseline; }
.op-access-t .op-dot { transform: translateY(-1px); }
.op-access-n { margin: 0; }
.op-access .op-sheet-note, .op-access .si-err { margin: 0; }
.op-access .btn { align-self: stretch; }
.cp-ask { width: 100%; margin-top: 12px; }
.cp-state .cp-ask { width: auto; align-self: stretch; }

@media (min-width: 900px) {
  .op-access .btn { align-self: flex-start; min-width: 180px; }
  .si[data-view="ops"] { padding: 48px 32px 48px calc(232px + 32px); }
  .si[data-view="ops"] .si-card { width: min(960px, 100%); }
  .op-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .op-kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .op-sheet { inset: 0; margin: auto; width: min(480px, calc(100% - 64px)); height: fit-content; padding: 24px; border-bottom: 1px solid var(--sep); border-radius: var(--r-xl); }
  .op-compose .btn { align-self: flex-start; min-width: 180px; }
  .op-actions .btn { flex: 0 0 auto; min-width: 180px; }
  .op-sheet-act { flex-direction: row-reverse; justify-content: flex-start; }
  .op-sheet-act .btn { min-width: 120px; }
}
