.roster-review-modal {
  position: relative;
  width: min(1120px, 96vw);
  max-width: 1120px;
  max-height: 92vh;
  overflow: auto;
}

.roster-review-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 0 4rem 1rem 0;
  border-bottom: 1px solid var(--border, #d9e1e8);
}

[dir="rtl"] .roster-review-header { padding: 0 0 1rem 4rem; }
.roster-review-header h2 { margin: .15rem 0 .35rem; }
.roster-review-header p { margin: 0; }
.roster-review-eyebrow { font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, #64748b); }
.roster-review-status { flex: 0 0 auto; padding: .5rem .8rem; border-radius: 999px; font-weight: 800; white-space: nowrap; }
.roster-review-status.danger { background: #fde8eb; color: #8e1728; }
.roster-review-status.success { background: #e4f6eb; color: #0d6335; }

.roster-review-blocked {
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid #d95b6b;
  border-inline-start: 5px solid #bd263a;
  border-radius: .75rem;
  background: #fff1f3;
  color: #65101e;
}

.roster-review-blocked strong { color: #65101e; }
.roster-review-blocked p { margin: .4rem 0 0; color: #751d2a; }
.roster-review-clear,
.roster-save-result { padding: 1rem; border-inline-start: 4px solid #16935e; margin: 1rem 0; background: var(--surface-muted, #f5f8fa); border-radius: .5rem; }

.roster-employee-conflicts { display: grid; gap: .75rem; margin: 1rem 0; }
.roster-employee-conflict { border: 1px solid var(--border, #cbd7e3); border-radius: .8rem; overflow: hidden; background: var(--surface, #fff); }
.roster-employee-conflict > summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  min-height: 72px;
  padding: .85rem 1rem;
  cursor: pointer;
  list-style: none;
  background: var(--surface-muted, #f3f7fa);
}

.roster-employee-conflict > summary::-webkit-details-marker { display: none; }
.roster-employee-conflict > summary::after { content: "+"; flex: 0 0 auto; width: 1.8rem; height: 1.8rem; display: grid; place-items: center; border: 1px solid var(--border, #b9c8d8); border-radius: 50%; font-weight: 900; color: var(--text, #0f2948); }
.roster-employee-conflict[open] > summary::after { content: "−"; }
.roster-employee-conflict[open] > summary { border-bottom: 1px solid var(--border, #cbd7e3); }
.roster-employee-conflict h3 { margin: 0 0 .15rem; font-size: 1.05rem; }
.roster-employee-conflict summary span { color: var(--muted, #64748b); font-size: .88rem; }
.roster-conflict-summary { display: grid; gap: .15rem; margin-inline-start: auto; text-align: end; }
.roster-conflict-summary strong { color: var(--text, #102a49); }

.roster-conflict-list { display: grid; }
.roster-conflict-row { display: grid; grid-template-columns: minmax(125px, .75fr) minmax(190px, 1.2fr) minmax(190px, 1.2fr) minmax(250px, 1.5fr); gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--border, #d9e1e8); align-items: start; }
.roster-conflict-row:last-child { border-bottom: 0; }
.roster-conflict-date,
.roster-conflict-detail { display: grid; gap: .3rem; min-width: 0; }
.roster-conflict-detail span:not(.roster-conflict-label),
.roster-conflict-detail small { overflow-wrap: anywhere; }
.roster-conflict-label { font-size: .76rem; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; color: #315f91; }
.roster-conflict-reason strong { color: #a31d2d; line-height: 1.4; }
.roster-conflict-reason a { color: #2457b2; font-weight: 700; }
.roster-conflict-invalid { grid-column: 2 / -1; }
.roster-conflict-invalid p { margin: .2rem 0; }
.roster-fix-guidance { margin: .25rem 0; color: var(--text, #142c49); font-weight: 700; line-height: 1.45; }
.roster-plain-note { color: var(--muted, #64748b); }

.roster-review-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; margin-top: 1rem; padding: 1rem 0 .2rem; border-top: 1px solid var(--border, #d9e1e8); background: var(--surface, #fff); }
.roster-operation-row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--border, #d9e1e8); }
.roster-operation-row > strong { min-width: 200px; }
.roster-retained,
.roster-operation-history { margin-top: 1rem; }
.roster-review-table-wrap { overflow: auto; margin: 1rem 0; max-height: 48vh; }
.roster-review-table-wrap table { min-width: 700px; width: 100%; border-collapse: collapse; }
.roster-review-table-wrap th,
.roster-review-table-wrap td { padding: .7rem; text-align: start; vertical-align: top; border-bottom: 1px solid var(--border, #d9e1e8); }
.back-link { display: block; margin-top: .35rem; }

html[data-theme="dark"] .roster-review-modal { color: #f5f8fc; }
html[data-theme="dark"] .roster-review-status.danger { background: #5b202a; color: #ffd7dc; border: 1px solid #a84756; }
html[data-theme="dark"] .roster-review-status.success { background: #163d2a; color: #b7f2ce; border: 1px solid #397b59; }
html[data-theme="dark"] .roster-review-blocked { background: #3a1d25; border-color: #9f4856; border-inline-start-color: #ff7182; color: #fff4f5; }
html[data-theme="dark"] .roster-review-blocked strong { color: #fff; }
html[data-theme="dark"] .roster-review-blocked p { color: #ffdce1; }
html[data-theme="dark"] .roster-employee-conflict { background: #17263a; border-color: #4d6380; }
html[data-theme="dark"] .roster-employee-conflict > summary { background: #223752; }
html[data-theme="dark"] .roster-employee-conflict > summary::after { border-color: #7890ad; color: #fff; }
html[data-theme="dark"] .roster-employee-conflict[open] > summary { border-color: #4d6380; }
html[data-theme="dark"] .roster-employee-conflict h3,
html[data-theme="dark"] .roster-conflict-summary strong { color: #fff; }
html[data-theme="dark"] .roster-employee-conflict summary span,
html[data-theme="dark"] .roster-plain-note { color: #c5d2e1; }
html[data-theme="dark"] .roster-conflict-row { border-color: #41556f; }
html[data-theme="dark"] .roster-conflict-label { color: #9dd0ff; }
html[data-theme="dark"] .roster-conflict-reason strong { color: #ff9eaa; }
html[data-theme="dark"] .roster-conflict-reason a { color: #a9c8ff; }
html[data-theme="dark"] .roster-fix-guidance { color: #f5f8fc; }
html[data-theme="dark"] .roster-review-actions { background: #17263a; }

@media (max-width: 800px) {
  .roster-review-header { align-items: stretch; flex-direction: column; padding-inline-end: 3.5rem; }
  [dir="rtl"] .roster-review-header { padding-inline-start: 3.5rem; padding-inline-end: 0; }
  .roster-review-status { align-self: flex-start; white-space: normal; }
  .roster-employee-conflict > summary { align-items: flex-start; }
  .roster-conflict-summary { text-align: start; }
  .roster-conflict-row { grid-template-columns: 1fr; }
  .roster-conflict-invalid { grid-column: auto; }
  .roster-conflict-detail { padding-top: .65rem; border-top: 1px dashed var(--border, #52657e); }
}
