/* ОПиУ — вкладки по листам эталона */

.page-main.page-opiu {
  max-width: 1520px;
  padding-top: 1.25rem;
}

.opiu-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.page-opiu .page-title { margin: 0 0 0.25rem; letter-spacing: -0.02em; }
.page-opiu .page-lead { margin: 0; max-width: 44rem; }

.opiu-hero-asof {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  white-space: nowrap;
}

.opiu-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.opiu-pill {
  border: 0;
  background: #e2e8f0;
  color: #334155;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.opiu-pill:hover { background: #cbd5e1; }
.opiu-pill.is-active {
  background: #0f172a;
  color: #fff;
}

.opiu-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.opiu-kpi {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
}

.opiu-kpi .sub {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.opiu-seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.opiu-seg-btn {
  border: 0;
  background: transparent;
  color: #334155;
  padding: 0.38rem 0.75rem;
  font-weight: 650;
  font-size: 0.82rem;
  cursor: pointer;
}

.opiu-seg-btn + .opiu-seg-btn { border-left: 1px solid var(--border); }
.opiu-seg-btn.is-active { background: #0f172a; color: #fff; }

.opiu-pl tr.r-line td.sticky-name { padding-left: 1.4rem; font-weight: 500; }
.opiu-pl tr.r-group td.sticky-name { padding-left: 1.05rem; font-weight: 650; }

.opiu-month thead tr.subhead th {
  top: 2.15rem;
  background: #1e293b;
  font-weight: 500;
  font-size: 0.72rem;
  color: #94a3b8;
  text-align: right;
}
.opiu-pl .pct-col {
  color: #2563eb;
  font-size: 0.75rem;
  width: 4.4rem;
}
.opiu-month td.opiu-shared {
  text-align: center;
  vertical-align: middle;
  padding: 0.2rem 0.55rem;
}
.opiu-shared-flow {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.opiu-shared-rail {
  flex: 1;
  height: 0;
  border-top: 2px solid #94a3b8;
  min-width: 1rem;
}
.opiu-shared-arrow {
  font-size: 1.15rem;
  line-height: 1;
  color: #334155;
  font-weight: 700;
}
.opiu-pl tr.r-oh .opiu-shared-flow,
.opiu-pl tr.r-admin .opiu-shared-flow,
.opiu-pl tr.r-comm .opiu-shared-flow,
.opiu-pl tr.r-ind .opiu-shared-flow,
.opiu-pl tr.r-below .opiu-shared-flow,
.opiu-pl tr.r-prod .opiu-shared-flow {
  color: #78350f;
}
.opiu-pl tr.r-oh .opiu-shared-rail,
.opiu-pl tr.r-admin .opiu-shared-rail,
.opiu-pl tr.r-comm .opiu-shared-rail,
.opiu-pl tr.r-ind .opiu-shared-rail,
.opiu-pl tr.r-below .opiu-shared-rail,
.opiu-pl tr.r-prod .opiu-shared-rail {
  border-top-color: #b45309;
}
.opiu-pl tr.r-oh .opiu-shared-arrow,
.opiu-pl tr.r-admin .opiu-shared-arrow,
.opiu-pl tr.r-comm .opiu-shared-arrow,
.opiu-pl tr.r-ind .opiu-shared-arrow,
.opiu-pl tr.r-below .opiu-shared-arrow,
.opiu-pl tr.r-prod .opiu-shared-arrow {
  color: #92400e;
}
.opiu-pl .pct-wide { color: #2563eb; }
.opiu-pl tr.r-rev .pct-col,
.opiu-pl tr.r-md .pct-col,
.opiu-pl tr.r-gp-dir .pct-col,
.opiu-pl tr.r-gp .pct-col,
.opiu-pl tr.r-ebitda .pct-col,
.opiu-pl tr.r-ni .pct-col,
.opiu-pl tr.r-debt .pct-col,
.opiu-pl tr.r-re .pct-col { color: #bfdbfe; }

.opiu-cal { font-size: 0.75rem; }
.opiu-cal th.y-prev { color: #94a3b8; }
.opiu-cal td.cal-on { background: #dbeafe; }
.opiu-cal td.cal-empty { background: #f8fafc; }
.opiu-cal tfoot tr.cal-total td,
.opiu-cal tfoot tr.cal-total td.sticky-name {
  background: #0f172a;
  color: #fff;
  font-weight: 700;
}

.opiu-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem 1.15rem;
  margin-bottom: 0.85rem;
}

.opiu-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 650;
}

.opiu-card .hint {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.opiu-tax-modes {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.opiu-tax-mode {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
}

.opiu-tax-mode h3 {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  font-weight: 650;
}

.opiu-tax-mode .hint {
  margin: 0 0 0.35rem;
}

.opiu-tax-mode .hint:last-child {
  margin-bottom: 0;
}

.opiu-table-wrap {
  overflow: visible;
  max-height: none;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.opiu-table-wrap.is-fitted {
  overflow: hidden;
}

.opiu-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
}

.opiu-table th,
.opiu-table td {
  border-bottom: 1px solid #e8edf3;
  padding: 0.4rem 0.55rem;
  vertical-align: top;
}

.opiu-table thead th {
  position: relative;
  background: #0f172a;
  color: #e2e8f0;
  font-weight: 600;
  text-align: left;
}

.opiu-table .num {
  font-family: var(--mono);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.opiu-table tr.sec td {
  background: #f1f5f9;
  font-weight: 650;
}

.pill-st {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.st-from_dds { background: #d1fae5; color: #047857; }
.st-partial { background: #fef3c7; color: #b45309; }
.st-mapped_zero { background: #e2e8f0; color: #475569; }
.st-need_mp, .st-need_stock, .st-need_calc, .st-need_payroll, .st-need_mixed, .st-no_map, .st-need_cogs {
  background: #ffe4e6;
  color: #9f1239;
}
.st-need_user { background: #fef3c7; color: #b45309; }
.st-ok { background: #d1fae5; color: #047857; }
.st-expired { background: #ffe4e6; color: #9f1239; }

.opiu-input,
.opiu-date,
.opiu-note {
  font: inherit;
  width: 100%;
  min-width: 6.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.28rem 0.4rem;
  background: #fff;
}

.opiu-note { min-width: 9rem; }
.opiu-input { font-family: var(--mono); text-align: right; width: 7.5rem; }
.opiu-date { width: 9.5rem; }
.loan-date {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  white-space: nowrap;
}
.loan-dpart {
  font: inherit;
  font-family: var(--mono);
  width: 2.4rem;
  min-width: 2.4rem;
  text-align: center;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.28rem 0.15rem;
  background: #fff;
}
.loan-receipt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  min-width: 11rem;
}
.loan-receipt .loan-receipt-amt {
  width: 8.5rem;
  min-width: 8.5rem;
}
.loan-receipt.loan-edited {
  background: #fffbeb;
  border-radius: 8px;
  padding: 0.25rem;
}

.opiu-table td.sticky-name {
  background: #fff;
  font-weight: 600;
  min-width: 11rem;
}

.opiu-table thead th.sticky-name {
  background: #0f172a;
}

.opiu-sub {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.opiu-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}

.opiu-add input[type="text"] {
  font: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  min-width: 16rem;
}

.opiu-save-ok { color: #047857; font-size: 0.75rem; }
.opiu-cogs-off td { opacity: 0.55; }
.opiu-cogs-off .opiu-input { opacity: 1; }

.opiu-cogs-table { font-size: 0.82rem; }
.opiu-cogs-table thead th { text-align: right; }
.opiu-cogs-table thead th.sticky-name,
.opiu-cogs-table thead th.dir { text-align: center; }
.opiu-cogs-table thead th.sticky-name { text-align: left; }
.opiu-cogs-table thead tr.subhead th {
  top: 2.2rem;
  background: #1e293b;
  font-weight: 500;
  font-size: 0.78rem;
  color: #94a3b8;
  text-align: right;
}
.opiu-cogs-table td.sticky-name { min-width: 11rem; }
.opiu-cogs-table .opiu-input { width: 100%; min-width: 0; font-size: 0.82rem; }
.opiu-cogs-name {
  font: inherit;
  font-weight: 600;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.28rem 0.4rem;
  background: #fff;
  text-align: left;
}
.opiu-cogs-bucket,
#cogs-new-bucket {
  font: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.32rem 0.45rem;
  background: #fff;
  min-width: 12rem;
}
.opiu-cogs-table tfoot td {
  font-weight: 650;
  background: #f8fafc;
}
.opiu-cogs-table tr.cogs-grand td,
.opiu-cogs-year tfoot tr.cogs-grand td,
.opiu-cogs-year tfoot tr.cogs-grand td.sticky-name {
  background: #0f172a;
  color: #fff;
  font-weight: 700;
}
.opiu-cogs-table tr.cogs-bucket-sum td { color: #475569; font-weight: 600; }
.opiu-cogs-table tr.cogs-missing td { background: #fff7ed; }
.opiu-cogs-table tr.cogs-missing td.sticky-name { background: #fff7ed; }
.opiu-cogs-year tr.is-open td { background: #e2e8f0; }

.opiu-cogs-wrap { max-height: none; }
.opiu-cogs-sheet { min-width: 0; width: 100%; }
.opiu-cogs-sheet thead th.cogs-m {
  text-align: center;
  min-width: 0;
  width: auto;
  font-weight: 600;
  padding: 0.28rem 0.22rem;
  font-size: 0.72rem;
}
.opiu-cogs-sheet thead th.cogs-m.is-future,
.opiu-cogs-sheet td.is-future { color: #94a3b8; }
.opiu-cogs-sheet td.cogs-cell {
  padding: 0.15rem 0.2rem 0.28rem;
  vertical-align: top;
  background: #f8fafc;
}
.opiu-cogs-sheet td.cogs-filled { background: #fff; }
.opiu-cogs-sheet td.has-sales { background: #eff6ff; }
.opiu-cogs-sheet td.cogs-filled.has-sales { background: #eff6ff; }
.opiu-cogs-sheet td.cogs-gap,
.opiu-cogs-sheet td.cogs-gap .opiu-input { background: #fff7ed; }
.opiu-cogs-sheet td.cogs-cell .opiu-input {
  width: 100%;
  min-width: 0;
  font-size: 0.78rem;
  padding: 0.28rem 0.32rem;
  border-radius: 6px;
}
.opiu-cogs-sheet td.cogs-blank .opiu-input { background: transparent; }
.opiu-cogs-sheet td.cogs-filled .opiu-input,
.opiu-cogs-sheet td.has-sales .opiu-input { background: #fff; }
.opiu-cogs-sheet td.cogs-gap .opiu-input { background: #fff7ed; }
.cogs-units {
  display: block;
  min-height: 1.05rem;
  margin-top: 0.12rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #1d4ed8;
  text-align: right;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.cogs-units.is-empty { visibility: hidden; }
.opiu-cogs-sheet td.cogs-gap .cogs-units { color: #c2410c; }
.opiu-cogs-sheet td.is-future .cogs-units { color: #64748b; }
.opiu-cogs-sheet tr.cogs-cab td {
  background: #e2e8f0;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #334155;
  padding: 0.45rem 0.55rem;
}
.opiu-cogs-sheet tr.cogs-cab td.sticky-name { background: #e2e8f0; }
.opiu-cogs-sheet tfoot td.num { font-size: 0.72rem; }

.opiu-outline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.65rem;
}

.opiu-outline article {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
}

.opiu-outline h3 {
  margin: 0 0 0.4rem;
  font-size: 0.88rem;
}

.opiu-outline ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.cab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.65rem;
}

.cab-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  background: #f8fafc;
}

.cab-card h3 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.cab-card p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }

.opiu-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.opiu-month-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: #334155;
  min-width: 2.6rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  font-weight: 650;
  cursor: pointer;
}

.opiu-month-btn.is-active { background: #0f172a; color: #fff; border-color: #0f172a; }

.opiu-check {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-left: auto;
}

.opiu-pl { font-size: 0.8rem; }
.opiu-pl th { text-align: right; }
.opiu-pl th.sticky-name, .opiu-pl td.sticky-name { text-align: left; min-width: 12rem; max-width: none; }
.opiu-pl thead th.dir { text-align: center; }
.opiu-pl td.num { padding: 0.28rem 0.5rem; }
.opiu-pl .pct {
  display: block;
  font-size: 0.7rem;
  color: #2563eb;
  font-weight: 500;
}
.opiu-pl .neg { color: #b91c1c; }

.opiu-pl tr.r-rev td { background: #1e293b; color: #fff; font-weight: 700; }
.opiu-pl tr.r-rev .pct, .opiu-pl tr.r-md .pct, .opiu-pl tr.r-gp-dir .pct,
.opiu-pl tr.r-gp .pct, .opiu-pl tr.r-ebitda .pct, .opiu-pl tr.r-ni .pct,
.opiu-pl tr.r-debt .pct, .opiu-pl tr.r-re .pct { color: #bfdbfe; }
.opiu-pl tr.r-rev td.sticky-name { background: #1e293b; color: #fff; }
.opiu-pl tr.r-var td, .opiu-pl tr.r-var td.sticky-name { background: #fde68a; font-weight: 700; }
.opiu-pl tr.r-fixed td, .opiu-pl tr.r-fixed td.sticky-name,
.opiu-pl tr.r-oh td, .opiu-pl tr.r-oh td.sticky-name,
.opiu-pl tr.r-admin td, .opiu-pl tr.r-admin td.sticky-name,
.opiu-pl tr.r-comm td, .opiu-pl tr.r-comm td.sticky-name,
.opiu-pl tr.r-ind td, .opiu-pl tr.r-ind td.sticky-name,
.opiu-pl tr.r-below td, .opiu-pl tr.r-below td.sticky-name,
.opiu-pl tr.r-prod td, .opiu-pl tr.r-prod td.sticky-name { background: #fef3c7; font-weight: 700; }
.opiu-pl tr.r-md td, .opiu-pl tr.r-md td.sticky-name,
.opiu-pl tr.r-gp-dir td, .opiu-pl tr.r-gp-dir td.sticky-name,
.opiu-pl tr.r-gp td, .opiu-pl tr.r-gp td.sticky-name { background: #b91c1c; color: #fff; font-weight: 700; }
.opiu-pl tr.r-ebitda td, .opiu-pl tr.r-ebitda td.sticky-name { background: #9f1239; color: #fff; font-weight: 700; }
.opiu-pl tr.r-ni td, .opiu-pl tr.r-ni td.sticky-name { background: #f9a8d4; font-weight: 700; }
.opiu-pl tr.r-debt td, .opiu-pl tr.r-debt td.sticky-name { background: #1d4ed8; color: #fff; font-weight: 700; }
.opiu-pl tr.r-re td, .opiu-pl tr.r-re td.sticky-name { background: #14532d; color: #fff; font-weight: 700; }
.opiu-pl tr.r-ref td { color: #1d4ed8; font-weight: 650; }
.opiu-pl tr.r-pct td { background: #fff7ed; }
.opiu-pl tr.r-empty td { color: #94a3b8; }

.opiu-pl tr.has-details { cursor: pointer; }
.opiu-pl tr.has-details td.sticky-name { color: #1d4ed8; }
.opiu-expand {
  border: 0;
  background: inherit;
  color: inherit;
  font: inherit;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.opiu-expand::before {
  content: "▸ ";
  color: #64748b;
  font-size: 0.75em;
}
.opiu-pl tr.has-details.is-open .opiu-expand::before { content: "▾ "; }
.opiu-detail-row td {
  background: #f8fafc;
  padding: 0.5rem 0.75rem 0.85rem !important;
}
.opiu-details {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.opiu-details th,
.opiu-details td {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.28rem 0.45rem;
  text-align: left;
}
.opiu-details th { color: #64748b; font-weight: 600; }
.opiu-details td.num { text-align: right; font-family: var(--mono); }
.opiu-details tr.opiu-detail-group td {
  background: #f1f5f9;
  font-weight: 700;
  padding-top: 0.45rem;
}
.opiu-details tr.opiu-detail-op td {
  color: #64748b;
  font-size: 0.78rem;
}
.opiu-details tr.opiu-detail-op td:nth-child(2) { padding-left: 1.1rem; }
.opiu-recon-bad { background: #fef2f2; }
.opiu-recon-ok { color: #047857; font-weight: 600; }
p.opiu-recon-ok, p.opiu-recon-bad, p.opiu-recon-miss {
  margin: 0.35rem 0 0.6rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
}
p.opiu-recon-ok { background: #ecfdf5; }
p.opiu-recon-bad { background: #fef2f2; color: #b91c1c; font-weight: 600; }
p.opiu-recon-miss { background: #fffbeb; color: #b45309; }
p.opiu-recon-restated,
.opiu-review-card {
  background: #fecaca;
  color: #7f1d1d;
  font-weight: 600;
}
p.opiu-recon-restated {
  margin: 0.35rem 0 0.6rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
}
table.opiu-month.is-restated td,
.opiu-th-restated {
  background: #fecaca !important;
}
.opiu-review-block {
  margin-top: 1rem;
}
.opiu-review-block h3 {
  margin: 0 0 0.35rem;
}

.opiu-pl-wrap { max-height: none; }

.opiu-kpi.neg .val { color: #b91c1c; }
.opiu-in-band { background: #d1fae5; }
.opiu-out-band { background: #fee2e2; }

.opiu-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.opiu-chart-box { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 0.9rem 1rem 1rem; }
.opiu-chart-box.opiu-chart-hero { grid-column: 1 / -1; }
.opiu-chart-box h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.opiu-chart-box .hint { margin: 0 0 0.6rem; }
.opiu-chart-box svg { width: 100%; height: auto; display: block; }
.opiu-chart-note { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; margin-top: 0.45rem; }
.opiu-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  font-size: 0.8rem;
  color: #334155;
  margin: 0 0 0.45rem;
}
.opiu-chart-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 0.35rem;
  vertical-align: -2px;
}
.opiu-chart-legend i.is-line {
  height: 3px;
  width: 16px;
  border-radius: 1px;
  vertical-align: 3px;
}
.opiu-chart-grid { stroke: #e2e8f0; }
.opiu-chart-tick { font-size: 11px; fill: #64748b; }
.opiu-chart-zero { stroke: #0f172a; stroke-width: 1.2; }
.opiu-chart-link { stroke: #94a3b8; stroke-dasharray: 3 3; }
.opiu-chart-danger { fill: #be123c; fill-opacity: 0.18; }
.opiu-chart-flag { font-size: 10px; font-weight: 700; fill: #9f1239; }
.opiu-chart-callout {
  margin: 0.7rem 0 0;
  padding: 0.65rem 0.85rem;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1.45;
}
.opiu-chart-callout.warn { background: #9f1239; }

@media (max-width: 1100px) {
  .opiu-charts { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .opiu-kpis { grid-template-columns: 1fr 1fr; }
  .opiu-hero { flex-direction: column; align-items: flex-start; }
}

.opiu-select {
  font: inherit;
  width: 100%;
  min-width: 10rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.28rem 0.4rem;
  background: #fff;
}
.opiu-fot .fot-role { min-width: 10rem; text-align: left; }
.opiu-fot tr.fot-need td.sticky-name { background: #fffbeb; }
.opiu-fot .opiu-sub { max-width: 22rem; white-space: normal; }
.opiu-fot td.fot-split { white-space: nowrap; line-height: 1.25; }
.opiu-loans-wrap {
  overflow: visible;
}
.opiu-loans {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}
.opiu-loans .opiu-input {
  width: 100%;
  min-width: 0;
}
.opiu-loans .loan-amt {
  width: 5.4rem;
  min-width: 5.4rem;
  max-width: 5.4rem;
  font-size: 0.78rem;
  padding: 0.28rem 0.3rem;
}
.opiu-loans td.loan-edited { background: #fffbeb; }
.opiu-loans td.loan-carried { background: #eef6ff; }
.opiu-loans td.loan-final { background: #f4eefe; }
.opiu-loans .loan-final-row .opiu-input { width: 5.4rem; }
.opiu-loans td[rowspan] { vertical-align: top; }
.opiu-loans td.sticky-name,
.opiu-loans th.sticky-name {
  min-width: 14rem;
  max-width: 16rem;
  position: sticky;
  left: 0;
  z-index: 2;
}
.opiu-loans .loan-title {
  width: 100%;
  min-width: 0;
  text-align: left;
}
.opiu-loans .loan-term {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin-top: 0.5rem;
}
.opiu-loans .loan-term-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}
.opiu-loans .loan-term-row > span {
  width: 1.4rem;
  flex: 0 0 1.4rem;
}
.opiu-loans .loan-ypart {
  width: 3.15rem;
  min-width: 3.15rem;
}
.opiu-loans thead th.loan-m,
.opiu-loans td.loan-m {
  min-width: 6.2rem;
  width: 6.2rem;
  white-space: nowrap;
}
.opiu-loans td.loan-m {
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}
.opiu-loans .loan-note {
  min-width: 8rem;
  width: 10rem;
}
.opiu-loans .loan-kind {
  min-width: 3.2rem;
  width: 3.2rem;
  white-space: nowrap;
}
.opiu-add label { display: flex; gap: 0.35rem; align-items: center; font-size: 0.85rem; color: var(--text-muted); }
.opiu-tax tr.cal-total td { font-weight: 700; }

.opiu-rbp-sheet { min-width: 0; width: 100%; }
.opiu-rbp-sheet td.sticky-name { min-width: 11rem; }
.opiu-rbp-sheet .rbp-term {
  width: 4.2rem;
  min-width: 4.2rem;
  text-align: right;
}
.opiu-rbp-sheet .rbp-start {
  width: 100%;
  min-width: 0;
  font: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.28rem 0.35rem;
  background: #fff;
}
.opiu-rbp-sheet .opiu-note { width: 100%; min-width: 0; }
.opiu-rbp-sheet td.cal-on { background: #eff6ff; }
.opiu-rbp-sheet td.cal-empty { background: #f8fafc; }
.opiu-rbp-sheet .rbp-open { max-width: 16rem; }
.opiu-rbp-sheet tr.rbp-skip td { color: #64748b; }
.opiu-rbp-sheet tr.rbp-kind td {
  background: #0f172a;
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: none;
}
.opiu-rbp-sheet tr.rbp-kind td.sticky-name { background: #0f172a; color: #fff; }
.opiu-rbp-sheet tr.rbp-foot-m td,
.opiu-rbp-sheet tr.rbp-foot-m td.sticky-name {
  background: #334155;
  color: #fff;
  font-weight: 700;
}
.opiu-rbp-sheet tfoot td.num { font-size: 0.72rem; }

.opiu-heat-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
}
.opiu-heat-legend span {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-weight: 600;
  color: #334155;
}
.opiu-heat-legend .heat-look-swatch {
  box-shadow: inset 0 0 0 2px #0f172a;
  background: #fff;
}

.opiu-heat td.heat-e1 { background: #fff7ed; }
.opiu-heat td.heat-e2 { background: #ffedd5; }
.opiu-heat td.heat-e3 { background: #fdba74; color: #7c2d12; }
.opiu-heat td.heat-e4 { background: #ea580c; color: #fff; font-weight: 650; }
.opiu-heat td.heat-g1 { background: #ecfdf5; }
.opiu-heat td.heat-g2 { background: #a7f3d0; color: #065f46; }
.opiu-heat td.heat-g3 { background: #34d399; color: #064e3b; font-weight: 650; }
.opiu-heat td.heat-g4 { background: #047857; color: #fff; font-weight: 650; }
.opiu-heat td.heat-b1 { background: #fff1f2; }
.opiu-heat td.heat-b2 { background: #fecdd3; color: #9f1239; }
.opiu-heat td.heat-b3 { background: #fb7185; color: #fff; }
.opiu-heat td.heat-b4 { background: #be123c; color: #fff; font-weight: 650; }
.opiu-heat td.heat-e3 .pct,
.opiu-heat td.heat-e4 .pct,
.opiu-heat td.heat-g2 .pct,
.opiu-heat td.heat-g3 .pct,
.opiu-heat td.heat-g4 .pct,
.opiu-heat td.heat-b2 .pct,
.opiu-heat td.heat-b3 .pct,
.opiu-heat td.heat-b4 .pct { color: inherit; opacity: 0.9; }
.opiu-heat td.heat-e4.neg,
.opiu-heat td.heat-g4.neg,
.opiu-heat td.heat-b3.neg,
.opiu-heat td.heat-b4.neg { color: #fff; }
.opiu-heat td.heat-look {
  box-shadow: inset 0 0 0 2px #0f172a;
}

.opiu-analysis-report {
  border: 2px solid #0f172a;
  margin-top: 1.15rem;
}
.opiu-analysis-report h2 { margin-bottom: 0.75rem; }
.opiu-analysis-report h3 {
  margin: 1rem 0 0.35rem;
  font-size: 1rem;
}
.opiu-verdict {
  font-size: 1.02rem;
  line-height: 1.55;
  margin: 0.45rem 0;
  max-width: 58rem;
}
.opiu-look-list {
  margin: 0.35rem 0 0;
  padding-left: 1.3rem;
  line-height: 1.5;
  max-width: 58rem;
}
.opiu-look-list li { margin: 0.35rem 0; }

body.opiu-readonly .opiu-input,
body.opiu-readonly .opiu-note,
body.opiu-readonly select.opiu-bucket,
body.opiu-readonly input.fot-role,
body.opiu-readonly input.cogs-cost,
body.opiu-readonly input.loan-amt {
  pointer-events: none;
  background: #f8fafc;
  color: #334155;
}
body.opiu-readonly .opiu-add,
body.opiu-readonly #taxes-sync-btn,
body.opiu-readonly .cogs-copy,
body.opiu-readonly button.opiu-save {
  display: none !important;
}
