/* Calculation Rules (#rules, superadmin only): grouped three-column table of applied and pending rules. */
.side-link[hidden] { display: none; }
.rules-page { display: grid; gap: 14px; max-width: 1600px; min-width: 0; margin: 0 auto; }
.rules-page .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.rules-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.rules-kicker { color: #a9d3fb; font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.rules-kicker i { margin-right: 5px; color: #f5bf70; }
.rules-intro h2 { margin: 5px 0 3px; color: #f6fbff; font-size: clamp(22px, 2vw, 28px); line-height: 1.15; letter-spacing: -.03em; }
.rules-intro p { max-width: 680px; margin: 0; color: #c3d2dd; font-size: 12px; line-height: 1.5; }
.rules-totals { display: flex; flex: 0 0 auto; gap: 10px; }
.rules-totals > div { display: grid; min-width: 112px; padding: 10px 14px; border: 1px solid #457f78; border-radius: 10px; background: #23534b; }
.rules-totals > div.is-pending { border-color: #81704f; background: #4f4636; }
.rules-totals strong { color: #f6fbff; font-size: 24px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.rules-totals span { margin-top: 4px; color: #d6e3ec; font-size: 10px; font-weight: 700; }

.rules-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.rules-filter { display: flex; gap: 4px; padding: 4px; border: 1px solid #5d6f7d; border-radius: 9px; background: #2b3741; }
.rules-filter button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: #c9d7e2; font-size: 12px; font-weight: 700; }
.rules-filter button span { margin-left: 4px; color: #9fb3c2; font-variant-numeric: tabular-nums; }
.rules-filter button:hover, .rules-filter button:focus-visible { background: #ffffff10; color: #fff; outline: none; }
.rules-filter button.is-active { background: #2f7fd8; color: #fff; }
.rules-filter button.is-active span { color: #dcecff; }
.rules-search { display: flex; flex: 0 1 320px; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px; border: 1px solid #6f8292; border-radius: 8px; background: #2b3741; color: #9fb3c2; }
.rules-search input { flex: 1; min-width: 0; border: 0; background: none; color: #f3f8fc; font: inherit; font-size: 12px; outline: none; }

.rules-table-wrap { overflow: hidden; border: 1px solid #637380; border-radius: 12px; background: linear-gradient(145deg, #46545f, #394752); }
.rules-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rules-table thead th { padding: 11px 14px; background: #2b3741; color: #b7cbd8; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.rules-table thead th:nth-child(1) { width: 24%; }
.rules-table thead th:nth-child(2) { width: 26%; }
.rules-group th { padding: 14px 14px 8px; border-top: 1px solid #5d6f7d; color: #f6fbff; font-size: 13px; font-weight: 800; text-align: left; }
.rules-group small { margin-left: 6px; color: #9fb3c2; font-size: 10px; font-weight: 700; }
.rules-row td { padding: 10px 14px; border-top: 1px solid #ffffff12; color: #d6e3ec; font-size: 12px; line-height: 1.5; vertical-align: top; }
.rules-row td strong { display: block; color: #f3f8fc; font-weight: 800; }
.rules-row.is-pending { background: #f5bf700d; }
.rules-row.is-pending td:first-child { box-shadow: inset 3px 0 0 #f0c46a; }
.rules-status { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; padding: 2px 8px; border-radius: 99px; font-size: 10px; font-weight: 700; }
.rules-status.is-applied { background: #23534b; color: #c8f1e6; }
.rules-status.is-pending { background: #594831; color: #ffe4af; }
.rules-empty { padding: 30px; color: #c3d2dd; font-size: 12px; text-align: center; }
.rules-empty i { margin-right: 8px; color: #9dccff; }

@media (max-width: 760px) {
  .rules-intro { flex-direction: column; align-items: stretch; }
  .rules-totals > div { flex: 1; }
  .rules-search { flex: 1 1 100%; }
  /* Each rule becomes a stacked card; the cells carry their own labels. */
  .rules-table thead { display: none; }
  .rules-table, .rules-table tbody, .rules-table tr, .rules-table td, .rules-table th { display: block; width: auto; }
  .rules-row td { padding: 4px 14px; border: 0; }
  .rules-row { padding: 10px 0; border-top: 1px solid #ffffff12; }
  .rules-row td:not(:first-child)::before { display: block; margin-bottom: 2px; color: #b7cbd8; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; content: attr(data-label); }
}
@media (pointer: coarse), (max-width: 1024px) { .rules-filter button { min-height: 40px; } }
