:root {
  --red: #c7222d;
  --red-dark: #a81722;
  --ink: #181818;
  --muted: #65676c;
  --line: #e4e6ea;
  --panel: #ffffff;
  --bg: #f6f7f9;
  --yellow: #fff0a8;
  --yellow-line: #d6aa15;
  --green: #197a50;
  --green-bg: #eaf7f1;
  --shadow: 0 22px 50px rgba(24, 24, 24, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.screen {
  min-height: 100vh;
}

.login-screen {
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 28%, rgba(199, 34, 45, 0.42) 0 4px, transparent 5px),
    radial-gradient(circle at 82% 34%, rgba(199, 34, 45, 0.34) 0 4px, transparent 5px),
    radial-gradient(circle at 72% 88%, rgba(199, 34, 45, 0.28) 0 4px, transparent 5px),
    linear-gradient(120deg, rgba(255, 255, 255, 0.95), rgba(255, 214, 214, 0.68)),
    repeating-linear-gradient(30deg, rgba(199, 34, 45, 0.10) 0 1px, transparent 1px 42px);
}

.login-card {
  width: min(100%, 360px);
  min-height: 480px;
  padding: 58px 56px 46px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: var(--shadow);
  text-align: center;
}

.medpush-logo {
  display: grid;
  justify-items: center;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}

.logo-word {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  white-space: nowrap;
  font-size: 30px;
  line-height: 1;
}

.logo-med {
  color: var(--red);
}

.logo-push {
  color: #222222;
}

.medpush-logo small {
  margin-top: 3px;
  color: #222222;
  font-size: 9px;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 36px 0 14px;
  color: var(--red);
  font-size: 20px;
}

.assure-mark {
  margin: 0 auto 8px;
  width: fit-content;
  color: var(--red);
  font-weight: 900;
}

.login-card h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 8px;
}

.login-form label {
  display: grid;
  gap: 0;
  text-align: left;
  color: #ffffff;
  background: var(--red);
  border: 1px solid var(--red-dark);
  padding: 8px 10px;
}

.login-form input {
  width: 100%;
  border: 0;
  outline: 0;
  color: #ffffff;
  background: transparent;
  padding: 6px 0 0;
}

.sr-only-submit {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.page-shell {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0;
}

.page-shell.wide {
  width: min(1180px, calc(100% - 40px));
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.page-header h1 {
  margin: 0;
  font-size: 34px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.header-brand {
  color: var(--red);
  font-size: 18px;
  font-weight: 900;
}

.panel,
.case-summary {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 14px 34px rgba(24, 24, 24, 0.07);
}

.dashboard-grid,
.choice-grid {
  display: grid;
  gap: 14px;
}

.dashboard-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.module-card,
.choice-card {
  min-height: 150px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 18px;
  text-align: left;
  box-shadow: 0 14px 34px rgba(24, 24, 24, 0.07);
}

.module-card.active,
.choice-card:hover,
.module-card:hover {
  border-color: var(--red);
  box-shadow: 0 16px 38px rgba(199, 34, 45, 0.16);
}

.module-card span,
.choice-card span {
  display: block;
  font-size: 18px;
  font-weight: 900;
}

.module-card small,
.choice-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.panel {
  padding: 24px;
}

.section-title {
  margin-bottom: 22px;
}

.section-title.with-status {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-title h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.case-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.case-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.case-form input,
.case-form select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

.case-form input:focus,
.case-form select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(199, 34, 45, 0.12);
}

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  grid-column: 1 / -1;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border: 1px solid transparent;
  padding: 9px 16px;
  font-weight: 800;
}

.primary-button {
  background: var(--red);
  color: #ffffff;
}

.secondary-button {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.secondary-button.danger {
  color: var(--red);
}

.case-summary {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 18px;
}

.case-summary div {
  padding: 14px;
  border-right: 1px solid var(--line);
}

.case-summary div:last-child {
  border-right: 0;
}

.case-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.case-summary strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.pass {
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid #b9e4d0;
}

.status-pill.warning {
  color: #7a5a00;
  background: var(--yellow);
  border: 1px solid var(--yellow-line);
}

.document-list {
  display: grid;
  gap: 10px;
}

.admin-panel {
  padding: 22px;
}

.admin-selector {
  display: grid;
  gap: 6px;
  min-width: 220px;
  color: var(--muted);
  font-weight: 800;
}

.admin-selector select,
.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

.admin-form textarea {
  min-height: 80px;
  resize: vertical;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.3fr);
  gap: 18px;
}

.admin-list-panel,
.admin-form-panel {
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 16px;
}

.admin-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.admin-list-header h3,
.admin-form-panel h3 {
  margin: 0;
}

.admin-record-list {
  display: grid;
  gap: 8px;
}

.admin-record {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 12px;
  text-align: left;
}

.admin-record:hover,
.admin-record.selected {
  border-color: var(--red);
}

.admin-record strong,
.admin-record span,
.admin-record small {
  display: block;
}

.admin-record span,
.admin-record small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.admin-form {
  display: grid;
  gap: 14px;
}

.admin-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-fields label,
.brand-row label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.admin-fields .full-width {
  grid-column: 1 / -1;
}

.brand-list {
  display: grid;
  gap: 10px;
}

.brand-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  padding: 10px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 14px;
}

.document-row.missing {
  background: var(--yellow);
  border-color: var(--yellow-line);
}

.document-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.document-heading strong {
  font-size: 16px;
}

.document-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.document-main p {
  margin: 6px 0;
  color: var(--muted);
  line-height: 1.45;
}

.document-main small {
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* Media-invoice document controls laid out as a tidy 2x2 box (client request):
   Uploaded/Missing badge + Upload on the top row, Download + Clear below. */
.document-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.document-actions > * {
  width: 100%;
  min-height: 38px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.file-button,
.clear-file-button,
.file-dl-button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 7px 10px;
  font-weight: 800;
  border-radius: 6px;
}

.file-button input {
  display: none;
}

.clear-file-button {
  color: var(--red);
}

.missing-warning {
  margin: 16px 0;
  padding: 14px;
  background: var(--yellow);
  border: 1px solid var(--yellow-line);
}

.missing-warning ul,
.modal-card ul,
.accepted-summary ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 24, 24, 0.42);
  /* Above sticky table headers (position:sticky), dropdown menus (z-index 80)
     and the fixed footer (z-index 60) -- otherwise a sticky red tracker header
     shows through/over the open editor. */
  z-index: 1000;
}

.modal-card {
  width: min(560px, 100%);
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 24px;
}

.modal-card h2 {
  margin: 0 0 10px;
}

.modal-card p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.accepted-summary {
  display: grid;
  gap: 12px;
}

.export-status {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.summary-block {
  border: 1px solid var(--line);
  padding: 14px;
}

.summary-block h3 {
  margin: 0;
}

.status-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.status-toolbar label {
  display: grid;
  gap: 7px;
  flex: 1;
  color: var(--muted);
  font-weight: 800;
}

.status-toolbar input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  padding: 9px 11px;
}

.campaign-status-list {
  display: grid;
  gap: 10px;
}

.campaign-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 14px;
}

.campaign-status-row strong,
.campaign-status-row span,
.campaign-status-row small {
  display: block;
}

.campaign-status-row span,
.campaign-status-row small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.campaign-status-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.warning-block {
  background: var(--yellow);
  border-color: var(--yellow-line);
}

@media (max-width: 820px) {
  .login-card {
    padding: 44px 28px;
  }

  .page-header,
  .section-title.with-status {
    align-items: flex-start;
    flex-direction: column;
  }

  .case-form,
  .case-summary,
  .choice-grid,
  .dashboard-grid,
  .admin-layout,
  .admin-fields,
  .brand-row,
  .campaign-status-row,
  .document-row {
    grid-template-columns: 1fr;
  }

  .case-summary div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .case-summary div:last-child {
    border-bottom: 0;
  }

  .document-actions {
    justify-content: flex-start;
  }

  .status-toolbar,
  .campaign-status-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
