/* MINUM Relatórios — administration (Usuários e acessos, Dados manuais,
   Registro de KPIs), transcribed from the approved design's admin views
   (design-reference/MINUM Relatorios v2.dc.html: isUsers, isData,
   isRegistry). Tokens are reporting.css's; nothing new is invented. */

/* ---------- shared ---------- */
.ma-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.ma-card { background: #fff; border: 1px solid var(--mr-border); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ma-card.is-tight { padding: 20px; gap: 8px; }
.ma-card-title { font-size: 15px; font-weight: 700; color: var(--mr-deep); }
.ma-card-sub { font-size: 12.5px; color: var(--mr-muted); margin-top: 2px; line-height: 1.45; }
.ma-head { display: flex; align-items: flex-end; gap: 12px 18px; flex-wrap: wrap; }
.ma-head > :first-child { flex: 1 1 260px; }
.ma-field { display: flex; flex-direction: column; gap: 6px; }
.ma-input { height: 40px; padding: 0 12px; border: 1px solid var(--mr-border); border-radius: 9px; font-size: 14px; outline: none; background: #fff; color: var(--mr-text); }
.ma-input:focus { border-color: var(--mr-turq); box-shadow: 0 0 0 3px rgba(0,210,174,.25); }
.ma-input[disabled] { background: var(--mr-bg); color: var(--mr-muted); }
.ma-ghost { padding: 10px 16px; border-radius: 9px; border: 0; background: none; color: var(--mr-green) !important; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none !important; }
.ma-ghost:hover { background: var(--mr-bg); }
.ma-btn-sm { height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--mr-border); background: #fff; color: var(--mr-deep) !important; font-size: 13px;
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none !important; }
.ma-btn-sm:hover { background: var(--mr-bg); }
.ma-btn-sm.is-danger { color: #c0392b !important; border-color: #f2c4bf; }
.ma-btn-sm.is-danger:hover { background: #fdecea; }
.ma-btn-sm[disabled], .mr-btn[disabled] { opacity: .45; cursor: not-allowed; }
.ma-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ma-pick { position: relative; }
.ma-pick input { position: absolute; opacity: 0; pointer-events: none; }
.ma-pick span { height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--mr-border); background: #fff; color: var(--mr-text);
  font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ma-pick span small { font-weight: 400; color: var(--mr-muted); font-size: 12px; }
.ma-pick input:checked + span { border-color: var(--mr-green); background: var(--mr-mint); }
.ma-pick input:focus-visible + span { box-shadow: 0 0 0 3px var(--mr-turq); }
a.ma-pick span:hover, .ma-pick span:hover { border-color: var(--mr-green); }
.ma-pick.is-on span { border-color: var(--mr-green); background: var(--mr-mint); }
.ma-errors { padding: 10px 12px; border-radius: 9px; background: #fdecea; color: #8a1f1f; font-size: 13px; line-height: 1.45; }
.ma-errors ul { margin: 0; padding-left: 18px; }
.ma-tag { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11.5px; background: var(--mr-bg); color: var(--mr-text); white-space: nowrap; }
.ma-tag.is-persona { background: var(--mr-low-bg); color: var(--mr-low-fg); }
.ma-tag.is-caution { background: #fdf3d7; color: #8a6d00; }
.ma-tag.is-good { background: #e6f6ec; color: #1b7a47; }
.ma-tag.is-none { background: var(--mr-bg); color: var(--mr-muted); }
.ma-dep { padding: 1px 7px; border-radius: 5px; background: var(--mr-bg); color: var(--mr-text); font-size: 12px; font-weight: 600; }
.ma-muted { color: var(--mr-muted); }

/* ---------- Usuários e acessos ---------- */
.ma-users { flex: 1 1 560px; }
.ma-form { flex: 0 1 430px; min-width: 300px; gap: 16px; }
.ma-table { border: 1px solid var(--mr-border); border-radius: 10px; overflow: auto; }
.ma-utable { min-width: 640px; }
.ma-urow { display: grid; grid-template-columns: minmax(0,1.4fr) 190px minmax(0,1fr) 110px; gap: 10px; align-items: center; padding: 9px 14px;
  border-bottom: 1px solid var(--mr-border); color: var(--mr-text) !important; text-decoration: none !important; background: #fff; }
.ma-urow:last-child { border-bottom: 0; }
.ma-urow:hover { background: var(--mr-bg); }
.ma-urow.is-sel { background: var(--mr-low-bg); }
.ma-urow.is-head { font-size: 13px; font-weight: 600; color: var(--mr-muted) !important; background: #fff; }
.ma-urow.is-head:hover { background: #fff; }
.ma-urow.is-off { color: #77767b !important; }
.ma-uname { min-width: 0; }
.ma-uname b { display: block; font-size: 14px; font-weight: 600; }
.ma-uname span { display: block; font-size: 12px; color: var(--mr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-persona { padding: 2px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.ma-persona.is-business_director { background: #e6f6ec; color: #1b7a47; }
.ma-persona.is-commercial_supervisor { background: var(--mr-low-bg); color: var(--mr-low-fg); }
.ma-persona.is-operations { background: var(--mr-bg); color: var(--mr-text); }
.ma-persona.is-finance { background: #fdf3d7; color: #8a6d00; }
.ma-uscope { font-size: 13px; }
.ma-uscope small { display: block; font-size: 12px; color: #8a6d00; }
.ma-ulast { font-size: 13px; color: var(--mr-muted); }
.ma-personas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ma-persona-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--mr-border); background: #fff; text-align: left; cursor: pointer; min-height: 76px; }
.ma-persona-card input { position: absolute; opacity: 0; pointer-events: none; }
.ma-persona-card:hover { border-color: var(--mr-green); }
.ma-persona-card:has(input:checked) { border: 2px solid var(--mr-green); background: var(--mr-low-bg); padding: 9px 11px; }
.ma-persona-card:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--mr-turq); }
.ma-persona-card b { font-size: 14px; font-weight: 700; color: var(--mr-text); }
.ma-persona-card span { font-size: 12px; color: var(--mr-muted); line-height: 1.35; }
.ma-sees { border-radius: 10px; background: var(--mr-bg); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ma-sees-title { font-size: 13px; font-weight: 700; color: var(--mr-deep); }
.ma-secs { display: flex; flex-direction: column; gap: 5px; }
.ma-sec { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; }
.ma-sec i { flex: none; width: 20px; height: 20px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
  font-size: 12px; font-style: normal; background: #e6f6ec; color: #1b7a47; align-self: center; }
.ma-sec.is-off i { background: #f0f0f0; color: #77767b; }
.ma-sec.is-off b { color: #77767b; text-decoration: line-through; font-weight: 400; }
.ma-sec b { font-weight: 400; white-space: nowrap; }
.ma-sec small { font-size: 12px; color: var(--mr-muted); }
.ma-facts { display: flex; flex-direction: column; gap: 6px; }
.ma-fact { display: flex; gap: 10px; font-size: 13px; line-height: 1.4; }
.ma-fact > span { flex: 0 0 110px; color: var(--mr-muted); }
.ma-fact > b { flex: 1; font-weight: 600; }
.ma-fact.is-warn > b { color: #8a6d00; }
.ma-kpis summary { cursor: pointer; font-size: 12.5px; color: var(--mr-blue); }
.ma-kpis ul { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.5; color: var(--mr-text); }
.ma-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ma-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 12px; border-top: 1px solid var(--mr-border); font-size: 12.5px; color: var(--mr-muted); }
.ma-status form { display: contents; }

/* ---------- Dados manuais: list ---------- */
.ma-sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .ma-sets { grid-template-columns: 1fr; } }
.ma-set { gap: 12px; }
.ma-set-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ma-kv { display: grid; grid-template-columns: 120px 1fr; gap: 5px 10px; font-size: 13px; }
.ma-kv > span:nth-child(odd) { color: var(--mr-muted); }
.ma-deps { display: flex; flex-wrap: wrap; gap: 4px; }
.ma-stale { padding: 8px 12px; border-radius: 8px; background: #fdf3d7; color: #8a6d00; font-size: 13px; line-height: 1.45; }
.ma-why { font-size: 12.5px; color: var(--mr-muted); line-height: 1.45; border-top: 1px solid var(--mr-border); padding-top: 10px; }
.ma-why b { color: var(--mr-text); font-weight: 600; }
.ma-open { align-self: flex-start; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--mr-green); background: #fff; color: var(--mr-deep) !important;
  font-size: 14px; font-weight: 600; text-decoration: none !important; }
.ma-open:hover { background: var(--mr-low-bg); }

/* ---------- Dados manuais: grid ---------- */
.ma-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ma-bar-name { font-size: 15px; font-weight: 700; color: var(--mr-deep); }
.ma-grid-card { flex: 1 1 600px; gap: 12px; }
.ma-side { flex: 0 1 380px; min-width: 300px; display: flex; flex-direction: column; gap: 14px; }
.ma-grid-scroll { overflow: auto; max-height: 560px; border: 1px solid var(--mr-border); border-radius: 10px; overscroll-behavior-x: contain; }
.ma-grid { min-width: 100%; width: max-content; }
.ma-grow { display: flex; border-bottom: 1px solid var(--mr-border); }
.ma-grow:last-child { border-bottom: 0; }
.ma-grow.is-head { position: sticky; top: 0; z-index: 2; background: #fff; }
.ma-gname { position: sticky; left: 0; z-index: 1; flex: 0 0 230px; background: #fff; padding: 6px 12px; border-right: 1px solid var(--mr-border); min-width: 0; }
.ma-grow.is-head .ma-gname { z-index: 3; padding: 9px 12px; font-size: 13px; font-weight: 600; color: var(--mr-muted); }
.ma-gname b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-gname span { display: block; font-size: 11.5px; color: var(--mr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ma-gname input { width: 100%; height: 30px; padding: 0 8px; border: 1px dashed var(--mr-border); border-radius: 7px; font-size: 13px; }
.ma-gth { flex: 0 0 116px; padding: 9px 12px; text-align: right; border-left: 1px solid var(--mr-border); }
.ma-gth b { display: block; font-size: 13px; font-weight: 600; color: var(--mr-muted); }
.ma-gth span { display: block; font-size: 11px; color: var(--mr-muted); }
.ma-gth.is-locked span { color: #77767b; }
.ma-gcell { flex: 0 0 116px; padding: 4px 6px; border-left: 1px solid var(--mr-border); display: flex; flex-direction: column; justify-content: center; background: #fff; }
.ma-gcell input { width: 100%; height: 30px; padding: 0 8px; border: 1px solid var(--mr-border); border-radius: 7px; background: #fff; color: var(--mr-text);
  font-size: 13.5px; text-align: right; outline: none; font-variant-numeric: tabular-nums; }
.ma-gcell input:focus { border-color: var(--mr-turq); box-shadow: 0 0 0 3px rgba(0,210,174,.25); }
.ma-gcell input::placeholder { color: #9aa8a2; font-style: italic; }
.ma-gcell.is-manual input { font-weight: 700; }
.ma-gcell.is-missing { background: #fdf3d7; }
.ma-gcell.is-missing input { border-color: #e07b1a; }
.ma-gcell.is-missing input::placeholder { color: #8a6d00; font-style: normal; }
.ma-gcell.is-outside { background: var(--mr-bg); }
.ma-gcell.is-outside input { border-color: transparent; background: transparent; }
.ma-gcell.is-locked { background: var(--mr-bg); }
.ma-gcell.is-locked input { border-color: transparent; background: transparent; color: var(--mr-muted); }
.ma-gcell.is-changed { background: var(--mr-low-bg); }
.ma-gcell.is-changed input { border-color: var(--mr-green); }
.ma-gcell.is-error { background: #fdecea; }
.ma-gcell.is-error input { border-color: #c0392b; }
.ma-gcell small { font-size: 10.5px; color: #8a1f1f; line-height: 1.2; padding: 2px 2px 0; }
.ma-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--mr-muted); }
.ma-legend span { display: flex; align-items: center; gap: 5px; }
.ma-legend i { width: 18px; height: 12px; border-radius: 3px; display: inline-block; }
.ma-legend i.is-locked { background: var(--mr-bg); border: 1px solid var(--mr-border); }
.ma-legend i.is-missing { background: #fdf3d7; }
.ma-legend i.is-changed { background: var(--mr-low-bg); }
.ma-legend i.is-default { background: #fff; border: 1px dashed #9aa8a2; }
.ma-window { display: flex; gap: 6px; }
.ma-note { width: 100%; min-height: 60px; padding: 8px 12px; border: 1px solid var(--mr-border); border-radius: 9px; font-size: 13.5px; font-family: inherit; resize: vertical; outline: none; }
.ma-note:focus { border-color: var(--mr-turq); box-shadow: 0 0 0 3px rgba(0,210,174,.25); }
.ma-changes { font-size: 13px; line-height: 1.45; }
.ma-version { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--mr-border); }
.ma-version > span { flex: none; padding: 2px 7px; border-radius: 6px; font-size: 12px; font-weight: 700; background: #f0f0f0; color: #77767b; height: fit-content; }
.ma-version.is-current > span { background: #e6f6ec; color: #1b7a47; }
.ma-version div { font-size: 13px; line-height: 1.4; }
.ma-version div b { font-weight: 600; }
.ma-version div span { color: var(--mr-muted); }
.ma-file { font-size: 13px; }
.ma-missing-list { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Dados manuais: upload preview ---------- */
.ma-ptable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ma-ptable th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--mr-muted); padding: 8px 10px; border-bottom: 1px solid var(--mr-border); position: sticky; top: 0; background: #fff; }
.ma-ptable td { padding: 7px 10px; border-bottom: 1px solid var(--mr-border); vertical-align: top; }
.ma-ptable td.is-num, .ma-ptable th.is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ma-ptable tr.is-bad td { background: #fffaf9; }
.ma-reason { color: #8a1f1f; font-weight: 600; }
.ma-counts { display: flex; flex-wrap: wrap; gap: 10px; }
.ma-count { flex: 1 1 140px; padding: 10px 12px; border-radius: 9px; background: var(--mr-bg); }
.ma-count b { display: block; font-size: 18px; font-weight: 700; color: var(--mr-deep); }
.ma-count.is-bad b { color: #8a1f1f; }
.ma-count span { font-size: 12px; color: var(--mr-muted); line-height: 1.35; }

/* ---------- Registro de KPIs ---------- */
.ma-search { width: 240px; height: 36px; padding: 0 12px; border: 1px solid var(--mr-border); border-radius: 9px; font-size: 14px; outline: none; }
.ma-search:focus { border-color: var(--mr-turq); box-shadow: 0 0 0 3px rgba(0,210,174,.25); }
.ma-reg-scroll { overflow: auto; border: 1px solid var(--mr-border); border-radius: 10px; max-height: 720px; }
.ma-reg { min-width: 1240px; }
.ma-reg-row { display: grid; grid-template-columns: 230px 140px minmax(0,1fr) 170px 160px 170px 120px; gap: 12px; padding: 10px 14px;
  border-bottom: 1px solid var(--mr-border); font-size: 13px; line-height: 1.4; align-items: start; }
.ma-reg-row:last-child { border-bottom: 0; }
.ma-reg-row.is-head { position: sticky; top: 0; z-index: 2; background: #fff; padding: 9px 14px; font-weight: 600; color: var(--mr-muted); }
.ma-reg-row > span { min-width: 0; overflow-wrap: anywhere; }
.ma-reg-name b { display: block; font-weight: 700; font-size: 13.5px; }
.ma-reg-name > span { display: block; color: var(--mr-muted); font-size: 12px; }
.ma-reg-name .is-down { color: var(--mr-blue); }
.ma-reg-name > .ma-reg-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.ma-reg-tags .ma-tag { font-size: 11px; }
.ma-formula { display: block; margin-top: 4px; font-size: 12px; color: var(--mr-muted); font-family: ui-monospace, Consolas, monospace; }
.ma-chips { display: flex; flex-wrap: wrap; gap: 3px; }

/* ---------- KPI surfaces: manual input pending (Stage 5) ---------- */
.mr-heat .is-manual, .mr-heat-legend i.is-manual { background: #fdf3d7; color: #8a6d00; }
.mr-heat-cls.is-manual { background: #fdf3d7; color: #8a6d00; }
.mr-scope-link { color: inherit !important; font-weight: 600; text-decoration: underline !important; white-space: nowrap; }
.mr-user-link.is-on { background: var(--mr-low-bg); }
/* The last column takes any spare width, so shaded rows reach the edge. */
.ma-gth:last-child, .ma-gcell:last-child { flex-grow: 1; }
