:root {
  --ink: #1d1d1f;
  --muted: #686872;
  --line: #dddddf;
  --paper: #ffffff;
  --soft: #f6f7f9;
  --purple: #a12c98;
  --green: #9fce3d;
  --blue: #29a7dd;
  --teal: #26a49b;
  --red: #f21b2a;
  --yellow: #ffcd21;
  --orange: #f9ad14;
  --shadow: 0 18px 45px rgba(29, 29, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(241, 27, 42, 0.08), transparent 35%),
    linear-gradient(315deg, rgba(38, 164, 155, 0.12), transparent 42%),
    var(--soft);
  font-family: Arial, Helvetica, sans-serif;
}

.admin-app-mode {
  background: #f5f6f8;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.admin-nav {
  background: #101113;
  color: #fff;
  padding: 24px 18px;
}

.admin-nav .brand-mark {
  margin-bottom: 28px;
}

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

.admin-tab {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-weight: 800;
  text-align: left;
  padding: 0 14px;
  cursor: pointer;
}

.admin-tab.active {
  background: #ffd02a;
  color: #101113;
}

.admin-main {
  min-width: 0;
}

.login-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
}

.login-card {
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-actions {
  justify-content: flex-start;
  margin-top: 16px;
}

.admin-content {
  padding: 28px;
}

.admin-topbar,
.admin-section-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
}

.admin-view {
  display: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.admin-view.active {
  display: block;
}

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

.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfbfc;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
}

.admin-form {
  margin-bottom: 16px;
}

.table-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    position: static;
  }

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 310px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px;
  background: #101113;
  color: #fff;
}

.brand-mark {
  display: grid;
  place-items: center;
  min-height: 130px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.brand-mark img {
  display: none;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
}

.brand-mark img,
.brand-mark.has-logo img {
  display: block;
}

.brand-mark img[src] + #logoFallback,
.brand-mark.has-logo #logoFallback {
  display: none;
}

#logoFallback {
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

.sidebar-upload {
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  margin-top: -18px;
  color: #111;
  background: var(--yellow);
  border-radius: 7px;
  font-weight: 900;
  cursor: pointer;
}

.hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

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

.task-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  text-align: left;
}

.task-button.active,
.task-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.task-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #111;
  background: var(--yellow);
  border-radius: 50%;
  font-weight: 800;
}

.task-button strong,
.task-button small {
  display: block;
}

body.candidate-mode .task-button[data-step="admin"] {
  display: none;
}

body.no-training-required .task-button[data-step="training"],
body.no-training-required .step-panel[data-panel="training"] {
  display: none;
}

.task-button small {
  margin-top: 2px;
  font-size: 12px;
  color: currentColor;
  opacity: 0.72;
}

.portal {
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 24px;
}

.status-pill {
  min-width: 230px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.meter {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  background: #ececef;
  border-radius: 99px;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--teal));
  transition: width 180ms ease;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}

.flow-panel,
.admin-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.flow-panel {
  min-height: 660px;
}

.step-panel {
  display: none;
  padding: 30px;
}

.step-panel.active {
  display: block;
}

.panel-heading {
  margin-bottom: 24px;
}

.intro-grid,
.form-grid,
.signature-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.span-2 {
  grid-column: span 2;
}

label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfcfd5;
  border-radius: 7px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(41, 167, 221, 0.16);
}

input[readonly] {
  color: #4b4b53;
  background: #f1f2f4;
}

.notice-strip,
.invite-result,
.document-banner,
.offer-card,
.review-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfc;
}

.notice-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding: 14px 16px;
}

.notice-strip p {
  margin: 0;
}

.notice-dot {
  width: 12px;
  height: 12px;
  background: var(--green);
  border-radius: 50%;
}

.admin-create {
  display: grid;
  gap: 20px;
}

.admin-generate {
  justify-self: start;
}

.invite-result {
  display: grid;
  gap: 14px;
  margin-top: 20px;
  padding: 16px;
}

.invite-result[hidden] {
  display: none;
}

.invite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.invite-mail {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.submissions-panel {
  display: grid;
  gap: 14px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.compact-heading {
  margin-bottom: 0;
}

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

.submission-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fbfbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.submission-item strong,
.submission-item small {
  display: block;
}

.submission-item small {
  margin-top: 3px;
  color: var(--muted);
}

.submission-detail {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
  background: #101113;
  color: #fff;
  border-radius: 8px;
}

.submission-detail:empty {
  display: none;
}

.offer-card {
  display: grid;
  gap: 14px;
  padding: 24px;
  margin-bottom: 22px;
  font-size: 17px;
  line-height: 1.48;
}

.offer-card p {
  margin: 0;
}

.generated-offer h3 {
  margin: 0;
  font-size: 18px;
  text-transform: uppercase;
}

.offer-letterhead {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 14px;
}

.offer-letterhead strong {
  color: var(--ink);
}

.document-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.document-banner strong,
.document-banner span {
  display: block;
}

.document-banner span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.document-banner input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-action {
  display: inline-grid;
  place-items: center;
  min-height: 40px;
  margin: 0;
  border: 0;
  padding: 0 14px;
  color: #fff;
  background: var(--blue);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.secondary-file-action {
  background: var(--teal);
}

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

.terms-list div {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.terms-list span {
  color: var(--muted);
}

.template-note {
  padding-top: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.section-divider {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.section-divider strong {
  color: var(--purple);
}

.disclaimer-box {
  padding: 14px 16px;
  color: #45454c;
  background: #fbfbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.45;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
}

.check-row input {
  width: 20px;
  min-height: 20px;
}

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

.training-options .check-row {
  padding: 10px 12px;
  background: #fbfbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  background: #ececef;
  border-radius: 8px;
}

.segmented label {
  margin: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: block;
  min-width: 130px;
  padding: 10px 14px;
  border-radius: 6px;
  text-align: center;
}

.segmented input:checked + span {
  color: #fff;
  background: var(--teal);
}

.deposit-notice {
  margin-top: 0;
  margin-bottom: 18px;
}

.review-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.review-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
}

.review-item strong {
  font-size: 14px;
}

.review-item span {
  color: var(--muted);
  text-align: right;
}

.flow-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 30px;
  border-top: 1px solid var(--line);
}

.primary-action,
.ghost-action,
.export-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 7px;
  font-weight: 800;
}

.primary-action {
  color: #fff;
  background: var(--red);
  border: 1px solid var(--red);
}

.ghost-action,
.export-button {
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfcfd5;
}

.admin-panel {
  padding: 22px;
}

.admin-header {
  margin-bottom: 16px;
}

.admin-card {
  display: grid;
  gap: 4px;
  padding: 16px;
  margin-bottom: 16px;
  color: #fff;
  background: #151619;
  border-radius: 8px;
}

.admin-label,
.admin-card small {
  color: rgba(255, 255, 255, 0.72);
}

.checklist {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
}

.admin-check {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.admin-check:last-child {
  border-bottom: 0;
}

.check-badge {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #fff;
  background: #a9a9b2;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 900;
}

.admin-check.done .check-badge {
  background: var(--green);
}

.admin-check small {
  color: var(--muted);
}

.export-button {
  width: 100%;
}

.submit-message {
  min-height: 24px;
  color: var(--teal);
  font-weight: 800;
}

.step-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--red);
  font-weight: 800;
}

.training-link-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding: 14px 16px;
  background: #fbfbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.training-link-panel[hidden] {
  display: none;
}

.training-link-panel a {
  color: var(--blue);
  font-weight: 800;
}

@media (max-width: 1000px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 20px;
  }

  .task-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .portal {
    padding: 18px;
  }

  .topbar,
  .workspace,
  .intro-grid,
  .form-grid,
  .signature-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .task-list {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .check-grid {
    grid-template-columns: 1fr;
  }

  .document-banner {
    grid-template-columns: 1fr;
  }

  .step-panel,
  .flow-actions {
    padding: 20px;
  }

  h1 {
    font-size: 28px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .admin-panel,
  .document-banner,
  .flow-actions,
  .step-panel:not([data-panel="offer"]) {
    display: none !important;
  }

  .app-shell,
  .workspace {
    display: block;
  }

  .portal {
    padding: 0;
  }

  .flow-panel,
  .offer-card {
    border: 0;
    box-shadow: none;
  }

  .step-panel[data-panel="offer"] {
    display: block;
    padding: 0;
  }
}
