/*
 * @cfm/ops-console — operator console styles ("Лаконичный свет" + IBM Plex).
 *
 * The INTERNAL operator console: work the KYB queue, open a provider dossier and
 * moderate it, read the internal reputation/SLA display, transcribe the
 * PROVIDER's own published quote, mediate a dispute WITHOUT any control of funds,
 * and preview the client board. It authors no rate, holds no funds, advances no
 * deal — every value shown is provider- or platform-observed and rendered via
 * esc()/textContent in app.js.
 *
 * Design tokens + the self-hosted Plex faces live in tokens.css (shared, byte-
 * identical with the client + provider consoles). This sheet is component styling
 * only; it references var(--…) tokens exclusively, restyling the console's class
 * vocabulary (shell / topbar / panel / field / btn / tabs / list-item / badge /
 * offer-card / kv / chips / notice) into "Лаконичный свет". The column is wider
 * than the phone mini-apps because this is a desktop operator tool. Dark derives
 * from the OS (prefers-color-scheme) via app.js — there is no Telegram here.
 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
}

body {
  color: var(--ink);
  font-family: var(--ff);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ *
 * Shell — a centred document column (wider than the phone mini-apps).
 * ------------------------------------------------------------------ */

.shell {
  max-width: 760px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 8px 20px calc(40px + env(safe-area-inset-bottom));
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.topbar h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

h1,
h2,
h3 {
  margin: 0;
}

h2 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Status line under a title — a small state dot + label. */
.status-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.status-line::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pos);
  flex: none;
}

.status-line.is-error {
  color: var(--danger);
}

.status-line.is-error::before {
  background: var(--danger);
}

/* ------------------------------------------------------------------ *
 * Panels → clean cards; a heading is a quiet uppercase label.
 * ------------------------------------------------------------------ */

.panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--s1);
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px 0;
}

.panel-heading h2 {
  color: var(--muted);
}

.panel-body {
  padding: 13px 15px;
}

/* A bare disclaimer-only panel reads as a quiet inset note, not a card. */
.panel:has(> .panel-body > .disclaimer:only-child) {
  border: 0;
  background: var(--s2);
  border-radius: var(--r-md);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.disclaimer {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 6px;
}

.disclaimer:first-child {
  margin-top: 0;
}

.empty {
  padding: 20px 6px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.mono {
  font-family: var(--mono);
  font-weight: 500;
}

/* ------------------------------------------------------------------ *
 * Fields
 * ------------------------------------------------------------------ */

.field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  min-width: 0;
}

.field span {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--s1);
  color: var(--ink);
  padding: 11px 12px;
  font-size: 15px;
  font-weight: 600;
  outline: none;
}

textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.45;
  font-weight: 400;
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
  font-weight: 400;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--asoft);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.form-grid .field.span-2 {
  grid-column: 1 / -1;
}

/* ------------------------------------------------------------------ *
 * Buttons — primary = cobalt; ok / warn / danger = semantic outlines.
 * ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--s1);
  color: var(--ink);
  padding: 0 15px;
  font-family: var(--ff);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.btn.block {
  width: 100%;
  margin-top: 12px;
}

.btn.primary {
  background: var(--accent);
  color: var(--on);
  border-color: transparent;
}

.btn.ok {
  color: var(--pos);
  border-color: color-mix(in srgb, var(--pos) 40%, var(--line));
}

.btn.warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 40%, var(--line));
}

.btn.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
}

.btn:disabled,
.is-busy {
  opacity: 0.5;
  pointer-events: none;
}

/* Compact buttons in the sticky topbar. */
.topbar-actions .btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: var(--r-md);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}

.text-button {
  border: 0;
  background: none;
  color: var(--accent);
  font-family: var(--ff);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 0;
}

/* ------------------------------------------------------------------ *
 * Login — a centred card.
 * ------------------------------------------------------------------ */

.login-card {
  max-width: 400px;
  margin: 12vh auto 0;
}

/* ------------------------------------------------------------------ *
 * Queue filter tabs — horizontal pills.
 * ------------------------------------------------------------------ */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tab {
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--s1);
  color: var(--muted);
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 600;
}

.tab.is-active {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--asoft);
  color: var(--aink);
}

/* ------------------------------------------------------------------ *
 * Lists — clickable rows (queue / ranking / disputes) + card lists.
 * ------------------------------------------------------------------ */

.list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 12px;
}

/* A clickable dossier / ranking / dispute row. */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  min-height: 60px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--s1);
  color: var(--ink);
}

.list-item:active {
  background: var(--s2);
}

.list-item .lead {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.list-item .lead strong {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item .lead .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ *
 * Cards (rate board, commissions, board preview).
 * ------------------------------------------------------------------ */

.offer-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--s1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 13px 14px;
  color: var(--ink);
}

.offer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.offer-head strong {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.offer-rate {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.offer-rate .mono {
  font-size: 20px;
  letter-spacing: -0.01em;
}

.offer-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 9px;
  line-height: 1.5;
  word-break: break-word;
}

/* Fat-finger advisory inside an offer card. */
.offer-warn {
  margin-top: 10px;
}

/* Publish/update form inside an offer card. */
.offer-publish {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------------ *
 * Badges + chips
 * ------------------------------------------------------------------ */

.badge {
  flex: none;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--s2);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Positive / in-progress states. */
.badge.st-approved,
.badge.st-fresh,
.badge.st-completed,
.badge.lic-verified {
  background: color-mix(in srgb, var(--pos) 14%, var(--s1));
  color: var(--pos);
}

/* Neutral / active-review states. */
.badge.st-pending_kyb,
.badge.st-under_review {
  background: var(--asoft);
  color: var(--aink);
}

/* Caution states. */
.badge.st-more_info_requested,
.badge.st-limited,
.badge.st-suspended,
.badge.st-stale,
.badge.st-aml_review,
.badge.st-refund_pending {
  background: color-mix(in srgb, var(--warn) 16%, var(--s1));
  color: var(--warn);
}

/* Stop / terminal / attention states. */
.badge.st-blocked,
.badge.st-archived,
.badge.st-dispute,
.badge.st-amount_mismatch,
.badge.lic-unverified,
.badge.lic-expired,
.badge.lic-revoked {
  background: color-mix(in srgb, var(--danger) 12%, var(--s1));
  color: var(--danger);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.chip {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--s2);
  padding: 3px 8px;
  border-radius: 5px;
  word-break: break-word;
}

/* ------------------------------------------------------------------ *
 * Key/value (dossier facts, SLA metrics, dispute deal facts).
 * ------------------------------------------------------------------ */

.kv {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-top: 8px;
}

.kv dt,
.kv dd {
  padding: 10px 13px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  min-width: 0;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  font-weight: 600;
  word-break: break-word;
}

.kv dt:first-of-type,
.kv dd:first-of-type {
  border-top: 0;
}

/* ------------------------------------------------------------------ *
 * Notices
 * ------------------------------------------------------------------ */

.notice {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--s2);
  color: var(--ink);
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  margin-top: 12px;
}

.notice.is-info {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
  background: var(--asoft);
  color: var(--aink);
}

.notice.is-ok {
  border-color: color-mix(in srgb, var(--pos) 30%, var(--line));
  background: color-mix(in srgb, var(--pos) 9%, var(--s1));
  color: var(--pos);
}

.notice.is-error {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  background: color-mix(in srgb, var(--danger) 8%, var(--s1));
  color: var(--danger);
}

.notice.is-warn {
  border-color: color-mix(in srgb, var(--warn) 34%, var(--line));
  background: color-mix(in srgb, var(--warn) 12%, var(--s1));
  color: var(--warn);
}

/* ------------------------------------------------------------------ *
 * Narrow viewports — collapse the two-column form grid.
 * ------------------------------------------------------------------ */

@media (max-width: 520px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .kv {
    grid-template-columns: minmax(96px, auto) 1fr;
  }

  .shell {
    padding-left: 15px;
    padding-right: 15px;
  }
}
