/* Shared visual system for every authenticated area and the login screen. */
:root {
  color-scheme: dark;
  --bg-0: #0b0d0f;
  --bg-1: #111416;
  --bg-2: #171b1e;
  --bg-3: #1d2225;
  --bg-4: #252b2f;
  --border: #252b2f;
  --border-strong: #343d42;
  --text-0: #f1f5f4;
  --text-1: #b1bbb8;
  --text-2: #84908c;
  --text-3: #65706c;
  --green: #10b981;
  --green-hover: #0e9f70;
  --green-soft: #48d6a0;
  --green-glow: rgba(16, 185, 129, .14);
  --money: #34d399;
  --radius-sm: 9px;
  --radius: 13px;
  --radius-lg: 18px;
  --transition: .16s ease;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; width: 100%; overflow-x: clip; }
body { width: 100%; min-width: 320px; overflow-x: clip; }
img, svg, canvas, video { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }

/* Every screen shares the same contained two-column shell. */
.layout {
  width: 100%;
  min-height: 100vh;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
}
.sidebar, .main, #page-content { min-width: 0; }
#page-content { width: 100%; max-width: 100%; }
#page-content > * { min-width: 0; }
.main { overflow-x: clip; }

.topbar {
  min-height: 64px;
  padding: 12px clamp(16px, 2.4vw, 32px);
}
.topbar .user { min-width: 0; flex-wrap: wrap; }
.topbar .email { max-width: min(38vw, 340px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-title { padding: clamp(20px, 2.5vw, 30px) clamp(16px, 2.4vw, 32px) 16px; line-height: 1.25; }
.page-head, .finance-header, .toolbar { min-width: 0; flex-wrap: wrap; gap: 12px; }
.page-head { padding: clamp(20px, 2.5vw, 30px) clamp(16px, 2.4vw, 32px) 16px; }
.cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.panel, .finance-card, .order-card, .doc-sidebar, .doc-content {
  border-radius: var(--radius);
}

/* Long values and dense tables stay inside their own scroll containers. */
.table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-inline: contain; }
.data-table { width: 100%; }
.data-table th, .data-table td { overflow-wrap: anywhere; }
pre, code, .code-block, .api-key-value, .requisite-details, .wallet-address {
  max-width: 100%; overflow-wrap: anywhere; word-break: break-word;
}
.code-block, .table-wrap { scrollbar-width: thin; }
input, select, textarea { max-width: 100%; min-width: 0; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal-backdrop { padding: 16px; overflow-y: auto; }
.modal { width: min(560px, 100%); max-width: 100%; max-height: calc(100dvh - 32px); overflow-y: auto; }
.rate-bar { min-width: 0; max-width: 100%; flex-wrap: wrap; }
.finance-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.doc-layout { min-width: 0; }

/* Keep wide admin tables inside the content column (including their margins). */
.main > #page-content > .table-wrap,
#page-content .table-wrap {
  width: auto;
  max-width: none;
  min-width: 0;
  margin-inline: clamp(16px, 2.4vw, 28px);
}
.table-wrap .data-table { max-width: 100%; }

/* Styled select controls replace the operating system's pop-up menu. */
.custom-select { position: relative; display: inline-block; min-width: 160px; max-width: 100%; height: 42px; vertical-align: middle; }
.custom-select-native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; opacity: 0 !important; pointer-events: none !important; }
.custom-select-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; height: 42px; padding: 0 12px !important;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-0); color: var(--text-0); font: inherit; font-size: 13px;
  text-align: left; cursor: pointer; transition: border-color var(--transition), box-shadow var(--transition);
}
.custom-select-trigger:hover, .custom-select-trigger[aria-expanded="true"] { border-color: var(--green); }
.custom-select-trigger:focus-visible { outline: 0; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-glow); }
.custom-select-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-select-chevron { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: var(--text-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--transition); }
.custom-select-trigger[aria-expanded="true"] .custom-select-chevron { transform: rotate(180deg); }
.custom-select-options {
  position: absolute; z-index: 500; top: calc(100% + 6px); left: 0; right: 0;
  display: none; max-height: min(260px, 45vh); overflow-y: auto; padding: 5px;
  border: 1px solid var(--border-strong); border-radius: 11px;
  background: color-mix(in srgb, var(--bg-2) 94%, transparent); color: var(--text-0);
  box-shadow: 0 18px 48px rgba(0,0,0,.5); backdrop-filter: blur(18px);
}
.custom-select-options.show { display: grid; gap: 2px; animation: select-pop .13s ease-out; }
.custom-select-options.open-up { top: auto; bottom: calc(100% + 6px); }
.custom-select-option { position: relative; width: 100%; min-height: 38px; padding: 8px 10px 8px 31px; border: 0; border-radius: 7px; background: transparent; color: var(--text-1); text-align: left; font: inherit; font-size: 13px; cursor: pointer; }
.custom-select-option:hover, .custom-select-option:focus-visible { outline: 0; background: var(--bg-3); color: var(--text-0); }
.custom-select-option.selected { background: var(--green-glow); color: var(--green-soft); font-weight: 650; }
.custom-select-option.selected::before { content: "✓"; position: absolute; left: 11px; color: var(--green-soft); }
.custom-select-option:disabled { opacity: .45; cursor: not-allowed; }
@keyframes select-pop { from { opacity: 0; transform: translateY(-4px) scale(.99); } to { opacity: 1; transform: none; } }
.ops-toolbar .custom-select { flex: 0 1 190px; }
.ops-filter-control .custom-select { flex: 0 1 190px; }

/* Shared in-product alert, confirmation and text-entry dialogs. */
.site-dialog { position: fixed; z-index: 11000; inset: 0; display: none; align-items: center; justify-content: center; padding: 18px; }
.site-dialog.is-open { display: flex; }
.site-dialog-backdrop { position: absolute; inset: 0; background: rgba(3,7,6,.72); backdrop-filter: blur(6px); animation: dialog-fade .16s ease-out; }
.site-dialog-panel { position: relative; width: min(440px,100%); padding: 26px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: linear-gradient(145deg,var(--bg-2),var(--bg-1) 65%); box-shadow: 0 26px 80px rgba(0,0,0,.55); animation: dialog-enter .18s ease-out; }
.site-dialog-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 16px; border: 1px solid rgba(72,214,160,.2); border-radius: 13px; background: var(--green-glow); color: var(--green-soft); font-size: 19px; font-weight: 700; }
.site-dialog-panel h2 { margin: 0; color: var(--text-0); font-size: 19px; letter-spacing: -.015em; }
.site-dialog-panel > p { margin: 9px 0 20px; color: var(--text-1); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.site-dialog-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-size: 24px; cursor: pointer; }
.site-dialog-close:hover { background: var(--bg-3); color: var(--text-0); }
.site-dialog-actions { display: flex; justify-content: end; gap: 9px; margin-top: 18px; }
.site-dialog-input-wrap textarea { width: 100%; min-height: 94px; resize: vertical; padding: 11px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); outline: 0; background: var(--bg-0); color: var(--text-0); font: inherit; font-size: 13px; line-height: 1.5; }
.site-dialog-input-wrap textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-glow); }
.site-dialog-input-wrap > span { display: block; min-height: 16px; margin-top: 5px; color: #ff9a9a; font-size: 11px; }
.site-dialog.is-danger .site-dialog-icon { color: #ffb4a9; border-color: rgba(239,68,68,.24); background: rgba(239,68,68,.12); }
.site-dialog.is-danger .site-dialog-actions .btn-primary { background: #b94848; }
.site-dialog.is-danger .site-dialog-actions .btn-primary:hover { background: #d25454; }
body.site-dialog-open { overflow: hidden; }
@keyframes dialog-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(7px) scale(.985); } to { opacity: 1; transform: none; } }
@media (max-width: 520px) {
  .site-dialog-panel { padding: 23px 19px 18px; }
  .site-dialog-actions { flex-direction: column-reverse; }
  .site-dialog-actions > button { width: 100%; }
  .ops-toolbar .custom-select, .ops-filter-control .custom-select { flex: 1 1 0; min-width: 0; width: auto; }
}

/* Shared layout for operational pages: orders and dispute review. */
.ops-page {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 30px clamp(16px, 2.4vw, 32px) 40px;
  min-width: 0;
}
.ops-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.ops-eyebrow {
  color: var(--green-soft);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .14em;
  margin-bottom: 7px;
}
.ops-heading h1 { color: var(--text-0); font-size: clamp(23px, 2vw, 30px); line-height: 1.15; letter-spacing: -.025em; }
.ops-heading p { margin-top: 7px; color: var(--text-2); font-size: 13px; }
.ops-heading-icon {
  width: 46px; height: 46px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid rgba(16,185,129,.22); border-radius: 14px;
  background: var(--green-glow); color: var(--green-soft); font-size: 24px; font-weight: 500;
}
.ops-heading-icon-alert { color: #f6bd5b; background: rgba(246,189,91,.1); border-color: rgba(246,189,91,.2); }
.ops-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px; margin-bottom: 27px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(135deg, var(--bg-2), var(--bg-1));
}
.ops-search {
  display: flex; align-items: center; gap: 9px; flex: 1 1 300px; min-width: 0;
  height: 42px; padding: 0 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--bg-0); color: var(--text-2);
}
.ops-search > span { font-size: 21px; line-height: 1; }
.ops-search input { width: 100%; height: 100%; border: 0; outline: 0; color: var(--text-0); background: transparent; font-size: 13px; }
.ops-search input::placeholder { color: var(--text-3); }
.ops-filter-label, .ops-filter-control > span { color: var(--text-2); font-size: 12px; }
.ops-select {
  min-width: 160px; height: 42px; padding: 0 34px 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text-0); background: var(--bg-0); font-size: 13px;
}
.ops-search-button { height: 42px; min-width: 120px; }
.ops-results-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 0 2px 13px; }
.ops-results-head h2, .ops-toolbar-disputes h2 { color: var(--text-0); font-size: 16px; font-weight: 650; }
.ops-results-head p, .ops-toolbar-disputes p { margin-top: 4px; color: var(--text-2); font-size: 12px; }
.ops-live-dot { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 11px; }
.ops-live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green-glow); }
.ops-list { display: grid; gap: 10px; min-width: 0; }
.ops-order, .ops-dispute {
  min-width: 0; padding: 17px 18px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-1); transition: border-color var(--transition), background var(--transition);
}
.ops-order { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr) auto; align-items: center; gap: 22px; }
.ops-order:hover, .ops-dispute:hover { border-color: var(--border-strong); background: #14191b; }
.ops-order-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.ops-order-id { color: var(--text-0); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.ops-incoming-id { min-width: 0; color: var(--text-2); font-size: 11px; font-weight: 500; overflow-wrap: anywhere; }
.ops-status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid transparent; border-radius: 999px; font-size: 10px; font-weight: 650; white-space: nowrap; }
.ops-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ops-status-in_pool { color: #f4c66b; border-color: rgba(244,198,107,.18); background: rgba(244,198,107,.08); }
.ops-status-in_work { color: var(--green-soft); border-color: rgba(72,214,160,.18); background: rgba(72,214,160,.08); }
.ops-status-completed { color: #8ab9ff; border-color: rgba(138,185,255,.18); background: rgba(138,185,255,.08); }
.ops-status-partially_refunded { color: #f4c66b; border-color: rgba(244,198,107,.18); background: rgba(244,198,107,.08); }
.ops-status-disputed { color: #ff8d8d; border-color: rgba(255,141,141,.18); background: rgba(255,141,141,.08); }
.ops-status-canceled { color: #a0aaa6; border-color: var(--border); background: var(--bg-2); }
.ops-parties { display: flex; align-items: center; gap: 12px; margin-top: 13px; min-width: 0; }
.ops-parties > div, .ops-dispute-parties > div { display: grid; gap: 4px; min-width: 0; }
.ops-parties > div > span, .ops-dispute-parties > div > span { color: var(--text-3); font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.ops-parties b, .ops-dispute-parties b { color: var(--text-1); font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops-arrow { color: var(--text-3); }
.ops-order-numbers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; min-width: 0; }
.ops-order-numbers > div, .ops-dispute-metrics > div { display: grid; gap: 5px; min-width: 0; }
.ops-order-numbers span, .ops-dispute-metrics span { color: var(--text-2); font-size: 11px; }
.ops-order-numbers b, .ops-dispute-metrics b { color: var(--text-0); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ops-order-numbers small, .ops-dispute-metrics small { color: var(--text-2); font-size: 11px; font-weight: 500; }
.ops-order-numbers em { color: var(--text-2); font-size: 10px; font-style: normal; }
.ops-order-action { display: flex; justify-content: end; }
.ops-action { min-height: 36px; white-space: nowrap; }
.ops-muted { color: var(--text-3); font-size: 11px; }
.ops-pagination { display: flex; justify-content: center; align-items: center; gap: 14px; padding-top: 18px; }
.ops-pagination span { color: var(--text-2); font-size: 12px; }
.ops-pagination button:disabled { opacity: .45; cursor: default; }
.ops-state { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 26px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-2); text-align: center; }
.ops-state b { color: var(--text-1); font-size: 14px; }
.ops-state span { font-size: 12px; }
.ops-state-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-3); color: var(--green-soft); font-size: 18px; }
.ops-state.is-error { border-color: rgba(239,68,68,.35); color: #fca5a5; }
.ops-toolbar-disputes { justify-content: space-between; margin-bottom: 15px; }
.ops-filter-control { display: flex; align-items: center; gap: 10px; }
.ops-dispute.is-open { border-left: 3px solid #f2b84b; }
.ops-dispute-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ops-dispute-link { color: var(--text-2); font-size: 12px; }
.ops-reason { margin: 15px 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-0); }
.ops-reason > span { color: var(--text-3); font-size: 9px; font-weight: 700; letter-spacing: .09em; }
.ops-reason p { margin-top: 6px; color: var(--text-1); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.ops-dispute-parties { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.ops-dispute-receipts { display: grid; gap: 9px; margin-top: 17px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: linear-gradient(145deg, rgba(255,255,255,.025), transparent 52%), var(--bg-0); }
.ops-dispute-receipts-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 2px 3px; }
.ops-dispute-receipts-heading h3 { margin: 0; color: var(--text-1); font-size: 12px; font-weight: 700; }
.ops-dispute-receipts-heading > span { color: var(--text-3); font-size: 11px; }
.ops-dispute-receipt { display: grid; grid-template-columns: 36px minmax(130px, 1fr) minmax(110px, auto) auto; align-items: center; gap: 12px; padding: 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-1); }
.ops-receipt-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: rgba(72,214,160,.09); color: var(--green-soft); font-size: 17px; }
.ops-dispute-receipt-info { display: grid; gap: 3px; min-width: 0; }
.ops-dispute-receipt-info .ops-receipt-id { color: var(--text-3); font-size: 9px; font-weight: 750; letter-spacing: .08em; }
.ops-dispute-receipt-info b { color: var(--text-1); font-size: 15px; font-variant-numeric: tabular-nums; }
.ops-dispute-receipt-info > span:last-child { color: var(--text-2); font-size: 10px; }
.ops-receipt-state { display: grid; justify-items: start; gap: 5px; }
.ops-receipt-status { padding: 4px 7px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); font-size: 9px; font-weight: 650; white-space: nowrap; }
.ops-receipt-status.is-pending { color: #f4c66b; border-color: rgba(244,198,107,.2); background: rgba(244,198,107,.07); }
.ops-receipt-status.is-confirmed { color: var(--green-soft); border-color: rgba(72,214,160,.2); background: rgba(72,214,160,.07); }
.ops-receipt-status.is-rejected { color: #ff9a9a; border-color: rgba(239,68,68,.2); background: rgba(239,68,68,.07); }
.ops-receipt-delivery { color: var(--text-3); font-size: 9px; }
.ops-dispute-receipt-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 7px; }
.ops-dispute-receipt-actions .btn-primary, .ops-dispute-receipt-actions .btn-ghost { min-height: 34px; padding: 0 10px; font-size: 10px; }
.ops-dispute-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--border); }
.ops-dispute-metrics { display: flex; gap: clamp(18px, 4vw, 52px); }
.ops-dispute-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; }
.ops-dispute-actions .btn-primary, .ops-dispute-actions .btn-ghost { min-height: 36px; }
.ops-refund { background: #b94848; }
.ops-refund:hover { background: #d25454; }
.ops-resolution-label { color: var(--text-2); font-size: 11px; }
.ops-toast { position: fixed; z-index: 10001; right: 24px; bottom: 24px; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid rgba(72,214,160,.26); border-radius: 10px; background: var(--bg-2); color: var(--green-soft); font-size: 13px; box-shadow: 0 14px 38px rgba(0,0,0,.32); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.ops-toast.is-visible { opacity: 1; transform: translateY(0); }
.ops-toast.is-error { color: #ff9a9a; border-color: rgba(239,68,68,.3); }
.finance-history-panel { margin: 0 28px 28px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-1); }
.finance-history-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.finance-history-heading h3 { margin: 0; color: var(--text-0); font-size: 16px; }
.finance-history-heading p { margin: 4px 0 0; color: var(--text-2); font-size: 11px; }
.finance-history-list { display: grid; gap: 8px; }
.finance-history-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 20px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-0); }
.finance-history-row.is-admin { grid-template-columns: minmax(150px, .8fr) minmax(0, 1.3fr) auto auto; }
.finance-history-row.is-platform { grid-template-columns: minmax(150px, .8fr) minmax(0, 1.3fr) auto; }
.finance-card-value.is-negative { color: #ff9292 !important; }
.finance-history-main { display: grid; gap: 4px; min-width: 0; }
.finance-history-main > b { color: var(--text-1); font-size: 12px; }
.finance-history-main > span, .finance-history-main > time, .finance-history-after { color: var(--text-3); font-size: 10px; }
.finance-history-participant { display: grid; gap: 4px; min-width: 150px; }
.finance-history-participant b { color: var(--text-1); font-size: 11px; overflow-wrap: anywhere; }
.finance-history-participant span { color: var(--text-3); font-size: 9px; }
.finance-history-delta { display: grid; gap: 4px; min-width: 104px; text-align: right; }
.finance-history-delta > span { color: var(--text-3); font-size: 9px; }
.finance-history-delta > b { font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.finance-history-delta .is-positive { color: var(--green-soft); }
.finance-history-delta .is-negative { color: #ff9292; }
.finance-history-delta .is-zero { color: var(--text-3); }
.finance-history-empty { padding: 28px 14px; border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--text-2); font-size: 12px; text-align: center; }
.order-rate-line { display: flex; align-items: center; gap: 6px; margin-top: 9px; color: var(--text-2); font-size: 11px; }
.order-rate-line b { color: var(--green-soft); font-weight: 650; font-variant-numeric: tabular-nums; }
.receipt-refund-badge { display: inline-flex; align-items: center; margin-left: 8px; padding: 3px 7px; border: 1px solid rgba(239,68,68,.28); border-radius: 999px; background: rgba(239,68,68,.1); color: #ff7777; font-size: 9px; font-weight: 750; letter-spacing: .04em; vertical-align: middle; }
.receipt-reissue-badge { display: inline-flex; align-items: center; margin-left: 8px; padding: 3px 7px; border: 1px solid rgba(245,158,11,.3); border-radius: 999px; background: rgba(245,158,11,.1); color: #f5bf62; font-size: 9px; font-weight: 750; letter-spacing: .04em; vertical-align: middle; }
.tab-count.has-disputes,
.tab.active .tab-count.has-disputes {
  background: rgba(239, 68, 68, .18);
  color: #ff6868;
  box-shadow: 0 0 12px rgba(239, 68, 68, .32), inset 0 0 0 1px rgba(239, 68, 68, .22);
}
.bot-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 650;
}
.bot-status.is-configured {
  border-color: rgba(16,185,129,.42);
  background: rgba(16,185,129,.12);
  color: #35d6a2;
  box-shadow: 0 0 16px rgba(16,185,129,.12);
}
.trader-reissue-notice { display: grid; gap: 9px; padding: 13px; border: 1px solid rgba(245,158,11,.28); border-radius: 12px; background: rgba(245,158,11,.055); }
.trader-reissue-notice p { margin: 0; color: var(--text-1); font-size: 13px; line-height: 1.5; }
.trader-reissue-notice p b { color: var(--text-0); }
.trader-reissue-notice .btn-full { width: 100%; }
.ops-modal { position: fixed; z-index: 10000; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; }
.ops-modal.is-open { display: flex; }
.ops-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.ops-modal-dialog { position: relative; width: min(480px, 100%); padding: 26px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-1); box-shadow: 0 26px 80px rgba(0,0,0,.5); }
.ops-modal-close { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 24px; cursor: pointer; }
.ops-modal-close:hover { background: var(--bg-3); color: var(--text-0); }
.ops-modal-mark { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 14px; border-radius: 12px; background: var(--green-glow); color: var(--green-soft); font-size: 20px; }
.ops-modal-mark-alert { color: #f6bd5b; background: rgba(246,189,91,.1); }
.ops-modal-dialog h2 { color: var(--text-0); font-size: 19px; }
.ops-modal-dialog > p { margin: 8px 0 20px; color: var(--text-2); font-size: 12px; line-height: 1.5; }
.ops-note-label { display: flex; gap: 7px; margin-bottom: 7px; color: var(--text-1); font-size: 12px; }
.ops-note-label span { color: var(--text-3); }
.ops-modal-dialog textarea { width: 100%; resize: vertical; padding: 11px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); outline: 0; background: var(--bg-0); color: var(--text-0); font-size: 13px; line-height: 1.5; }
.ops-modal-dialog textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-glow); }
.ops-form-error { min-height: 18px; margin-top: 7px; color: #ff9a9a; font-size: 11px; overflow-wrap: anywhere; }
.ops-warning-button { background: #b94848; }
.ops-warning-button:hover { background: #d25454; }
.ops-modal-actions { display: flex; justify-content: end; gap: 9px; margin-top: 18px; }
body.ops-modal-open { overflow: hidden; }

/* A table wrapper must account for its side margins; otherwise it adds width
   beyond the main column and clips its last columns at the viewport edge. */
.table-wrap { box-sizing: border-box; }

@media (max-width: 1100px) {
  .ops-order { grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: 15px; }
  .ops-order-action { grid-column: 1 / -1; justify-content: start; }
  .ops-dispute-receipt { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .ops-dispute-receipt-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .ops-page { padding: 22px 16px 30px; }
  .ops-heading { margin-bottom: 18px; }
  .ops-heading-icon { width: 40px; height: 40px; }
  .ops-toolbar { padding: 11px; gap: 9px; }
  .ops-search { flex-basis: 100%; }
  .ops-filter-label { margin-left: 2px; }
  .ops-select { flex: 1; min-width: 0; }
  .ops-search-button { flex: 0 0 auto; }
  .ops-order { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 15px; }
  .ops-order-numbers { padding-top: 12px; border-top: 1px solid var(--border); }
  .ops-order-action { grid-column: auto; }
  .ops-dispute-bottom { align-items: stretch; flex-direction: column; }
  .ops-dispute-actions { justify-content: start; }
  .ops-dispute-receipt { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; }
  .ops-dispute-receipt-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-dispute-receipt-actions > * { width: 100%; }
  .finance-history-panel { margin: 0 16px 20px; padding: 14px; }
  .finance-history-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .finance-history-row.is-admin { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .finance-history-main, .finance-history-participant { grid-column: 1 / -1; }
  .finance-history-delta { min-width: 0; text-align: left; }
}
@media (max-width: 520px) {
  .ops-page { padding-inline: 12px; }
  .finance-history-panel { margin-inline: 12px; }
  .ops-heading p { max-width: 270px; font-size: 12px; }
  .ops-live-dot { display: none; }
  .ops-toolbar-disputes { align-items: start; flex-direction: column; }
  .ops-filter-control { width: 100%; justify-content: space-between; }
  .ops-dispute { padding: 14px; }
  .ops-dispute-parties { gap: 10px; }
  .ops-dispute-parties b { font-size: 11px; }
  .ops-dispute-metrics { justify-content: space-between; gap: 12px; }
  .ops-dispute-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .ops-dispute-actions > * { width: 100%; }
  .ops-modal-dialog { padding: 22px 18px 18px; }
  .ops-modal-actions { flex-direction: column-reverse; }
  .ops-modal-actions > * { width: 100%; }
}

/* Login uses the same surfaces, typography, borders and accent as the cabinets. */
.login-page {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  height: auto !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overscroll-behavior-y: none;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 18%, rgba(16, 185, 129, .12), transparent 42%), var(--bg-0) !important;
}
.login-page .shell { width: min(100%, 400px); min-width: 0; height: auto; margin-block: auto; }
.login-page #loginForm {
  width: 100%; max-width: 400px; min-width: 0;
  gap: 16px;
  padding: clamp(24px, 6vw, 38px);
  background: var(--bg-1) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 24px 72px rgba(0, 0, 0, .38) !important;
}
.login-page h1 { color: var(--text-0) !important; }
.login-page .subtitle { color: var(--text-2) !important; }
.login-page .subtitle-acronym { color: var(--green-soft) !important; }
.login-page label span { color: var(--text-1); }
.login-page input {
  width: 100%; min-height: 46px;
  font-size: 16px !important;
  background: var(--bg-0) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-0) !important;
}
.login-page input:focus { border-color: var(--green) !important; box-shadow: 0 0 0 3px var(--green-glow); }
.login-page #submitBtn {
  min-height: 46px; margin-top: 0 !important;
  background: var(--green) !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 650 !important;
}
.login-page #submitBtn:hover:not(:disabled) { background: var(--green-hover) !important; }
.login-page #vanta-bg { background: transparent !important; }

@media (max-width: 1023px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .topbar .email { max-width: 44vw; }
  .grid-container, #dynamicOrdersGrid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)) !important; }
}

@media (max-width: 768px) {
  .page-title, .page-head { padding-left: 16px; padding-right: 16px; }
  .cards, .finance-cards { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .grid-container, #dynamicOrdersGrid { grid-template-columns: minmax(0, 1fr) !important; }
}

@media (max-width: 520px) {
  .topbar { padding: 10px 14px; }
  .topbar .user { gap: 8px; }
  .topbar .email { max-width: 48vw; font-size: 12px; }
  .topbar .role { display: none; }
  .page-title { font-size: 20px; }
  .toolbar > *, .toolbar .search-input, .toolbar .custom-select { width: 100%; max-width: 100%; }
  .finance-header { padding: 20px 16px 14px; }
  .tabs, .admin-tabs { max-width: 100%; overflow-x: auto; }
  .tab, .admin-tab { flex: 0 0 auto; }
  .sidebar { width: min(300px, 86vw); }
  .login-page .shell { max-width: 400px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
