/*
 * Rirekisho PDF Generator public form
 * Modern visual refresh with simplified education/work period input and protected processing flow.
 */
.rpg-wrap {
  --rpg-primary: #2563eb;
  --rpg-primary-dark: #1d4ed8;
  --rpg-primary-soft: #eff6ff;
  --rpg-text: #1f2937;
  --rpg-heading: #111827;
  --rpg-muted: #6b7280;
  --rpg-border: #e5e7eb;
  --rpg-border-strong: #d1d5db;
  --rpg-surface: #ffffff;
  --rpg-page: #f3f4f6;
  --rpg-success: #15803d;
  --rpg-danger: #b91c1c;
  width: min(100%, 1080px);
  margin: 24px auto;
  padding: 38px;
  border: 1px solid #e8ebef;
  border-radius: 24px;
  background: var(--rpg-page);
  color: var(--rpg-text);
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

.rpg-wrap *,
.rpg-wrap *::before,
.rpg-wrap *::after {
  box-sizing: border-box;
}

.rpg-wrap [hidden] {
  display: none !important;
}

.rpg-hero {
  max-width: 760px;
  margin: 0 auto 26px;
  text-align: center;
}

.rpg-hero__badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-bottom: 12px;
  padding: 5px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rpg-hero h1 {
  margin: 0 0 8px;
  color: var(--rpg-heading);
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.rpg-hero h1 span {
  white-space: nowrap;
}

.rpg-hero p {
  margin: 0;
  color: var(--rpg-muted);
  font-size: 16px;
}

.rpg-notice {
  position: relative;
  margin: 0 0 22px;
  padding: 15px 18px 15px 48px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  color: #334155;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.06);
}

.rpg-notice::before {
  content: "i";
  position: absolute;
  top: 15px;
  left: 17px;
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 50%;
  background: var(--rpg-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  font-style: normal;
  line-height: 1;
}

.rpg-notice strong {
  color: #1e3a8a;
}

.rpg-form {
  display: grid;
  gap: 20px;
}

.rpg-section {
  overflow: hidden;
  border: 1px solid var(--rpg-border);
  border-radius: 16px;
  background: var(--rpg-surface);
  box-shadow: 0 5px 18px rgba(17, 24, 39, 0.045);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.rpg-section:hover {
  border-color: #d8dde5;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.075);
}

.rpg-section > summary {
  position: relative;
  display: flex;
  min-height: 62px;
  align-items: center;
  padding: 17px 54px 17px 22px;
  cursor: pointer;
  list-style: none;
  border-bottom: 1px solid transparent;
  background: #fbfcfe;
  color: var(--rpg-heading);
  font-size: 17px;
  font-weight: 750;
  line-height: 1.35;
  user-select: none;
}

.rpg-section > summary::-webkit-details-marker {
  display: none;
}

.rpg-section > summary::before {
  content: "";
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-right: 12px;
  border-radius: 50%;
  background: var(--rpg-primary);
  box-shadow: 0 0 0 5px #dbeafe;
}

.rpg-section > summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 23px;
  width: 9px;
  height: 9px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: translateY(-65%) rotate(45deg);
  transition: transform 0.18s ease;
}

.rpg-section[open] > summary {
  border-bottom-color: var(--rpg-border);
  background: #f8fafc;
}

.rpg-section[open] > summary::after {
  transform: translateY(-30%) rotate(225deg);
}

.rpg-section > :not(summary) {
  margin-left: 24px;
  margin-right: 24px;
}

.rpg-section > :last-child {
  margin-bottom: 24px;
}

.rpg-grid {
  display: grid;
  align-items: start;
  gap: 18px;
  padding-top: 24px;
}

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

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

.rpg-subgrid {
  display: grid;
  align-items: start;
  gap: 18px;
  min-width: 0;
}

.rpg-subgrid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rpg-field {
  display: grid;
  align-content: start;
  align-self: start;
  gap: 7px;
  min-width: 0;
}

.rpg-field--full {
  grid-column: 1 / -1;
}

.rpg-field > span {
  color: #374151;
  font-size: 14px;
  font-weight: 650;
}

.rpg-field small,
.rpg-help {
  color: var(--rpg-muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.rpg-field small.is-warning {
  color: #a16207;
  font-weight: 650;
}

.rpg-field input,
.rpg-field select,
.rpg-field textarea,
.rpg-input-table input,
.rpg-input-table select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 45px;
  padding: 10px 13px;
  border: 1px solid var(--rpg-border-strong);
  border-radius: 10px;
  outline: none;
  background: #f9fafb;
  color: var(--rpg-text);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.02);
  font: inherit;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

/* Keep all one-line controls visually aligned, regardless of helper text in a neighbouring field. */
.rpg-field input:not([type="checkbox"]):not([type="radio"]),
.rpg-field select,
.rpg-input-table input:not([type="checkbox"]):not([type="radio"]),
.rpg-input-table select {
  height: 46px;
  min-height: 46px;
}

.rpg-field textarea {
  min-height: 108px;
  resize: vertical;
}

.rpg-field input:hover,
.rpg-field select:hover,
.rpg-field textarea:hover,
.rpg-input-table input:hover,
.rpg-input-table select:hover {
  background: #fff;
  border-color: #b8c0cc;
}

.rpg-field input:focus,
.rpg-field select:focus,
.rpg-field textarea:focus,
.rpg-input-table input:focus,
.rpg-input-table select:focus {
  border-color: var(--rpg-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.rpg-field input[readonly] {
  background: #eef2f7;
  color: #1e3a5f;
  font-weight: 700;
}

.rpg-field input[type="file"] {
  padding: 5px;
  background: #fff;
}

.rpg-field input[type="file"]::file-selector-button {
  min-height: 34px;
  margin-right: 10px;
  padding: 7px 12px;
  border: 0;
  border-radius: 7px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.rpg-help {
  margin-top: 20px;
  margin-bottom: 0;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
}

.rpg-table-wrap {
  width: auto;
  overflow-x: auto;
  margin-top: 16px;
  border: 1px solid var(--rpg-border);
  border-radius: 12px;
  background: #fff;
}

.rpg-input-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.rpg-input-table--history {
  min-width: 1180px;
}

.rpg-input-table--licenses {
  min-width: 1040px;
}

.rpg-input-table th,
.rpg-input-table td {
  padding: 10px;
  border-right: 1px solid var(--rpg-border);
  border-bottom: 1px solid var(--rpg-border);
  vertical-align: middle;
}

.rpg-input-table th:last-child,
.rpg-input-table td:last-child {
  border-right: 0;
}

.rpg-input-table tbody tr:last-child td {
  border-bottom: 0;
}

.rpg-input-table th {
  background: #f8fafc;
  color: #475569;
  text-align: left;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.025em;
}

.rpg-input-table td {
  background: #fff;
}

.rpg-input-table--history th:nth-child(1),
.rpg-input-table--history td:nth-child(1) { width: 105px; }
.rpg-input-table--history th:nth-child(2),
.rpg-input-table--history td:nth-child(2) { width: 85px; }
.rpg-input-table--history th:nth-child(4),
.rpg-input-table--history td:nth-child(4) { width: 210px; }
.rpg-input-table--history th:nth-child(5),
.rpg-input-table--history td:nth-child(5) { width: 330px; }

.rpg-input-table--licenses th:nth-child(1),
.rpg-input-table--licenses td:nth-child(1) { width: 110px; }
.rpg-input-table--licenses th:nth-child(2),
.rpg-input-table--licenses td:nth-child(2) { width: 90px; }
.rpg-input-table--licenses th:nth-child(4),
.rpg-input-table--licenses td:nth-child(4) { width: 250px; }

.rpg-history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rpg-history-action {
  display: inline-flex;
  cursor: pointer;
}

.rpg-history-action input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.rpg-history-action span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 53px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--rpg-border-strong);
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 13px;
  font-weight: 750;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.rpg-history-action input:checked + span {
  border-color: var(--rpg-primary);
  background: var(--rpg-primary);
  color: #fff;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.2);
}

.rpg-history-action input:focus-visible + span {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.rpg-history-action.is-disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.rpg-license-choice,
.rpg-family-occupation {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.rpg-upload-control {
  display: block;
}

.rpg-upload-control input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.rpg-upload-control__button {
  display: inline-flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border: 1px dashed #93c5fd;
  border-radius: 9px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  font-weight: 750;
  text-align: center;
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.rpg-upload-control:hover .rpg-upload-control__button,
.rpg-upload-control:focus-within .rpg-upload-control__button {
  border-color: var(--rpg-primary);
  background: #dbeafe;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.rpg-upload-control__name {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: var(--rpg-muted);
  font-size: 12px;
  line-height: 1.35;
}

.rpg-upload-control__name.is-ready {
  color: var(--rpg-success);
  font-weight: 700;
}

.rpg-repeat-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.rpg-repeat-actions small {
  color: var(--rpg-muted);
  font-weight: 700;
}

.rpg-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.rpg-button:hover {
  transform: translateY(-1px);
}

.rpg-button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.2);
  outline-offset: 2px;
}

.rpg-button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.rpg-button--primary {
  margin-left: auto;
  background: var(--rpg-primary);
  color: #fff;
  box-shadow: 0 5px 12px rgba(37, 99, 235, 0.22);
}

.rpg-button--primary:hover {
  background: var(--rpg-primary-dark);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.rpg-button--secondary {
  border-color: var(--rpg-border-strong);
  background: #fff;
  color: #374151;
}

.rpg-button--secondary:hover {
  border-color: #aeb7c4;
  background: #f8fafc;
  box-shadow: 0 5px 12px rgba(17, 24, 39, 0.07);
}

.rpg-button--danger {
  border-color: #fecaca;
  background: #fff7f7;
  color: var(--rpg-danger);
}

.rpg-button--danger:hover {
  border-color: #fca5a5;
  background: #fef2f2;
  box-shadow: 0 5px 12px rgba(185, 28, 28, 0.08);
}

.rpg-save-flow-help {
  margin: 0;
  padding: 15px 17px;
  border-color: #dbeafe;
  background: #f8fbff;
  color: #475569;
}

.rpg-actions {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--rpg-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.12);
  backdrop-filter: blur(12px);
}

.rpg-status {
  min-height: 0;
  margin: -8px 0 0;
  color: #1e3a8a;
  font-weight: 700;
}

.rpg-status:not(:empty) {
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
}

.rpg-status.is-error {
  color: var(--rpg-danger);
}

.rpg-status.is-error:not(:empty) {
  border-color: #fecaca;
  background: #fef2f2;
}

.rpg-status.is-success {
  color: var(--rpg-success);
}

.rpg-status.is-success:not(:empty) {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.rpg-draft-access,
.rpg-credentials {
  margin: 0;
  padding: 22px;
  border: 1px solid var(--rpg-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(17, 24, 39, 0.045);
}

.rpg-draft-access {
  border-left: 4px solid var(--rpg-primary);
}

.rpg-credentials {
  border-color: #bbf7d0;
  border-left: 4px solid var(--rpg-success);
  background: #f7fff9;
}

.rpg-draft-access h3,
.rpg-credentials h3 {
  margin: 0 0 8px;
  color: var(--rpg-heading);
  font-size: 18px;
  font-weight: 750;
}

.rpg-credentials p {
  margin: 0 0 16px;
  color: var(--rpg-muted);
}

.rpg-draft-access__grid,
.rpg-credentials__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
}

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

.rpg-credentials input[readonly] {
  background: #fff;
  color: #14532d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.rpg-preview {
  margin-top: 24px;
  padding: 22px;
  border: 1px solid var(--rpg-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.07);
}

.rpg-preview h3 {
  margin: 0 0 6px;
  color: #312e81;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.rpg-preview__note {
  margin: 0 0 16px;
  color: var(--rpg-muted);
  font-size: 13px;
}

.rpg-preview__canvas {
  overflow: auto;
  max-height: 78vh;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #64748b;
  text-align: center;
}

.rpg-preview__canvas canvas {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}

.rpg-preview__canvas iframe {
  display: block;
  width: 100%;
  min-height: 72vh;
  border: 0;
  border-radius: 7px;
  background: #fff;
}

.rpg-guide {
  padding-top: 18px;
}

.rpg-guide ul {
  margin: 0 0 14px 18px;
  line-height: 1.65;
}

.rpg-guide code {
  padding: 2px 6px;
  border-radius: 5px;
  background: #f1f5f9;
}

[data-rpg-repeat-row][hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .rpg-wrap {
    width: calc(100% - 24px);
    margin: 12px auto;
    padding: 26px 20px;
    border-radius: 18px;
  }

  .rpg-grid--2,
  .rpg-grid--3,
  .rpg-subgrid--3 {
    grid-template-columns: 1fr;
  }

  .rpg-button--primary {
    margin-left: 0;
  }

  .rpg-draft-access__grid,
  .rpg-credentials__grid {
    grid-template-columns: 1fr;
  }
}

/* Phone-first presentation for repeating input tables. */
@media (max-width: 800px) {
  .rpg-wrap {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 24px 14px 32px;
    overflow-x: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .rpg-hero {
    margin-bottom: 20px;
  }

  .rpg-hero__badge {
    font-size: 10px;
  }

  .rpg-hero h1 {
    font-size: 28px;
  }

  .rpg-hero p {
    font-size: 14px;
  }

  .rpg-notice {
    padding: 13px 14px 13px 43px;
    font-size: 13px;
  }

  .rpg-notice::before {
    top: 13px;
    left: 14px;
  }

  .rpg-form {
    gap: 15px;
  }

  .rpg-section {
    border-radius: 13px;
  }

  .rpg-section > summary {
    min-height: 56px;
    padding: 15px 47px 15px 16px;
    font-size: 15px;
  }

  .rpg-section > summary::before {
    width: 7px;
    height: 7px;
    margin-right: 10px;
    box-shadow: 0 0 0 4px #dbeafe;
  }

  .rpg-section > summary::after {
    right: 19px;
  }

  .rpg-section > :not(summary) {
    margin-left: 14px;
    margin-right: 14px;
  }

  .rpg-section > :last-child {
    margin-bottom: 16px;
  }

  .rpg-grid,
  .rpg-subgrid {
    gap: 14px;
    padding-top: 17px;
  }

  .rpg-help {
    margin-top: 15px;
  }

  .rpg-table-wrap {
    width: 100%;
    overflow: visible;
    margin-top: 12px;
    border: 0;
    background: transparent;
  }

  .rpg-input-table,
  .rpg-input-table--history,
  .rpg-input-table--licenses {
    display: block;
    width: 100%;
    min-width: 0;
    border: 0;
  }

  .rpg-input-table thead {
    display: none;
  }

  .rpg-input-table tbody {
    display: grid;
    width: 100%;
    gap: 12px;
  }

  .rpg-input-table tr {
    display: block;
    width: 100%;
    padding: 13px;
    border: 1px solid var(--rpg-border);
    border-radius: 12px;
    background: #fbfcfe;
    box-shadow: 0 3px 12px rgba(17, 24, 39, 0.04);
  }

  .rpg-input-table td {
    display: grid;
    grid-template-columns: minmax(100px, 35%) minmax(0, 1fr);
    width: 100% !important;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid #edf0f3;
    background: transparent;
  }

  .rpg-input-table td:last-child {
    border-bottom: 0;
  }

  .rpg-input-table td::before {
    color: #475569;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.3;
  }

  .rpg-input-table--family td:nth-child(1)::before { content: "Tanggal lahir"; }
  .rpg-input-table--family td:nth-child(2)::before { content: "Hubungan"; }
  .rpg-input-table--family td:nth-child(3)::before { content: "Nama"; }
  .rpg-input-table--family td:nth-child(4)::before { content: "Katakana"; }
  .rpg-input-table--family td:nth-child(5)::before { content: "Pekerjaan"; }

  .rpg-input-table--history td:nth-child(1)::before { content: "Belajar / Bekerja"; }
  .rpg-input-table--history td:nth-child(2)::before { content: "Dari (Tahun / Bulan)"; }
  .rpg-input-table--history td:nth-child(3)::before { content: "Sampai (Tahun / Bulan)"; }
  .rpg-input-table--history td:nth-child(4)::before { content: "Nama sekolah / kerja"; }
  .rpg-input-table--history td:nth-child(5)::before { content: "Jenis"; }

  .rpg-input-table--licenses td:nth-child(1)::before { content: "Tahun"; }
  .rpg-input-table--licenses td:nth-child(2)::before { content: "Bulan"; }
  .rpg-input-table--licenses td:nth-child(3)::before { content: "Lisensi"; }
  .rpg-input-table--licenses td:nth-child(4)::before { content: "Sertifikat"; }

  .rpg-repeat-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .rpg-repeat-actions .rpg-button {
    width: 100%;
  }

  .rpg-actions {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    padding: 11px;
    border-radius: 13px;
  }

  .rpg-actions .rpg-button,
  .rpg-button--primary {
    width: 100%;
    margin-left: 0;
  }

  .rpg-preview {
    padding: 14px;
    border-radius: 13px;
  }

  .rpg-preview h3 {
    font-size: 22px;
  }

  .rpg-preview__canvas {
    max-height: none;
    padding: 6px;
  }

  .rpg-preview__canvas iframe {
    min-height: 68vh;
  }
}

@media (max-width: 480px) {
  .rpg-wrap {
    padding-right: 10px;
    padding-left: 10px;
  }

  .rpg-section > :not(summary) {
    margin-left: 10px;
    margin-right: 10px;
  }

  .rpg-input-table td {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .rpg-input-table td::before {
    margin-bottom: 1px;
  }

  .rpg-history-actions {
    gap: 5px;
  }

  .rpg-history-action span {
    min-width: 50px;
    padding-right: 8px;
    padding-left: 8px;
  }
}

/* v2.1.6: aligned and compact education/work period input */
.rpg-input-table--history {
  min-width: 1040px;
  table-layout: fixed;
}

.rpg-input-table--history th:nth-child(1),
.rpg-input-table--history td:nth-child(1) { width: 14%; }
.rpg-input-table--history th:nth-child(2),
.rpg-input-table--history td:nth-child(2) { width: 19%; }
.rpg-input-table--history th:nth-child(3),
.rpg-input-table--history td:nth-child(3) { width: 24%; }
.rpg-input-table--history th:nth-child(4),
.rpg-input-table--history td:nth-child(4) { width: 26%; }
.rpg-input-table--history th:nth-child(5),
.rpg-input-table--history td:nth-child(5) { width: 17%; }

.rpg-input-table--history td {
  vertical-align: top;
}

.rpg-history-date-pair {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 8px;
  width: 100%;
}

.rpg-history-end {
  display: grid;
  align-content: start;
  gap: 7px;
}

.rpg-history-current {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  color: #475569;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
}

/* Reset the generic table-input sizing so the checkbox does not secretly make the row taller. */
.rpg-history-current input[type="checkbox"] {
  width: 17px;
  min-width: 17px;
  max-width: 17px;
  height: 17px;
  min-height: 17px;
  margin: 0;
  padding: 0;
  flex: 0 0 17px;
  border-radius: 3px;
  box-shadow: none;
  accent-color: var(--rpg-primary);
}

.rpg-history-current input[type="checkbox"]:hover,
.rpg-history-current input[type="checkbox"]:focus {
  background: initial;
  box-shadow: none;
}

.rpg-history-date-pair input:disabled {
  cursor: not-allowed;
  background: #f1f5f9;
  color: #94a3b8;
  opacity: 0.8;
}

.rpg-processing[hidden] {
  display: none !important;
}

.rpg-processing {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(2px);
}

.rpg-processing__card {
  display: flex;
  min-width: min(340px, 92vw);
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.24);
  text-align: center;
}

.rpg-processing__spinner {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 3px solid #dbeafe;
  border-top-color: var(--rpg-primary);
  border-radius: 999px;
  animation: rpg-processing-spin 0.7s linear infinite;
}

.rpg-processing.is-done .rpg-processing__spinner {
  position: relative;
  border: 0;
  animation: none;
}

.rpg-processing.is-done .rpg-processing__spinner::before {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--rpg-success);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

@keyframes rpg-processing-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  /* This element is a direct child of .rpg-section and already has 14px
     horizontal margins. width:100% would therefore overflow by 28px. */
  .rpg-section > .rpg-table-wrap {
    width: auto;
    max-width: none;
  }

  /* Reset the wide desktop history table after its v2.1.6 rules. */
  .rpg-input-table--history {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: auto;
  }

  .rpg-input-table--history tbody,
  .rpg-input-table--history tr,
  .rpg-input-table--history td {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
  }

  .rpg-input-table--history tbody {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
  }

  .rpg-input-table--history tr {
    display: block;
    width: auto;
    overflow: hidden;
  }

  .rpg-input-table--history td {
    display: grid;
    width: auto !important;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
  }

  .rpg-input-table--history td > *,
  .rpg-input-table--history input,
  .rpg-input-table--history select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .rpg-input-table--history td:nth-child(1)::before { content: "Belajar / Bekerja"; }
  .rpg-input-table--history td:nth-child(2)::before { content: "Dari (Tahun / Bulan)"; }
  .rpg-input-table--history td:nth-child(3)::before { content: "Sampai (Tahun / Bulan)"; }
  .rpg-input-table--history td:nth-child(4)::before { content: "Nama sekolah / kerja"; }
  .rpg-input-table--history td:nth-child(5)::before { content: "Jenis"; }

  .rpg-history-date-pair {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .rpg-history-date-pair input {
    width: 100%;
    min-width: 0;
  }

  .rpg-input-table--history td {
    align-items: start;
  }

  .rpg-history-current {
    width: 100%;
  }
}
.rpg-form [aria-invalid="true"]{border-color:#b91c1c!important;box-shadow:0 0 0 2px rgba(185,28,28,.18)!important;background:#fff7f7!important}

.rpg-existing-access{margin:0 0 22px;padding:18px;border:1px solid #bfdbfe;border-radius:18px;background:linear-gradient(135deg,#eff6ff,#ffffff);box-shadow:0 8px 24px rgba(15,23,42,.06)}
.rpg-existing-access__intro{display:flex;align-items:center;justify-content:space-between;gap:16px}
.rpg-existing-access__intro strong{display:block;font-size:18px;color:#0f172a}
.rpg-existing-access__intro p{margin:5px 0 0;color:#475569}
.rpg-existing-access .rpg-draft-access{margin:16px 0 0;padding-top:16px;border-top:1px solid #dbeafe}
@media(max-width:680px){.rpg-existing-access__intro{align-items:stretch;flex-direction:column}.rpg-existing-access__intro .rpg-button{width:100%}}
