/* MAGPC MI suite: shared look. MA Group navy and steel blue; orange only for things that need attention. */
:root {
  --navy: #25255C; --navy-2: #4A4A85; --steel: #7197B1; --steel-dark: #4E7491; --steel-light: #C9D6E2;
  --bg: #F3F5F8; --card: #FFFFFF; --line: #DCE3EA; --line-soft: #E6EBF0; --chip: #EEF2F6; --input: #C5D0DB;
  --ink: #16163A; --body: #3D4657; --muted: #5B6475; --faint: #B9C3CE;
  --alert: #D9661F; --alert-text: #B4501A; --amber: #E8A36B; --good: #2E7D5B;
  --head: 'Bricolage Grotesque', 'Segoe UI', sans-serif;
  --text: 'IBM Plex Sans', 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* hidden wins over a class's own display */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--text); font-size: 15px; line-height: 1.45; font-variant-numeric: tabular-nums; }
a { color: var(--navy); } a:hover { color: var(--steel-dark); }
h1, h2, h3 { font-family: var(--head); color: var(--navy); margin: 0; font-weight: 700; }
h1 { font-size: 32px; line-height: 1.15; text-wrap: balance; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid var(--steel); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.top { background: var(--navy); color: #fff; }
.top-in { max-width: 1376px; margin: 0 auto; padding: 8px 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 16px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.logo { display: block; height: 56px; width: auto; }
.brand .rule { width: 1px; height: 36px; background: var(--navy-2); }
.brand .site { font-family: var(--head); font-weight: 500; font-size: 21px; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; flex: 1 1 auto; }
.tabs a { color: var(--steel-light); text-decoration: none; padding: 12px 14px; border-bottom: 3px solid transparent; }
.tabs a:hover { color: #fff; }
.tabs a[aria-current="page"] { color: #fff; border-bottom-color: var(--steel); font-weight: 600; }
.userbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 13px; color: var(--steel-light); margin-left: auto; }
.userbar b { color: #fff; font-weight: 600; }
.userbar a, .userbar button { color: var(--steel-light); background: none; border: 0; padding: 6px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }
.userbar a:hover, .userbar button:hover { color: #fff; }

/* layout */
.wrap { max-width: 1376px; margin: 0 auto; padding: 26px 28px 56px; display: flex; flex-direction: column; gap: 22px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.card.dark h2 { color: #fff; }
.row { display: flex; flex-wrap: wrap; gap: 22px; }
.row > .wide { flex: 999 1 560px; }
.row > .narrow { flex: 1 1 340px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 22px; }
.head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 20px; }
.sub { font-size: 14px; color: var(--muted); }
.note { font-size: 14px; color: var(--body); margin: 0; }
.muted { color: var(--muted); }
.alert-text { color: var(--alert-text); font-weight: 600; }

/* buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 6px; border: 1px solid var(--navy); background: #fff; color: var(--navy); font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--chip); color: var(--navy); }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: #33337A; color: #fff; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.linkbtn { background: none; border: 0; color: var(--navy); text-decoration: underline; cursor: pointer; padding: 4px 0; }
label.lab, .lab { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=month], select {
  min-height: 44px; padding: 0 10px; border: 1px solid var(--input); border-radius: 6px; background: #fff; color: var(--ink); }
.form { max-width: 420px; margin: 24px auto; }
.form label { font-weight: 600; font-size: 14px; color: var(--body); }
.form input { width: 100%; }
.form .acts { display: flex; gap: 10px; flex-wrap: wrap; }
.form-error { color: #B42318; font-weight: 600; margin: 0; min-height: 1em; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.notice { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--steel); border-radius: 8px; padding: 14px 16px; }
.notice.error { border-left-color: #B42318; }
.notice.warn { border-left-color: var(--alert); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 50; }

/* filter bar */
.filters { background: #fff; border-bottom: 1px solid var(--line); }
.filters-in { max-width: 1376px; margin: 0 auto; padding: 12px 28px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.fgroup { display: flex; flex-direction: column; gap: 6px; }
.fgroup select { min-width: 150px; max-width: 240px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; background: var(--chip); padding: 4px; border-radius: 8px; }
.chips button { min-height: 36px; padding: 0 13px; border: 0; border-radius: 6px; background: transparent; color: var(--navy); cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--navy); color: #fff; font-weight: 600; }
.chips button:hover:not([aria-pressed="true"]) { background: #DDE4EC; }
.clear { align-self: center; }

/* figures */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 16px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.tile .k { font-size: 14px; font-weight: 600; color: var(--muted); }
.tile .v { font-family: var(--head); font-weight: 700; font-size: 42px; line-height: 1; color: var(--navy); }
.tile .v small { font-size: 19px; font-weight: 500; }
.tile .d { font-size: 14px; color: var(--muted); }
.big { font-family: var(--head); font-weight: 700; font-size: 28px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--body); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 2px; display: inline-block; flex: none; }
.track { height: 16px; background: var(--chip); border-radius: 3px; overflow: hidden; display: flex; }
.track.thin { height: 8px; }
.track > i { display: block; height: 100%; }
.barrow { display: grid; grid-template-columns: minmax(110px, 170px) 1fr 44px; align-items: center; gap: 10px; }
.barrow .n { font-weight: 600; text-align: right; }
.barrow .l { font-size: 14px; color: var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steprow { display: grid; grid-template-columns: 28px 1fr 44px; align-items: center; gap: 10px; }
.steprow .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--chip); color: var(--navy); font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.steprow .n { font-weight: 600; text-align: right; }

/* month chart */
.months { overflow-x: auto; }
.months .bars, .months .labels { display: grid; gap: 8px; min-width: 560px; }
.months .bars { align-items: end; border-bottom: 1px solid var(--input); padding-top: 18px; }
.months .col { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 190px; }
.months .b { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--body); }
.months .b i { display: block; width: 15px; border-radius: 3px 3px 0 0; }
.months .labels { padding-top: 8px; }
.months .labels span { text-align: center; font-size: 12px; color: var(--body); }

/* tables */
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; padding: 8px; white-space: nowrap; }
table.t td { padding: 9px 8px; border-top: 1px solid var(--line-soft); vertical-align: top; }
table.t th:first-child, table.t td:first-child { padding-left: 0; }
table.t th:last-child, table.t td:last-child { padding-right: 0; }
table.t .r { text-align: right; }
table.t .ref { font-weight: 600; color: var(--navy); white-space: nowrap; }
table.t .late { color: var(--alert-text); font-weight: 700; }
table.t th button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.ratebar { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.ratebar .track { flex: 1; height: 12px; }
.ratebar b { width: 40px; text-align: right; }

/* owner cards */
.owners { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.owner { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.owner .top-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.owner .name { font-family: var(--head); font-weight: 700; font-size: 19px; color: var(--navy); }
.owner .count { font-family: var(--head); font-weight: 700; font-size: 38px; color: var(--navy); line-height: 1; text-align: right; }
.owner .count small { display: block; font-family: var(--text); font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 4px; }
.owner .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.owner .stats span { display: block; font-size: 12px; color: var(--muted); }
.owner .stats b { font-size: 17px; }

/* home cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 18px; }
.modcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink); }
a.modcard:hover { border-color: var(--steel); box-shadow: 0 4px 18px rgba(37,37,92,.08); color: var(--ink); }
.modcard p { margin: 0; color: var(--body); }
.modcard .meta { font-size: 13px; color: var(--muted); }
.modcard .go { align-self: flex-start; margin-top: 4px; }
.tag { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.tag.live { background: #E3EEF5; color: var(--steel-dark); }

.loading { padding: 40px 0; text-align: center; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; margin: 0; }

@media (max-width: 640px) {
  .top-in, .filters-in, .wrap { padding-left: 16px; padding-right: 16px; }
  h1 { font-size: 26px; }
  .tile .v { font-size: 36px; }
}
@media print {
  .filters, .userbar, .no-print { display: none !important; }
  body { background: #fff; }
  .card, .tile, .owner { break-inside: avoid; }
}
