/* =====================================================
   1. Data tables (.sites, .loans): full width, bordered
   ===================================================== */
.sites,
.loans {
  overflow-x: auto;
  padding: 10px 0;
}

.sites table,
.loans table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #cfd4dc;
  background: #fff;
  font-size: 15px;
}

.sites table th, .sites table td,
.loans table th, .loans table td {
  border: 1px solid #cfd4dc;
  padding: 14px 18px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.sites table thead th,
.loans table thead th {
  background: #f3f4f6;
  border-bottom: 2px solid #b8bec9;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .03em;
  color: #4b5160;
}

.sites table tbody td,
.loans table tbody td {
  color: #2b2d31;
  transition: background .15s ease;
}

.sites table tbody tr:nth-child(even) td,
.loans table tbody tr:nth-child(even) td { background: #fafbfc; }

.sites table tbody tr:hover td,
.loans table tbody tr:hover td { background: #faf3e3; }

.sites table tbody td:first-child,
.loans table tbody td:first-child { font-weight: 600; }

.sites table tbody td a,
.loans table tbody td a {
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color .15s ease, color .15s ease;
}
.sites table tbody td a:hover,
.loans table tbody td a:hover {
  color: #b9801f;
  border-bottom-color: #e6a94a;
}

/* =====================================================
   2. Same tables on phones: one card per row
      (every <td> needs a data-label attribute)
   ===================================================== */
@media (max-width: 767px) {
  .sites table, .sites table tbody, .sites table tr, .sites table td,
  .loans table, .loans table tbody, .loans table tr, .loans table td {
    display: block;
    width: 100%;
  }

  .sites table thead,
  .loans table thead { position: absolute; left: -9999px; }

  .sites table tbody tr,
  .loans table tbody tr {
    border: 1px solid #cfd4dc;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
    background: #fff;
  }

  .sites table tbody td,
  .loans table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    text-align: right;
    white-space: normal;
    word-break: break-word;
    border: 0;
    border-bottom: 1px solid #eef0f3;
    padding: 10px 14px;
  }
  .sites table tbody td:last-child,
  .loans table tbody td:last-child { border-bottom: 0; }

  .sites table tbody td::before,
  .loans table tbody td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    text-align: left;
    font-weight: 600;
    color: #4b5160;
  }

  /* first cell = card title */
  .sites table tbody tr td:first-child,
  .loans table tbody tr td:first-child {
    background: #f3f4f6;
    font-size: 16px;
  }
}

/* =====================================================
   3. Loan pages with Bootstrap tables (.loans-page)
   ===================================================== */
.desktop-only { display: table !important; }
.mobile-only  { display: none !important; }
@media (max-width: 767px) {
  .desktop-only { display: none !important; }
  .mobile-only  { display: table !important; }
}

.table-item { display: block; color: inherit; text-decoration: none; }
.table-item:hover { color: #b9801f; }

.loans-page .table { width: 100%; margin-bottom: 0; }
.loans-page .table th,
.loans-page .table td { padding: 12px 14px; vertical-align: middle; }
.loans-page .table-dark th { background: #212529; color: #fff; }
.loans-page .table-striped tbody tr:nth-child(odd) td,
.loans-page .table-striped tbody tr:nth-child(odd) th { background: #f2f2f2; }
.loans-page .table-bordered,
.loans-page .table-bordered th,
.loans-page .table-bordered td { border: 1px solid #dee2e6; }
.loans-page .table-bordered { border-collapse: collapse; }

/* =====================================================
   4. Login / register
   ===================================================== */
.auth-wrap {
  min-height: calc(100vh - 100px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-box { width: 100%; max-width: 420px; }
.auth-box-wide { max-width: 520px; }
.auth-box h3 { text-align: center; margin-bottom: 25px; }
.auth-box .btn { width: 100%; }

.auth-field { margin-bottom: 16px; }
.auth-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #4b5160;
}

/* dropdowns: same look as the text inputs, black text */
.auth-field select,
.auth-box select {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  padding: 10px 40px 10px 14px !important;
  color: #2b2d31 !important;
  -webkit-text-fill-color: #2b2d31 !important;
  background-color: #fff !important;
  border: 1px solid #cfd4dc !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  font-size: inherit !important;
  line-height: 1.4 !important;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%234b5160' stroke-width='2'/></svg>") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
}

.auth-field select:focus,
.auth-box select:focus {
  border-color: #e6a94a !important;
  outline: 0;
}

/* the opened list */
.auth-field select option,
.auth-box select option {
  color: #2b2d31 !important;
  background: #fff !important;
}

.auth-field .errorlist,
.auth-box .alert .errorlist {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  color: #c0392b;
  font-size: 13px;
}

/* forced, because the theme styles bare inputs with its own colors */
.auth-field input,
.auth-box input[type="text"],
.auth-box input[type="email"],
.auth-box input[type="password"] {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  padding: 10px 14px !important;
  color: #2b2d31 !important;
  background: #fff !important;
  border: 1px solid #cfd4dc !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}
.auth-field input:focus {
  border-color: #e6a94a !important;
  outline: 0;
}

/* Pay button */
.pay-btn {
  display: inline-block;
  padding: 6px 16px;
  background: #e6a94a;
  color: #fff !important;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.pay-btn:hover { background: #d4942f; }

/* ----- row status colours ----- */
.sites table tbody tr.site-active   td { background: #eaf7ee; }
.sites table tbody tr.site-expiring td { background: #fff4cc; }
.sites table tbody tr.site-expired  td { background: #fde4e4; }

.sites table tbody tr.site-active:hover   td { background: #d9f0e0; }
.sites table tbody tr.site-expiring:hover td { background: #ffeba6; }
.sites table tbody tr.site-expired:hover  td { background: #fbd0d0; }

/* the date that caused the status is emphasised */
.sites td.date-expiring span { color: #9a6b00; font-weight: 700; }
.sites td.date-expired  span { color: #c0392b; font-weight: 700; }
.sites td.date-active   span { color: #1e7a3c; font-weight: 600; }

/* renew button inside the date cell */
.date-cell { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.renew-form { margin: 0; }
.sites .pay-btn {
  border: 0;
  padding: 4px 10px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.4;
  cursor: pointer;
}

/* legend */
.sites-legend { margin: 0 0 12px; font-size: 14px; color: #4b5160; }
.sites-legend .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin: 0 6px 0 16px; vertical-align: -1px; }
.sites-legend .dot:first-child { margin-left: 0; }
.dot-active   { background: #4caf6f; }
.dot-expiring { background: #f2c230; }
.dot-expired  { background: #e05252; }

/* ----- loan row colours (override Bootstrap's striping) ----- */
.loans-page .table .loan-high > td, .loans-page .table .loan-high > th,
.loans-page .table .loan-high > tr > td, .loans-page .table .loan-high > tr > th {
  background: #fde4e4 !important; box-shadow: none !important;
}
.loans-page .table .loan-mid > td, .loans-page .table .loan-mid > th,
.loans-page .table .loan-mid > tr > td, .loans-page .table .loan-mid > tr > th {
  background: #fff4cc !important; box-shadow: none !important;
}
.loans-page .table .loan-low > td, .loans-page .table .loan-low > th,
.loans-page .table .loan-low > tr > td, .loans-page .table .loan-low > tr > th {
  background: #eaf7ee !important; box-shadow: none !important;
}

/* slightly darker on hover (desktop rows) */
.loans-page .table tr.loan-high:hover > td { background: #fbd0d0 !important; }
.loans-page .table tr.loan-mid:hover  > td { background: #ffeba6 !important; }
.loans-page .table tr.loan-low:hover  > td { background: #d9f0e0 !important; }

/* ----- loans list row colours (.sites.loans table) ----- */
.sites table tbody tr.loan-high td { background: #fde4e4 !important; }
.sites table tbody tr.loan-mid  td { background: #fff4cc !important; }
.sites table tbody tr.loan-low  td { background: #eaf7ee !important; }

.sites table tbody tr.loan-high:hover td { background: #fbd0d0 !important; }
.sites table tbody tr.loan-mid:hover  td { background: #ffeba6 !important; }
.sites table tbody tr.loan-low:hover  td { background: #d9f0e0 !important; }

/* ----- loan detail page ----- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.page-head h2 { margin: 0; }
.page-head .pay-btn { margin-right: 8px; }

.back-btn {
  padding: 6px 16px;
  background: #fff;
  color: #4b5160;
  border: 1px solid #cfd4dc;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
.back-btn:hover { border-color: #e6a94a; color: #b9801f; }

.block-title { font-size: 18px; margin: 0 0 12px; }

.detail-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #cfd4dc;
  background: #fff;
  font-size: 15px;
}
.detail-table th,
.detail-table td {
  border: 1px solid #cfd4dc;
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
}
.detail-table th {
  width: 48%;
  background: #f3f4f6;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .03em;
  color: #4b5160;
}
.detail-table td { color: #2b2d31; font-weight: 600; }

/* ----- progress bars ----- */
.progress-wrap { margin-bottom: 28px; }
.progress-info {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 14px;
  color: #4b5160;
}
.progress-info strong { color: #2b2d31; }

.progress-track {
  height: 12px;
  background: #e9ecef;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  min-width: 2px;
  background: #e6a94a;
  border-radius: 999px;
  transition: width .4s ease;
}
.progress-fill.done { background: #4caf6f; }

.progress-mini { display: flex; align-items: center; gap: 10px; min-width: 130px; }
.progress-mini .progress-track { flex: 1; height: 8px; }
.progress-mini span { font-size: 13px; font-weight: 600; color: #4b5160; }