/* Sabea Broker Portal — Commissions page (commissions.js). Owner-only.
   Scoped under .cm-* and #panel-commissions. Reuses the brand vars from
   index.html (--navy, --gold, --gold-l, --mu, --br, --bg). Single light theme. */

#panel-commissions { padding: 4px 2px; }
.cm-page { max-width: 1400px; }

.cm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.cm-head h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; color: var(--navy); }
.cm-sub { font-size: 13px; color: var(--mu); margin: 0; }
.cm-head-actions { display: flex; gap: 8px; }

.cm-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--br); margin-bottom: 16px; }
.cm-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px; font: inherit; font-size: 14px; color: var(--mu); cursor: pointer; margin-bottom: -1px; }
.cm-tab:hover { color: var(--navy); }
.cm-tab.active { color: var(--navy); font-weight: 600; border-bottom-color: var(--gold); }
.cm-tab.inactive { opacity: .55; font-style: italic; }
.cm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #D97706; margin-left: 4px; vertical-align: middle; }

.cm-busy { background: var(--gold-l); border: 1px solid var(--gold-b); color: var(--navy); padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.cm-error { color: #b00020; font-size: 14px; padding: 16px 0; }
.cm-empty { padding: 40px 0; text-align: center; color: var(--mu); font-size: 14px; }

/* tiles */
.cm-tiles { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cm-tile { flex: 1 1 160px; background: #fff; border: 1px solid #eef1f6; border-radius: 12px; padding: 12px 16px; }
.cm-tile-v { font-size: 20px; font-weight: 700; color: var(--navy); }
.cm-tile-l { font-size: 12px; color: var(--mu); margin-bottom: 2px; }
.cm-tile.pos { border-color: #bfe3c8; background: #f3fbf5; } .cm-tile.pos .cm-tile-v { color: #1d7a3a; }
.cm-tile.neg { border-color: #f0c4c4; background: #fdf4f4; } .cm-tile.neg .cm-tile-v { color: #b00020; }

.cm-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cm-toolbar-r { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cm-meta { font-size: 13px; color: var(--mu); }
.cm-check { font-size: 13px; color: var(--mu); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.cm-check input { margin: 0; }

/* buttons + inputs */
.cm-btn { padding: 7px 12px; font: inherit; font-size: 13px; background: #fff; color: var(--navy); border: 1px solid #e2e6ee; border-radius: 8px; cursor: pointer; }
.cm-btn:hover { border-color: var(--gold); }
.cm-btn:disabled { opacity: .5; cursor: default; }
.cm-btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.cm-btn-primary:hover { background: #1c2158; }
.cm-btn-sm { padding: 4px 9px; font-size: 12px; }
.cm-btn-danger { color: #b00020; }
.cm-btn-danger:hover { border-color: #b00020; }
.cm-link { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: #2563EB; cursor: pointer; text-decoration: underline; }
.cm-input, .cm-select { width: 100%; box-sizing: border-box; border: 1px solid var(--br); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; color: var(--navy); background: #fff; }
.cm-input:focus, .cm-select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-l); }
.cm-input-sm { max-width: 170px; } .cm-input-xs { max-width: 70px; }
.cm-select-sm { padding: 4px 6px; font-size: 12px; min-width: 110px; }
.cm-file { display: block; margin-top: 4px; font-size: 13px; }
.cm-label { display: block; font-size: 12px; font-weight: 600; color: var(--navy); margin: 10px 0 4px; flex: 1 1 200px; }
.cm-label .cm-input, .cm-label .cm-select { margin-top: 4px; font-weight: 400; }
.cm-form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.cm-form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }

/* the sheet grid */
.cm-grid-wrap { overflow-x: auto; background: #fff; border: 1px solid #eef1f6; border-radius: 12px; }
.cm-grid { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
.cm-grid th, .cm-grid td { padding: 5px 8px; border-bottom: 1px solid #f0f2f6; border-right: 1px solid #f4f5f8; white-space: nowrap; }
.cm-grid thead th { background: #f7f8fb; color: var(--navy); font-weight: 600; text-align: right; position: sticky; top: 0; z-index: 2; vertical-align: bottom; }
.cm-grid thead th.cm-corner, .cm-grid tbody th { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; font-weight: 500; color: var(--navy); min-width: 200px; }
.cm-grid thead th.cm-corner { z-index: 3; background: #f7f8fb; }
.cm-grid td { text-align: right; min-width: 118px; font-variant-numeric: tabular-nums; }
.cm-grid td.cm-now, .cm-grid th.cm-now { background: #fffaf0; }
.cm-grid tr.cm-section th { background: #f2f4f8; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--mu); padding-top: 8px; position: sticky; left: 0; }
.cm-grid tr.cm-row-calc td { color: var(--navy); }
.cm-grid tr.cm-strong td, .cm-grid tr.cm-strong th { font-weight: 700; }
.cm-grid tr.cm-balance td { background: #f3f6ff; } .cm-grid tr.cm-balance td.cm-now { background: #eef3ff; }
.cm-grid td.neg, .neg { color: #b00020; }
.cm-mn { font-size: 11px; color: var(--mu); font-weight: 400; }
.cm-grid td.cm-from-stmt { position: relative; }
.cm-stmt-mark { position: absolute; right: 2px; top: 2px; font-size: 9px; color: var(--gold); line-height: 1; }
.cm-cell { width: 100%; box-sizing: border-box; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; font: inherit; font-size: 13px; text-align: right; color: var(--navy); background: transparent; font-variant-numeric: tabular-nums; }
.cm-cell:hover { border-color: #e2e6ee; background: #fff; }
.cm-cell:focus { outline: none; border-color: var(--gold); background: #fff; box-shadow: 0 0 0 3px var(--gold-l); }
.cm-cell-text { text-align: left; }
.cm-grid tr.cm-notes td { min-width: 160px; }
.cm-foot { font-size: 12px; color: var(--mu); margin: 10px 2px 0; }

/* cards + tables (statements, settings) */
.cm-two { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .cm-two { grid-template-columns: 1fr; } }
.cm-card { background: #fff; border: 1px solid #eef1f6; border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.cm-card h2 { margin: 0 0 6px; font-size: 16px; color: var(--navy); }
.cm-card-muted { color: var(--mu); }
.cm-note { font-size: 13px; color: var(--mu); line-height: 1.5; margin: 0 0 10px; }
.cm-note code { background: #f2f4f8; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.cm-warn { background: #fff8e6; border: 1px solid #f3e2a8; color: #7a5c00; padding: 8px 12px; border-radius: 8px; }
.cm-ok { background: #f3fbf5; border: 1px solid #bfe3c8; color: #1d7a3a; padding: 8px 12px; border-radius: 8px; }
.cm-table-wrap { overflow-x: auto; }
.cm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cm-table th, .cm-table td { padding: 8px 10px; border-bottom: 1px solid #f0f2f6; text-align: left; vertical-align: top; }
.cm-table th { font-size: 12px; color: var(--mu); font-weight: 600; }
.cm-table tfoot th { color: var(--navy); font-size: 13px; border-top: 2px solid #e2e6ee; }
.cm-table-sm td { padding: 4px 8px; font-size: 12px; }
.cm-table tr.cm-selected td { background: #fffaf0; }
.cm-table tr.cm-untracked td { opacity: .7; }
.cm-table tr.cm-lines td { background: #fafbfd; }
.cm-review-table td .cm-cell { border-color: #e2e6ee; background: #fff; min-width: 96px; }
.cm-review-table td, .cm-review-table th { white-space: nowrap; }
.cm-muted { color: var(--mu); }
.cm-actions { white-space: nowrap; } .cm-actions .cm-btn { margin-right: 4px; }
.cm-status { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #f2f4f8; color: var(--navy); }
.cm-status-parsed { background: #fff3d6; color: #7a5c00; }
.cm-status-applied { background: #e3f6e8; color: #1d7a3a; }
.cm-status-failed { background: #fde7e9; color: #b00020; }
.cm-status-parsing { background: #e8f0ff; color: #1d4ed8; }
.cm-err-sm { font-size: 11px; color: #b00020; max-width: 260px; white-space: normal; }
.cm-chip { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: #f2f4f8; color: var(--navy); margin: 1px 0; white-space: nowrap; }
.cm-chip-warn { background: #fff3d6; color: #7a5c00; }
.cm-add-broker { margin-top: 12px; align-items: center; }
.cm-add-broker .cm-input { flex: 1 1 180px; }

/* toast */
.cm-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 9999; box-shadow: 0 6px 24px rgba(0,0,0,.18); max-width: 90vw; display: none; }
.cm-toast.err { background: #b00020; }

@media (max-width: 720px) {
  .cm-grid thead th.cm-corner, .cm-grid tbody th { min-width: 140px; white-space: normal; }
  .cm-grid td { min-width: 100px; }
}
