/* Finance › Freelancer Margin (#margin). Colours come from styles.css's tokens, so light and dark both work. */
[data-page="margin"] .page-actions { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.mg-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.mg-kpis .kpi b { font-size: 30px; }
#mg-body { display: grid; gap: 18px; min-width: 0; margin-top: 18px; }
.mg-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 14px 20px 8px; min-height: 52px; }
.mg-tbl td { vertical-align: top; }
.mg-tbl td small { display: block; font-size: 11.5px; margin-top: 2px; }
.mg-name { min-width: 150px; }
.mg-name > a { font-weight: 600; text-transform: none; letter-spacing: normal; text-decoration: none; }
.mg-neg { color: var(--red); }
.mg-flag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.mg-flag.red { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.mg-flag.amber { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }
.mg-flag.green { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.mg-act { white-space: nowrap; text-align: right; }
.mg-act .msg { margin: 6px 0 0; white-space: normal; text-align: left; }
.mg-pad { padding: 0 20px 16px; }
.mg-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; padding: 6px 20px 20px; }
.mg-form label { display: grid; gap: 4px; font-size: 12.5px; align-content: start; }
.mg-form input, .mg-form select, .mg-in { font: 13px var(--font); color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 36px; width: 100%; }
.mg-wide { grid-column: 1 / -1; }
.mg-form .msg { margin: 0; }
.mg-inline { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; align-items: end; border-top: 1px solid var(--line); padding-top: 16px; }
.mg-actcell { align-self: end; }
.mg-rate { max-width: 110px; }
.mg-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 1250px) { .mg-lg { display: none; } }
@media (max-width: 1100px) { .mg-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .mg-md { display: none; } .mg-two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .mg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mg-kpis .kpi b { font-size: 22px; }
  .mg-filters { padding: 12px 14px 8px; }
  .mg-filters .search { width: 100%; }
  .mg-filters .search input { min-width: 0; width: 100%; }
  .mg-tbl th:first-child, .mg-tbl td:first-child { padding-left: 14px; }
  .mg-tbl th, .mg-tbl td { padding-left: 8px; padding-right: 8px; }
  .mg-name { min-width: 110px; }
  .mg-form { grid-template-columns: minmax(0, 1fr); padding: 6px 14px 16px; }
  .mg-inline { grid-template-columns: minmax(0, 1fr); }
  .mg-pad { padding: 0 14px 14px; }
}
