:root {
  --pcl-primary: #30aed1;
  --pcl-primary-dark: #258ab6;
  --pcl-primary-soft: rgba(48, 174, 209, 0.12);
  --pcl-primary-rgb: 48, 174, 209;
  --pcl-primary-ink: #0b5d72;
}

/* Primary pill button style (matches pcl_scav) */
.pcl-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px !important;
  padding: 0.56rem 1.2rem !important;
  font-weight: 700 !important;
  line-height: 1.1;
  background: var(--pcl-primary) !important;
  border: 2px solid var(--pcl-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 14px rgba(var(--pcl-primary-rgb), 0.18);
  text-decoration: none !important;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.pcl-pill-btn:hover,
.pcl-pill-btn:focus,
.pcl-pill-btn:active {
  background: var(--pcl-primary-dark) !important;
  border-color: var(--pcl-primary-dark) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(var(--pcl-primary-rgb), 0.22);
  outline: none !important;
  text-decoration: none !important;
}

.pcl-pill-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 999px !important;
  padding: 0.44rem 0.95rem !important;
  font-weight: 700 !important;
  line-height: 1.1;
  background: transparent !important;
  color: var(--pcl-primary) !important;
  border: 2px solid var(--pcl-primary) !important;
  box-shadow: none !important;
  text-decoration: none !important;
  transition: all 0.2s ease;
}

.pcl-pill-btn-outline:hover,
.pcl-pill-btn-outline:focus,
.pcl-pill-btn-outline:active {
  background: rgba(var(--pcl-primary-rgb), 0.1) !important;
  color: var(--pcl-primary-ink) !important;
  border-color: var(--pcl-primary-dark) !important;
  outline: none !important;
  text-decoration: none !important;
}

.pcl-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.pcl-status-pill-active {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.pcl-status-pill-inactive {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

/* Make generated mform action buttons in books admin match scav pills */
.mform .fitem_actionbuttons .btn,
.mform .fitem_actionbuttons .felement button,
.mform .fitem_actionbuttons input[type="submit"],
.mform .fitem_fgroup .felement.fgroup .btn,
.mform .fitem_fgroup .felement.fgroup button,
.mform .fitem_fgroup .felement.fgroup input[type="submit"] {
  border-radius: 999px !important;
  font-weight: 700 !important;
  padding: 0.56rem 1.2rem !important;
  min-height: 44px;
  text-decoration: none !important;
}

.mform .fitem_actionbuttons .btn-primary,
.mform .fitem_actionbuttons .felement button.btn-primary,
.mform .fitem_actionbuttons input[name="submitbutton"],
.mform .fitem_fgroup .felement.fgroup .btn-primary,
.mform .fitem_fgroup .felement.fgroup input[name="submitbutton"] {
  background: var(--pcl-primary) !important;
  border: 2px solid var(--pcl-primary) !important;
  color: #fff !important;
}

.mform .fitem_actionbuttons .btn-primary:hover,
.mform .fitem_actionbuttons .btn-primary:focus,
.mform .fitem_actionbuttons .felement button.btn-primary:hover,
.mform .fitem_actionbuttons .felement button.btn-primary:focus,
.mform .fitem_actionbuttons input[name="submitbutton"]:hover,
.mform .fitem_actionbuttons input[name="submitbutton"]:focus,
.mform .fitem_fgroup .felement.fgroup .btn-primary:hover,
.mform .fitem_fgroup .felement.fgroup .btn-primary:focus,
.mform .fitem_fgroup .felement.fgroup input[name="submitbutton"]:hover,
.mform .fitem_fgroup .felement.fgroup input[name="submitbutton"]:focus {
  background: var(--pcl-primary-dark) !important;
  border-color: var(--pcl-primary-dark) !important;
}

.mform .fitem_actionbuttons .btn-secondary,
.mform .fitem_actionbuttons .felement button.btn-secondary,
.mform .fitem_actionbuttons button.btn-cancel,
.mform .fitem_actionbuttons input.btn-cancel,
.mform .fitem_actionbuttons [data-cancel="1"],
.mform .fitem_actionbuttons input[name="cancel"],
.mform .fitem_fgroup .felement.fgroup .btn-secondary,
.mform .fitem_fgroup .felement.fgroup button.btn-cancel,
.mform .fitem_fgroup .felement.fgroup input.btn-cancel,
.mform .fitem_fgroup .felement.fgroup [data-cancel="1"],
.mform .fitem_fgroup .felement.fgroup input[name="cancel"] {
  background: #fff !important;
  border: 2px solid rgba(var(--pcl-primary-rgb), 0.5) !important;
  color: var(--pcl-primary-ink) !important;
}

.mform .fitem_actionbuttons .btn-secondary:hover,
.mform .fitem_actionbuttons .btn-secondary:focus,
.mform .fitem_actionbuttons button.btn-cancel:hover,
.mform .fitem_actionbuttons button.btn-cancel:focus,
.mform .fitem_actionbuttons input.btn-cancel:hover,
.mform .fitem_actionbuttons input.btn-cancel:focus,
.mform .fitem_actionbuttons [data-cancel="1"]:hover,
.mform .fitem_actionbuttons [data-cancel="1"]:focus,
.mform .fitem_actionbuttons input[name="cancel"]:hover,
.mform .fitem_actionbuttons input[name="cancel"]:focus,
.mform .fitem_fgroup .felement.fgroup .btn-secondary:hover,
.mform .fitem_fgroup .felement.fgroup .btn-secondary:focus,
.mform .fitem_fgroup .felement.fgroup button.btn-cancel:hover,
.mform .fitem_fgroup .felement.fgroup button.btn-cancel:focus,
.mform .fitem_fgroup .felement.fgroup input.btn-cancel:hover,
.mform .fitem_fgroup .felement.fgroup input.btn-cancel:focus,
.mform .fitem_fgroup .felement.fgroup [data-cancel="1"]:hover,
.mform .fitem_fgroup .felement.fgroup [data-cancel="1"]:focus,
.mform .fitem_fgroup .felement.fgroup input[name="cancel"]:hover,
.mform .fitem_fgroup .felement.fgroup input[name="cancel"]:focus {
  background: rgba(var(--pcl-primary-rgb), 0.12) !important;
  border-color: var(--pcl-primary) !important;
  color: var(--pcl-primary-ink) !important;
}

/* Force consistent Save/Cancel pill styling even when Moodle renders different wrappers */
.mform .btn,
.mform button,
.mform input[type="submit"] {
  border-radius: 999px !important;
}

.mform .btn-primary,
.mform input[name="submitbutton"] {
  background: var(--pcl-primary) !important;
  border: 2px solid var(--pcl-primary) !important;
  color: #fff !important;
}

.mform .btn-primary:hover,
.mform .btn-primary:focus,
.mform input[name="submitbutton"]:hover,
.mform input[name="submitbutton"]:focus {
  background: var(--pcl-primary-dark) !important;
  border-color: var(--pcl-primary-dark) !important;
  color: #fff !important;
}

.mform .btn-secondary,
.mform button.btn-cancel,
.mform input.btn-cancel,
.mform [data-cancel="1"],
.mform input[name="cancel"] {
  background: #fff !important;
  border: 2px solid rgba(var(--pcl-primary-rgb), 0.6) !important;
  color: var(--pcl-primary-ink) !important;
}

.mform .btn-secondary:hover,
.mform .btn-secondary:focus,
.mform button.btn-cancel:hover,
.mform button.btn-cancel:focus,
.mform input.btn-cancel:hover,
.mform input.btn-cancel:focus,
.mform [data-cancel="1"]:hover,
.mform [data-cancel="1"]:focus,
.mform input[name="cancel"]:hover,
.mform input[name="cancel"]:focus {
  background: rgba(var(--pcl-primary-rgb), 0.12) !important;
  border-color: var(--pcl-primary) !important;
  color: var(--pcl-primary-ink) !important;
}

/* Direct target for Moodle cancel action button */
#id_cancel,
#id_cancel.btn,
#id_cancel.btn-secondary {
  border-radius: 999px !important;
  background: #fff !important;
  border: 2px solid rgba(var(--pcl-primary-rgb), 0.6) !important;
  color: var(--pcl-primary-ink) !important;
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

#id_cancel:hover,
#id_cancel:active,
#id_cancel:focus,
#id_cancel:focus-visible,
#id_cancel.btn:hover,
#id_cancel.btn:active,
#id_cancel.btn:focus,
#id_cancel.btn:focus-visible,
#id_cancel.btn-secondary:hover,
#id_cancel.btn-secondary:active,
#id_cancel.btn-secondary:focus,
#id_cancel.btn-secondary:focus-visible {
  background: rgba(var(--pcl-primary-rgb), 0.12) !important;
  border-color: var(--pcl-primary) !important;
  color: var(--pcl-primary-ink) !important;
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
}

#id_cancel::-moz-focus-inner {
  border: 0 !important;
  padding: 0 !important;
}

/* Remove square browser focus outline around pill buttons */
.mform .btn:focus,
.mform .btn:focus-visible,
.mform button:focus,
.mform button:focus-visible,
.mform input[type="submit"]:focus,
.mform input[type="submit"]:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* Remove default wrapper/focus chrome that can appear square around action buttons */
.mform .fitem_actionbuttons .felement,
.mform .fitem_actionbuttons .fgroup,
.mform .fitem_fgroup .felement.fgroup,
.mform .fitem_fgroup .fgroup {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

.mform .fitem_actionbuttons .btn,
.mform .fitem_actionbuttons button,
.mform .fitem_actionbuttons input[type="submit"],
.mform .fitem_fgroup .felement.fgroup .btn,
.mform .fitem_fgroup .felement.fgroup button,
.mform .fitem_fgroup .felement.fgroup input[type="submit"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  background-clip: padding-box !important;
}

.mform .fitem_actionbuttons .btn::-moz-focus-inner,
.mform .fitem_actionbuttons button::-moz-focus-inner,
.mform .fitem_actionbuttons input[type="submit"]::-moz-focus-inner,
.mform .fitem_fgroup .felement.fgroup .btn::-moz-focus-inner,
.mform .fitem_fgroup .felement.fgroup button::-moz-focus-inner,
.mform .fitem_fgroup .felement.fgroup input[type="submit"]::-moz-focus-inner {
  border: 0 !important;
  padding: 0 !important;
}

/* Pill-shaped form controls across local_pcl_books pages */
.mform input[type="text"],
.mform input[type="search"],
.mform input[type="url"],
.mform input[type="email"],
.mform input[type="number"],
.mform input[type="password"],
.mform select,
.mform textarea,
.mform .form-control,
.mform .custom-select {
  border-radius: 999px !important;
  border: 2px solid rgba(var(--pcl-primary-rgb), 0.35) !important;
  min-height: 46px;
  padding: 0.55rem 1rem !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.mform select,
.mform .custom-select {
  width: 100% !important;
  padding-right: 2.2rem !important;
}

.mform textarea {
  border-radius: 18px !important;
  min-height: 120px;
}

/* Winners description should be a normal textarea, not a pill. */
.mform textarea.pcl-winners-description-input,
.mform textarea.pcl-winners-description-input.form-control {
  border-radius: 12px !important;
  min-height: 140px;
  padding: 0.75rem 0.9rem !important;
}

/* Enforce non-pill description field on winners admin page. */
body.pcl-winners-admin-page .mform textarea#id_description,
body.pcl-winners-admin-page .mform textarea#id_description.form-control {
  border-radius: 12px !important;
  min-height: 140px !important;
  padding: 0.75rem 0.9rem !important;
}

.mform input[type="text"]:focus,
.mform input[type="search"]:focus,
.mform input[type="url"]:focus,
.mform input[type="email"]:focus,
.mform input[type="number"]:focus,
.mform input[type="password"]:focus,
.mform select:focus,
.mform textarea:focus,
.mform .form-control:focus,
.mform .custom-select:focus {
  border-color: var(--pcl-primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(var(--pcl-primary-rgb), 0.18) !important;
}

.mform .form-control.is-invalid,
.mform input.is-invalid,
.mform textarea.is-invalid,
.mform select.is-invalid,
.mform .custom-select.is-invalid {
  border-color: #dc3545 !important;
}

/* Search area above books table */
.pcl-books-search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.pcl-books-search-form label {
  width: 100%;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.pcl-books-search-form .form-control,
.pcl-books-search-form input[type="text"] {
  flex: 1 1 100%;
  width: 100%;
  max-width: 100%;
  border-radius: 999px !important;
  border: 2px solid rgba(var(--pcl-primary-rgb), 0.35) !important;
  min-height: 46px;
  padding: 0.55rem 1rem !important;
}

.pcl-books-search-form .form-control:focus,
.pcl-books-search-form input[type="text"]:focus {
  border-color: var(--pcl-primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(var(--pcl-primary-rgb), 0.18) !important;
}

.pcl-books-admin-page .mform .requirednote {
  margin: 0.75rem 0 1.25rem;
}

.pcl-books-admin-page .pcl-books-list-title {
  margin-top: 1.4rem;
  margin-bottom: 0.85rem;
}

.pcl-books-admin-top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.85rem 0;
}

.pcl-books-admin-top-actions #pcl-open-security-sql-modal {
  margin-left: auto;
}

@media (max-width: 768px) {
  .pcl-books-admin-top-actions {
    flex-wrap: wrap;
  }

  .pcl-books-admin-top-actions #pcl-open-security-sql-modal {
    margin-left: 0;
  }
}

body.pcl-books-sql-modal-open {
  overflow: hidden;
}

.pcl-books-sql-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(11, 22, 36, 0.68);
}

.pcl-books-sql-modal[hidden] {
  display: none !important;
}

.pcl-books-sql-modal__dialog {
  position: relative;
  width: min(95vw, 920px);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid #c9d8ef;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 26px 56px rgba(8, 20, 36, 0.42);
  padding: 1rem;
}

.pcl-books-sql-modal__close {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid #d2dded;
  border-radius: 999px;
  background: #f5f8fe;
  color: #233a58;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.pcl-books-sql-modal__close:hover,
.pcl-books-sql-modal__close:focus {
  background: #ebf3ff;
  color: #0e3c66;
}

.pcl-books-sql-modal__title {
  margin: 0 2rem 0.45rem 0;
}

.pcl-books-sql-modal__help {
  margin: 0 0 0.75rem 0;
  color: #4c5e79;
}

.pcl-books-sql-modal textarea {
  width: 100%;
  max-width: 100%;
  min-height: 220px;
  border-radius: 14px !important;
  border: 2px solid rgba(var(--pcl-primary-rgb), 0.35) !important;
  padding: 0.75rem !important;
}

.pcl-books-sql-modal textarea:focus {
  border-color: var(--pcl-primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(var(--pcl-primary-rgb), 0.18) !important;
}

.pcl-books-sql-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

/* Admin books action buttons layout + semantic colors */
.pcl-books-admin-table td:last-child {
  min-width: 360px;
}

.pcl-books-admin-table .pcl-books-empty-cell {
  text-align: center;
  color: #6c757d;
  font-weight: 600;
  padding: 1rem 0.75rem;
}

.pcl-action-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  align-items: center;
}

.pcl-action-group .pcl-action-btn {
  min-height: 34px;
  padding: 0.38rem 0.85rem !important;
  line-height: 1.1;
  text-decoration: none !important;
  white-space: nowrap;
}

.pcl-action-group .pcl-action-btn.pcl-action-danger,
.pcl-action-group .pcl-action-btn.pcl-action-danger:visited {
  background: #dc3545 !important;
  border-color: #dc3545 !important;
  color: #fff !important;
}

.pcl-action-group .pcl-action-btn.pcl-action-danger:hover,
.pcl-action-group .pcl-action-btn.pcl-action-danger:focus {
  background: #bd2130 !important;
  border-color: #bd2130 !important;
  color: #fff !important;
}

.pcl-action-group .pcl-action-btn.pcl-action-success,
.pcl-action-group .pcl-action-btn.pcl-action-success:visited {
  background: #28a745 !important;
  border-color: #28a745 !important;
  color: #fff !important;
}

.pcl-action-group .pcl-action-btn.pcl-action-success:hover,
.pcl-action-group .pcl-action-btn.pcl-action-success:focus {
  background: #1e7e34 !important;
  border-color: #1e7e34 !important;
  color: #fff !important;
}

.pcl-bookstores-admin-table {
  width: 100%;
  table-layout: fixed;
}

.pcl-bookstores-admin-table th,
.pcl-bookstores-admin-table td {
  padding: 0.85rem 0.75rem !important;
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: anywhere;
}

.pcl-bookstores-admin-table th:nth-child(1),
.pcl-bookstores-admin-table td:nth-child(1) {
  width: 5%;
}

.pcl-bookstores-admin-table th:nth-child(2),
.pcl-bookstores-admin-table td:nth-child(2) {
  width: 17%;
}

.pcl-bookstores-admin-table th:nth-child(3),
.pcl-bookstores-admin-table td:nth-child(3) {
  width: 8%;
}

.pcl-bookstores-admin-table th:nth-child(4),
.pcl-bookstores-admin-table td:nth-child(4) {
  width: 12%;
}

.pcl-bookstores-admin-table th:nth-child(5),
.pcl-bookstores-admin-table td:nth-child(5) {
  width: 15%;
}

.pcl-bookstores-admin-table th:nth-child(6),
.pcl-bookstores-admin-table td:nth-child(6) {
  width: 11%;
}

.pcl-bookstores-admin-table th:nth-child(7),
.pcl-bookstores-admin-table td:nth-child(7) {
  width: 17%;
}

.pcl-bookstores-admin-table th:nth-child(8),
.pcl-bookstores-admin-table td:nth-child(8) {
  width: 15%;
}

.pcl-bookstores-admin-table td:nth-child(8) .pcl-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pcl-bookstores-admin-table td:nth-child(8) .pcl-action-btn {
  min-height: 32px;
  padding: 0.3rem 0.7rem !important;
}

/* Give winners admin list more horizontal breathing room between columns. */
body.pcl-winners-admin-page .pcl-winners-admin-table {
  table-layout: auto;
  width: 100%;
}

body.pcl-winners-admin-page .pcl-winners-admin-table th,
body.pcl-winners-admin-page .pcl-winners-admin-table td {
  padding: 1rem 1rem !important;
  vertical-align: top;
}

body.pcl-winners-admin-page .pcl-winners-admin-table th:nth-child(2),
body.pcl-winners-admin-page .pcl-winners-admin-table td:nth-child(2) {
  min-width: 220px;
}

body.pcl-winners-admin-page .pcl-winners-admin-table th:nth-child(3),
body.pcl-winners-admin-page .pcl-winners-admin-table td:nth-child(3) {
  min-width: 150px;
}

body.pcl-winners-admin-page .pcl-winners-admin-table th:nth-child(4),
body.pcl-winners-admin-page .pcl-winners-admin-table td:nth-child(4) {
  min-width: 300px;
  max-width: 420px;
  white-space: normal;
  overflow-wrap: anywhere;
}

body.pcl-winners-admin-page .pcl-winners-admin-table th:last-child,
body.pcl-winners-admin-page .pcl-winners-admin-table td:last-child {
  min-width: 210px;
}

.pcl-orders-admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(var(--pcl-primary-rgb), 0.24);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(8, 28, 56, 0.08);
}

.pcl-orders-search-wrap {
  margin: 0 0 0.8rem 0;
}

.pcl-orders-search-form {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.pcl-orders-search-label {
  margin: 0;
  font-weight: 700;
  color: #1f3f62;
}

.pcl-orders-search-form .form-control {
  width: min(100%, 440px);
  border-radius: 999px !important;
  border: 2px solid rgba(var(--pcl-primary-rgb), 0.35) !important;
  min-height: 44px;
  padding: 0.5rem 0.95rem !important;
}

.pcl-orders-search-form .form-control:focus {
  border-color: var(--pcl-primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(var(--pcl-primary-rgb), 0.15) !important;
}

.pcl-orders-search-empty {
  margin-top: 0.45rem;
  color: #50698a;
  font-weight: 600;
  font-size: 0.92rem;
}

.pcl-orders-admin-table {
  width: 100%;
  min-width: 0;
  margin-bottom: 0 !important;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.pcl-orders-admin-table th,
.pcl-orders-admin-table td {
  vertical-align: top;
  padding: 0.62rem 0.68rem !important;
  white-space: normal;
  overflow-wrap: anywhere;
  border-top: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-bottom: 1px solid #e6eef9 !important;
  line-height: 1.3;
}

.pcl-orders-admin-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(var(--pcl-primary-rgb), 0.18), rgba(var(--pcl-primary-rgb), 0.1));
  color: var(--pcl-primary-ink);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 800;
  white-space: normal;
}

.pcl-orders-admin-table tbody tr:nth-child(even) {
  background: rgba(var(--pcl-primary-rgb), 0.04);
}

.pcl-orders-admin-table tbody tr:hover {
  background: rgba(var(--pcl-primary-rgb), 0.09);
}

.pcl-orders-admin-table tbody tr:last-child td {
  border-bottom: 0 !important;
}

.pcl-orders-admin-table th:nth-child(1),
.pcl-orders-admin-table td:nth-child(1) {
  width: 4%;
  text-align: center;
}

.pcl-orders-admin-table th:nth-child(2),
.pcl-orders-admin-table td:nth-child(2) {
  width: 15%;
}

.pcl-orders-admin-table th:nth-child(3),
.pcl-orders-admin-table td:nth-child(3) {
  width: 13%;
}

.pcl-orders-admin-table th:nth-child(4),
.pcl-orders-admin-table td:nth-child(4) {
  width: 15%;
}

.pcl-orders-admin-table th:nth-child(5),
.pcl-orders-admin-table td:nth-child(5) {
  width: 14%;
}

.pcl-orders-admin-table th:nth-child(6),
.pcl-orders-admin-table td:nth-child(6) {
  width: 11%;
}

.pcl-orders-admin-table th:nth-child(7),
.pcl-orders-admin-table td:nth-child(7) {
  width: 8%;
  text-align: center;
}

.pcl-orders-admin-table th:nth-child(8),
.pcl-orders-admin-table td:nth-child(8) {
  width: 20%;
}

.pcl-books-orders-school-address {
  margin-top: 0.18rem;
  color: #5f7390;
  font-size: 0.82rem;
  line-height: 1.25;
}

.pcl-books-orders-items {
  margin: 0;
  padding-left: 0.95rem;
}

.pcl-books-orders-items li {
  margin: 0;
  padding: 0;
  font-size: 0.86rem;
  line-height: 1.3;
}

.pcl-order-status-pill {
  min-width: 88px;
}

.pcl-order-status-new {
  background: rgba(var(--pcl-primary-rgb), 0.13);
  border: 1px solid rgba(var(--pcl-primary-rgb), 0.45);
  color: var(--pcl-primary-ink);
}

.pcl-order-status-completed {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.pcl-order-status-deleted {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.pcl-orders-status-actions {
  margin-top: 0.35rem;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.pcl-orders-status-actions.no-badge {
  margin-top: 0;
}

.pcl-orders-status-actions .pcl-action-btn {
  min-height: 28px;
  padding: 0.24rem 0.62rem !important;
  font-size: 0.76rem;
}

.pcl-bookstores-manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem 0.95rem;
  margin-bottom: 0.85rem;
}

.pcl-bookstores-manage-grid .fitem label {
  display: block;
  margin-bottom: 0.32rem;
  font-weight: 700;
}

.pcl-bookstores-manage-grid select.form-control,
.pcl-bookstores-manage-grid .custom-select {
  min-width: 240px;
}

.pcl-bookstores-manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 1rem;
}

/* Modernize confirmation dialog and place it higher (bootstrap modal + legacy moodle-dialogue) */
body.path-local-pcl_books .modal.show .modal-dialog,
body.pcl-books-admin-page .modal.show .modal-dialog {
  margin-top: 6vh !important;
}

body.path-local-pcl_books .modal.show .modal-dialog.modal-dialog-centered,
body.pcl-books-admin-page .modal.show .modal-dialog.modal-dialog-centered {
  align-items: flex-start !important;
  min-height: calc(100% - 1rem) !important;
}

body.path-local-pcl_books .modal-content,
body.pcl-books-admin-page .modal-content {
  border: 0 !important;
  border-radius: 18px !important;
  overflow: hidden !important;
  box-shadow: 0 24px 60px rgba(11, 23, 41, 0.28) !important;
}

body.path-local-pcl_books .modal-header,
body.pcl-books-admin-page .modal-header {
  border-bottom: 1px solid #e6edf7 !important;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%) !important;
  padding: 1rem 1.15rem 0.9rem !important;
}

body.path-local-pcl_books .modal-title,
body.pcl-books-admin-page .modal-title {
  font-size: 1.75rem !important;
  line-height: 1.15 !important;
  font-weight: 700 !important;
  color: #13233f !important;
}

body.path-local-pcl_books .modal-body,
body.pcl-books-admin-page .modal-body {
  padding: 1.15rem !important;
  color: #243652 !important;
  font-size: 1.12rem !important;
  line-height: 1.45 !important;
}

body.path-local-pcl_books .modal-footer,
body.pcl-books-admin-page .modal-footer {
  border-top: 0 !important;
  padding: 0 1.15rem 1.15rem !important;
  gap: 0.7rem !important;
}

body.path-local-pcl_books .modal-footer .btn,
body.pcl-books-admin-page .modal-footer .btn {
  border-radius: 999px !important;
  min-height: 44px !important;
  padding: 0.52rem 1.35rem !important;
  font-weight: 700 !important;
  border-width: 2px !important;
}

body.path-local-pcl_books .modal-footer .btn-primary,
body.pcl-books-admin-page .modal-footer .btn-primary {
  background: var(--pcl-primary) !important;
  border-color: var(--pcl-primary) !important;
  color: #fff !important;
}

body.path-local-pcl_books .modal-footer .btn-primary:hover,
body.path-local-pcl_books .modal-footer .btn-primary:focus,
body.pcl-books-admin-page .modal-footer .btn-primary:hover,
body.pcl-books-admin-page .modal-footer .btn-primary:focus {
  background: var(--pcl-primary-dark) !important;
  border-color: var(--pcl-primary-dark) !important;
}

body.path-local-pcl_books .modal-footer .btn-secondary,
body.pcl-books-admin-page .modal-footer .btn-secondary {
  background: #fff !important;
  border-color: rgba(var(--pcl-primary-rgb), 0.52) !important;
  color: var(--pcl-primary-ink) !important;
}

body.path-local-pcl_books .modal-footer .btn-secondary:hover,
body.path-local-pcl_books .modal-footer .btn-secondary:focus,
body.pcl-books-admin-page .modal-footer .btn-secondary:hover,
body.pcl-books-admin-page .modal-footer .btn-secondary:focus {
  background: rgba(var(--pcl-primary-rgb), 0.1) !important;
  border-color: var(--pcl-primary) !important;
}

body.path-local-pcl_books .moodle-dialogue-base .moodle-dialogue.moodle-dialogue-confirm,
body.pcl-books-admin-page .moodle-dialogue-base .moodle-dialogue.moodle-dialogue-confirm {
  top: 8vh !important;
  transform: none !important;
}

body.path-local-pcl_books .moodle-dialogue-base .moodle-dialogue-confirm .moodle-dialogue-wrap,
body.pcl-books-admin-page .moodle-dialogue-base .moodle-dialogue-confirm .moodle-dialogue-wrap {
  border: 0 !important;
  border-radius: 18px !important;
  overflow: hidden !important;
  box-shadow: 0 24px 60px rgba(11, 23, 41, 0.28) !important;
}

body.path-local-pcl_books .moodle-dialogue-base .moodle-dialogue-confirm .moodle-dialogue-hd,
body.pcl-books-admin-page .moodle-dialogue-base .moodle-dialogue-confirm .moodle-dialogue-hd {
  border-bottom: 1px solid #e6edf7 !important;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%) !important;
  padding: 1rem 1.15rem 0.9rem !important;
}

body.path-local-pcl_books .moodle-dialogue-base .moodle-dialogue-confirm .moodle-dialogue-hd h1,
body.pcl-books-admin-page .moodle-dialogue-base .moodle-dialogue-confirm .moodle-dialogue-hd h1 {
  font-size: 1.75rem !important;
  line-height: 1.15 !important;
  font-weight: 700 !important;
  color: #13233f !important;
}

body.path-local-pcl_books .moodle-dialogue-base .moodle-dialogue-confirm .moodle-dialogue-bd,
body.pcl-books-admin-page .moodle-dialogue-base .moodle-dialogue-confirm .moodle-dialogue-bd {
  padding: 1.15rem !important;
  color: #243652 !important;
}

body.path-local-pcl_books .moodle-dialogue-base .moodle-dialogue-confirm .confirmation-message,
body.pcl-books-admin-page .moodle-dialogue-base .moodle-dialogue-confirm .confirmation-message {
  font-size: 1.12rem !important;
  line-height: 1.45 !important;
  margin-bottom: 1rem !important;
}

body.path-local-pcl_books .moodle-dialogue-base .moodle-dialogue-confirm .confirmation-dialogue input,
body.pcl-books-admin-page .moodle-dialogue-base .moodle-dialogue-confirm .confirmation-dialogue input {
  border-radius: 999px !important;
  min-height: 44px !important;
  padding: 0.52rem 1.35rem !important;
  font-weight: 700 !important;
  border: 2px solid rgba(var(--pcl-primary-rgb), 0.52) !important;
}

body.path-local-pcl_books .moodle-dialogue-base .moodle-dialogue-confirm .confirmation-dialogue input:first-child,
body.pcl-books-admin-page .moodle-dialogue-base .moodle-dialogue-confirm .confirmation-dialogue input:first-child {
  background: var(--pcl-primary) !important;
  border-color: var(--pcl-primary) !important;
  color: #fff !important;
}

body.path-local-pcl_books .moodle-dialogue-base .moodle-dialogue-confirm .confirmation-dialogue input:first-child:hover,
body.path-local-pcl_books .moodle-dialogue-base .moodle-dialogue-confirm .confirmation-dialogue input:first-child:focus,
body.pcl-books-admin-page .moodle-dialogue-base .moodle-dialogue-confirm .confirmation-dialogue input:first-child:hover,
body.pcl-books-admin-page .moodle-dialogue-base .moodle-dialogue-confirm .confirmation-dialogue input:first-child:focus {
  background: var(--pcl-primary-dark) !important;
  border-color: var(--pcl-primary-dark) !important;
}

@media (max-width: 991px) {
  .pcl-orders-admin-table {
    min-width: 980px;
  }

  .pcl-orders-admin-table th,
  .pcl-orders-admin-table td {
    padding: 0.56rem 0.6rem !important;
  }

  .pcl-books-admin-table td:last-child {
    min-width: 280px;
  }

  .pcl-action-group {
    flex-wrap: wrap;
  }

  body.path-local-pcl_books .modal.show .modal-dialog,
  body.pcl-books-admin-page .modal.show .modal-dialog {
    margin-top: 4vh !important;
    margin-left: 0.75rem !important;
    margin-right: 0.75rem !important;
  }

  body.path-local-pcl_books .modal-title,
  body.pcl-books-admin-page .modal-title {
    font-size: 1.45rem !important;
  }

  body.path-local-pcl_books .modal-body,
  body.pcl-books-admin-page .modal-body {
    font-size: 1rem !important;
  }

  body.path-local-pcl_books .moodle-dialogue-base .moodle-dialogue.moodle-dialogue-confirm,
  body.pcl-books-admin-page .moodle-dialogue-base .moodle-dialogue.moodle-dialogue-confirm {
    top: 4vh !important;
    left: 0.75rem !important;
    right: 0.75rem !important;
    width: auto !important;
  }
}
