.modules-view,
.module-detail-view {
  background: var(--ice-canvas);
}

.modules-header {
  padding: max(20px, env(safe-area-inset-top)) 18px 12px;
  background:
    radial-gradient(circle at 88% 2%, rgba(22, 185, 220, 0.14), transparent 34%),
    var(--ice-canvas);
}

.modules-topbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  margin-bottom: 18px;
}

.modules-topbar h1 {
  margin: 0;
  text-align: center;
  font-size: 20px;
  font-weight: 790;
  letter-spacing: -0.025em;
}

.module-help-button {
  justify-self: end;
}

.module-help-button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.module-campaign-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--ice-line);
  border-radius: 18px;
  background: #e8f3f7;
}

.module-campaign-tabs button,
.module-item-tabs button {
  border: 0;
  cursor: pointer;
}

.module-campaign-tabs button {
  display: flex;
  min-width: 0;
  min-height: 46px;
  padding: 6px 3px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.module-campaign-tabs button small,
.module-item-tabs button small {
  display: grid;
  min-width: 18px;
  height: 18px;
  padding-inline: 4px;
  place-items: center;
  border-radius: 7px;
  background: rgba(132, 153, 168, 0.14);
  font-size: 10px;
  font-weight: 800;
}

.module-campaign-tabs button.is-active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 5px 14px rgba(31, 81, 101, 0.08);
}

.module-campaign-tabs button.is-active small {
  color: #087e9b;
  background: var(--cyan-pale);
}

.module-search {
  display: flex;
  min-height: 48px;
  margin-top: 12px;
  padding: 0 14px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ice-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
}

.module-search svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.module-search input {
  width: 100%;
  height: 46px;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.module-search input::placeholder {
  color: var(--muted);
}

.module-freshness {
  min-height: 26px;
  padding: 1px 22px 5px;
  color: var(--muted);
  font-size: 12px;
}

.module-freshness.is-stale {
  color: var(--warning);
}

.modules-content {
  display: grid;
  gap: 12px;
  padding: 6px 14px 32px;
}

.module-campaign-card {
  overflow: hidden;
  border: 1px solid rgba(210, 230, 238, 0.92);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow);
}

.module-campaign-card__main {
  display: grid;
  width: 100%;
  min-height: 148px;
  padding: 20px 18px;
  grid-template-columns: 38px 1fr 18px;
  align-items: start;
  gap: 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.module-campaign-card__mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 13px;
  color: var(--muted);
  background: var(--ice-soft);
  font-size: 18px;
  font-weight: 850;
}

.module-campaign-card--danger .module-campaign-card__mark {
  color: #c84e55;
  background: #fff0f1;
}

.module-campaign-card--warning .module-campaign-card__mark {
  color: #a96217;
  background: #fff4df;
}

.module-campaign-card--positive .module-campaign-card__mark {
  color: #168760;
  background: #e6f8f0;
}

.module-campaign-card__copy {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.module-campaign-card__term,
.module-campaign-card__time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 620;
}

.module-campaign-card__copy strong {
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.module-campaign-card__status {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 720;
}

.module-campaign-card__arrow,
.module-tree-row__arrow {
  color: var(--cyan-deep);
  font-size: 24px;
}

.module-campaign-card footer {
  display: flex;
  min-height: 49px;
  padding: 8px 14px 8px 20px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid #e9f2f5;
  color: var(--muted);
  font-size: 11px;
}

.open-modeus {
  display: inline-flex;
  min-height: 44px;
  padding: 9px 13px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #bde4ee;
  border-radius: 14px;
  background: #f0fbfd;
  color: #087e9b;
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
}

.open-modeus svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.open-modeus--compact {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 11px;
}

.module-subpage-header {
  min-height: 120px;
  padding-bottom: 18px;
  align-items: center;
}

.module-subpage-header > div {
  min-width: 0;
  flex: 1 1 auto;
}

.module-subpage-header h1 {
  display: -webkit-box;
  overflow: hidden;
  font-size: 21px;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.module-campaign-content,
.module-item-content,
.module-help-content {
  padding: 0 14px 32px;
}

.module-item-content {
  padding-bottom: calc(var(--nav-height) + 40px);
}

.campaign-summary-card {
  padding: 20px;
  border-radius: var(--radius-card);
  background:
    radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.7), transparent 25%),
    linear-gradient(145deg, #d6f7fc, #b9edf6);
  box-shadow: 0 10px 24px rgba(31, 81, 101, 0.08);
}

.campaign-summary-card__eyebrow {
  margin: 0 0 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.campaign-summary-card h2 {
  margin: 0 0 16px;
  max-width: 350px;
  font-size: 22px;
  line-height: 1.22;
  letter-spacing: -0.035em;
}

.module-status {
  display: inline-flex;
  width: fit-content;
  min-height: 32px;
  padding: 6px 10px;
  align-items: center;
  gap: 6px;
  border-radius: 11px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 760;
}

.module-status > span {
  font-size: 14px;
  font-weight: 900;
}

.module-status--danger { color: #b9454c; }
.module-status--warning { color: #965b18; }
.module-status--positive { color: #127958; }
.module-status--compact {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 10px;
}

.campaign-dates {
  display: grid;
  margin-top: 18px;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.campaign-dates span {
  display: grid;
  gap: 4px;
}

.campaign-dates small,
.module-facts dt {
  color: var(--muted);
  font-size: 11px;
}

.campaign-dates strong {
  font-size: 13px;
  font-weight: 750;
}

.campaign-summary-card__footer {
  display: flex;
  margin-top: 18px;
  padding-top: 14px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid rgba(7, 156, 190, 0.13);
}

.campaign-summary-card__footer > strong {
  font-size: 13px;
}

.module-item-tabs {
  display: grid;
  margin: 16px 0 0;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--ice-line);
}

.module-item-tabs button {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 48px;
  padding: 4px 2px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.module-item-tabs button::after {
  content: "";
  position: absolute;
  inset: auto 14px -1px;
  height: 2px;
  border-radius: 2px;
  background: transparent;
}

.module-item-tabs button.is-active {
  color: var(--ink);
}

.module-item-tabs button.is-active::after {
  background: var(--cyan-deep);
}

.module-search--campaign {
  margin-top: 12px;
}

.module-block-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.module-block {
  overflow: hidden;
  border: 1px solid var(--ice-line);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow);
}

.module-block__header {
  display: grid;
  padding: 18px;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
  background: #fafdfe;
}

.module-block__header .module-status {
  grid-column: 2;
}

.module-block__symbol {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  color: #aa671b;
  background: #fff3de;
  font-size: 19px;
}

.module-block--positive .module-block__symbol {
  color: #168760;
  background: #e6f8f0;
}

.module-block__copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.module-block__copy > span,
.module-block__copy small {
  color: var(--muted);
  font-size: 10px;
}

.module-block__copy strong {
  font-size: 16px;
  line-height: 1.3;
}

.module-block-metrics {
  display: flex;
  margin-top: 6px;
  flex-wrap: wrap;
  gap: 5px;
}

.module-block-metrics span {
  display: inline-flex;
  min-height: 24px;
  padding: 4px 7px;
  align-items: center;
  border-radius: 8px;
  color: var(--ink-soft);
  background: var(--ice-soft);
  font-size: 9px;
  font-weight: 690;
}

.module-tree {
  border-top: 1px solid #e9f2f5;
}

.module-nested-block {
  margin: 10px;
  overflow: hidden;
  border: 1px solid #dcecf1;
  border-radius: 18px;
  background: #fbfdfe;
}

.module-nested-block > header {
  display: grid;
  padding: 14px;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.module-nested-block > header .module-status {
  grid-column: 2;
}

.module-nested-block__symbol {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 10px;
  color: #7a6b45;
  background: #f3efe4;
  font-size: 16px;
  font-weight: 800;
}

.module-nested-block--positive .module-nested-block__symbol {
  color: #168760;
  background: #e6f8f0;
}

.module-nested-block__copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.module-nested-block__copy > small {
  color: var(--muted);
  font-size: 9px;
}

.module-nested-block__copy > strong {
  font-size: 14px;
  line-height: 1.35;
}

.module-nested-children {
  border-top: 1px solid #e6eff2;
  background: var(--white);
}

.module-nested-children .module-nested-block {
  margin: 8px;
}

.module-tree-row {
  position: relative;
  display: flex;
  min-height: 82px;
  align-items: stretch;
}

.module-tree-row + .module-tree-row {
  border-top: 1px solid #e9f2f5;
}

.module-tree-row::before {
  content: "";
  position: absolute;
  inset: 14px auto 14px 0;
  width: 4px;
  border-radius: 0 6px 6px 0;
  background: #9eb3bf;
}

.module-tree-row--positive::before { background: var(--positive); }
.module-tree-row--warning::before { background: var(--warning); }
.module-tree-row--danger::before { background: var(--danger); }

.module-tree-row__main {
  display: grid;
  min-width: 0;
  padding: 15px 7px 15px 17px;
  flex: 1 1 auto;
  grid-template-columns: 26px minmax(0, 1fr) 15px;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.module-tree-row__status {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 9px;
  color: var(--muted);
  background: var(--ice-soft);
  font-weight: 850;
}

.module-tree-row--positive .module-tree-row__status {
  color: #168760;
  background: #e6f8f0;
}

.module-tree-row__copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.module-tree-row__copy strong {
  font-size: 13px;
  line-height: 1.35;
}

.module-tree-row__copy small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.open-modeus--icon-row {
  width: 38px;
  min-height: 38px;
  margin: auto 7px auto 0;
  padding: 0;
  flex: 0 0 38px;
  border-radius: 12px;
}

.open-modeus--icon-row span {
  display: none;
}

.module-info-card,
.module-data-missing,
.module-help-card {
  margin-bottom: 14px;
  padding: 22px;
  border: 1px solid var(--ice-line);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow);
}

.module-item-summary__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.module-favorite-chip,
.module-selected-label {
  color: #9a651b;
  font-size: 11px;
  font-weight: 740;
}

.module-item-summary > p {
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
}

.module-facts {
  display: grid;
  margin: 18px 0 0;
  gap: 14px;
}

.module-facts div {
  display: grid;
  gap: 4px;
}

.module-facts dt,
.module-facts dd {
  margin: 0;
}

.module-facts dd {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.module-facts--compact {
  padding: 14px 0;
  border-top: 1px solid #e9f2f5;
  border-bottom: 1px solid #e9f2f5;
}

.module-item-summary > .open-modeus {
  width: 100%;
  margin-top: 16px;
}

.module-team-card__heading {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
}

.module-team-card {
  box-shadow: none;
}

.module-team-card.is-selected {
  border-color: #bfe7d8;
  box-shadow: 0 9px 22px rgba(29, 128, 94, 0.07);
}

.module-team-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 13px;
  color: #168760;
  background: #e6f8f0;
  font-weight: 900;
}

.module-team-card:not(.is-selected) .module-team-icon {
  color: var(--muted);
  background: var(--ice-soft);
}

.module-team-card__heading small {
  color: var(--muted);
  font-size: 10px;
}

.module-team-card__heading h2 {
  margin: 3px 0 0;
  font-size: 17px;
}

.module-selected-label {
  color: #168760;
}

.module-team-card:not(.is-selected) .module-selected-label {
  color: var(--muted);
}

.module-cycle {
  margin-bottom: 16px;
}

.module-cycle > header {
  position: relative;
  padding: 4px 6px 12px;
}

.module-cycle > header > span,
.module-cycle > header > small {
  color: var(--muted);
  font-size: 10px;
}

.module-cycle > header h2 {
  margin: 3px 0 0;
  padding-right: 70px;
  font-size: 16px;
}

.module-cycle > header > small {
  position: absolute;
  right: 6px;
  bottom: 14px;
}

.module-cycle-empty {
  display: grid;
  gap: 6px;
}

.module-cycle-empty span {
  color: var(--muted);
  font-size: 11px;
}

.module-cycle-empty strong {
  font-size: 14px;
}

.module-roster {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #e9f2f5;
}

.module-roster__heading {
  display: flex;
  margin-bottom: 10px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.module-roster__heading strong {
  font-size: 13px;
}

.module-roster__heading span {
  color: var(--muted);
  font-size: 10px;
}

.module-roster__person {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
}

.module-roster__person + .module-roster__person {
  border-top: 1px solid #eef4f6;
}

.module-roster__person > span {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 10px;
  color: #17647b;
  background: var(--ice-soft);
  font-size: 9px;
  font-weight: 800;
}

.module-roster__person strong {
  font-size: 12px;
}

.module-data-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.module-data-missing {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 13px;
}

.module-data-missing__icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: #8c641f;
  background: #fff3de;
  font-size: 20px;
}

.module-data-missing h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.module-data-missing p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.module-data-missing .open-modeus {
  grid-column: 1 / -1;
}

.module-empty {
  padding: 48px 24px;
  border: 1px solid var(--ice-line);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.78);
  text-align: center;
}

.module-empty > span {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 17px;
  color: var(--cyan-deep);
  background: var(--cyan-pale);
  font-size: 22px;
}

.module-empty h2 {
  margin: 0;
  font-size: 17px;
}

.module-empty p {
  margin: 7px auto 0;
  max-width: 290px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.module-empty .open-modeus {
  margin-top: 16px;
}

.module-empty--inline {
  padding: 36px 20px;
}

.module-help-card > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}

.module-help-list {
  margin: 20px 0;
  border-top: 1px solid #e9f2f5;
}

.module-help-list > div {
  display: grid;
  min-height: 70px;
  padding: 12px 0;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid #e9f2f5;
}

.module-help-list > div > span {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  color: var(--cyan-deep);
  background: var(--ice-soft);
  font-size: 17px;
  font-weight: 850;
}

.module-help-list p {
  display: grid;
  margin: 0;
  gap: 4px;
}

.module-help-list strong {
  font-size: 13px;
}

.module-help-list small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.module-help-card > .open-modeus {
  width: 100%;
}

@media (max-width: 340px) {
  .modules-header,
  .module-campaign-content,
  .module-item-content,
  .module-help-content {
    padding-inline: 10px;
  }

  .module-campaign-tabs button {
    font-size: 10px;
  }

  .module-campaign-card__main {
    padding-inline: 15px 12px;
    grid-template-columns: 34px 1fr 14px;
    gap: 9px;
  }

  .module-campaign-card__mark {
    width: 34px;
    height: 34px;
  }

  .module-tree-row__main {
    grid-template-columns: 24px minmax(0, 1fr) 12px;
    padding-left: 14px;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modules-view *,
  .module-detail-view * {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
