body {
  font-family: Arial, sans-serif;
  margin: 20px;
}

h1 {
  color: #333;
}

header.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 90%;
}

.header-title {
  margin-top: 10px;
  text-align: center;
}

.header-btn {
  height: 36px;
}

input,
textarea {
  width: 100%;
  padding: 8px;
  margin: 6px 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  max-width: 400px;
}

input[type='file'] {
  display: none;
}

.table-wrapper {
  width: 100%;
  max-height: 600px;
  overflow-y: auto;
}

table {
  width: 90%;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 16px auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-size: 13px;
  word-wrap: break-word;
}

th,
td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: left;
  vertical-align: middle;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
}

th {
  background-color: #f29900;
  color: white;
  text-align: center;
  font-size: 13px;
  padding: 8px;
  line-height: 1.2;
  position: sticky;
  top: 0;
  z-index: 2;
}

td a {
  display: block;
  text-align: center;
  font-size: 13px;
}

button {
  padding: 10px 15px;
  background-color: #1e88e5;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.15s ease;
}

button:hover,
.form-row button:hover {
  background-color: #1565c0;
}

button:active,
.form-row button:active {
  background-color: #0d47a1;
}

button:disabled,
.form-row button:disabled {
  background-color: #797878 !important;
  cursor: not-allowed;
  opacity: 0.6;
}

#send_email_btn,
#validate_code_btn {
  width: 160px;
}

.upload_btn {
  display: inline-block;
  background-color: #f29900;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
  word-break: break-word;
  text-align: center;
}

.upload_btn.uploaded {
  background-color: #2e7d32;
}

label.upload_btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.form {
  max-width: 820px;
  margin: 0 auto 18px;
  padding: 8px 12px;
  box-sizing: border-box;
}

.form_row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.form_row label {
    width: 170px;
    flex: 0 0 170px;
    font-weight: 600;
}

.form_row input[type='email'],
.form_row input[type='text'],
.form_row textarea {
    flex: 1 1 200px; /* shrinks but won't go below 200px before wrapping */
    padding: 8px 10px;
    border: 1px solid #cfcfcf;
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
    min-width: 0;
}

.form_row button {
    flex: 0 0 auto;
}

.field_error {
  color: #b00020;
  font-size: 0.9rem;
  margin: 4px 0 10px 170px;
  display: none;
}

.form_row select {
  flex: 1 1 auto;
  padding: 8px 10px;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  font-size: 15px;
  box-sizing: border-box;
}

.contract-modal {
  display: none; /* toggle with JS */
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);

  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modal box */
.contract-modal-content {
  background: white;
  width: 100%;
  max-width: 400px;
  padding: 20px;
  border-radius: 8px;
  box-sizing: border-box;
}

/* Form layout */
.contract-modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Field container */
.contract-modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Label centered */
.contract-modal-field label {
  text-align: center;
  font-weight: 600;
}

/* Select styled like your inputs */
.contract-modal-field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  font-size: 15px;
  box-sizing: border-box;
  background-color: white;
}

/* Disabled state */
.contract-modal-field select:disabled {
  background-color: #f5f5f5;
  color: #888;
}

/* Actions (buttons untouched) */
.contract-modal-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}

#loader {
  text-align: center;
  margin: 20px;
  font-weight: bold;
  color: #555;
}

/* =====================================================
   GLOBAL MODAL SYSTEM (APPLIES TO ALL MODALS)
   ===================================================== */

/* Prevent background scroll while modal is open */
body.modal-open {
  overflow: hidden;
}

/* Modal backdrop */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
}

.modal.show {
  display: flex;
}

/* =====================================================
   SHARED MODAL PANEL (BASE LOOK)
   ===================================================== */

.modal-content {
  background-color: #fff;
  padding: 20px 25px;
  border-radius: 12px;
  width: auto;          /* 🔥 remove hard lock */
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  position: relative;
}

/* Close button (default) */
.close {
  position: absolute;
  top: 10px;
  right: 15px;
  color: #888;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: #000;
}

/* =====================================================
   MODAL: SHOW MESSAGE
   (Restores original centered + compact look)
   ===================================================== */

#modal_message .modal-content {
  width: 380px;
  text-align: center;
  padding: 18px 22px;
}

#modal_message #modal_text {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

.buttons-container {
  max-width: 90%;
  margin: auto;
}

.buttons-row {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr; /* LEFT | CENTER | RIGHT */
  align-items: center;
  margin: 10px 0;
}



.buttons-left {
    justify-self: start;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.buttons-right {
    justify-self: end;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.buttons-center {
    justify-self: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.buttons-row button {
    width: 150px;
    height: 50px;
}

.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #4285F4;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: auto;
}

@keyframes spin {
  0% {transform: rotate(0deg);}
  100% {transform: rotate(360deg);}
}

.copy-row {
  display: grid;
  grid-template-columns: 200px 1fr 50px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.copy-row label {
  font-weight: 600;
}

.copy-row input {
  width: 100%;
  padding: 6px 8px;
}

.copy-btn {
  padding: 6px;
  cursor: pointer;
}

#copy_modal .modal-content {
  width: max-content;
  max-width: 90vw;
}

.cell-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.span-like-button {
  display: inline-block;
  padding: 10px 15px;
  background-color: #1e88e5;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.15s ease;
  text-align: center;
}

.span-like-button:hover {
  background-color: #1565c0;
}

.span-like-button:active {
  background-color: #0d47a1;
}

.span-like-button.disabled {
  background-color: #ccc !important;
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

.upload-btn {
  padding: 8px 12px;
  background: #ff9800;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  justify-content: center;
  text-align: center;
  font-weight: bold;
  width: 90%;
  box-sizing: border-box;
}

.upload-btn:hover {
  background: #e68900;
}

.upload-btn.has-file {
  background: #4caf50;
}

.upload-btn.has-file:hover {
  background: #3d8b40;
}

.upload-btn.disabled {
  background: #797878 !important;
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

/* Diff rows */
.upload-diff-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 13px;
}
.upload-diff-row.match {
  background-color: #e8f5e9;
}
.upload-diff-row.mismatch {
  background-color: #fff3e0;
}
.upload-diff-row .diff-label {
  font-weight: 600;
  color: #333;
}
.upload-diff-row .diff-expected {
  color: #999;
  text-decoration: line-through;
  font-size: 12px;
  margin-right: 6px;
}
.upload-diff-row .diff-found-ok {
  color: #2e7d32;
  font-weight: 600;
}
.upload-diff-row .diff-found-warn {
  color: #e65100;
  font-weight: 600;
}

/* Fill fields */
.upload-fill-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.upload-fill-field label {
  font-weight: 600;
  font-size: 13px;
}
.upload-fill-field input {
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.search-result-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.15s ease;
}

.search-result-item:hover {
    background-color: #f0f0f0;
}

.search-result-item.selected {
    background-color: #e3f2fd;
    font-weight: 600;
}