.rule-settings {
  padding: clamp(14px, 2vw, 28px);
}
.balance-warning {
  padding: 10px 17px;
  color: #755521;
  background: #faf3df;
  font-size: 0.86rem;
  border-bottom: 1px solid #e8dbad;
}
.balance-warning summary {
  cursor: pointer;
  line-height: 1.6;
}
.balance-warning summary svg {
  display: inline;
  vertical-align: -0.18em;
  margin: 0 4px;
}
.balance-warning summary strong {
  margin-right: 5px;
}
.balance-warning p {
  margin: 6px 0 0 20px;
  font-size: 0.8rem;
}
.rules-heading {
  margin-bottom: 17px;
}
.rules-heading h2 {
  font-size: 1.22rem;
  font-weight: 640;
  margin: 0 0 4px;
}
.rules-heading p,
.rule-copy small,
.rule-empty-note {
  font-size: 0.8rem;
  line-height: 1.55;
  color: #596d60;
}
.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  align-items: start;
}
.rule-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 18px;
}
.rule-groups a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  color: #496052;
  text-decoration: none;
  border: 1px solid #d9e2d7;
  border-radius: 7px;
  font-size: 0.875rem;
}
.rule-groups a[aria-current] {
  color: #fff;
  border-color: var(--pine);
  background: var(--pine);
}
.rule-groups a:focus-visible {
  outline: 3px solid #4d795c;
  outline-offset: 2px;
}
.rule-card {
  min-width: 0;
  margin: 0;
  border: 1px solid #dfe6dd;
  border-radius: 11px;
  padding: 15px 17px 6px;
}
.rule-card > legend {
  float: inline-start;
  width: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 5px;
  font-size: 1rem;
  font-weight: 620;
}
.rule-card > legend + * {
  clear: both;
}
.rule-card > legend > span {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #487151;
  background: #ecf3e8;
  display: grid;
  place-items: center;
}
.rule-row,
.frequency-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  border-bottom: 1px solid #e7ece5;
  padding: 11px 0;
}
.rule-row:last-child,
.frequency-row:last-child {
  border-bottom: 0;
}
.rule-row {
  cursor: pointer;
}
.rule-row:has(input:disabled),
.rule-channels label:has(input:disabled) {
  cursor: default;
}
.rule-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.rule-copy strong,
.frequency-row label,
.rule-channels legend {
  font-size: 0.9rem;
  font-weight: 590;
}
.rule-control {
  position: relative;
  flex: none;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 32px;
}
.rule-control input {
  position: absolute;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  opacity: 0;
  cursor: inherit;
}
.rule-state {
  font-size: 0.75rem;
  color: #69796c;
}
.rule-control input:checked ~ .rule-state {
  color: #366b45;
}
.rule-control input:focus-visible ~ .toggle {
  outline: 3px solid #3f7554;
  outline-offset: 3px;
}
.rule-control input:disabled ~ .toggle {
  opacity: 0.65;
}
.rule-threshold {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 9px 10px;
  border-radius: 6px;
  background: #f1f6ef;
  margin: 4px 0;
}
.rule-threshold label,
.rule-threshold input {
  font-size: 0.82rem;
}
.rule-threshold input {
  min-width: 0;
  width: 85px;
  min-height: 32px;
  padding: 3px 6px;
  border: 1px solid #b9cabb;
  background: white;
  border-radius: 5px;
  color: var(--ink);
}
.rule-channels {
  min-width: 0;
  border: 0;
  padding: 0 0 12px;
  border-bottom: 1px solid #e7ece5;
  margin: 12px 0 0;
}
.rule-channels legend {
  padding: 0 0 8px;
}
.rule-channels > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.rule-channels label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid #d7e1d5;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}
.rule-channels input {
  margin: 0;
  accent-color: var(--pine);
  width: 15px;
  height: 15px;
}
.rule-channels label:has(input:checked) {
  background: #edf5e9;
  border-color: #c8d9c4;
  color: #315c3e;
}
.rule-select {
  position: relative;
  color: var(--pine);
  max-width: 65%;
}
.period-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
.period-fields label,
.period-fields input {
  min-width: 0;
}
.cadence-card {
  grid-column: 1 / -1;
  padding-bottom: 14px;
}
.cadence-settings {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr);
  gap: 16px;
  align-items: start;
}
.activity-sync {
  min-width: 0;
  border: 1px solid #dce7db;
  border-radius: 8px;
  padding: 9px 11px 5px;
  background: #f6f9f5;
}
.activity-sync header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 7px;
}
.activity-sync header p {
  margin: 3px 0 0;
  color: #51685a;
  font-size: 0.79rem;
  line-height: 1.5;
}
.activity-sync-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #475e50;
  font-size: 0.78rem;
}
.activity-sync-row {
  display: grid;
  grid-template-columns: minmax(81px, 0.85fr) minmax(0, 1.3fr) minmax(64px, 0.8fr);
  align-items: center;
  gap: 8px;
  min-height: 43px;
  border-top: 1px solid #dfe9de;
}
.activity-sync .rule-select {
  min-width: 0;
  max-width: 100%;
}
.activity-sync-row select {
  width: 100%;
}
.activity-sync-switch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  font-size: 0.83rem;
  cursor: pointer;
}
.activity-sync-switch:has(input:disabled) {
  cursor: default;
}
.activity-sync-status {
  justify-self: end;
  border-radius: 4px;
  padding: 3px 5px;
  color: #4e6154;
  background: #e9efe8;
  font-size: 0.72rem;
  text-align: center;
}
.activity-sync-status[data-tone='active'] {
  color: #1f593c;
  background: #deeddd;
}
.activity-sync-status[data-tone='stopped'] {
  color: #715320;
  background: #f3ead7;
}
.rule-select select {
  appearance: none;
  max-width: 100%;
  padding: 6px 28px 6px 10px;
  background: white;
  border: 1px solid #cbd8cb;
  min-height: 34px;
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--ink);
}
.rule-select svg {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  pointer-events: none;
}
.rule-select select:disabled,
.rule-threshold input:disabled {
  color: #516355;
  opacity: 1;
  background: #f4f6f2;
}
.rule-empty-note {
  margin: 8px 0 6px;
}
@media (max-width: 1000px) {
  .rules-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .cadence-settings {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }
}
@media (max-width: 600px) {
  .rule-settings {
    padding: 13px 10px;
  }
  .rule-card {
    padding: 12px 11px 5px;
  }
  .rules-grid {
    gap: 11px;
  }
  .rule-row {
    gap: 6px;
  }
  .rule-control {
    flex-direction: column-reverse;
    gap: 2px;
  }
  .activity-sync {
    padding-inline: 7px;
  }
  .activity-sync-row {
    gap: 5px;
  }
  .activity-sync .rule-select select {
    padding-inline: 6px 22px;
    font-size: 0.78rem;
  }
  .activity-sync .rule-select svg {
    right: 4px;
  }
}
@media (pointer: coarse) {
  .rule-groups a {
    min-height: 48px;
  }
  .rule-select select,
  .rule-threshold input {
    min-height: 44px;
    font-size: 1rem;
  }
  .rule-channels label {
    min-height: 44px;
  }
}

.task-tabs {
  display: flex;
  padding-inline: clamp(12px, 3vw, 48px);
  gap: 6px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.task-tabs a {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 43px;
  padding-inline: 12px;
  border-bottom: 2px solid transparent;
  color: #4c6356;
  font-weight: 560;
  text-decoration: none;
}
.task-tabs a[aria-current] {
  color: #205f46;
  border-color: #287353;
  font-weight: 650;
}
.task-tabs span {
  background: #eaf3e9;
  color: #315b42;
  font-size: 0.76rem;
  padding: 2px 6px;
  border-radius: 4px;
}
[data-task-badge][hidden] {
  display: none;
}
.tasks-page .page-buttons a {
  text-decoration: none;
}
.promotion-form {
  padding: 5px 10px 10px;
}
.promotion-form > fieldset,
.promo-options {
  padding: 0;
  border: 0;
  min-width: 0;
}
.promotion-form p {
  margin: 0 0 7px;
  color: #597063;
  font-size: 0.78rem;
}
.promo-limits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr));
  gap: 8px 10px;
}
.promo-limits label {
  min-width: 0;
  display: grid;
  gap: 4px;
  color: #354c3d;
  font-size: 0.8rem;
}
.promo-limits label > span:last-child {
  display: flex;
  gap: 5px;
  align-items: center;
}
.promo-limits input {
  width: 100%;
  min-width: 0;
  border: 1px solid #cfdbd0;
  border-radius: 6px;
  min-height: 34px;
  padding: 4px 7px;
  background: #fff;
}
.promo-limits small {
  min-width: 1em;
  color: #556c5e;
}
.promo-options {
  margin-block: 12px;
}
.promo-options legend {
  font-size: 0.84rem;
  font-weight: 620;
  color: #304936;
}
.promo-options > div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 4px;
}
.promo-options label {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 29px;
  font-size: 0.8rem;
}
.promo-options input {
  accent-color: #246b4c;
}
.ops-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 9px;
}
@media (max-width: 1050px) {
  .ops-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.ops-category {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.ops-category h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  background: #f0f5ef;
}
.ops-category .rule-row {
  min-height: 35px;
  padding: 5px 10px;
  gap: 6px;
}
.ops-category .rule-copy strong {
  font-size: 0.82rem;
}

@media (max-width: 760px) {
  .task-tabs a {
    min-height: 41px;
  }
  .promo-limits {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ops-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 137px), 1fr));
  }
}
