.epg-page {
  --epg-wine: #9f2444;
  --epg-wine-dark: #7f1734;
  --epg-border: #eadde0;
  --epg-text: #252126;
  --epg-muted: #766b70;
  --epg-soft: #fbf6f7;
  color: var(--epg-text);
  display: grid;
  gap: 14px;
  min-width: 0;
}

.epg-page * { box-sizing: border-box; }
.epg-page button,
.epg-page input,
.epg-page select,
.epg-page textarea { font: inherit; }
.epg-page button {
  background: #fff;
  border: 1px solid #decfd3;
  border-radius: 7px;
  color: #4d3e43;
  cursor: pointer;
  min-height: 34px;
  padding: 7px 13px;
}
.epg-page button:hover { border-color: var(--epg-wine); color: var(--epg-wine); }
.epg-page button.primary {
  background: var(--epg-wine);
  border-color: var(--epg-wine);
  color: #fff;
}
.epg-page button:disabled { cursor: not-allowed; opacity: .5; }

.epg-page-head {
  align-items: flex-end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 2px 2px 4px;
}
.epg-page-head > div > span,
.epg-drawer > header span {
  color: var(--epg-wine);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}
.epg-page-head h1 { font-size: 28px; margin: 3px 0 2px; }
.epg-page-head p { color: var(--epg-muted); margin: 0; }
.epg-page-head nav { display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; }

.epg-service-banner {
  align-items: center;
  background: #fff5e8;
  border: 1px solid #f2d6ad;
  border-radius: 8px;
  display: grid;
  gap: 3px 14px;
  grid-template-columns: auto 1fr auto;
  padding: 10px 13px;
}
.epg-service-banner.error { background: #fff1f2; border-color: #efc2ca; }
.epg-service-banner b { color: #8c5114; }
.epg-service-banner.error b { color: #a1253d; }
.epg-service-banner span { color: #765f4a; font-size: 12px; }

.epg-kpis {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.epg-kpi,
.epg-card {
  background: #fff;
  border: 1px solid var(--epg-border);
  border-radius: 9px;
  box-shadow: 0 5px 16px rgba(80, 45, 55, .035);
}
.epg-kpi {
  align-items: center;
  display: flex;
  gap: 11px;
  min-height: 78px;
  padding: 11px 13px;
}
.epg-kpi > i {
  align-items: center;
  background: #f8e8ec;
  border-radius: 50%;
  color: var(--epg-wine);
  display: flex;
  font-style: normal;
  font-weight: 800;
  height: 40px;
  justify-content: center;
  width: 40px;
}
.epg-kpi > i svg { height: 22px; width: 22px; }
.epg-kpi.warn > i { background: #fff0df; color: #cf7416; }
.epg-kpi.ok > i { background: #eaf6e8; color: #43863c; }
.epg-kpi.risk > i { background: #ffe9ec; color: #c52b45; }
.epg-kpi.info > i { background: #edf1ff; color: #4b5fbc; }
.epg-kpi.blue > i { background: #eaf3ff; color: #3478c5; }
.epg-kpi.violet > i { background: #f1edff; color: #7653d0; }
.epg-listing-page .epg-kpi > i { border-radius: 10px; }
.epg-kpi div { display: grid; gap: 2px; }
.epg-kpi span { color: var(--epg-muted); }
.epg-kpi strong { font-size: 23px; line-height: 1.05; }
.epg-kpi small { color: #94888c; font-size: 12px; }

.epg-filter-bar {
  align-items: end;
  background: #fff;
  border: 1px solid var(--epg-border);
  border-radius: 9px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, minmax(105px, .7fr)) minmax(220px, 1.5fr);
  padding: 11px;
}
.epg-listing-filter { grid-template-columns: repeat(6, minmax(96px, .65fr)) minmax(210px, 1.3fr); }
.epg-filter-bar label { display: grid; gap: 4px; min-width: 0; }
.epg-filter-bar label > span { color: #675b60; font-size: 12px; }
.epg-filter-bar input,
.epg-filter-bar select,
.epg-form-grid input,
.epg-form-grid select,
.epg-form-grid textarea,
.epg-master-summary select {
  background: #fff;
  border: 1px solid #e2d7da;
  border-radius: 6px;
  color: #40363a;
  height: 34px;
  min-width: 0;
  padding: 6px 9px;
  width: 100%;
}
.epg-form-grid textarea { height: auto; min-height: 82px; resize: vertical; }

.epg-main-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.68fr) minmax(330px, .72fr);
  min-width: 0;
}
.epg-card { min-width: 0; overflow: hidden; }
.epg-card > header,
.epg-drawer-section > header {
  align-items: center;
  border-bottom: 1px solid #f0e7e9;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 14px;
}
.epg-card > header h2,
.epg-drawer-section h3 { font-size: 16px; margin: 0; }
.epg-card > header p,
.epg-drawer-section header p { color: var(--epg-muted); font-size: 12px; margin: 3px 0 0; }

.epg-table-wrap { max-width: 100%; overflow: auto; }
.epg-table {
  border-collapse: collapse;
  min-width: 930px;
  table-layout: auto;
  width: 100%;
}
.epg-table th {
  background: #fcf7f8;
  color: #62565b;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}
.epg-table td {
  border-top: 1px solid #f0e8ea;
  color: #41383c;
  font-size: 12px;
  padding: 8px 10px;
  vertical-align: middle;
}
.epg-table tr.selected td { background: #fff7f8; }
.epg-table td b,
.epg-table td small { display: block; }
.epg-table td small { color: #8a7d82; margin-top: 3px; }
.epg-table td button { border: 0; color: var(--epg-wine); min-height: auto; padding: 4px; }
.epg-product-cell { align-items: center; display: flex; gap: 9px; min-width: 150px; }
.epg-product-cell > img,
.epg-product-cell > i,
.epg-master-thumb {
  align-items: center;
  background: #f4ecee;
  border-radius: 6px;
  display: flex;
  flex: 0 0 38px;
  font-style: normal;
  height: 38px;
  justify-content: center;
  object-fit: cover;
  overflow: hidden;
  width: 38px;
}
.epg-product-cell p { margin: 0; }
.epg-platform-list { display: flex; flex-wrap: wrap; gap: 4px; min-width: 105px; }
.epg-platform-list em { background: #f7eff1; border-radius: 10px; color: #785360; font-size: 12px; font-style: normal; padding: 3px 6px; }
.epg-positive { color: #3e913c; }
.epg-score { color: #ab314c; font-size: 14px; font-weight: 800; }
.epg-score.good { color: #3d923e; }
.epg-chip {
  border-radius: 11px;
  display: inline-flex;
  font-size: 12px;
  font-style: normal;
  padding: 3px 7px;
  white-space: nowrap;
}
.epg-chip.ok { background: #e9f5e8; color: #3d813a; }
.epg-chip.warn { background: #fff0df; color: #b8620d; }
.epg-chip.risk { background: #ffe8ec; color: #b52641; }
.epg-chip.info { background: #edf2fb; color: #426a9e; }

.epg-candidate-detail,
.epg-listing-diagnosis { align-self: start; }
.epg-candidate-detail > header h2,
.epg-listing-diagnosis > header h2 { font-size: 18px; margin: 0; }
.epg-summary-list {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 8px 14px;
}
.epg-summary-list div {
  border-bottom: 1px solid #f0e8ea;
  display: grid;
  gap: 4px;
  grid-template-columns: 72px 1fr;
  padding: 8px 0;
}
.epg-summary-list dt { color: #83767b; }
.epg-summary-list dd { font-weight: 700; margin: 0; text-align: right; }
.epg-score-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 10px 14px;
}
.epg-score-grid > div { background: #faf7f8; border: 1px solid #efe5e7; border-radius: 7px; display: grid; gap: 4px; padding: 9px 7px; text-align: center; }
.epg-score-grid span { color: #817378; font-size: 12px; }
.epg-score-grid strong { font-size: 18px; }
.epg-score-grid .warn strong { color: #bd680e; }
.epg-score-grid .risk strong { color: #b92540; }
.epg-ai-panel { background: #fff7f8; border: 1px solid #e9bcc6; border-radius: 7px; margin: 2px 14px 10px; overflow: hidden; }
.epg-ai-panel header { align-items: center; background: var(--epg-wine); color: #fff; display: flex; justify-content: space-between; padding: 8px 10px; }
.epg-ai-panel header span { font-size: 12px; opacity: .8; }
.epg-ai-panel ul { display: grid; gap: 8px; margin: 0; padding: 11px 12px 11px 30px; }
.epg-ai-panel li { color: #634b53; font-size: 12px; }
.epg-detail-actions,
.epg-listing-diagnosis > footer { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 14px 12px; }
.epg-boundary { background: #fff1f2; color: #9b334a; font-size: 12px; margin: 0; padding: 8px 14px; }
.epg-action-plan { border-top: 1px solid #efe5e7; padding: 10px 14px; }
.epg-action-plan h3 { font-size: 14px; margin: 0 0 7px; }
.epg-action-plan > div { align-items: center; border-top: 1px solid #f0e8ea; display: grid; gap: 8px; grid-template-columns: auto 1fr; padding: 7px 0; }
.epg-action-plan > div > span { background: #fff0df; border-radius: 10px; color: #ac5e13; font-size: 12px; padding: 3px 6px; }
.epg-action-plan p { margin: 0; }
.epg-action-plan small { color: #8a7e82; display: block; }

.epg-todo-strip > div,
.epg-alert-strip > div {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 10px;
}
.epg-todo-strip article,
.epg-alert-strip article {
  align-items: center;
  background: #fcf9fa;
  border: 1px solid #eee2e5;
  border-radius: 7px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
  min-height: 64px;
  padding: 9px 11px;
}
.epg-todo-strip article > span,
.epg-alert-strip article > span { color: var(--epg-wine); font-weight: 700; }
.epg-todo-strip p { margin: 0; }
.epg-todo-strip small,
.epg-alert-strip small { color: #8d8085; display: block; font-size: 12px; }
.epg-todo-strip article { grid-template-columns: auto minmax(0, 1fr) auto; }
.epg-todo-strip article > span { white-space: nowrap; }
.epg-alert-strip article {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  min-height: 76px;
}
.epg-alert-strip article > i {
  align-items: center;
  background: #fff1df;
  border-radius: 9px;
  color: #d47a1e;
  display: flex;
  height: 38px;
  justify-content: center;
  width: 38px;
}
.epg-alert-strip article > i svg { height: 21px; width: 21px; }
.epg-alert-strip article.red > i { background: #ffeaec; color: #cf2d49; }
.epg-alert-strip article.blue > i { background: #eaf3ff; color: #3276bd; }
.epg-alert-strip article p { display: grid; gap: 2px; margin: 0; min-width: 0; }
.epg-alert-strip article p > b { font-size: 13px; }
.epg-alert-strip article strong { color: var(--epg-wine); font-size: 20px; line-height: 1; }
.epg-alert-strip article strong small { display: inline; font-size: 12px; font-weight: 400; }
.epg-alert-strip article p > span { color: #8d8085; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.epg-alert-strip article button { min-height: 30px; padding: 5px 10px; }

.epg-empty { align-items: center; color: #84787c; display: flex; flex-direction: column; gap: 8px; justify-content: center; min-height: 180px; padding: 24px; text-align: center; }
.epg-loading { align-items: center; display: flex; flex-direction: column; gap: 8px; justify-content: center; min-height: 460px; }
.epg-loading i { animation: epg-spin .8s linear infinite; border: 3px solid #efdce1; border-radius: 50%; border-top-color: var(--epg-wine, #9f2444); height: 28px; width: 28px; }
.epg-loading span { color: #85777c; }
@keyframes epg-spin { to { transform: rotate(360deg); } }

.epg-drawer-layer { inset: 0; position: fixed; z-index: 1200; }
.epg-drawer-scrim { background: rgba(45, 37, 40, .48) !important; border: 0 !important; border-radius: 0 !important; inset: 0; min-height: 0 !important; padding: 0 !important; position: absolute; width: 100%; }
.epg-drawer {
  background: #fff;
  bottom: 0;
  box-shadow: -14px 0 34px rgba(38, 25, 30, .18);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  position: absolute;
  right: 0;
  top: 0;
  width: min(1020px, 72vw);
}
.epg-form-drawer { width: min(660px, 92vw); }
.epg-drawer > header { align-items: center; border-bottom: 1px solid #eee4e6; display: flex; gap: 16px; justify-content: space-between; padding: 16px 20px; }
.epg-drawer > header h2 { font-size: 23px; margin: 3px 0; }
.epg-drawer > header p { color: #776b70; margin: 0; }
.epg-drawer > header nav { align-items: center; display: flex; gap: 8px; }
.epg-drawer > header nav > button:last-child,
.epg-drawer > header > button:last-child { font-size: 20px; padding: 2px 9px; }
.epg-drawer > main,
.epg-drawer > form > main { overflow: auto; padding: 14px 20px; }
.epg-drawer > form { display: contents; }
.epg-drawer > footer,
.epg-drawer > form > footer {
  align-items: center;
  background: #fff;
  border-top: 1px solid #eee4e6;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 20px;
}
.epg-claim-drawer > footer { justify-content: space-between; }
.epg-claim-drawer > footer nav { display: flex; gap: 8px; }
.epg-form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.epg-form-grid label { display: grid; gap: 5px; }
.epg-form-grid label > span { color: #61565a; font-size: 12px; }
.epg-form-grid .wide { grid-column: 1 / -1; }
.epg-switch {
  align-items: center;
  background: #faf7f8;
  border: 1px solid #eee3e6;
  border-radius: 7px;
  display: flex !important;
  gap: 9px !important;
  min-height: 44px;
  padding: 9px 11px;
}
.epg-switch input { flex: 0 0 auto; height: 16px; width: 16px; }
.epg-confirm-row { align-items: start; display: flex !important; grid-template-columns: auto 1fr; }
.epg-confirm-row input { height: 16px; margin: 2px 0; width: 16px; }
.epg-form-note { background: #fff5f6; border: 1px solid #efd8dd; border-radius: 7px; margin: 12px 20px; padding: 10px 12px; }
.epg-form-note p { color: #7d626a; margin: 4px 0 0; }

.epg-claim-kpis { border: 1px solid #eadde0; border-radius: 8px; display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 12px; }
.epg-claim-kpis > div { border-right: 1px solid #eee4e7; display: grid; gap: 5px; padding: 12px; text-align: center; }
.epg-claim-kpis > div:last-child { border-right: 0; }
.epg-claim-kpis span { color: #7d7075; }
.epg-claim-kpis strong { font-size: 22px; }
.epg-drawer-section { border: 1px solid #eadde0; border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.epg-drawer-section > header label { align-items: center; display: flex; gap: 7px; }
.epg-drawer-section > header select { min-width: 240px; }
.epg-master-summary-grid { align-items: center; display: grid; gap: 14px; grid-template-columns: 90px 1fr; padding: 12px; }
.epg-master-thumb { height: 82px; width: 82px; }
.epg-master-thumb img { height: 100%; object-fit: cover; width: 100%; }
.epg-master-summary-grid dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.epg-master-summary-grid dl > div { border-bottom: 1px solid #f0e8ea; display: flex; justify-content: space-between; padding: 8px 10px; }
.epg-master-summary-grid dt { color: #7f7277; }
.epg-master-summary-grid dd { font-weight: 700; margin: 0; }
.epg-adaptation-grid { display: grid; gap: 10px; grid-template-columns: repeat(4, 1fr); padding: 11px; }
.epg-adaptation-grid article {
  align-items: center;
  border: 1px solid #eee2e5;
  border-radius: 8px;
  display: grid;
  gap: 9px;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  min-height: 68px;
  padding: 10px;
}
.epg-adaptation-grid article > i,
.epg-task-flow article > i {
  align-items: center;
  background: #e7f5eb;
  border-radius: 50%;
  color: #3c8b59;
  display: flex;
  height: 38px;
  justify-content: center;
  width: 38px;
}
.epg-adaptation-grid article.orange > i { background: #fff0dc; color: #d57a13; }
.epg-adaptation-grid article.yellow > i { background: #fff4d9; color: #c88a18; }
.epg-adaptation-grid article.red > i { background: #ffe9ec; color: #c52b45; }
.epg-adaptation-grid svg,
.epg-task-flow svg { height: 21px; width: 21px; }
.epg-adaptation-grid p { display: grid; gap: 4px; margin: 0; }
.epg-adaptation-grid b { color: #3e3539; font-size: 13px; }
.epg-adaptation-grid em { color: #9b8d92; font-size: 20px; font-style: normal; }
.epg-adaptation-grid strong.ok { color: #468741; }
.epg-adaptation-grid strong.warn { color: #b56817; }
.epg-adaptation-grid strong.risk { color: #b92540; }
.epg-task-flow {
  align-items: stretch;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 24px minmax(0, 1fr);
  padding: 11px;
}
.epg-task-flow article {
  align-items: start;
  border: 1px solid #e9dde0;
  border-radius: 8px;
  display: grid;
  gap: 9px;
  grid-template-columns: 38px minmax(0, 1fr);
  min-width: 0;
  padding: 11px;
}
.epg-task-flow article.blue > i { background: #e8f2ff; color: #3c76bc; }
.epg-task-flow article.orange > i { background: #fff0df; color: #d36d17; }
.epg-task-flow article > div { display: grid; gap: 3px; min-width: 0; }
.epg-task-flow article b { font-size: 13px; }
.epg-task-flow article span,
.epg-task-flow article small {
  color: #8c7e83;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.epg-task-flow article span { color: #6f6267; }
.epg-task-flow article small:first-of-type { color: var(--epg-wine); font-weight: 700; }
.epg-task-arrow { align-self: center; color: #9d9094; font-size: 22px; text-align: center; }
.epg-version-note { align-items: center; background: #fff5f6; border: 1px solid #efd9dd; border-radius: 7px; display: flex; gap: 12px; padding: 10px 12px; }
.epg-version-note b { color: var(--epg-wine); }
.epg-package-toolbar {
  align-items: center;
  background: #faf7f8;
  border: 1px solid #eee3e6;
  border-radius: 7px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 9px 11px;
}
.epg-package-toolbar label { align-items: center; display: flex; gap: 8px; }
.epg-package-toolbar select {
  background: #fff;
  border: 1px solid #e2d7da;
  border-radius: 6px;
  height: 34px;
  padding: 5px 9px;
}
.epg-package-toolbar span { color: var(--epg-wine); font-weight: 700; }
.epg-package-drawer .epg-table { min-width: 620px; }

@media (max-width: 1280px) {
  .epg-main-grid { grid-template-columns: minmax(0, 1fr); }
  .epg-candidate-detail,
  .epg-listing-diagnosis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .epg-candidate-detail > header,
  .epg-listing-diagnosis > header,
  .epg-candidate-detail > footer,
  .epg-listing-diagnosis > footer,
  .epg-boundary { grid-column: 1 / -1; }
  .epg-filter-bar,
  .epg-listing-filter { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .epg-filter-bar .search { grid-column: span 2; }
}

@media (max-width: 760px) {
  .epg-page-head { align-items: stretch; flex-direction: column; }
  .epg-page-head nav { justify-content: flex-start; }
  .epg-kpis { grid-auto-flow: column; grid-auto-columns: 180px; grid-template-columns: none; overflow-x: auto; }
  .epg-filter-bar,
  .epg-listing-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .epg-filter-bar .search { grid-column: 1 / -1; }
  .epg-service-banner { grid-template-columns: 1fr; }
  .epg-candidate-detail,
  .epg-listing-diagnosis { display: block; }
  .epg-summary-list { grid-template-columns: 1fr; }
  .epg-todo-strip > div,
  .epg-alert-strip > div { grid-template-columns: 1fr; }
  .epg-drawer { width: 100vw; }
  .epg-form-grid { grid-template-columns: 1fr; }
  .epg-form-grid .wide { grid-column: auto; }
  .epg-claim-kpis { grid-template-columns: repeat(2, 1fr); }
  .epg-master-summary-grid { grid-template-columns: 1fr; }
  .epg-master-summary-grid dl { grid-template-columns: 1fr; }
  .epg-adaptation-grid { grid-template-columns: 1fr; }
  .epg-task-flow { grid-template-columns: 1fr; }
  .epg-task-arrow { transform: rotate(90deg); }
  .epg-claim-drawer > footer { align-items: stretch; flex-direction: column; }
  .epg-claim-drawer > footer nav { justify-content: flex-end; }
}
