/* Operating-plan views. All rules are scoped to their component classes. */
.plan-notice {
  margin: 0 0 24px;
  padding: 15px 18px;
  border: 1px solid #dce2cc;
  border-left: 3px solid var(--forest-muted);
  border-radius: 6px;
  background: #eef1e3;
  color: #4d5d47;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.plan-notice:not(:first-child) { margin-top: 24px; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.6; }

.plan-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin: 0 0 22px;
}
.plan-metrics > div {
  min-width: 0;
  min-height: 136px;
  padding: 21px 20px 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
}
.plan-metrics > div > span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.plan-metrics strong {
  display: block;
  margin-top: 17px;
  color: var(--forest);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -1px;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.plan-metrics strong small { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.plan-metrics > div > small { display: block; margin-top: 9px; font-size: 12px; line-height: 1.5; color: var(--muted); }

.tier-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 24px;
}
.tier-guide > div {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 21px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
}
.tier-guide > div:nth-child(2) { background: #edf1e3; }
.tier-guide > div:nth-child(3) { background: #fae7d7; border-color: #ebccb4; }
.tier-guide strong { color: var(--forest); font-size: 20px; font-weight: 600; line-height: 1.3; }
.tier-guide span { color: var(--ink); font-size: 14px; line-height: 1.6; }
.tier-guide small { margin-top: auto; padding-top: 3px; color: #5d6854; font-size: 12px; line-height: 1.5; }

.plan-section { margin-top: 24px; overflow: hidden; }
.plan-section > .section-heading, .scorecard > .section-heading { flex-wrap: wrap; }
.plan-section h2, .scorecard h2 { line-height: 1.4; }
.activity-feed { padding: 0 23px 7px; }
.activity-feed > div { display: flex; align-items: center; gap: 13px; padding: 17px 0; border-top: 1px solid var(--line); }
.activity-feed > div > div { min-width: 0; flex: 1; }
.activity-feed strong { display: block; font-size: 14px; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; }
.activity-feed small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.activity-feed > p { padding: 4px 0 20px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.activity-feed .activity-dot { flex-shrink: 0; width: 10px; height: 10px; border: 3px solid #cf9b6e; border-radius: 50%; background: var(--paper); }
.activity-feed .text-button { padding: 10px 3px 10px 10px; min-height: 40px; font-size: 13px; flex-shrink: 0; }

.review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.review-card { display: flex; flex-direction: column; min-width: 0; padding: 24px; }
.review-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.review-top > span:first-child { color: var(--muted); font-size: 12px; line-height: 1.6; }
.review-card .badge { font-size: 12px; white-space: normal; line-height: 1.5; flex-shrink: 0; }
.review-stars { margin: 22px 0 10px; color: #96702d; font-size: 22px; letter-spacing: 3px; line-height: 1.2; }
.review-card h2 { font-size: 19px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.review-card > p { margin: 12px 0 23px; color: #53614e; font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.review-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px 18px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.review-meta > span { color: var(--muted); font-size: 12px; line-height: 1.6; }
.review-meta .text-button { min-height: 40px; font-size: 13px; }
.review-grid > .empty-state { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }

.rhythm-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 24px; border: 1px solid #d7dfc6; border-radius: 7px; overflow: hidden; background: #eaf0df; }
.rhythm-strip > div { padding: 18px 17px; border-right: 1px solid #d7dfc6; }
.rhythm-strip > div:last-child { border-right: 0; }
.rhythm-strip strong { display: block; color: var(--forest); font-size: 12px; font-weight: 700; line-height: 1.6; letter-spacing: .3px; }
.rhythm-strip span { display: block; margin-top: 7px; color: #4d5d47; font-size: 14px; line-height: 1.55; }
.report-summary { min-width: 200px; max-width: 280px; white-space: normal; line-height: 1.65; overflow-wrap: anywhere; }

.scorecard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 20px; margin-top: 24px; }
.scorecard { min-width: 0; overflow: hidden; }
.scorecard .badge { font-size: 12px; color: #59674f; }
.scorecard-row { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 9px 16px; margin: 0 23px; padding: 16px 0; border-top: 1px solid var(--line); }
.scorecard-row > span { font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.scorecard-row > strong { align-self: start; text-align: right; color: var(--forest); font-size: 14px; line-height: 1.55; font-weight: 650; font-variant-numeric: tabular-nums; }
.weight-track { grid-column: 1 / -1; height: 4px; background: #e9eddf; border-radius: 3px; overflow: hidden; }
.weight-track > i { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: #9aa879; }
.scorecard-grid > .scorecard:last-child .weight-track > i { background: #c49368; }
.scorecard-total { display: flex; justify-content: space-between; gap: 15px; padding: 18px 23px; margin-top: 4px; background: #edf1e4; border-top: 1px solid #dae2ca; color: var(--forest); font-size: 14px; line-height: 1.5; }
.scorecard-total strong { font-variant-numeric: tabular-nums; }

.automation-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px; padding: 20px 23px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
.automation-summary > strong { color: var(--forest); font-size: 24px; font-weight: 600; letter-spacing: -.6px; line-height: 1.2; margin-right: auto; }
.automation-summary > span { color: var(--muted); font-size: 13px; line-height: 1.6; }
.automation-summary > span:first-of-type { padding: 4px 9px; border-radius: 4px; background: #eef0e6; }
.rule-list { padding: 0 23px 7px; }
.rule-item { border-top: 1px solid var(--line); }
.rule-item > summary { display: grid; grid-template-columns: 72px minmax(0, 1fr) 64px 20px; gap: 14px; align-items: center; list-style: none; cursor: pointer; padding: 19px 0; font-size: 14px; line-height: 1.65; }
.rule-item > summary::-webkit-details-marker { display: none; }
.rule-item > summary::marker { content: ''; }
.rule-item > summary > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.rule-code { justify-self: start; padding: 3px 7px; background: #edf1e4; border: 1px solid #dce3ce; border-radius: 4px; color: #526447; font-size: 12px; font-weight: 650; line-height: 1.5; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rule-item .badge { justify-self: end; color: #5d6755; font-size: 12px; }
.rule-item summary > b { display: flex; align-items: center; justify-content: center; font-size: 0; font-weight: 400; color: var(--forest); }
.rule-item summary > b::after { content: '+'; font-size: 21px; line-height: 1; }
.rule-item[open] summary > b::after { content: '−'; }
.rule-item > summary:hover > span:nth-child(2) { color: var(--forest); text-decoration: underline; text-underline-offset: 4px; }
.rule-item[open] > summary { padding-bottom: 12px; }
.rule-item > div { margin: 0 0 18px 86px; padding: 14px 17px; border-left: 2px solid #c4d0ae; border-radius: 0 5px 5px 0; background: #f2f4e9; }
.rule-item > div > p { font-size: 14px; color: #465740; line-height: 1.75; overflow-wrap: anywhere; }
.rule-item > div > small { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.stage-guidance { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px 20px; padding: 16px 18px; margin: 18px 0; border: 1px solid #dce3ce; border-left: 3px solid #9aa879; border-radius: 5px; background: #f0f3e6; }
.stage-guidance > strong { font-size: 14px; line-height: 1.6; color: var(--forest); font-weight: 600; overflow-wrap: anywhere; }
.stage-guidance > span { align-self: start; color: #5b694f; font-size: 12px; line-height: 1.8; text-align: right; }
.stage-guidance > p { grid-column: 1 / -1; color: #53624c; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.form-grid > .stage-guidance { grid-column: 1 / -1; margin: 0; }

/* Plan tables reuse the existing panel, but retain readable type and their own scroll area. */
#main:has(> .plan-metrics, > .tier-guide, > .rhythm-strip) > .data-panel { min-width: 0; overflow: hidden; }
#main:has(> .plan-metrics, > .tier-guide, > .rhythm-strip) > .data-panel > .section-heading { flex-wrap: wrap; }
#main:has(> .plan-metrics, > .tier-guide, > .rhythm-strip) > .data-panel .table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-color: #b1bba3 #f0f2e6; }
#main:has(> .plan-metrics, > .tier-guide, > .rhythm-strip) > .data-panel table { min-width: 740px; }
#main:has(> .plan-metrics, > .tier-guide, > .rhythm-strip) > .data-panel td,
#main:has(> .plan-metrics, > .tier-guide, > .rhythm-strip) > .data-panel .record-link strong { font-size: 14px; }
#main:has(> .plan-metrics, > .tier-guide, > .rhythm-strip) > .data-panel th,
#main:has(> .plan-metrics, > .tier-guide, > .rhythm-strip) > .data-panel .badge { font-size: 12px; }
#main:has(> .plan-metrics, > .tier-guide, > .rhythm-strip) > .data-panel .badge { color: #526146; }

@media (max-width: 1100px) {
  .plan-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scorecard-grid { grid-template-columns: minmax(0, 1fr); }
  .rhythm-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rhythm-strip > div { border-bottom: 1px solid #d7dfc6; }
  .rhythm-strip > div:nth-child(3n) { border-right: 0; }
  .rhythm-strip > div:nth-last-child(-n+2) { border-bottom: 0; }
  .tier-guide > div { padding: 18px 16px; }
}
@media (max-width: 900px) {
  .review-grid { grid-template-columns: minmax(0, 1fr); }
  .tier-guide { gap: 10px; }
  .tier-guide > div { padding: 17px 14px; }
  .rule-item > summary { grid-template-columns: 66px minmax(0, 1fr) 62px 18px; gap: 10px; }
  .rule-item > div { margin-left: 76px; }
}
@media (max-width: 540px) {
  .plan-notice { padding: 14px 15px; margin-bottom: 20px; }
  .plan-metrics { gap: 10px; margin-bottom: 20px; }
  .plan-metrics > div { padding: 17px 14px; min-height: 125px; }
  .plan-metrics > div > span { font-size: 12px; }
  .plan-metrics strong { font-size: 29px; margin-top: 15px; letter-spacing: -.8px; }
  .plan-metrics strong small { font-size: 13px; }
  .tier-guide { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .tier-guide > div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 5px 13px; padding: 17px; }
  .tier-guide strong { grid-row: 1 / 3; align-self: center; font-size: 19px; }
  .tier-guide small { grid-column: 2; margin: 0; padding: 0; }
  .plan-section { margin-top: 20px; }
  .activity-feed { padding: 0 17px 5px; }
  .activity-feed > div { gap: 10px; }
  .review-grid { gap: 15px; }
  .review-card { padding: 20px 18px; }
  .review-top { flex-wrap: wrap; gap: 8px; }
  .review-stars { margin-top: 19px; }
  .rhythm-strip { grid-template-columns: minmax(0, 1fr); }
  .rhythm-strip > div { display: grid; grid-template-columns: 132px minmax(0, 1fr); align-items: start; gap: 12px; padding: 15px 17px; border-right: 0; }
  .rhythm-strip > div:nth-last-child(-n+2) { border-bottom: 1px solid #d7dfc6; }
  .rhythm-strip > div:last-child { border-bottom: 0; }
  .rhythm-strip span { margin-top: 0; }
  .scorecard-grid { gap: 18px; margin-top: 20px; }
  .scorecard-row { margin: 0 17px; padding: 15px 0; gap: 8px 12px; }
  .scorecard-total { padding: 17px; }
  .automation-summary { gap: 10px 18px; padding: 18px; }
  .automation-summary > strong { font-size: 23px; flex: 1 0 50%; }
  .automation-summary > span { font-size: 12px; }
  .rule-list { padding: 0 17px 5px; }
  .rule-item > summary { grid-template-columns: 64px minmax(0, 1fr) 18px; align-items: start; gap: 8px 10px; padding: 17px 0; }
  .rule-item > summary .rule-code { grid-column: 1; grid-row: 1; }
  .rule-item > summary > span:nth-child(2) { grid-column: 2; grid-row: 1; }
  .rule-item > summary .badge { grid-column: 2; grid-row: 2; justify-self: start; }
  .rule-item > summary > b { grid-column: 3; grid-row: 1 / 3; padding-top: 3px; }
  .rule-item > div { margin: 0 0 17px; padding: 13px 14px; }
  .stage-guidance { grid-template-columns: minmax(0, 1fr); padding: 15px; gap: 6px; }
  .stage-guidance > span { text-align: left; }
  .stage-guidance > p { margin-top: 3px; }
}
